diff --git a/bridge-validators/src/block.rs b/bridge-validators/src/block.rs index 14b61f8..f8c3280 100644 --- a/bridge-validators/src/block.rs +++ b/bridge-validators/src/block.rs @@ -316,7 +316,7 @@ impl EventListener { let mut interval = interval(Duration::from_secs(3)); // Set this down 1 because we (almost) certainly haven't scanned this block // yet... - self.current_block = self.chain_client.client.get_block_number().await? - 1; + self.current_block = self.get_block_number().await? - 1; loop { interval.tick().await; diff --git a/bridge-validators/src/bridge_node.rs b/bridge-validators/src/bridge_node.rs index 30495d8..b8588bc 100644 --- a/bridge-validators/src/bridge_node.rs +++ b/bridge-validators/src/bridge_node.rs @@ -313,7 +313,7 @@ impl BridgeNode { }; if !self.validators.contains(&address) { - info!("Address not part of the validator set, {}", address); + info!("Address not part of the validator set, {:x}", address); return Ok(()); } diff --git a/bridge-validators/src/client.rs b/bridge-validators/src/client.rs index 9239c68..07bacea 100644 --- a/bridge-validators/src/client.rs +++ b/bridge-validators/src/client.rs @@ -33,7 +33,8 @@ pub struct ChainClient { pub wallet: LocalWallet, pub chain_gateway_block_deployed: u64, pub block_instant_finality: bool, - pub legacy_gas_estimation_percent: Option, + pub gas_estimation_percent: Option, + pub use_legacy_transactions: bool, pub scan_behind_blocks: u64, pub log_strategy: LogStrategy, pub to_block_number: Option, @@ -103,7 +104,8 @@ impl ChainClient { wallet, chain_gateway_block_deployed: config.chain_gateway_block_deployed, block_instant_finality: config.block_instant_finality.unwrap_or_default(), - legacy_gas_estimation_percent: config.legacy_gas_estimation_percent, + gas_estimation_percent: config.gas_estimation_percent, + use_legacy_transactions: config.use_legacy_transactions.unwrap_or(false), scan_behind_blocks: config.scan_behind_blocks.unwrap_or_default(), log_strategy: strategy, to_block_number: config.to_block_number, diff --git a/bridge-validators/src/main.rs b/bridge-validators/src/main.rs index b374884..83e754f 100644 --- a/bridge-validators/src/main.rs +++ b/bridge-validators/src/main.rs @@ -57,7 +57,8 @@ pub struct ChainConfig { pub chain_gateway_address: Address, pub chain_gateway_block_deployed: u64, pub block_instant_finality: Option, - pub legacy_gas_estimation_percent: Option, + pub gas_estimation_percent: Option, + pub use_legacy_transactions: Option, pub scan_behind_blocks: Option, pub use_get_transactions: Option, pub to_block_number: Option, diff --git a/bridge-validators/src/validator_node.rs b/bridge-validators/src/validator_node.rs index 67294c8..65f9f0a 100644 --- a/bridge-validators/src/validator_node.rs +++ b/bridge-validators/src/validator_node.rs @@ -181,7 +181,7 @@ impl ValidatorNode { event.target_chain_id, event.nonce ); - let function_call = if client.legacy_gas_estimation_percent.is_some() { + let function_call = if client.use_legacy_transactions { function_call.legacy() } else { function_call @@ -192,18 +192,10 @@ impl ValidatorNode { // Get gas estimate // TODO: refactor configs specifically for zilliqa - let _function_call = if let Some(percent) = client.legacy_gas_estimation_percent { - let gas_estimate = match function_call.estimate_gas().await { - Ok(estimate) => estimate, - Err(err) => { - warn!("Failed to estimate gas, {:?} - using built-in default", err); - U256::from(2_000_000) - // return Ok(()); - } - }; - info!("Legacy gas estimation: estimate {:?}", gas_estimate); - function_call.clone().gas(gas_estimate * percent / 100) // Apply multiplier - } else { + let gas_percent = client.gas_estimation_percent.unwrap_or(100); + + // If we're not using legacy txns, try to simulate the txn. + if !client.use_legacy_transactions { let function_call = function_call.clone(); // `eth_call` does not seem to work on ZQ so it had to be skipped // Simulate call, if fails decode error and exit early @@ -227,8 +219,23 @@ impl ValidatorNode { } } } - function_call + } + + // Now we need to estimate gas. + let gas_estimate = match function_call.estimate_gas().await { + Ok(estimate) => estimate, + Err(err) => { + warn!("Failed to estimate gas, {:?} - using built-in default", err); + U256::from(2_000_000) + // return Ok(()); + } }; + let gas_to_use = (gas_estimate * U256::from(gas_percent)) / U256::from(100); + info!( + "Gas estimation: estimate {:?} calling with gas {:?}", + gas_estimate, gas_to_use + ); + let _function_call = function_call.clone().gas(gas_to_use); // Make the actual call match _function_call.send().await { diff --git a/bridge-web/src/App.tsx b/bridge-web/src/App.tsx index d454399..7e365b1 100644 --- a/bridge-web/src/App.tsx +++ b/bridge-web/src/App.tsx @@ -38,8 +38,12 @@ import AddToken from "./components/AddToken"; type TxnType = "approve" | "bridge"; function getAvailableTokens(fromChainConfig: ChainConfig, toChainConfig: ChainConfig) { - return fromChainConfig.tokens.filter((tok) => - tok.bridgesTo.find((network) => network == toChainConfig.chain)); + const avail = Array.from(fromChainConfig.tokens).filter((tok) => + tok.bridgesTo.find((network) => network == toChainConfig.chain)) + .sort((a,b) => a.name.localeCompare(b.name, 'en') ); + let names = avail.map((x) => (x.name)); + return avail; + } function App() { @@ -73,9 +77,9 @@ function App() { const pendingFromChainConfig = chainConfigs[pendingChains[0]]!; const pendingToChainConfig = chainConfigs[pendingChains[1]]!; // Don't query whilst we're switching chains. - const pendingChainSwitch = chain != fromChainConfig.wagmiChain; + const pendingChainSwitch = chain?.id != fromChainConfig?.wagmiChain?.id; - // console.log(`pending ${JSON.stringify(pendingChains)} current ${JSON.stringify(currentChains)} chain ${JSON.stringify(chain)} pending ${pendingChainSwitch}`); + //console.log(`pending ${JSON.stringify(pendingChains)} current ${JSON.stringify(currentChains)} fromChainConfig.wagmiChain ${JSON.stringify(fromChainConfig.wagmiChain)} chain ${JSON.stringify(chain)} pending ${pendingChainSwitch}`); const fromChainClient = usePublicClient({ chainId: fromChainConfig.chainId }); const toChainClient = usePublicClient({ chainId: toChainConfig.chainId }); @@ -85,7 +89,8 @@ function App() { switchNetwork && switchNetwork(pendingFromChainConfig.chainId); }, [pendingChains, switchNetwork]); - // This fires when switchNetwork() has completed and the chain has been changed in the wallet. + // This fires when switchNetwork() has completed and the chain has been changed in the wallet, or + // when we just change the to network. useEffect(() => { let goTo = pendingToChainConfig.chain; let goFrom = pendingFromChainConfig.chain; @@ -110,7 +115,7 @@ function App() { if (toChainConfig.chain != goTo || fromChainConfig.chain != goFrom) { setCurrentChains([goFrom, goTo]); } - }, [chain]); + }, [chain,pendingToChainConfig]); // Fires when currentChains is set - chooses a token. @@ -165,6 +170,7 @@ function App() { watch: true, }); + //console.log(`contractBalance ${contractBalance} account ${account} address ${token.address} pending ${pendingChainSwitch}`); contractBalance = contractBalance ?? BigInt(0); let nativeBalance = nativeBalanceData && nativeBalanceData.value @@ -470,7 +476,6 @@ function App() { const selectTokenOnDropdown = (token: TokenConfig) => { const elem = document.activeElement; - if (elem) { elem && (elem as any).blur(); } @@ -651,23 +656,23 @@ function App() { tabIndex={0} className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52" > - {getAvailableTokens(fromChainConfig, toChainConfig).map((token) => ( + {getAvailableTokens(fromChainConfig, toChainConfig).filter((tok) => tok.name != token.name).map((tok) => (
  • selectTokenOnDropdown(token)} + key={tok.address} + onClick={() => selectTokenOnDropdown(tok)} >
    - {token.logo && ( + {tok.logo && ( Token Logo + src={tok.logo} + className="h-8" + alt="Token Logo" + /> )} -

    {token.name}

    +

    {tok.name}

  • - ))} + ))} diff --git a/bridge-web/src/config/config.ts b/bridge-web/src/config/config.ts index 623cb08..980a207 100644 --- a/bridge-web/src/config/config.ts +++ b/bridge-web/src/config/config.ts @@ -73,7 +73,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "bsc" ] }, { - name: "zMATIC", + name: "MATIC", address: "0x4345472A0c6164F35808CDb7e7eCCd3d326CC50b", blockExplorer: "https://otterscan.zilliqa.com/address/0x4345472A0c6164F35808CDb7e7eCCd3d326CC50b", logo: test_hrse_token, @@ -90,15 +90,6 @@ export const chainConfigs: Partial> = tokenManagerType: TokenManagerType.LockAndRelease, bridgesTo: [ "ethereum", "polygon", "arbitrum", "bsc" ] }, - { - name: "zETH", - address: "0x17D5af5658A24bd964984b36d28e879a8626adC3", - blockExplorer: "https://otterscan.zilliqa.com/address/0x17D5af5658A24bd964984b36d28e879a8626adC3", - logo: fps_token, - tokenManagerAddress: "0x4fa6148C9DAbC7A737422fb1b3AB9088c878d26C", - tokenManagerType: TokenManagerType.LockAndRelease, - bridgesTo: [ "ethereum" ] - }, { name: "XCAD", address: "0xCcF3Ea256d42Aeef0EE0e39Bfc94bAa9Fa14b0Ba", @@ -108,9 +99,18 @@ export const chainConfigs: Partial> = tokenManagerType: TokenManagerType.LockAndRelease, bridgesTo: [ "ethereum" ] }, - { - name: "zOPUL", - address: "0x17D5af5658A24bd964984b36d28e879a8626adC3", + { + name: "ETH", + address: "0x17D5af5658A24bd964984b36d28e879a8626adC3", + blockExplorer: "https://otterscan.zilliqa.com/address/0x17D5af5658A24bd964984b36d28e879a8626adC3", + logo: fps_token, + tokenManagerAddress: "0x4fa6148C9DAbC7A737422fb1b3AB9088c878d26C", + tokenManagerType: TokenManagerType.LockAndRelease, + bridgesTo: [ "ethereum", "arbitrum" ] + }, + { + name: "OPUL", + address: "0x8DEAdC20f7218994c86b59eE1D5c7979fFcAa893", blockExplorer: "https://otterscan.zilliqa.com/address/0x17D5af5658A24bd964984b36d28e879a8626adC3", logo: seed_token, tokenManagerAddress: "0x4fa6148C9DAbC7A737422fb1b3AB9088c878d26C", @@ -118,7 +118,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "ethereum" ] }, { - name: "zBRKL", + name: "BRKL", address: "0xD819257C964A78A493DF93D5643E9490b54C5af2", blockExplorer: "https://otterscan.zilliqa.com/address/0xD819257C964A78A493DF93D5643E9490b54C5af2", logo: seed_token, @@ -127,7 +127,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "ethereum" ] }, { - name: "zWBTC", + name: "WBTC", address: "0x2938fF251Aecc1dfa768D7d0276eB6d073690317", blockExplorer: "https://otterscan.zilliqa.com/address/0x2938fF251Aecc1dfa768D7d0276eB6d073690317", logo: seed_token, @@ -136,7 +136,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "ethereum" ] }, { - name: "zUSDT", + name: "USDT", address: "0x2274005778063684fbB1BfA96a2b725dC37D75f9", blockExplorer: "https://otterscan.zilliqa.com/address/0x2274005778063684fbB1BfA96a2b725dC37D75f9", logo: seed_token, @@ -145,7 +145,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "ethereum" ] }, { - name: "zTRAXX", + name: "TRAXX", address: "0x9121A67cA79B6778eAb477c5F76dF6de7C79cC4b", blockExplorer: "https://otterscan.zilliqa.com/address/0x9121A67cA79B6778eAb477c5F76dF6de7C79cC4b", logo: seed_token, @@ -209,7 +209,7 @@ export const chainConfigs: Partial> = nativeTokenSymbol: "POL", tokens: [ { - name: "eZIL", + name: "ZIL", address: "0xCc88D28f7d4B0D5AFACCC77F6102d88EE630fA17", blockExplorer: "https://polygonscan.com/token/0xCc88D28f7d4B0D5AFACCC77F6102d88EE630fA17", logo: test_hrse_token, @@ -242,7 +242,7 @@ export const chainConfigs: Partial> = nativeTokenSymbol: "ARB", tokens: [ { - name: "eZIL", + name: "ZIL", address: "0x1816a0f20bc996f643b1af078e8d84a0aabd772a", blockExplorer: "https://arbiscan.io/token/0x1816a0f20bc996f643b1af078e8d84a0aabd772a", logo: test_hrse_token, @@ -271,7 +271,7 @@ export const chainConfigs: Partial> = chainGatewayAddress: "0x49EA20823c953dd00619E2090DFa3965C89269C3", chainId: 1, isZilliqa: false, - blockExplorer: "https://etherscan.io", + blockExplorer: "https://etherscan.io/tx/", nativeTokenSymbol: "ETH", tokens: [ { @@ -363,7 +363,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "zq" ] }, { - name: "zWBTC", + name: "WBTC", address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", logo: seed_token, blockExplorer: "https://etherscan.io/token/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", @@ -372,7 +372,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "zq" ] }, { - name: "zUSDT", + name: "USDT", address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", logo: seed_token, blockExplorer: "https://etherscan.io/token/0xdAC17F958D2ee523a2206206994597C13D831ec7", @@ -381,7 +381,7 @@ export const chainConfigs: Partial> = bridgesTo: [ "zq" ] }, { - name: "zTRAXX", + name: "TRAXX", address: "0xD43Be54C1aedf7Ee4099104f2DaE4eA88B18A249", logo: seed_token, blockExplorer: "https://etherscan.io/token/0xD43Be54C1aedf7Ee4099104f2DaE4eA88B18A249", diff --git a/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/dry-run/run-1736760353.json b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/dry-run/run-1736760353.json new file mode 100644 index 0000000..156f294 --- /dev/null +++ b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/dry-run/run-1736760353.json @@ -0,0 +1,54 @@ +{ + "transactions": [ + { + "hash": null, + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "function": "setLockProxyData(address,address)", + "arguments": [ + "0x9a016Ce184a22DbF6c17daA59Eb7d3140DBd1c54", + "0x405e42de24Dc4894dB22595D041EBb170dC21D60" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "gas": "0xd029", + "value": "0x0", + "input": "0x766a1b7b0000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c54000000000000000000000000405e42de24dc4894db22595d041ebb170dc21d60", + "nonce": "0x27", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": null, + "transactionType": "CALL", + "contractName": "LockProxyProxy", + "contractAddress": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "function": "addCaller(address)", + "arguments": [ + "0x99bCB148BEC418Fc66ebF7ACA3668ec1C6289695" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "gas": "0x1e9a3", + "value": "0x0", + "input": "0x747293fb00000000000000000000000099bcb148bec418fc66ebf7aca3668ec1c6289695", + "nonce": "0x28", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1736760353, + "chain": 1, + "commit": "05b8b5a" +} \ No newline at end of file diff --git a/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/dry-run/run-latest.json b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/dry-run/run-latest.json new file mode 100644 index 0000000..156f294 --- /dev/null +++ b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/dry-run/run-latest.json @@ -0,0 +1,54 @@ +{ + "transactions": [ + { + "hash": null, + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "function": "setLockProxyData(address,address)", + "arguments": [ + "0x9a016Ce184a22DbF6c17daA59Eb7d3140DBd1c54", + "0x405e42de24Dc4894dB22595D041EBb170dC21D60" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "gas": "0xd029", + "value": "0x0", + "input": "0x766a1b7b0000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c54000000000000000000000000405e42de24dc4894db22595d041ebb170dc21d60", + "nonce": "0x27", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": null, + "transactionType": "CALL", + "contractName": "LockProxyProxy", + "contractAddress": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "function": "addCaller(address)", + "arguments": [ + "0x99bCB148BEC418Fc66ebF7ACA3668ec1C6289695" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "gas": "0x1e9a3", + "value": "0x0", + "input": "0x747293fb00000000000000000000000099bcb148bec418fc66ebf7aca3668ec1c6289695", + "nonce": "0x28", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1736760353, + "chain": 1, + "commit": "05b8b5a" +} \ No newline at end of file diff --git a/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/run-1736760422.json b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/run-1736760422.json new file mode 100644 index 0000000..e394c5a --- /dev/null +++ b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/run-1736760422.json @@ -0,0 +1,101 @@ +{ + "transactions": [ + { + "hash": "0x58035a74a8aee8bb3127b7226ead09cfcd2c7040baba9c8eeb0f7c88adda3384", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "function": "setLockProxyData(address,address)", + "arguments": [ + "0x9a016Ce184a22DbF6c17daA59Eb7d3140DBd1c54", + "0x405e42de24Dc4894dB22595D041EBb170dC21D60" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "gas": "0xd029", + "value": "0x0", + "input": "0x766a1b7b0000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c54000000000000000000000000405e42de24dc4894db22595d041ebb170dc21d60", + "nonce": "0x27", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0x98732a507d9b0543df1f4b3e9d5a8062dbfe8d41c525ef06e585adf05f9ac9dc", + "transactionType": "CALL", + "contractName": "LockProxyProxy", + "contractAddress": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "function": "addCaller(address)", + "arguments": [ + "0x99bCB148BEC418Fc66ebF7ACA3668ec1C6289695" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "gas": "0x1e9a3", + "value": "0x0", + "input": "0x747293fb00000000000000000000000099bcb148bec418fc66ebf7aca3668ec1c6289695", + "nonce": "0x28", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x10bb74a", + "logs": [ + { + "address": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "topics": [ + "0x90ca77ab15009de2392c35890c8e7fb753565ab9e96a342289aa32fcf433f35a" + ], + "data": "0x0000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c540000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c54000000000000000000000000d819257c964a78a493df93d5643e9490b54c5af2000000000000000000000000405e42de24dc4894db22595d041ebb170dc21d60", + "blockHash": "0xf6c595af962fb459ed460b72e321d17b60e91f79195657e07880e6660bd6f650", + "blockNumber": "0x149d045", + "transactionHash": "0x58035a74a8aee8bb3127b7226ead09cfcd2c7040baba9c8eeb0f7c88adda3384", + "transactionIndex": "0xb1", + "logIndex": "0x206", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000800000000000000000000000000000000000001000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x58035a74a8aee8bb3127b7226ead09cfcd2c7040baba9c8eeb0f7c88adda3384", + "transactionIndex": "0xb1", + "blockHash": "0xf6c595af962fb459ed460b72e321d17b60e91f79195657e07880e6660bd6f650", + "blockNumber": "0x149d045", + "gasUsed": "0x96b5", + "effectiveGasPrice": "0x11e0b3b65", + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x10d19c8", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x98732a507d9b0543df1f4b3e9d5a8062dbfe8d41c525ef06e585adf05f9ac9dc", + "transactionIndex": "0xb2", + "blockHash": "0xf6c595af962fb459ed460b72e321d17b60e91f79195657e07880e6660bd6f650", + "blockNumber": "0x149d045", + "gasUsed": "0x1627e", + "effectiveGasPrice": "0x11e0b3b65", + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1736760422, + "chain": 1, + "commit": "05b8b5a" +} \ No newline at end of file diff --git a/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/run-latest.json b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/run-latest.json new file mode 100644 index 0000000..e394c5a --- /dev/null +++ b/smart-contracts/broadcast/08_revertToRegisteredLockProxyProxy.s.sol/1/run-latest.json @@ -0,0 +1,101 @@ +{ + "transactions": [ + { + "hash": "0x58035a74a8aee8bb3127b7226ead09cfcd2c7040baba9c8eeb0f7c88adda3384", + "transactionType": "CALL", + "contractName": null, + "contractAddress": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "function": "setLockProxyData(address,address)", + "arguments": [ + "0x9a016Ce184a22DbF6c17daA59Eb7d3140DBd1c54", + "0x405e42de24Dc4894dB22595D041EBb170dC21D60" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "gas": "0xd029", + "value": "0x0", + "input": "0x766a1b7b0000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c54000000000000000000000000405e42de24dc4894db22595d041ebb170dc21d60", + "nonce": "0x27", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0x98732a507d9b0543df1f4b3e9d5a8062dbfe8d41c525ef06e585adf05f9ac9dc", + "transactionType": "CALL", + "contractName": "LockProxyProxy", + "contractAddress": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "function": "addCaller(address)", + "arguments": [ + "0x99bCB148BEC418Fc66ebF7ACA3668ec1C6289695" + ], + "transaction": { + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "gas": "0x1e9a3", + "value": "0x0", + "input": "0x747293fb00000000000000000000000099bcb148bec418fc66ebf7aca3668ec1c6289695", + "nonce": "0x28", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x10bb74a", + "logs": [ + { + "address": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "topics": [ + "0x90ca77ab15009de2392c35890c8e7fb753565ab9e96a342289aa32fcf433f35a" + ], + "data": "0x0000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c540000000000000000000000009a016ce184a22dbf6c17daa59eb7d3140dbd1c54000000000000000000000000d819257c964a78a493df93d5643e9490b54c5af2000000000000000000000000405e42de24dc4894db22595d041ebb170dc21d60", + "blockHash": "0xf6c595af962fb459ed460b72e321d17b60e91f79195657e07880e6660bd6f650", + "blockNumber": "0x149d045", + "transactionHash": "0x58035a74a8aee8bb3127b7226ead09cfcd2c7040baba9c8eeb0f7c88adda3384", + "transactionIndex": "0xb1", + "logIndex": "0x206", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000800000000000000000000000000000000000001000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x58035a74a8aee8bb3127b7226ead09cfcd2c7040baba9c8eeb0f7c88adda3384", + "transactionIndex": "0xb1", + "blockHash": "0xf6c595af962fb459ed460b72e321d17b60e91f79195657e07880e6660bd6f650", + "blockNumber": "0x149d045", + "gasUsed": "0x96b5", + "effectiveGasPrice": "0x11e0b3b65", + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x99bcb148bec418fc66ebf7aca3668ec1c6289695", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x10d19c8", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x98732a507d9b0543df1f4b3e9d5a8062dbfe8d41c525ef06e585adf05f9ac9dc", + "transactionIndex": "0xb2", + "blockHash": "0xf6c595af962fb459ed460b72e321d17b60e91f79195657e07880e6660bd6f650", + "blockNumber": "0x149d045", + "gasUsed": "0x1627e", + "effectiveGasPrice": "0x11e0b3b65", + "from": "0xd89421cd5dd6d6269fbb9307535c386afe11a23e", + "to": "0x405e42de24dc4894db22595d041ebb170dc21d60", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1736760422, + "chain": 1, + "commit": "05b8b5a" +} \ No newline at end of file diff --git a/smart-contracts/script/eth/deploy/08_revertToRegisteredLockProxyProxy.s.sol b/smart-contracts/script/eth/deploy/08_revertToRegisteredLockProxyProxy.s.sol new file mode 100644 index 0000000..cd94fb0 --- /dev/null +++ b/smart-contracts/script/eth/deploy/08_revertToRegisteredLockProxyProxy.s.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity ^0.8.20; + +import {Script} from "forge-std/Script.sol"; +import "forge-std/console.sol"; +import {LockProxyTokenManagerUpgradeableV4} from "contracts/periphery/TokenManagerV4/LockProxyTokenManagerUpgradeableV4.sol"; +import {LockAndReleaseOrNativeTokenManagerUpgradeableV4} from "contracts/periphery/TokenManagerV4/LockAndReleaseOrNativeTokenManagerUpgradeableV4.sol"; +import {ChainGatewayUpgradeable} from "contracts/core-upgradeable/ChainGatewayUpgradeable.sol"; +import { MainnetConfig } from "script/mainnetConfig.s.sol"; +import {LockProxyProxy} from "contracts/periphery/LockProxyProxy.sol"; + +contract revertToRegisteredLockProxyProxy is Script, MainnetConfig { + function run() external { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_OWNER"); + vm.startBroadcast(deployerPrivateKey); + LockProxyTokenManagerUpgradeableV4 lockProxyTokenManager = LockProxyTokenManagerUpgradeableV4(payable(ethLockProxyTokenManager)); + lockProxyTokenManager.setLockProxyData(ethLockProxy, ethLockProxyProxy); + LockProxyProxy lockProxyProxy = LockProxyProxy(payable(ethLockProxyProxy)); + lockProxyProxy.addCaller(address(lockProxyTokenManager)); + vm.stopBroadcast(); + } +} + diff --git a/smart-contracts/script/mainnetConfig.s.sol b/smart-contracts/script/mainnetConfig.s.sol index 224edab..9b75641 100644 --- a/smart-contracts/script/mainnetConfig.s.sol +++ b/smart-contracts/script/mainnetConfig.s.sol @@ -46,8 +46,9 @@ abstract contract MainnetConfig { address public constant arbLockProxyTokenManager = 0x4fa6148C9DAbC7A737422fb1b3AB9088c878d26C; address public constant ethLockProxy = 0x9a016Ce184a22DbF6c17daA59Eb7d3140DBd1c54; - address public constant ethLockProxyProxy = 0xD819257C964A78A493DF93D5643E9490b54C5af2; + address public constant ethLockProxyProxyUnregistered = 0xD819257C964A78A493DF93D5643E9490b54C5af2; address public constant ethLockProxyProxyOld = 0x405e42de24Dc4894dB22595D041EBb170dC21D60; + address public constant ethLockProxyProxy = 0x405e42de24Dc4894dB22595D041EBb170dC21D60; address public constant ethValidatorManager = 0x9F71303eE8E1aA74DEE0bC70a009420953E82915; address public constant ethChainGatewayAddress = 0x49EA20823c953dd00619E2090DFa3965C89269C3; address public constant ethLockAndReleaseOrNativeTokenManagerUpgradeable = 0x2EE8e8D7C113Bb7c180f4755f06ed50bE53BEDe5;