Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: superseed deployment #716

Open
wants to merge 6 commits into
base: audit-latest
Choose a base branch
from
Open
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
72 changes: 72 additions & 0 deletions contracts/Superseed_SpokePool.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";

import "./Ovm_SpokePool.sol";
import "./external/interfaces/CCTPInterfaces.sol";
import { IOpUSDCBridgeAdapter } from "./external/interfaces/IOpUSDCBridgeAdapter.sol";

/**
* @notice Superseed Spoke pool.
* @custom:security-contact [email protected]
*/
contract Superseed_SpokePool is Ovm_SpokePool {
using SafeERC20 for IERC20;

// Address of the custom L2 USDC bridge.
address private constant USDC_BRIDGE = 0x88259017B7271EfbCA33cE6Fd2D9EDD9C2b2d995;

/// @custom:oz-upgrades-unsafe-allow constructor
constructor(
address _wrappedNativeTokenAddress,
uint32 _depositQuoteTimeBuffer,
uint32 _fillDeadlineBuffer,
IERC20 _l2Usdc,
ITokenMessenger _cctpTokenMessenger
)
Ovm_SpokePool(
_wrappedNativeTokenAddress,
_depositQuoteTimeBuffer,
_fillDeadlineBuffer,
_l2Usdc,
_cctpTokenMessenger
)
{} // solhint-disable-line no-empty-blocks

/**
* @notice Construct the OVM Superseed 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.
*/
function initialize(
uint32 _initialDepositId,
address _crossDomainAdmin,
address _hubPool
) public initializer {
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _hubPool, Lib_PredeployAddresses.OVM_ETH);
}

