From cb96815bb79afeb43489861f2a316130aa9b371d Mon Sep 17 00:00:00 2001 From: bennett Date: Wed, 25 Dec 2024 13:08:20 -0600 Subject: [PATCH] update tests Signed-off-by: bennett --- contracts/MockAtomicWethDepositor.sol | 4 +- deployments/mainnet/AtomicWethDepositor.json | 2 +- .../2d9892262097a1ffaaae202653dcb00a.json | 14 +- src/common/abi/AtomicDepositor.json | 394 +++++++++--------- test/AdapterManager.SendTokensCrossChain.ts | 10 +- .../AdapterManager.SendTokensCrossChain.ts | 10 +- test/generic-adapters/zkSync.ts | 4 +- 7 files changed, 223 insertions(+), 215 deletions(-) diff --git a/contracts/MockAtomicWethDepositor.sol b/contracts/MockAtomicWethDepositor.sol index 12a4b8263..2721f5424 100644 --- a/contracts/MockAtomicWethDepositor.sol +++ b/contracts/MockAtomicWethDepositor.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; contract MockAtomicWethDepositor { event AtomicWethDepositInitiated(address indexed from, uint256 indexed chainId, uint256 amount); - function bridgeWeth(uint256 chainId, uint256 amount, bytes calldata) public { - emit AtomicWethDepositInitiated(msg.sender, chainId, amount); + function bridgeWeth(uint256 chainId, uint256 netAmount, uint256 bridgeAmount, bytes calldata) public { + emit AtomicWethDepositInitiated(msg.sender, chainId, bridgeAmount); } } diff --git a/deployments/mainnet/AtomicWethDepositor.json b/deployments/mainnet/AtomicWethDepositor.json index 11bc60f80..1476a15dc 100644 --- a/deployments/mainnet/AtomicWethDepositor.json +++ b/deployments/mainnet/AtomicWethDepositor.json @@ -236,4 +236,4 @@ "metadata": "{\"compiler\":{\"version\":\"0.8.23+commit.f704f362\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidBridgeFunction\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"AtomicWethDepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"contract Weth\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"netValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bridgeValue\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"bridgeCallData\",\"type\":\"bytes\"}],\"name\":\"bridgeWeth\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"multicall\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"results\",\"type\":\"bytes[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSelector\",\"type\":\"bytes4\"}],\"name\":\"whitelistBridge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistedBridgeFunctions\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridge\",\"type\":\"address\"},{\"internalType\":\"bytes4\",\"name\":\"funcSelector\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract is ownable so that the owner can update whitelisted bridge addresses and function selectors.\",\"kind\":\"dev\",\"methods\":{\"bridgeWeth(uint256,uint256,uint256,bytes)\":{\"details\":\"Requires that the owner of this contract has whitelisted the bridge contract and function selector for the chainId that the user wants to send ETH to.\",\"params\":{\"bridgeCallData\":\"The calldata to pass to the bridge contract. The first 4 bytes should be equal to the whitelisted function selector of the bridge contract.\",\"bridgeValue\":\"The amount of WETH which the depositor expects to receive on L2. That is, netValue - fees.\",\"chainId\":\"The chain to send ETH to.\",\"netValue\":\"The total amount of WETH to withdraw and send to the bridge contract.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"whitelistBridge(uint256,address,bytes4)\":{\"params\":{\"bridge\":\"The address of the bridge contract to call to bridge ETH to the chain.\",\"chainId\":\"The chain ID of the bridge.\",\"funcSelector\":\"The function selector of the bridge contract.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridgeWeth(uint256,uint256,uint256,bytes)\":{\"notice\":\"Initiates a WETH deposit to a whitelisted bridge for a specified chain with user calldata.\"},\"whitelistBridge(uint256,address,bytes4)\":{\"notice\":\"Whitelists function selector and bridge contract for chain.\"},\"whitelistedBridgeFunctions(uint256)\":{\"notice\":\"Mapping of chain ID to whitelisted bridge addresses and function selectors that can be called by this contract.\"}},\"notice\":\"Contract deployed on Ethereum helps relay bots atomically unwrap and bridge WETH over the canonical chain bridges for chains that only support bridging of ETH not WETH.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/AtomicWethDepositor.sol\":\"AtomicWethDepositor\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xba43b97fba0d32eb4254f6a5a297b39a19a247082a02d6e69349e071e2946218\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc980984badf3984b6303b377711220e067722bbd6a135b24669ff5069ef9f32\",\"dweb:/ipfs/QmPHXMSXj99XjSVM21YsY6aNtLLjLVXDbyN76J5HQYvvrz\"]},\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"@uma/core/contracts/common/implementation/Lockable.sol\":{\"keccak256\":\"0x41d78fcce54598ad5f26bc0b778c0f4fedbd836401625e49e736979f69a87ef0\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://4ce111bb50441ef5125e7d42284f6debbc17fd589515d7b8cede7e9d1d5f0ede\",\"dweb:/ipfs/QmaXiXACWVEDDHoCHNXdVBoNpf8QNHkUZ1kf5MfbxfL6jj\"]},\"@uma/core/contracts/common/implementation/MultiCaller.sol\":{\"keccak256\":\"0x9f6afe5bafc5e16fe8d63010a740ec3a88a9f00a7236ea7e5b039a2f50eb346e\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://a971572a4a9ed32e5ec15ac384af593d9499778f6ec593dbdba67d44ced4c7d8\",\"dweb:/ipfs/QmbdpfhhnUyoHWe7TPFBZxT6R6zyxJEDcGBNwDt5ncweRv\"]},\"contracts/AtomicWethDepositor.sol\":{\"keccak256\":\"0x16dde9ea394c7f9c0c8115af99ea8c6650d9ac3491232043bbd6ed9380c7ab5e\",\"license\":\"GPL-3.0-only\",\"urls\":[\"bzz-raw://62193d23ddf5db7ae27cf8d4d4ee1a99b4224ab7bc863654c49220e0f07b1760\",\"dweb:/ipfs/QmYGW1GofASveQk4SkYTkrAGBiTexCN3bvfU1HfjpY6hdr\"]}},\"version\":1}", "bytecode": "0x60a08060405234610089575f543360018060a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a36001600160a81b0319163360ff60a01b191617600160a01b175f5573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2608052610f5e908161008e82396080518181816103cc0152610a790152f35b5f80fdfe60806040526004361015610018575b361561001657005b005b5f3560e01c80633a03c4a914610097578063715018a6146100925780638da5cb5b1461008d578063ac9650d814610088578063ad5c464814610083578063b44f12fa1461007e578063f2fde38b146100795763f6d65c7d0361000e57610577565b61048d565b6103f0565b610382565b6102fa565b6101c5565b61012b565b3461011d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d576004355f5260016020527fffffffff0000000000000000000000000000000000000000000000000000000060405f205473ffffffffffffffffffffffffffffffffffffffff811660805260401b1660a05260406080f35b5f80fd5b5f91031261011d57565b3461011d575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d57610161610e35565b5f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461011d575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d57602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b5f5b8381106102265750505f910152565b8181015183820152602001610217565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209361027281518092818752878088019101610215565b0116010190565b6020808201906020835283518092526040830192602060408460051b8301019501935f915b8483106102ae5750505050505090565b90919293949584806102ea837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a51610236565b980193019301919493929061029e565b3461011d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d5767ffffffffffffffff60043581811161011d573660238201121561011d57806004013591821161011d573660248360051b8301011161011d5761037e9160246103729201610960565b60405191829182610279565b0390f35b3461011d575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461011d5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d5760643567ffffffffffffffff80821161011d573660238301121561011d57816004013590811161011d57366024828401011161011d5760246100169201604435602435600435610a27565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361011d57565b3461011d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d5760043573ffffffffffffffffffffffffffffffffffffffff811680820361011d576104e5610e35565b156104f35761001690610eb3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b3461011d5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d576105ae61046a565b6044357fffffffff00000000000000000000000000000000000000000000000000000000811680910361011d576105e3610e35565b610666604051926105f3846106dd565b73ffffffffffffffffffffffffffffffffffffffff8091168452602084019283526004355f52600160205260405f20935116839073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b5181547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1660409190911c77ffffffff000000000000000000000000000000000000000016179055005b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff8211176106f957604052565b6106b0565b67ffffffffffffffff81116106f957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106f957604052565b67ffffffffffffffff81116106f95760051b60200190565b9061077582610753565b6107826040519182610712565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06107b08294610753565b01905f5b8281106107c057505050565b8060606020809385010152016107b4565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b919081101561085e5760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561011d57019081359167ffffffffffffffff831161011d57602001823603811361011d579190565b6107d1565b908092918237015f815290565b67ffffffffffffffff81116106f957601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b3d156108d4573d906108bb82610870565b916108c96040519384610712565b82523d5f602084013e565b606090565b60208183031261011d5780519067ffffffffffffffff821161011d570181601f8201121561011d57805161090c81610870565b9261091a6040519485610712565b8184526020828401011161011d576109389160208085019101610215565b90565b906020610938928181520190610236565b805182101561085e5760209160051b010190565b91909161096c8361076b565b925f5b81811061097b57505050565b5f806109888385876107fe565b6040939161099a855180938193610863565b0390305af4906109a86108aa565b91156109cf5750906001916109bd828861094c565b526109c8818761094c565b500161096f565b90604481511061011d57610a236109f4600492838101516024809183010191016108d9565b92519283927f08c379a0000000000000000000000000000000000000000000000000000000008452830161093b565b0390fd5b93919260ff5f5460a01c1615610cf957610a627fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f54165f55565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b1561011d576040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490525f8160648183865af18015610ce157610ce6575b50803b1561011d575f60405180927f2e1a7d4d000000000000000000000000000000000000000000000000000000008252818381610b3389600483019190602083019252565b03925af18015610ce157610cc8575b50610b5d610b58865f52600160205260405f2090565b610d57565b90610b8b60208301517fffffffff000000000000000000000000000000000000000000000000000000001690565b7fffffffff00000000000000000000000000000000000000000000000000000000610bde610bb98785610dab565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b911603610c9e57610c2c935f93610c0a85945173ffffffffffffffffffffffffffffffffffffffff1690565b92610c1a60405180948193610863565b03925af1610c266108aa565b90610def565b60405190815233907f07eaada8c9bcef700c8d25524866ae64bf4c9586cd632e43aa2ab78fc8dfef9e90602090a3610c9c740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f5416175f55565b565b60046040517f172b8892000000000000000000000000000000000000000000000000000000008152fd5b80610cd5610cdb926106fe565b80610121565b5f610b42565b610f1d565b80610cd5610cf3926106fe565b5f610aed565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b90604051610d64816106dd565b915473ffffffffffffffffffffffffffffffffffffffff8116835260401b7fffffffff00000000000000000000000000000000000000000000000000000000166020830152565b7fffffffff000000000000000000000000000000000000000000000000000000009035818116939260048110610de057505050565b60040360031b82901b16169150565b15610df75750565b610a23906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190610236565b73ffffffffffffffffffffffffffffffffffffffff5f54163303610e5557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b5f549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b6040513d5f823e3d90fdfea2646970667358221220acd786228f0b98d89ea582669ec5b1d27b4eedefc65bba401f0ef5cf2896eb5e64736f6c63430008170033", "deployedBytecode": "0x60806040526004361015610018575b361561001657005b005b5f3560e01c80633a03c4a914610097578063715018a6146100925780638da5cb5b1461008d578063ac9650d814610088578063ad5c464814610083578063b44f12fa1461007e578063f2fde38b146100795763f6d65c7d0361000e57610577565b61048d565b6103f0565b610382565b6102fa565b6101c5565b61012b565b3461011d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d576004355f5260016020527fffffffff0000000000000000000000000000000000000000000000000000000060405f205473ffffffffffffffffffffffffffffffffffffffff811660805260401b1660a05260406080f35b5f80fd5b5f91031261011d57565b3461011d575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d57610161610e35565b5f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461011d575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d57602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b5f5b8381106102265750505f910152565b8181015183820152602001610217565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f60209361027281518092818752878088019101610215565b0116010190565b6020808201906020835283518092526040830192602060408460051b8301019501935f915b8483106102ae5750505050505090565b90919293949584806102ea837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a51610236565b980193019301919493929061029e565b3461011d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d5767ffffffffffffffff60043581811161011d573660238201121561011d57806004013591821161011d573660248360051b8301011161011d5761037e9160246103729201610960565b60405191829182610279565b0390f35b3461011d575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461011d5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d5760643567ffffffffffffffff80821161011d573660238301121561011d57816004013590811161011d57366024828401011161011d5760246100169201604435602435600435610a27565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361011d57565b3461011d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d5760043573ffffffffffffffffffffffffffffffffffffffff811680820361011d576104e5610e35565b156104f35761001690610eb3565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b3461011d5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011d576105ae61046a565b6044357fffffffff00000000000000000000000000000000000000000000000000000000811680910361011d576105e3610e35565b610666604051926105f3846106dd565b73ffffffffffffffffffffffffffffffffffffffff8091168452602084019283526004355f52600160205260405f20935116839073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b5181547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1660409190911c77ffffffff000000000000000000000000000000000000000016179055005b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff8211176106f957604052565b6106b0565b67ffffffffffffffff81116106f957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176106f957604052565b67ffffffffffffffff81116106f95760051b60200190565b9061077582610753565b6107826040519182610712565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06107b08294610753565b01905f5b8281106107c057505050565b8060606020809385010152016107b4565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b919081101561085e5760051b810135907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561011d57019081359167ffffffffffffffff831161011d57602001823603811361011d579190565b6107d1565b908092918237015f815290565b67ffffffffffffffff81116106f957601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b3d156108d4573d906108bb82610870565b916108c96040519384610712565b82523d5f602084013e565b606090565b60208183031261011d5780519067ffffffffffffffff821161011d570181601f8201121561011d57805161090c81610870565b9261091a6040519485610712565b8184526020828401011161011d576109389160208085019101610215565b90565b906020610938928181520190610236565b805182101561085e5760209160051b010190565b91909161096c8361076b565b925f5b81811061097b57505050565b5f806109888385876107fe565b6040939161099a855180938193610863565b0390305af4906109a86108aa565b91156109cf5750906001916109bd828861094c565b526109c8818761094c565b500161096f565b90604481511061011d57610a236109f4600492838101516024809183010191016108d9565b92519283927f08c379a0000000000000000000000000000000000000000000000000000000008452830161093b565b0390fd5b93919260ff5f5460a01c1615610cf957610a627fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f54165f55565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b1561011d576040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490525f8160648183865af18015610ce157610ce6575b50803b1561011d575f60405180927f2e1a7d4d000000000000000000000000000000000000000000000000000000008252818381610b3389600483019190602083019252565b03925af18015610ce157610cc8575b50610b5d610b58865f52600160205260405f2090565b610d57565b90610b8b60208301517fffffffff000000000000000000000000000000000000000000000000000000001690565b7fffffffff00000000000000000000000000000000000000000000000000000000610bde610bb98785610dab565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b911603610c9e57610c2c935f93610c0a85945173ffffffffffffffffffffffffffffffffffffffff1690565b92610c1a60405180948193610863565b03925af1610c266108aa565b90610def565b60405190815233907f07eaada8c9bcef700c8d25524866ae64bf4c9586cd632e43aa2ab78fc8dfef9e90602090a3610c9c740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff5f5416175f55565b565b60046040517f172b8892000000000000000000000000000000000000000000000000000000008152fd5b80610cd5610cdb926106fe565b80610121565b5f610b42565b610f1d565b80610cd5610cf3926106fe565b5f610aed565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b90604051610d64816106dd565b915473ffffffffffffffffffffffffffffffffffffffff8116835260401b7fffffffff00000000000000000000000000000000000000000000000000000000166020830152565b7fffffffff000000000000000000000000000000000000000000000000000000009035818116939260048110610de057505050565b60040360031b82901b16169150565b15610df75750565b610a23906040519182917f08c379a0000000000000000000000000000000000000000000000000000000008352602060048401526024830190610236565b73ffffffffffffffffffffffffffffffffffffffff5f54163303610e5557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b5f549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b6040513d5f823e3d90fdfea2646970667358221220acd786228f0b98d89ea582669ec5b1d27b4eedefc65bba401f0ef5cf2896eb5e64736f6c63430008170033" -} \ No newline at end of file +} diff --git a/deployments/mainnet/solcInputs/2d9892262097a1ffaaae202653dcb00a.json b/deployments/mainnet/solcInputs/2d9892262097a1ffaaae202653dcb00a.json index 2d261ca9b..82b072d90 100644 --- a/deployments/mainnet/solcInputs/2d9892262097a1ffaaae202653dcb00a.json +++ b/deployments/mainnet/solcInputs/2d9892262097a1ffaaae202653dcb00a.json @@ -25,17 +25,9 @@ "viaIR": true, "outputSelection": { "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata" - ], - "": [ - "ast" - ] + "*": ["abi", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "metadata"], + "": ["ast"] } } } -} \ No newline at end of file +} diff --git a/src/common/abi/AtomicDepositor.json b/src/common/abi/AtomicDepositor.json index 30892fef5..6f079af5a 100644 --- a/src/common/abi/AtomicDepositor.json +++ b/src/common/abi/AtomicDepositor.json @@ -1,199 +1,199 @@ [ - { - "inputs": [], - "name": "InvalidBridgeFunction", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "AtomicWethDepositInitiated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "stateMutability": "payable", - "type": "fallback" - }, - { - "inputs": [], - "name": "WETH", - "outputs": [ - { - "internalType": "contract Weth", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "netValue", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bridgeValue", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "bridgeCallData", - "type": "bytes" - } - ], - "name": "bridgeWeth", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "bridge", - "type": "address" - }, - { - "internalType": "bytes4", - "name": "funcSelector", - "type": "bytes4" - } - ], - "name": "whitelistBridge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "whitelistedBridgeFunctions", - "outputs": [ - { - "internalType": "address", - "name": "bridge", - "type": "address" - }, - { - "internalType": "bytes4", - "name": "funcSelector", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } + { + "inputs": [], + "name": "InvalidBridgeFunction", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "AtomicWethDepositInitiated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "WETH", + "outputs": [ + { + "internalType": "contract Weth", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "netValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bridgeValue", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "bridgeCallData", + "type": "bytes" + } + ], + "name": "bridgeWeth", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "bridge", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "funcSelector", + "type": "bytes4" + } + ], + "name": "whitelistBridge", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "whitelistedBridgeFunctions", + "outputs": [ + { + "internalType": "address", + "name": "bridge", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "funcSelector", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } ] diff --git a/test/AdapterManager.SendTokensCrossChain.ts b/test/AdapterManager.SendTokensCrossChain.ts index c37fd6952..f90bd6857 100644 --- a/test/AdapterManager.SendTokensCrossChain.ts +++ b/test/AdapterManager.SendTokensCrossChain.ts @@ -189,6 +189,7 @@ describe("AdapterManager: Send tokens cross-chain", async function () { expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( chainId, // chainId amountToSend, // amount + amountToSend, bridgeCalldata // depositETHTo ); }); @@ -233,6 +234,7 @@ describe("AdapterManager: Send tokens cross-chain", async function () { expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( chainId, amountToSend, // amount + amountToSend, bridgeCalldata ); }); @@ -334,7 +336,12 @@ describe("AdapterManager: Send tokens cross-chain", async function () { [], relayer.address, ]); - expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith(chainId, amountToSend.add(fee), bridgeCalldata); + expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( + chainId, + amountToSend.add(fee), + amountToSend, + bridgeCalldata + ); expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWithValue(toBN(0)); }); it("Correctly sends tokens to chain: Base", async function () { @@ -401,6 +408,7 @@ describe("AdapterManager: Send tokens cross-chain", async function () { expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( chainId, // chainId amountToSend, // amount + amountToSend, bridgeCalldata ); }); diff --git a/test/generic-adapters/AdapterManager.SendTokensCrossChain.ts b/test/generic-adapters/AdapterManager.SendTokensCrossChain.ts index 3227f2fb5..0f818c97d 100644 --- a/test/generic-adapters/AdapterManager.SendTokensCrossChain.ts +++ b/test/generic-adapters/AdapterManager.SendTokensCrossChain.ts @@ -182,6 +182,7 @@ describe("AdapterManager: Send tokens cross-chain", async function () { expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( chainId, // chainId amountToSend, // amount + amountToSend, bridgeCalldata ); }); @@ -226,6 +227,7 @@ describe("AdapterManager: Send tokens cross-chain", async function () { expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( chainId, amountToSend, // amount + amountToSend, bridgeCalldata ); }); @@ -333,7 +335,12 @@ describe("AdapterManager: Send tokens cross-chain", async function () { [], relayer.address, ]); - expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith(chainId, amountToSend.add(fee), bridgeCalldata); + expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( + chainId, + amountToSend.add(fee), + amountToSend, + bridgeCalldata + ); expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWithValue(toBN(0)); }); it("Correctly sends tokens to chain: Base", async function () { @@ -401,6 +408,7 @@ describe("AdapterManager: Send tokens cross-chain", async function () { expect(l1AtomicDepositor.bridgeWeth).to.have.been.calledWith( chainId, // chainId amountToSend, // amount + amountToSend, bridgeCalldata ); }); diff --git a/test/generic-adapters/zkSync.ts b/test/generic-adapters/zkSync.ts index aebe7ab72..b7709684e 100644 --- a/test/generic-adapters/zkSync.ts +++ b/test/generic-adapters/zkSync.ts @@ -155,7 +155,7 @@ describe("Cross Chain Adapter: zkSync", async function () { describe("WETH bridge", function () { it("Get L1 deposits: EOA", async function () { // await adapter.sendTokenToTargetChain(monitoredEoa, WETH.addresses[MAINNET], l2Weth.address, depositAmount, false); - await atomicDepositor.bridgeWeth(ZK_SYNC, depositAmount, "0x"); + await atomicDepositor.bridgeWeth(ZK_SYNC, depositAmount, depositAmount, "0x"); const result = await adapter.bridges[l1Weth].queryL1BridgeInitiationEvents( l1Weth, @@ -221,7 +221,7 @@ describe("Cross Chain Adapter: zkSync", async function () { }); // Make a single l1 -> l2 deposit. - await atomicDepositor.bridgeWeth(ZK_SYNC, depositAmount, "0x"); + await atomicDepositor.bridgeWeth(ZK_SYNC, depositAmount, depositAmount, "0x"); const deposits = await adapter.bridges[l1Weth].queryL1BridgeInitiationEvents( l1Weth, monitoredEoa,