@across-protocol/contracts 3.0.20 → 3.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/build-info/e986ccf2458b97f0dcb4be2c6dc68250.json +1 -0
- package/artifacts/contracts/Cher_SpokePool.sol/Cher_SpokePool.dbg.json +4 -0
- package/artifacts/contracts/Cher_SpokePool.sol/Cher_SpokePool.json +2316 -0
- package/contracts/Cher_SpokePool.sol +72 -0
- package/dist/deploy/consts.js +5 -0
- package/dist/deployments/deployments.json +6 -1
- package/dist/hardhat.config.js +17 -0
- package/dist/src/svm/helpers.js +1 -1
- package/dist/typechain/contracts/Cher_SpokePool.d.ts +1251 -0
- package/dist/typechain/contracts/Cher_SpokePool.js +2 -0
- package/dist/typechain/contracts/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/Cher_SpokePool__factory.d.ts +1833 -0
- package/dist/typechain/factories/contracts/Cher_SpokePool__factory.js +2347 -0
- package/dist/typechain/factories/contracts/index.d.ts +1 -0
- package/dist/typechain/factories/contracts/index.js +3 -1
- package/dist/typechain/hardhat.d.ts +9 -0
- package/dist/typechain/index.d.ts +2 -0
- package/dist/typechain/index.js +5 -3
- package/package.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
|
|
4
|
+
|
|
5
|
+
import "./Ovm_SpokePool.sol";
|
|
6
|
+
import "./external/interfaces/CCTPInterfaces.sol";
|
|
7
|
+
import { IOpUSDCBridgeAdapter } from "./external/interfaces/IOpUSDCBridgeAdapter.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @notice Cher SpokePool.
|
|
11
|
+
* @custom:security-contact bugs@across.to
|
|
12
|
+
*/
|
|
13
|
+
contract Cher_SpokePool is Ovm_SpokePool {
|
|
14
|
+
using SafeERC20 for IERC20;
|
|
15
|
+
|
|
16
|
+
// Address of the custom L2 USDC bridge.
|
|
17
|
+
address private constant USDC_BRIDGE = 0x8be79275FCfD08A931087ECf70Ba8a99aee3AC59;
|
|
18
|
+
|
|
19
|
+
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
20
|
+
constructor(
|
|
21
|
+
address _wrappedNativeTokenAddress,
|
|
22
|
+
uint32 _depositQuoteTimeBuffer,
|
|
23
|
+
uint32 _fillDeadlineBuffer,
|
|
24
|
+
IERC20 _l2Usdc,
|
|
25
|
+
ITokenMessenger _cctpTokenMessenger
|
|
26
|
+
)
|
|
27
|
+
Ovm_SpokePool(
|
|
28
|
+
_wrappedNativeTokenAddress,
|
|
29
|
+
_depositQuoteTimeBuffer,
|
|
30
|
+
_fillDeadlineBuffer,
|
|
31
|
+
_l2Usdc,
|
|
32
|
+
_cctpTokenMessenger
|
|
33
|
+
)
|
|
34
|
+
{} // solhint-disable-line no-empty-blocks
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @notice Construct the OVM Cher SpokePool.
|
|
38
|
+
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
|
|
39
|
+
* relay hash collisions.
|
|
40
|
+
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
|
|
41
|
+
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
|
|
42
|
+
*/
|
|
43
|
+
function initialize(
|
|
44
|
+
uint32 _initialDepositId,
|
|
45
|
+
address _crossDomainAdmin,
|
|
46
|
+
address _withdrawalRecipient
|
|
47
|
+
) public initializer {
|
|
48
|
+
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @notice Cher-specific logic to bridge tokens back to the hub pool contract on L1.
|
|
53
|
+
* @param amountToReturn Amount of the token to bridge back.
|
|
54
|
+
* @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`,
|
|
55
|
+
* or via the canonical mapping defined in the bridge contract retrieved from `tokenBridges`.
|
|
56
|
+
* @dev This implementation deviates slightly from `_bridgeTokensToHubPool` in the `Ovm_SpokePool` contract since
|
|
57
|
+
* this chain uses Circle's bridged (upgradable to native) USDC standard, which uses a custom interface.
|
|
58
|
+
*/
|
|
59
|
+
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override {
|
|
60
|
+
// 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
|
|
61
|
+
// 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
|
|
62
|
+
// Cher, this block of code will be unused.
|
|
63
|
+
if (l2TokenAddress == address(usdcToken) && !_isCCTPEnabled()) {
|
|
64
|
+
usdcToken.safeIncreaseAllowance(USDC_BRIDGE, amountToReturn);
|
|
65
|
+
IOpUSDCBridgeAdapter(USDC_BRIDGE).sendMessage(
|
|
66
|
+
withdrawalRecipient, // _to. Withdraw, over the bridge, to the l1 hub pool contract.
|
|
67
|
+
amountToReturn, // _amount.
|
|
68
|
+
l1Gas // _minGasLimit. Same value used in other OpStack bridges.
|
|
69
|
+
);
|
|
70
|
+
} else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
|
|
71
|
+
}
|
|
72
|
+
}
|
package/dist/deploy/consts.js
CHANGED
|
@@ -86,6 +86,11 @@ exports.OP_STACK_ADDRESS_MAP = {
|
|
|
86
86
|
L1StandardBridge: "0x88ff1e5b602916615391f55854588efcbb7663f0",
|
|
87
87
|
L1OpUSDCBridgeAdapter: common_1.ZERO_ADDRESS,
|
|
88
88
|
},
|
|
89
|
+
[utils_1.CHAIN_IDs.CHER]: {
|
|
90
|
+
L1CrossDomainMessenger: "0x9cf951e3f74b644e621b36ca9cea147a78d4c39f",
|
|
91
|
+
L1StandardBridge: "0xeb9bf100225c214efc3e7c651ebbadcf85177607",
|
|
92
|
+
L1OpUSDCBridgeAdapter: "0xC67A8c5f22b40274Ca7C4A56Db89569Ee2AD3FAb",
|
|
93
|
+
},
|
|
89
94
|
[utils_1.CHAIN_IDs.LISK]: {
|
|
90
95
|
L1CrossDomainMessenger: "0x31B72D76FB666844C41EdF08dF0254875Dbb7edB",
|
|
91
96
|
L1StandardBridge: "0x2658723Bf70c7667De6B25F99fcce13A16D25d08",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"Zora_Adapter": { "address": "0x024f2fc31cbdd8de17194b1892c834f98ef5169b", "blockNumber": 20512287 },
|
|
30
30
|
"WorldChain_Adapter": { "address": "0xA8399e221a583A57F54Abb5bA22f31b5D6C09f32", "blockNumber": 20963234 },
|
|
31
31
|
"AlephZero_Adapter": { "address": "0x6F4083304C2cA99B077ACE06a5DcF670615915Af", "blockNumber": 21131132 },
|
|
32
|
-
"Ink_Adapter": { "address": "0x7e90a40c7519b041a7df6498fbf5662e8cfc61d2", "blockNumber": 21438590 }
|
|
32
|
+
"Ink_Adapter": { "address": "0x7e90a40c7519b041a7df6498fbf5662e8cfc61d2", "blockNumber": 21438590 },
|
|
33
|
+
"Cher_Adapter": { "address": "0x0c9d064523177dBB55CFE52b9D0c485FBFc35FD2", "blockNumber": 21597341 }
|
|
33
34
|
},
|
|
34
35
|
"10": {
|
|
35
36
|
"SpokePool": { "address": "0x6f26Bf09B1C792e3228e5467807a900A503c0281", "blockNumber": 93903076 },
|
|
@@ -168,5 +169,9 @@
|
|
|
168
169
|
"SpokePool": { "address": "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4", "blockNumber": 1139240 },
|
|
169
170
|
"SpokePoolVerifier": { "address": "0xB4A8d45647445EA9FC3E1058096142390683dBC2", "blockNumber": 1152853 },
|
|
170
171
|
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 1145284 }
|
|
172
|
+
},
|
|
173
|
+
"1868": {
|
|
174
|
+
"SpokePool": { "address": "0x3baD7AD0728f9917d1Bf08af5782dCbD516cDd96", "blockNumber": 1709997 },
|
|
175
|
+
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 1711482 }
|
|
171
176
|
}
|
|
172
177
|
}
|
package/dist/hardhat.config.js
CHANGED
|
@@ -102,6 +102,7 @@ const config = {
|
|
|
102
102
|
"contracts/Optimism_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
103
103
|
"contracts/WorldChain_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
104
104
|
"contracts/Ink_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
105
|
+
"contracts/Cher_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
|
|
105
106
|
},
|
|
106
107
|
},
|
|
107
108
|
zksolc: {
|
|
@@ -326,6 +327,13 @@ const config = {
|
|
|
326
327
|
accounts: { mnemonic },
|
|
327
328
|
companionNetworks: { l1: "mainnet" },
|
|
328
329
|
},
|
|
330
|
+
cher: {
|
|
331
|
+
chainId: constants_1.CHAIN_IDs.CHER,
|
|
332
|
+
url: (0, common_1.getNodeUrl)("cher", true, constants_1.CHAIN_IDs.CHER),
|
|
333
|
+
saveDeployments: true,
|
|
334
|
+
accounts: { mnemonic },
|
|
335
|
+
companionNetworks: { l1: "mainnet" },
|
|
336
|
+
},
|
|
329
337
|
},
|
|
330
338
|
gasReporter: { enabled: process.env.REPORT_GAS !== undefined, currency: "USD" },
|
|
331
339
|
etherscan: {
|
|
@@ -356,6 +364,7 @@ const config = {
|
|
|
356
364
|
worldchain: "blockscout",
|
|
357
365
|
alephzero: "blockscout",
|
|
358
366
|
ink: "blockscout",
|
|
367
|
+
cher: "blockscout",
|
|
359
368
|
},
|
|
360
369
|
customChains: [
|
|
361
370
|
{
|
|
@@ -390,6 +399,14 @@ const config = {
|
|
|
390
399
|
browserURL: "https://explorer.inkonchain.com",
|
|
391
400
|
},
|
|
392
401
|
},
|
|
402
|
+
{
|
|
403
|
+
network: "cher",
|
|
404
|
+
chainId: constants_1.CHAIN_IDs.CHER,
|
|
405
|
+
urls: {
|
|
406
|
+
apiURL: "https://blockscout.com/api",
|
|
407
|
+
browserURL: "https://blockscout.com",
|
|
408
|
+
},
|
|
409
|
+
},
|
|
393
410
|
{
|
|
394
411
|
network: "linea",
|
|
395
412
|
chainId: constants_1.CHAIN_IDs.LINEA,
|
package/dist/src/svm/helpers.js
CHANGED
|
@@ -7,7 +7,7 @@ const ethers_1 = require("ethers");
|
|
|
7
7
|
* Returns the chainId for a given solana cluster.
|
|
8
8
|
*/
|
|
9
9
|
const getSolanaChainId = (cluster) => {
|
|
10
|
-
return bignumber_1.BigNumber.from(BigInt(ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(`solana-${cluster}`))) & BigInt("
|
|
10
|
+
return bignumber_1.BigNumber.from(BigInt(ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(`solana-${cluster}`))) & BigInt("0xFFFFFFFFFFFF"));
|
|
11
11
|
};
|
|
12
12
|
exports.getSolanaChainId = getSolanaChainId;
|
|
13
13
|
/**
|