Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion contracts/Arbitrum_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@ contract Arbitrum_SpokePool is SpokePool {

/**
* @notice Construct the AVM SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _l2GatewayRouter Address of L2 token gateway. Can be reset by admin.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
* @param _hubPool Hub pool address to set. Can be changed by admin.
* @param _wethAddress Weth address for this network to set.
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
address _l2GatewayRouter,
address _crossDomainAdmin,
address _hubPool,
address _wethAddress,
address timerAddress
) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {
) SpokePool(_initialDepositId, _crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {
_setL2GatewayRouter(_l2GatewayRouter);
}

Expand Down
4 changes: 4 additions & 0 deletions contracts/Boba_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ import "./Ovm_SpokePool.sol";
contract Boba_SpokePool is Ovm_SpokePool {
/**
* @notice Construct the OVM Boba SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
* @param _hubPool Hub pool address to set. Can be changed by admin.
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
address _crossDomainAdmin,
address _hubPool,
address timerAddress
)
Ovm_SpokePool(
_initialDepositId,
_crossDomainAdmin,
_hubPool,
0x4200000000000000000000000000000000000006,
Expand Down
5 changes: 4 additions & 1 deletion contracts/Ethereum_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ contract Ethereum_SpokePool is SpokePool, Ownable {
/**
* @notice Construct the Ethereum SpokePool.
* @dev crossDomainAdmin is unused on this contract.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _hubPool Hub pool address to set. Can be changed by admin.
* @param _wethAddress Weth address for this network to set.
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
address _hubPool,
address _wethAddress,
address timerAddress
) SpokePool(_hubPool, _hubPool, _wethAddress, timerAddress) {}
) SpokePool(_initialDepositId, _hubPool, _hubPool, _wethAddress, timerAddress) {}

/**************************************
* INTERNAL FUNCTIONS *
Expand Down
4 changes: 4 additions & 0 deletions contracts/Optimism_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ import "./Ovm_SpokePool.sol";
contract Optimism_SpokePool is Ovm_SpokePool {
/**
* @notice Construct the OVM Optimism SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
* @param _hubPool Hub pool address to set. Can be changed by admin.
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
address _crossDomainAdmin,
address _hubPool,
address timerAddress
)
Ovm_SpokePool(
_initialDepositId,
_crossDomainAdmin,
_hubPool,
Lib_PredeployAddresses.OVM_ETH,
Expand Down
5 changes: 4 additions & 1 deletion contracts/Ovm_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ contract Ovm_SpokePool is CrossDomainEnabled, SpokePool {

/**
* @notice Construct the OVM SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
* @param _hubPool Hub pool address to set. Can be changed by admin.
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
address _crossDomainAdmin,
address _hubPool,
address _l2Eth,
address _wrappedNativeToken,
address timerAddress
)
CrossDomainEnabled(Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER)
SpokePool(_crossDomainAdmin, _hubPool, _wrappedNativeToken, timerAddress)
SpokePool(_initialDepositId, _crossDomainAdmin, _hubPool, _wrappedNativeToken, timerAddress)
{
l2Eth = _l2Eth;
}
Expand Down
5 changes: 4 additions & 1 deletion contracts/Polygon_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool {

/**
* @notice Construct the Polygon SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _polygonTokenBridger Token routing contract that sends tokens from here to HubPool. Changeable by Admin.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
* @param _hubPool Hub pool address to set. Can be changed by admin.
Expand All @@ -70,13 +72,14 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool {
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
PolygonTokenBridger _polygonTokenBridger,
address _crossDomainAdmin,
address _hubPool,
address _wmaticAddress, // Note: wmatic is used here since it is the token sent via msg.value on polygon.
address _fxChild,
address timerAddress
) SpokePool(_crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {
) SpokePool(_initialDepositId, _crossDomainAdmin, _hubPool, _wmaticAddress, timerAddress) {
polygonTokenBridger = _polygonTokenBridger;
fxChild = _fxChild;
}
Expand Down
4 changes: 4 additions & 0 deletions contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,21 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall

/**
* @notice Construct the base SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
* @param _hubPool Hub pool address to set. Can be changed by admin.
* @param _wrappedNativeTokenAddress wrappedNativeToken address for this network to set.
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
address _crossDomainAdmin,
address _hubPool,
address _wrappedNativeTokenAddress,
address timerAddress
) Testable(timerAddress) {
numberOfDeposits = _initialDepositId;
_setCrossDomainAdmin(_crossDomainAdmin);
_setHubPool(_hubPool);
wrappedNativeToken = WETH9(_wrappedNativeTokenAddress);
Expand Down
5 changes: 4 additions & 1 deletion contracts/ZkSync_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ contract ZkSync_SpokePool is SpokePool {

/**
* @notice Construct the ZkSync SpokePool.
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
* relay hash collisions.
* @param _zkErc20Bridge Address of L2 ERC20 gateway. Can be reset by admin.
* @param _zkEthBridge Address of L2 ETH gateway. Can be reset by admin.
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
Expand All @@ -43,13 +45,14 @@ contract ZkSync_SpokePool is SpokePool {
* @param timerAddress Timer address to set.
*/
constructor(
uint32 _initialDepositId,
ZkBridgeLike _zkErc20Bridge,
ZkBridgeLike _zkEthBridge,
address _crossDomainAdmin,
address _hubPool,
address _wethAddress,
address timerAddress
) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {
) SpokePool(_initialDepositId, _crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {
_setZkBridges(_zkErc20Bridge, _zkEthBridge);
}

Expand Down
3 changes: 2 additions & 1 deletion contracts/test/MockSpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ contract MockSpokePool is SpokePool {

// solhint-disable-next-line no-empty-blocks
constructor(
uint32 _initialDepositId,
address _crossDomainAdmin,
address _hubPool,
address _wethAddress,
address timerAddress
) SpokePool(_crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {} // solhint-disable-line no-empty-blocks
) SpokePool(_initialDepositId, _crossDomainAdmin, _hubPool, _wethAddress, timerAddress) {} // solhint-disable-line no-empty-blocks

// solhint-disable-next-line no-empty-blocks
function _bridgeTokensToHubPool(RelayerRefundLeaf memory relayerRefundLeaf) internal override {}
Expand Down
8 changes: 7 additions & 1 deletion test/SpokePool.Admin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, ethers, Contract, SignerWithAddress } from "./utils";
import { expect, ethers, Contract, SignerWithAddress, getContractFactory } from "./utils";
import { spokePoolFixture } from "./fixtures/SpokePool.Fixture";
import { destinationChainId, mockRelayerRefundRoot, mockSlowRelayRoot } from "./constants";

Expand All @@ -10,6 +10,12 @@ describe("SpokePool Admin Functions", async function () {
[owner] = await ethers.getSigners();
({ spokePool, erc20 } = await spokePoolFixture());
});
it("Can set initial deposit ID", async function () {
const spokePool = await (
await getContractFactory("MockSpokePool", owner)
).deploy(1, owner.address, owner.address, owner.address, owner.address);
expect(await spokePool.numberOfDeposits()).to.equal(1);
});
it("Enable token path", async function () {
await expect(spokePool.connect(owner).setEnableRoute(erc20.address, destinationChainId, true))
.to.emit(spokePool, "EnabledDepositRoute")
Expand Down
2 changes: 1 addition & 1 deletion test/chain-specific-spokepools/Arbitrum_SpokePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Arbitrum Spoke Pool", function () {

arbitrumSpokePool = await (
await getContractFactory("Arbitrum_SpokePool", owner)
).deploy(l2GatewayRouter.address, owner.address, hubPool.address, l2Weth, timer.address);
).deploy(0, l2GatewayRouter.address, owner.address, hubPool.address, l2Weth, timer.address);

await seedContract(arbitrumSpokePool, relayer, [dai], weth, amountHeldByPool);
await arbitrumSpokePool.connect(crossDomainAlias).whitelistToken(l2Dai, dai.address);
Expand Down
2 changes: 1 addition & 1 deletion test/chain-specific-spokepools/Ethereum_SpokePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("Ethereum Spoke Pool", function () {

spokePool = await (
await getContractFactory("Ethereum_SpokePool", owner)
).deploy(hubPool.address, weth.address, timer.address);
).deploy(0, hubPool.address, weth.address, timer.address);

// Seed spoke pool with tokens that it should transfer to the hub pool
// via the _bridgeTokensToHubPool() internal call.
Expand Down
2 changes: 1 addition & 1 deletion test/chain-specific-spokepools/Optimism_SpokePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("Optimism Spoke Pool", function () {

optimismSpokePool = await (
await getContractFactory("Optimism_SpokePool", owner)
).deploy(owner.address, hubPool.address, timer.address);
).deploy(0, owner.address, hubPool.address, timer.address);

await seedContract(optimismSpokePool, relayer, [dai], weth, amountHeldByPool);
});
Expand Down
10 changes: 9 additions & 1 deletion test/chain-specific-spokepools/Polygon_SpokePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ describe("Polygon Spoke Pool", function () {

polygonSpokePool = await (
await getContractFactory("Polygon_SpokePool", owner)
).deploy(polygonTokenBridger.address, owner.address, hubPool.address, weth.address, fxChild.address, timer.address);
).deploy(
0,
polygonTokenBridger.address,
owner.address,
hubPool.address,
weth.address,
fxChild.address,
timer.address
);

await seedContract(polygonSpokePool, relayer, [dai], weth, amountHeldByPool);
await seedWallet(owner, [], weth, toWei("1"));
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/HubPool.Fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function deployHubPool(ethers: any) {
const mockAdapter = await (await getContractFactory("Mock_Adapter", signer)).deploy();
const mockSpoke = await (
await getContractFactory("MockSpokePool", signer)
).deploy(crossChainAdmin.address, hubPool.address, weth.address, parentFixture.timer.address);
).deploy(0, crossChainAdmin.address, hubPool.address, weth.address, parentFixture.timer.address);
await hubPool.setCrossChainContracts(repaymentChainId, mockAdapter.address, mockSpoke.address);
await hubPool.setCrossChainContracts(originChainId, mockAdapter.address, mockSpoke.address);

Expand All @@ -53,7 +53,7 @@ export async function deployHubPool(ethers: any) {
const mockAdapterMainnet = await (await getContractFactory("Mock_Adapter", signer)).deploy();
const mockSpokeMainnet = await (
await getContractFactory("MockSpokePool", signer)
).deploy(crossChainAdmin.address, hubPool.address, weth.address, parentFixture.timer.address);
).deploy(0, crossChainAdmin.address, hubPool.address, weth.address, parentFixture.timer.address);
await hubPool.setCrossChainContracts(mainnetChainId, mockAdapterMainnet.address, mockSpokeMainnet.address);

// Deploy mock l2 tokens for each token created before and whitelist the routes.
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/SpokePool.Fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function deploySpokePool(ethers: any): Promise<{
// Deploy the pool
const spokePool = await (
await getContractFactory("MockSpokePool", deployerWallet)
).deploy(crossChainAdmin.address, hubPool.address, weth.address, timer.address);
).deploy(0, crossChainAdmin.address, hubPool.address, weth.address, timer.address);
await spokePool.setChainId(consts.destinationChainId);

return { timer, weth, erc20, spokePool, unwhitelistedErc20, destErc20 };
Expand Down
4 changes: 2 additions & 2 deletions test/gas-analytics/HubPool.RootExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ describe("Gas Analytics: HubPool Root Bundle Execution", function () {
const adapter = await (await getContractFactory("Mock_Adapter", owner)).deploy();
const spoke = await (
await getContractFactory("MockSpokePool", owner)
).deploy(randomAddress(), hubPool.address, randomAddress(), consts.zeroAddress);
).deploy(0, randomAddress(), hubPool.address, randomAddress(), consts.zeroAddress);
await hubPool.setCrossChainContracts(hubPoolChainId, adapter.address, spoke.address);

for (let i = 0; i < REFUND_CHAIN_COUNT; i++) {
const adapter = await (await getContractFactory("Mock_Adapter", owner)).deploy();
const spoke = await (
await getContractFactory("MockSpokePool", owner)
).deploy(randomAddress(), hubPool.address, randomAddress(), consts.zeroAddress);
).deploy(0, randomAddress(), hubPool.address, randomAddress(), consts.zeroAddress);
await hubPool.setCrossChainContracts(i, adapter.address, spoke.address);
await Promise.all(
l1Tokens.map(async (token) => {
Expand Down