/**
* @notice Superseed-specific logic to bridge tokens back to the hub pool contract on L1.
* @param amountToReturn Amount of the token to bridge back.
* @param l2TokenAddress Address of the l2 Token to bridge back. This token will either be bridged back to the token defined in the mapping `remoteL1Tokens`,
* or via the canonical mapping defined in the bridge contract retrieved from `tokenBridges`.
* @dev This implementation deviates slightly from `_bridgeTokensToHubPool` in the `Ovm_SpokePool` contract since Superseed has a USDC bridge which uses
* a custom interface. This is because the USDC token on Superseed is meant to be upgraded to a native, CCTP supported version in the future.
*/
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override {
// Handle custom USDC bridge which doesn't conform to the standard bridge interface. In the future, CCTP may be used to bridge USDC to mainnet, in which
// case bridging logic is handled by the Ovm_SpokePool code. In the meantime, if CCTP is not enabled, then use the USDC bridge. Once CCTP is activated on
// Superseed, this block of code will be unused.
if (l2TokenAddress == address(usdcToken) && !_isCCTPEnabled()) {
usdcToken.safeIncreaseAllowance(USDC_BRIDGE, amountToReturn);
IOpUSDCBridgeAdapter(USDC_BRIDGE).sendMessage(
hubPool, // _to. Withdraw, over the bridge, to the l1 hub pool contract.
amountToReturn, // _amount.
l1Gas // _minGasLimit. Same value used in other OpStack bridges.
);
} else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
}
}
8 changes: 4 additions & 4 deletions contracts/chain-adapters/OP_Adapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract OP_Adapter is CrossDomainEnabled, AdapterInterface, CircleCCTPAdapter {
/**
* @notice Constructs new Adapter.
* @param _l1Weth WETH address on L1.
* @param _crossDomainMessenger XDomainMessenger World Chain system contract.
* @param _crossDomainMessenger XDomainMessenger OpStack system contract.
* @param _l1StandardBridge Standard bridge contract.
* @param _l1Usdc USDC address on L1.
*/
Expand All @@ -63,8 +63,8 @@ contract OP_Adapter is CrossDomainEnabled, AdapterInterface, CircleCCTPAdapter {
}

/**
* @notice Send cross-chain message to target on World Chain.
* @param target Contract on World Chain that will receive message.
* @notice Send cross-chain message to target on the configured OpStack network.
* @param target Contract on the OpStack network that will receive message.
* @param message Data to send to target.
*/
function relayMessage(address target, bytes calldata message) external payable override {
Expand All @@ -73,7 +73,7 @@ contract OP_Adapter is CrossDomainEnabled, AdapterInterface, CircleCCTPAdapter {
}

/**
* @notice Bridge tokens to World Chain.
* @notice Bridge tokens to a configured OpStack network.
* @param l1Token L1 token to deposit.
* @param l2Token L2 token to receive.
* @param amount Amount of L1 tokens to deposit and L2 tokens to receive.
Expand Down
24 changes: 24 additions & 0 deletions deploy/056_deploy_superseed_adapter.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to drop this one in anticipation of #714 being merged.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { L1_ADDRESS_MAP, USDC, WETH } from "./consts";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.getNamedAccounts();
const chainId = parseInt(await hre.getChainId());

await hre.deployments.deploy("OP_Adapter", {
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
args: [
WETH[chainId],
USDC[chainId],
L1_ADDRESS_MAP[chainId].superseedCrossDomainMessenger,
L1_ADDRESS_MAP[chainId].superseedStandardBridge,
L1_ADDRESS_MAP[chainId].superseedOpUSDCBridge,
],
});
};

module.exports = func;
func.tags = ["SuperseedAdapter", "mainnet"];
31 changes: 31 additions & 0 deletions deploy/057_deploy_superseed_spokepool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployNewProxy, getSpokePoolDeploymentInfo } from "../utils/utils.hre";
import { FILL_DEADLINE_BUFFER, WETH, QUOTE_TIME_BUFFER, ZERO_ADDRESS, USDCe } from "./consts";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { hubPool, spokeChainId } = await getSpokePoolDeploymentInfo(hre);

const initArgs = [
1,
// Set hub pool as cross domain admin since it delegatecalls the Adapter logic.
hubPool.address,
hubPool.address,
];
const constructorArgs = [
WETH[spokeChainId],
QUOTE_TIME_BUFFER,
FILL_DEADLINE_BUFFER,
// Superseed's bridged USDC is upgradeable to native. There are not two different
// addresses for bridges/native USDC. This address is also used in the spoke pool
// to determine whether to use CCTP (in the future) or the custom USDC bridge.
USDCe[spokeChainId],
// L2_ADDRESS_MAP[spokeChainId].cctpTokenMessenger,
// For now, we are not using the CCTP bridge and can disable by setting
// the cctpTokenMessenger to the zero address.
ZERO_ADDRESS,
];
await deployNewProxy("Superseed_SpokePool", constructorArgs, initArgs);
};
module.exports = func;
func.tags = ["SuperseedSpokePool", "superseed"];
3 changes: 3 additions & 0 deletions deploy/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
worldChainCrossDomainMessenger: "0xf931a81D18B1766d15695ffc7c1920a62b7e710a",
worldChainStandardBridge: "0x470458C91978D2d929704489Ad730DC3E3001113",
worldChainOpUSDCBridge: "0x153A69e4bb6fEDBbAaF463CB982416316c84B2dB",
superseedCrossDomainMessenger: "0x3a30AEd8fa7717aC2D8454D82c125cF6B875061a",
superseedStandardBridge: "0x8b0576E39F1233679109F9b40cFcC2a7E0901Ede",
superseedOpUSDCBridge: "0x9cAa69fB5d4277Eb1e76FFdaD4447E7871bBD1Ed",
},
[CHAIN_IDs.SEPOLIA]: {
optimismCrossDomainMessenger: "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef",
Expand Down
8 changes: 8 additions & 0 deletions deployments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This is because this `deployments.json` file is used by bots in [`@across-protoc
| Redstone Adapter | [0x188F8C95B7cfB7993B53a4F643efa687916f73fA](https://etherscan.io/address/0x188F8C95B7cfB7993B53a4F643efa687916f73fA) |
| Zora Adapter | [0x024F2fC31CBDD8de17194b1892c834f98Ef5169b](https://etherscan.io/address/0x024F2fC31CBDD8de17194b1892c834f98Ef5169b) |
| WorldChain Adapter | [0x8eBebfc894047bEE213A561b8792fCa71241731f](https://etherscan.io/address/0x8eBebfc894047bEE213A561b8792fCa71241731f) |
| Superseed Adapter | [0xAca1Ca87872276E01CBB1ecb3488561402795F01](https://etherscan.io/address/0xAca1Ca87872276E01CBB1ecb3488561402795F01) |
| AcrossConfigStore | [0x3B03509645713718B78951126E0A6de6f10043f5](https://etherscan.io/address/0x3B03509645713718B78951126E0A6de6f10043f5) |
| Across Bond Token | [0xee1dc6bcf1ee967a350e9ac6caaaa236109002ea](https://etherscan.io/address/0xee1dc6bcf1ee967a350e9ac6caaaa236109002ea) |
| MulticallHandler | [0x924a9f036260DdD5808007E1AA95f08eD08aA569](https://etherscan.io/address/0x924a9f036260DdD5808007E1AA95f08eD08aA569) |
Expand Down Expand Up @@ -123,3 +124,10 @@ This is because this `deployments.json` file is used by bots in [`@across-protoc
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| WorldChain_SpokePool | [0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64](https://worldchain-mainnet.explorer.alchemy.com/address/0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64) |
| MulticallHandler | [0x924a9f036260DdD5808007E1AA95f08eD08aA569](https://worldchain-mainnet.explorer.alchemy.com/address/0x924a9f036260DdD5808007E1AA95f08eD08aA569) |

## Superseed mainnet (5330)

| Contract Name | Address |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Superseed_SpokePool | [0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64](https://explorer-superseed-mainnet-0.t.conduit.xyz/address/0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64) |
| MulticallHandler | [0x924a9f036260DdD5808007E1AA95f08eD08aA569](https://explorer-superseed-mainnet-0.t.conduit.xyz/address/0x924a9f036260DdD5808007E1AA95f08eD08aA569) |
6 changes: 6 additions & 0 deletions deployments/deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Lisk_Adapter": { "address": "0x8229E812f20537caA1e8Fb41749b4887B8a75C3B", "blockNumber": 20184545 },
"Blast_Adapter": { "address": "0xF2bEf5E905AAE0295003ab14872F811E914EdD81", "blockNumber": 20221494 },
"Scroll_Adapter": { "address": "0xb6129Ab69aEA75e6884c2D6ecf25293C343C519F", "blockNumber": 20318360 },
"Superseed_Adapter": { "address": "0xAca1Ca87872276E01CBB1ecb3488561402795F01", "blockNumber": 21087892 },
"Blast_DaiRetriever": { "address": "0x98Dd57048d7d5337e92D9102743528ea4Fea64aB", "blockNumber": 20378862 },
"Blast_RescueAdapter": { "address": "0xE5Dea263511F5caC27b15cBd58Ff103F4Ce90957", "blockNumber": 20378872 },
"Redstone_Adapter": { "address": "0x188F8C95B7cfB7993B53a4F643efa687916f73fA", "blockNumber": 20432774 },
Expand Down Expand Up @@ -86,6 +87,11 @@
"SpokePool": { "address": "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4", "blockNumber": 7267988 },
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 7660205 }
},
"5330": {
"SpokePool": { "address": "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64", "blockNumber": 2146091 },
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 2152579 },
"SpokePoolVerifier": { "address": "0x7E63A5f1a8F0B4d0934B2f2327DAED3F6bb2ee75", "blockNumber": 2146447 }
},
"8453": {
"SpokePool": { "address": "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64", "blockNumber": 2164878 },
"SpokePoolVerifier": { "address": "0xB4A8d45647445EA9FC3E1058096142390683dBC2", "blockNumber": 12285703 },
Expand Down
1 change: 1 addition & 0 deletions deployments/superseed/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5330
Loading
Loading