From 5045eeeedc91007a877e9aeb9b9563b553b0158d Mon Sep 17 00:00:00 2001 From: Zodomo Date: Thu, 31 Oct 2024 11:05:21 -0500 Subject: [PATCH 1/3] add simple token and vault contracts --- contracts/core/.gas-snapshot | 14 ++++++------- contracts/core/test/silk/MockToken.sol | 12 ++++++++++++ contracts/core/test/silk/Vault.sol | 27 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 contracts/core/test/silk/MockToken.sol create mode 100644 contracts/core/test/silk/Vault.sol diff --git a/contracts/core/.gas-snapshot b/contracts/core/.gas-snapshot index 448b07604..384bc79dc 100644 --- a/contracts/core/.gas-snapshot +++ b/contracts/core/.gas-snapshot @@ -7,13 +7,13 @@ AllocPredeploys_Test:test_num_allocs() (gas: 1181152549) AllocPredeploys_Test:test_predeploys() (gas: 1181134337) AllocPredeploys_Test:test_preinstalls() (gas: 1181850775) AllocPredeploys_Test:test_proxies() (gas: 1408777576) -FeeOracleV1_Test:test_bulkSetFeeParams() (gas: 172862) -FeeOracleV1_Test:test_feeFor() (gas: 122551) -FeeOracleV1_Test:test_setBaseGasLimit() (gas: 32208) -FeeOracleV1_Test:test_setGasPrice() (gas: 40996) -FeeOracleV1_Test:test_setManager() (gas: 45845) -FeeOracleV1_Test:test_setProtocolFee() (gas: 31442) -FeeOracleV1_Test:test_setToNativeRate() (gas: 41049) +FeeOracleV1_Test:test_bulkSetFeeParams() (gas: 173154) +FeeOracleV1_Test:test_feeFor() (gas: 122830) +FeeOracleV1_Test:test_setBaseGasLimit() (gas: 32375) +FeeOracleV1_Test:test_setGasPrice() (gas: 41034) +FeeOracleV1_Test:test_setManager() (gas: 45904) +FeeOracleV1_Test:test_setProtocolFee() (gas: 31610) +FeeOracleV1_Test:test_setToNativeRate() (gas: 41132) FeeOracleV2_Test:test_bulkSetFeeParams() (gas: 119117) FeeOracleV2_Test:test_feeFor() (gas: 103301) FeeOracleV2_Test:test_setBaseGasLimit() (gas: 32009) diff --git a/contracts/core/test/silk/MockToken.sol b/contracts/core/test/silk/MockToken.sol new file mode 100644 index 000000000..69e3f4d03 --- /dev/null +++ b/contracts/core/test/silk/MockToken.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity =0.8.24; + +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract MockToken is ERC20 { + constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) { } + + function mint(address to, uint256 amount) external { + _mint(to, amount); + } +} diff --git a/contracts/core/test/silk/Vault.sol b/contracts/core/test/silk/Vault.sol new file mode 100644 index 000000000..3f5cea4e2 --- /dev/null +++ b/contracts/core/test/silk/Vault.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity =0.8.24; + +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + +contract Vault { + using SafeERC20 for IERC20; + + address public immutable collateral; + + mapping(address depositor => uint256 balance) public balances; + + constructor(address newCollateral) { + collateral = newCollateral; + } + + function deposit(address onBehalfOf, uint256 amount) external { + IERC20(collateral).safeTransferFrom(msg.sender, address(this), amount); + balances[onBehalfOf] += amount; + } + + function withdraw(address to, uint256 amount) external { + balances[msg.sender] -= amount; + IERC20(collateral).safeTransfer(to, amount); + } +} From 971dc87fcaca7d9de29f5ea8e852c80d84cad600 Mon Sep 17 00:00:00 2001 From: Zodomo Date: Thu, 31 Oct 2024 18:19:55 -0500 Subject: [PATCH 2/3] initial implementation of mock symbiotic deployer --- contracts/Makefile | 2 +- contracts/bindings/mocksymbioticvault.go | 307 +++++++ contracts/bindings/mocktoken.go | 781 ++++++++++++++++++ .../{Vault.sol => MockSymbioticVault.sol} | 2 +- e2e/app/mocksymbiotic.go | 172 ++++ e2e/app/run.go | 4 + 6 files changed, 1266 insertions(+), 2 deletions(-) create mode 100644 contracts/bindings/mocksymbioticvault.go create mode 100644 contracts/bindings/mocktoken.go rename contracts/core/test/silk/{Vault.sol => MockSymbioticVault.sol} (96%) create mode 100644 e2e/app/mocksymbiotic.go diff --git a/contracts/Makefile b/contracts/Makefile index 57477e95a..12c4d2ae3 100644 --- a/contracts/Makefile +++ b/contracts/Makefile @@ -34,7 +34,7 @@ all: install-deps build bindings allocs ## Build contracts, generate bindings an CORE_CONTRACTS := OmniPortal FeeOracleV1 Create3 TransparentUpgradeableProxy \ Staking Slashing OmniBridgeL1 OmniBridgeNative Omni WOmni \ PortalRegistry AllocPredeploys PingPong ProxyAdmin Admin \ - OmniGasPump OmniGasStation + OmniGasPump OmniGasStation MockSymbioticVault MockToken AVS_CONTRACTS := OmniAVS DelegationManager StrategyManager StrategyBase AVSDirectory \ avs/test/common/MockERC20.sol:MockERC20 diff --git a/contracts/bindings/mocksymbioticvault.go b/contracts/bindings/mocksymbioticvault.go new file mode 100644 index 000000000..6c9a1ccc0 --- /dev/null +++ b/contracts/bindings/mocksymbioticvault.go @@ -0,0 +1,307 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// MockSymbioticVaultMetaData contains all meta data concerning the MockSymbioticVault contract. +var MockSymbioticVaultMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"newCollateral\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balances\",\"inputs\":[{\"name\":\"depositor\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"collateral\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[{\"name\":\"onBehalfOf\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"error\",\"name\":\"AddressEmptyCode\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AddressInsufficientBalance\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"FailedInnerCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SafeERC20FailedOperation\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}]}]", + Bin: "0x60a060405234801561001057600080fd5b506040516105af3803806105af83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161051861009760003960008181609e0152818160f8015261018301526105186000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806327e235e31461005157806347e7ef2414610084578063d8dfeb4514610099578063f3fef3a3146100d8575b600080fd5b61007161005f366004610410565b60006020819052908152604090205481565b6040519081526020015b60405180910390f35b61009761009236600461042b565b6100eb565b005b6100c07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161007b565b6100976100e636600461042b565b610151565b6101206001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330846101ae565b6001600160a01b0382166000908152602081905260408120805483929061014890849061046b565b90915550505050565b336000908152602081905260408120805483929061017090849061047e565b909155506101aa90506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016838361021b565b5050565b6040516001600160a01b0384811660248301528381166044830152606482018390526102159186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610251565b50505050565b6040516001600160a01b0383811660248301526044820183905261024c91859182169063a9059cbb906064016101e3565b505050565b60006102666001600160a01b038416836102b9565b9050805160001415801561028b5750808060200190518101906102899190610491565b155b1561024c57604051635274afe760e01b81526001600160a01b03841660048201526024015b60405180910390fd5b60606102c7838360006102d0565b90505b92915050565b6060814710156102f55760405163cd78605960e01b81523060048201526024016102b0565b600080856001600160a01b0316848660405161031191906104b3565b60006040518083038185875af1925050503d806000811461034e576040519150601f19603f3d011682016040523d82523d6000602084013e610353565b606091505b509150915061036386838361036f565b925050505b9392505050565b6060826103845761037f826103cb565b610368565b815115801561039b57506001600160a01b0384163b155b156103c457604051639996b31560e01b81526001600160a01b03851660048201526024016102b0565b5080610368565b8051156103db5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b038116811461040b57600080fd5b919050565b60006020828403121561042257600080fd5b6102c7826103f4565b6000806040838503121561043e57600080fd5b610447836103f4565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156102ca576102ca610455565b818103818111156102ca576102ca610455565b6000602082840312156104a357600080fd5b8151801515811461036857600080fd5b6000825160005b818110156104d457602081860181015185830152016104ba565b50600092019182525091905056fea2646970667358221220cf906c76df6feca017ffa507594c347ed9e47e71be5d82cff000c6c553a2c87c64736f6c63430008180033", +} + +// MockSymbioticVaultABI is the input ABI used to generate the binding from. +// Deprecated: Use MockSymbioticVaultMetaData.ABI instead. +var MockSymbioticVaultABI = MockSymbioticVaultMetaData.ABI + +// MockSymbioticVaultBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use MockSymbioticVaultMetaData.Bin instead. +var MockSymbioticVaultBin = MockSymbioticVaultMetaData.Bin + +// DeployMockSymbioticVault deploys a new Ethereum contract, binding an instance of MockSymbioticVault to it. +func DeployMockSymbioticVault(auth *bind.TransactOpts, backend bind.ContractBackend, newCollateral common.Address) (common.Address, *types.Transaction, *MockSymbioticVault, error) { + parsed, err := MockSymbioticVaultMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(MockSymbioticVaultBin), backend, newCollateral) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &MockSymbioticVault{MockSymbioticVaultCaller: MockSymbioticVaultCaller{contract: contract}, MockSymbioticVaultTransactor: MockSymbioticVaultTransactor{contract: contract}, MockSymbioticVaultFilterer: MockSymbioticVaultFilterer{contract: contract}}, nil +} + +// MockSymbioticVault is an auto generated Go binding around an Ethereum contract. +type MockSymbioticVault struct { + MockSymbioticVaultCaller // Read-only binding to the contract + MockSymbioticVaultTransactor // Write-only binding to the contract + MockSymbioticVaultFilterer // Log filterer for contract events +} + +// MockSymbioticVaultCaller is an auto generated read-only Go binding around an Ethereum contract. +type MockSymbioticVaultCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockSymbioticVaultTransactor is an auto generated write-only Go binding around an Ethereum contract. +type MockSymbioticVaultTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockSymbioticVaultFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type MockSymbioticVaultFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockSymbioticVaultSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type MockSymbioticVaultSession struct { + Contract *MockSymbioticVault // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockSymbioticVaultCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type MockSymbioticVaultCallerSession struct { + Contract *MockSymbioticVaultCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// MockSymbioticVaultTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type MockSymbioticVaultTransactorSession struct { + Contract *MockSymbioticVaultTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockSymbioticVaultRaw is an auto generated low-level Go binding around an Ethereum contract. +type MockSymbioticVaultRaw struct { + Contract *MockSymbioticVault // Generic contract binding to access the raw methods on +} + +// MockSymbioticVaultCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type MockSymbioticVaultCallerRaw struct { + Contract *MockSymbioticVaultCaller // Generic read-only contract binding to access the raw methods on +} + +// MockSymbioticVaultTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type MockSymbioticVaultTransactorRaw struct { + Contract *MockSymbioticVaultTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewMockSymbioticVault creates a new instance of MockSymbioticVault, bound to a specific deployed contract. +func NewMockSymbioticVault(address common.Address, backend bind.ContractBackend) (*MockSymbioticVault, error) { + contract, err := bindMockSymbioticVault(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &MockSymbioticVault{MockSymbioticVaultCaller: MockSymbioticVaultCaller{contract: contract}, MockSymbioticVaultTransactor: MockSymbioticVaultTransactor{contract: contract}, MockSymbioticVaultFilterer: MockSymbioticVaultFilterer{contract: contract}}, nil +} + +// NewMockSymbioticVaultCaller creates a new read-only instance of MockSymbioticVault, bound to a specific deployed contract. +func NewMockSymbioticVaultCaller(address common.Address, caller bind.ContractCaller) (*MockSymbioticVaultCaller, error) { + contract, err := bindMockSymbioticVault(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &MockSymbioticVaultCaller{contract: contract}, nil +} + +// NewMockSymbioticVaultTransactor creates a new write-only instance of MockSymbioticVault, bound to a specific deployed contract. +func NewMockSymbioticVaultTransactor(address common.Address, transactor bind.ContractTransactor) (*MockSymbioticVaultTransactor, error) { + contract, err := bindMockSymbioticVault(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &MockSymbioticVaultTransactor{contract: contract}, nil +} + +// NewMockSymbioticVaultFilterer creates a new log filterer instance of MockSymbioticVault, bound to a specific deployed contract. +func NewMockSymbioticVaultFilterer(address common.Address, filterer bind.ContractFilterer) (*MockSymbioticVaultFilterer, error) { + contract, err := bindMockSymbioticVault(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &MockSymbioticVaultFilterer{contract: contract}, nil +} + +// bindMockSymbioticVault binds a generic wrapper to an already deployed contract. +func bindMockSymbioticVault(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := MockSymbioticVaultMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_MockSymbioticVault *MockSymbioticVaultRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _MockSymbioticVault.Contract.MockSymbioticVaultCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_MockSymbioticVault *MockSymbioticVaultRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.MockSymbioticVaultTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_MockSymbioticVault *MockSymbioticVaultRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.MockSymbioticVaultTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_MockSymbioticVault *MockSymbioticVaultCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _MockSymbioticVault.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_MockSymbioticVault *MockSymbioticVaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_MockSymbioticVault *MockSymbioticVaultTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.contract.Transact(opts, method, params...) +} + +// Balances is a free data retrieval call binding the contract method 0x27e235e3. +// +// Solidity: function balances(address depositor) view returns(uint256 balance) +func (_MockSymbioticVault *MockSymbioticVaultCaller) Balances(opts *bind.CallOpts, depositor common.Address) (*big.Int, error) { + var out []interface{} + err := _MockSymbioticVault.contract.Call(opts, &out, "balances", depositor) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Balances is a free data retrieval call binding the contract method 0x27e235e3. +// +// Solidity: function balances(address depositor) view returns(uint256 balance) +func (_MockSymbioticVault *MockSymbioticVaultSession) Balances(depositor common.Address) (*big.Int, error) { + return _MockSymbioticVault.Contract.Balances(&_MockSymbioticVault.CallOpts, depositor) +} + +// Balances is a free data retrieval call binding the contract method 0x27e235e3. +// +// Solidity: function balances(address depositor) view returns(uint256 balance) +func (_MockSymbioticVault *MockSymbioticVaultCallerSession) Balances(depositor common.Address) (*big.Int, error) { + return _MockSymbioticVault.Contract.Balances(&_MockSymbioticVault.CallOpts, depositor) +} + +// Collateral is a free data retrieval call binding the contract method 0xd8dfeb45. +// +// Solidity: function collateral() view returns(address) +func (_MockSymbioticVault *MockSymbioticVaultCaller) Collateral(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _MockSymbioticVault.contract.Call(opts, &out, "collateral") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Collateral is a free data retrieval call binding the contract method 0xd8dfeb45. +// +// Solidity: function collateral() view returns(address) +func (_MockSymbioticVault *MockSymbioticVaultSession) Collateral() (common.Address, error) { + return _MockSymbioticVault.Contract.Collateral(&_MockSymbioticVault.CallOpts) +} + +// Collateral is a free data retrieval call binding the contract method 0xd8dfeb45. +// +// Solidity: function collateral() view returns(address) +func (_MockSymbioticVault *MockSymbioticVaultCallerSession) Collateral() (common.Address, error) { + return _MockSymbioticVault.Contract.Collateral(&_MockSymbioticVault.CallOpts) +} + +// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24. +// +// Solidity: function deposit(address onBehalfOf, uint256 amount) returns() +func (_MockSymbioticVault *MockSymbioticVaultTransactor) Deposit(opts *bind.TransactOpts, onBehalfOf common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockSymbioticVault.contract.Transact(opts, "deposit", onBehalfOf, amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24. +// +// Solidity: function deposit(address onBehalfOf, uint256 amount) returns() +func (_MockSymbioticVault *MockSymbioticVaultSession) Deposit(onBehalfOf common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.Deposit(&_MockSymbioticVault.TransactOpts, onBehalfOf, amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24. +// +// Solidity: function deposit(address onBehalfOf, uint256 amount) returns() +func (_MockSymbioticVault *MockSymbioticVaultTransactorSession) Deposit(onBehalfOf common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.Deposit(&_MockSymbioticVault.TransactOpts, onBehalfOf, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. +// +// Solidity: function withdraw(address to, uint256 amount) returns() +func (_MockSymbioticVault *MockSymbioticVaultTransactor) Withdraw(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockSymbioticVault.contract.Transact(opts, "withdraw", to, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. +// +// Solidity: function withdraw(address to, uint256 amount) returns() +func (_MockSymbioticVault *MockSymbioticVaultSession) Withdraw(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.Withdraw(&_MockSymbioticVault.TransactOpts, to, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. +// +// Solidity: function withdraw(address to, uint256 amount) returns() +func (_MockSymbioticVault *MockSymbioticVaultTransactorSession) Withdraw(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockSymbioticVault.Contract.Withdraw(&_MockSymbioticVault.TransactOpts, to, amount) +} diff --git a/contracts/bindings/mocktoken.go b/contracts/bindings/mocktoken.go new file mode 100644 index 000000000..ef8d533a2 --- /dev/null +++ b/contracts/bindings/mocktoken.go @@ -0,0 +1,781 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// MockTokenMetaData contains all meta data concerning the MockToken contract. +var MockTokenMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"name_\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"symbol_\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"mint\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ERC20InsufficientAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"allowance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC20InsufficientBalance\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidApprover\",\"inputs\":[{\"name\":\"approver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidReceiver\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidSpender\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}]}]", + Bin: "0x60806040523480156200001157600080fd5b5060405162000a8238038062000a82833981016040819052620000349162000126565b8181600362000044838262000221565b50600462000053828262000221565b5050505050620002ed565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200008657600080fd5b81516001600160401b0380821115620000a357620000a36200005e565b604051601f8301601f19908116603f01168101908282118183101715620000ce57620000ce6200005e565b8160405283815260209250866020858801011115620000ec57600080fd5b600091505b83821015620001105785820183015181830184015290820190620000f1565b6000602085830101528094505050505092915050565b600080604083850312156200013a57600080fd5b82516001600160401b03808211156200015257600080fd5b620001608683870162000074565b935060208501519150808211156200017757600080fd5b50620001868582860162000074565b9150509250929050565b600181811c90821680620001a557607f821691505b602082108103620001c657634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200021c576000816000526020600020601f850160051c81016020861015620001f75750805b601f850160051c820191505b81811015620002185782815560010162000203565b5050505b505050565b81516001600160401b038111156200023d576200023d6200005e565b62000255816200024e845462000190565b84620001cc565b602080601f8311600181146200028d5760008415620002745750858301515b600019600386901b1c1916600185901b17855562000218565b600085815260208120601f198616915b82811015620002be578886015182559484019460019091019084016200029d565b5085821015620002dd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61078580620002fd6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c806340c10f191161006657806340c10f191461011857806370a082311461012d57806395d89b4114610156578063a9059cbb1461015e578063dd62ed3e1461017157600080fd5b806306fdde03146100a3578063095ea7b3146100c157806318160ddd146100e457806323b872dd146100f6578063313ce56714610109575b600080fd5b6100ab6101aa565b6040516100b891906105ce565b60405180910390f35b6100d46100cf366004610639565b61023c565b60405190151581526020016100b8565b6002545b6040519081526020016100b8565b6100d4610104366004610663565b610256565b604051601281526020016100b8565b61012b610126366004610639565b61027a565b005b6100e861013b36600461069f565b6001600160a01b031660009081526020819052604090205490565b6100ab610288565b6100d461016c366004610639565b610297565b6100e861017f3660046106c1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101b9906106f4565b80601f01602080910402602001604051908101604052809291908181526020018280546101e5906106f4565b80156102325780601f1061020757610100808354040283529160200191610232565b820191906000526020600020905b81548152906001019060200180831161021557829003601f168201915b5050505050905090565b60003361024a8185856102a5565b60019150505b92915050565b6000336102648582856102b7565b61026f85858561033a565b506001949350505050565b6102848282610399565b5050565b6060600480546101b9906106f4565b60003361024a81858561033a565b6102b283838360016103cf565b505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610334578181101561032557604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b610334848484840360006103cf565b50505050565b6001600160a01b03831661036457604051634b637e8f60e11b81526000600482015260240161031c565b6001600160a01b03821661038e5760405163ec442f0560e01b81526000600482015260240161031c565b6102b28383836104a4565b6001600160a01b0382166103c35760405163ec442f0560e01b81526000600482015260240161031c565b610284600083836104a4565b6001600160a01b0384166103f95760405163e602df0560e01b81526000600482015260240161031c565b6001600160a01b03831661042357604051634a1406b160e11b81526000600482015260240161031c565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561033457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161049691815260200190565b60405180910390a350505050565b6001600160a01b0383166104cf5780600260008282546104c4919061072e565b909155506105419050565b6001600160a01b038316600090815260208190526040902054818110156105225760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161031c565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661055d5760028054829003905561057c565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516105c191815260200190565b60405180910390a3505050565b60006020808352835180602085015260005b818110156105fc578581018301518582016040015282016105e0565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461063457600080fd5b919050565b6000806040838503121561064c57600080fd5b6106558361061d565b946020939093013593505050565b60008060006060848603121561067857600080fd5b6106818461061d565b925061068f6020850161061d565b9150604084013590509250925092565b6000602082840312156106b157600080fd5b6106ba8261061d565b9392505050565b600080604083850312156106d457600080fd5b6106dd8361061d565b91506106eb6020840161061d565b90509250929050565b600181811c9082168061070857607f821691505b60208210810361072857634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561025057634e487b7160e01b600052601160045260246000fdfea2646970667358221220d74819f6c7fe0e2933359a2e688fc61ebf19e3f958ff867d0c570290475dd6a764736f6c63430008180033", +} + +// MockTokenABI is the input ABI used to generate the binding from. +// Deprecated: Use MockTokenMetaData.ABI instead. +var MockTokenABI = MockTokenMetaData.ABI + +// MockTokenBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use MockTokenMetaData.Bin instead. +var MockTokenBin = MockTokenMetaData.Bin + +// DeployMockToken deploys a new Ethereum contract, binding an instance of MockToken to it. +func DeployMockToken(auth *bind.TransactOpts, backend bind.ContractBackend, name_ string, symbol_ string) (common.Address, *types.Transaction, *MockToken, error) { + parsed, err := MockTokenMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(MockTokenBin), backend, name_, symbol_) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &MockToken{MockTokenCaller: MockTokenCaller{contract: contract}, MockTokenTransactor: MockTokenTransactor{contract: contract}, MockTokenFilterer: MockTokenFilterer{contract: contract}}, nil +} + +// MockToken is an auto generated Go binding around an Ethereum contract. +type MockToken struct { + MockTokenCaller // Read-only binding to the contract + MockTokenTransactor // Write-only binding to the contract + MockTokenFilterer // Log filterer for contract events +} + +// MockTokenCaller is an auto generated read-only Go binding around an Ethereum contract. +type MockTokenCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockTokenTransactor is an auto generated write-only Go binding around an Ethereum contract. +type MockTokenTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockTokenFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type MockTokenFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// MockTokenSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type MockTokenSession struct { + Contract *MockToken // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockTokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type MockTokenCallerSession struct { + Contract *MockTokenCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// MockTokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type MockTokenTransactorSession struct { + Contract *MockTokenTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// MockTokenRaw is an auto generated low-level Go binding around an Ethereum contract. +type MockTokenRaw struct { + Contract *MockToken // Generic contract binding to access the raw methods on +} + +// MockTokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type MockTokenCallerRaw struct { + Contract *MockTokenCaller // Generic read-only contract binding to access the raw methods on +} + +// MockTokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type MockTokenTransactorRaw struct { + Contract *MockTokenTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewMockToken creates a new instance of MockToken, bound to a specific deployed contract. +func NewMockToken(address common.Address, backend bind.ContractBackend) (*MockToken, error) { + contract, err := bindMockToken(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &MockToken{MockTokenCaller: MockTokenCaller{contract: contract}, MockTokenTransactor: MockTokenTransactor{contract: contract}, MockTokenFilterer: MockTokenFilterer{contract: contract}}, nil +} + +// NewMockTokenCaller creates a new read-only instance of MockToken, bound to a specific deployed contract. +func NewMockTokenCaller(address common.Address, caller bind.ContractCaller) (*MockTokenCaller, error) { + contract, err := bindMockToken(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &MockTokenCaller{contract: contract}, nil +} + +// NewMockTokenTransactor creates a new write-only instance of MockToken, bound to a specific deployed contract. +func NewMockTokenTransactor(address common.Address, transactor bind.ContractTransactor) (*MockTokenTransactor, error) { + contract, err := bindMockToken(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &MockTokenTransactor{contract: contract}, nil +} + +// NewMockTokenFilterer creates a new log filterer instance of MockToken, bound to a specific deployed contract. +func NewMockTokenFilterer(address common.Address, filterer bind.ContractFilterer) (*MockTokenFilterer, error) { + contract, err := bindMockToken(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &MockTokenFilterer{contract: contract}, nil +} + +// bindMockToken binds a generic wrapper to an already deployed contract. +func bindMockToken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := MockTokenMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_MockToken *MockTokenRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _MockToken.Contract.MockTokenCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_MockToken *MockTokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _MockToken.Contract.MockTokenTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_MockToken *MockTokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _MockToken.Contract.MockTokenTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_MockToken *MockTokenCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _MockToken.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_MockToken *MockTokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _MockToken.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_MockToken *MockTokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _MockToken.Contract.contract.Transact(opts, method, params...) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_MockToken *MockTokenCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { + var out []interface{} + err := _MockToken.contract.Call(opts, &out, "allowance", owner, spender) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_MockToken *MockTokenSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _MockToken.Contract.Allowance(&_MockToken.CallOpts, owner, spender) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_MockToken *MockTokenCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _MockToken.Contract.Allowance(&_MockToken.CallOpts, owner, spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_MockToken *MockTokenCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _MockToken.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_MockToken *MockTokenSession) BalanceOf(account common.Address) (*big.Int, error) { + return _MockToken.Contract.BalanceOf(&_MockToken.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_MockToken *MockTokenCallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _MockToken.Contract.BalanceOf(&_MockToken.CallOpts, account) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_MockToken *MockTokenCaller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _MockToken.contract.Call(opts, &out, "decimals") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_MockToken *MockTokenSession) Decimals() (uint8, error) { + return _MockToken.Contract.Decimals(&_MockToken.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_MockToken *MockTokenCallerSession) Decimals() (uint8, error) { + return _MockToken.Contract.Decimals(&_MockToken.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_MockToken *MockTokenCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _MockToken.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_MockToken *MockTokenSession) Name() (string, error) { + return _MockToken.Contract.Name(&_MockToken.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_MockToken *MockTokenCallerSession) Name() (string, error) { + return _MockToken.Contract.Name(&_MockToken.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_MockToken *MockTokenCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _MockToken.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_MockToken *MockTokenSession) Symbol() (string, error) { + return _MockToken.Contract.Symbol(&_MockToken.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_MockToken *MockTokenCallerSession) Symbol() (string, error) { + return _MockToken.Contract.Symbol(&_MockToken.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_MockToken *MockTokenCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _MockToken.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_MockToken *MockTokenSession) TotalSupply() (*big.Int, error) { + return _MockToken.Contract.TotalSupply(&_MockToken.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_MockToken *MockTokenCallerSession) TotalSupply() (*big.Int, error) { + return _MockToken.Contract.TotalSupply(&_MockToken.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_MockToken *MockTokenTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.contract.Transact(opts, "approve", spender, value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_MockToken *MockTokenSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.Approve(&_MockToken.TransactOpts, spender, value) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 value) returns(bool) +func (_MockToken *MockTokenTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.Approve(&_MockToken.TransactOpts, spender, value) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address to, uint256 amount) returns() +func (_MockToken *MockTokenTransactor) Mint(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockToken.contract.Transact(opts, "mint", to, amount) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address to, uint256 amount) returns() +func (_MockToken *MockTokenSession) Mint(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.Mint(&_MockToken.TransactOpts, to, amount) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address to, uint256 amount) returns() +func (_MockToken *MockTokenTransactorSession) Mint(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.Mint(&_MockToken.TransactOpts, to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 value) returns(bool) +func (_MockToken *MockTokenTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.contract.Transact(opts, "transfer", to, value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 value) returns(bool) +func (_MockToken *MockTokenSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.Transfer(&_MockToken.TransactOpts, to, value) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 value) returns(bool) +func (_MockToken *MockTokenTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.Transfer(&_MockToken.TransactOpts, to, value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) +func (_MockToken *MockTokenTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.contract.Transact(opts, "transferFrom", from, to, value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) +func (_MockToken *MockTokenSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.TransferFrom(&_MockToken.TransactOpts, from, to, value) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) +func (_MockToken *MockTokenTransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _MockToken.Contract.TransferFrom(&_MockToken.TransactOpts, from, to, value) +} + +// MockTokenApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the MockToken contract. +type MockTokenApprovalIterator struct { + Event *MockTokenApproval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockTokenApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockTokenApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockTokenApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockTokenApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockTokenApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockTokenApproval represents a Approval event raised by the MockToken contract. +type MockTokenApproval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_MockToken *MockTokenFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*MockTokenApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _MockToken.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &MockTokenApprovalIterator{contract: _MockToken.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_MockToken *MockTokenFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *MockTokenApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _MockToken.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockTokenApproval) + if err := _MockToken.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_MockToken *MockTokenFilterer) ParseApproval(log types.Log) (*MockTokenApproval, error) { + event := new(MockTokenApproval) + if err := _MockToken.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// MockTokenTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the MockToken contract. +type MockTokenTransferIterator struct { + Event *MockTokenTransfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *MockTokenTransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(MockTokenTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(MockTokenTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *MockTokenTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *MockTokenTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// MockTokenTransfer represents a Transfer event raised by the MockToken contract. +type MockTokenTransfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_MockToken *MockTokenFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*MockTokenTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _MockToken.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &MockTokenTransferIterator{contract: _MockToken.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_MockToken *MockTokenFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *MockTokenTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _MockToken.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(MockTokenTransfer) + if err := _MockToken.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_MockToken *MockTokenFilterer) ParseTransfer(log types.Log) (*MockTokenTransfer, error) { + event := new(MockTokenTransfer) + if err := _MockToken.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/contracts/core/test/silk/Vault.sol b/contracts/core/test/silk/MockSymbioticVault.sol similarity index 96% rename from contracts/core/test/silk/Vault.sol rename to contracts/core/test/silk/MockSymbioticVault.sol index 3f5cea4e2..6e77b53b6 100644 --- a/contracts/core/test/silk/Vault.sol +++ b/contracts/core/test/silk/MockSymbioticVault.sol @@ -4,7 +4,7 @@ pragma solidity =0.8.24; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -contract Vault { +contract MockSymbioticVault { using SafeERC20 for IERC20; address public immutable collateral; diff --git a/e2e/app/mocksymbiotic.go b/e2e/app/mocksymbiotic.go new file mode 100644 index 000000000..0ac40df1a --- /dev/null +++ b/e2e/app/mocksymbiotic.go @@ -0,0 +1,172 @@ +package app + +import ( + "context" + + "github.com/omni-network/omni/contracts/bindings" + "github.com/omni-network/omni/e2e/app/eoa" + "github.com/omni-network/omni/lib/errors" + "github.com/omni-network/omni/lib/log" + + "github.com/ethereum/go-ethereum/common" +) + +type TokenDeployment struct { + WstETH common.Address + RETH common.Address + METH common.Address +} + +type SymbioticVaultDeployment struct { + WstETHVault common.Address + RETHVault common.Address + METHVault common.Address +} + +func DeployMockSymbiotic(ctx context.Context, def Definition) (map[uint64]TokenDeployment, map[uint64]SymbioticVaultDeployment, error) { + deployedTokens, err := deployTokens(ctx, def) + if err != nil { + return nil, nil, errors.Wrap(err, "deploy tokens") + } + + deployedVaults, err := deploySymbioticVaults(ctx, def, deployedTokens) + if err != nil { + return nil, nil, errors.Wrap(err, "deploy symbiotic vaults") + } + + return deployedTokens, deployedVaults, nil +} + +// deployTokens deploys OmniGasPump contracts to all chains except Omni's EVM. +func deployTokens(ctx context.Context, def Definition) (map[uint64]TokenDeployment, error) { + tokens := []struct { + name string + symbol string + }{ + {"Wrapped Staked ETH", "wstETH"}, + {"Rocket Pool ETH", "rETH"}, + {"Mantle ETH", "mETH"}, + } + + // Track deployed token addresses per chain + deployments := make(map[uint64]TokenDeployment) + + for _, chain := range def.Testnet.EVMChains() { + backend, err := def.Backends().Backend(chain.ChainID) + if err != nil { + return nil, errors.Wrap(err, "backend", "chain", chain.Name) + } + + deployer := eoa.MustAddress(def.Testnet.Network, eoa.RoleDeployer) + auth, err := backend.BindOpts(ctx, deployer) + if err != nil { + return nil, errors.Wrap(err, "failed to get TransactionOpts for bindings") + } + + var deployment TokenDeployment + // Deploy each token + for i, token := range tokens { + addr, _ /* tx */, mockToken, err := bindings.DeployMockToken(auth, backend, token.name, token.symbol) + // receipt, _ := backend.WaitMined(ctx, tx) + if err != nil { + return nil, errors.Wrap( + err, + "failed to deploy mock token", + "chain", chain.Name, + "token", token.symbol, + ) + } + + // Store address in deployment struct + switch i { + case 0: + deployment.WstETH = addr + case 1: + deployment.RETH = addr + case 2: + deployment.METH = addr + } + + log.Info(ctx, "Token deployed", + "token", mockToken.Name, + "symbol", token.symbol, + "chain", chain.Name, + "address", addr.Hex(), + // "txid", receipt.TxHash.Hex() + ) + } + + deployments[chain.ChainID] = deployment + } + + return deployments, nil +} + +func deploySymbioticVaults(ctx context.Context, def Definition, deployedTokens map[uint64]TokenDeployment) (map[uint64]SymbioticVaultDeployment, error) { + vaults := []string{ + "wstETH Vault", + "rETH Vault", + "mETH Vault", + } + + // Track deployed vault addresses per chain + deployments := make(map[uint64]SymbioticVaultDeployment) + + for _, chain := range def.Testnet.EVMChains() { + tokens := deployedTokens[chain.ChainID] + + backend, err := def.Backends().Backend(chain.ChainID) + if err != nil { + return nil, errors.Wrap(err, "backend", "chain", chain.Name) + } + + deployer := eoa.MustAddress(def.Testnet.Network, eoa.RoleDeployer) + auth, err := backend.BindOpts(ctx, deployer) + if err != nil { + return nil, errors.Wrap(err, "failed to get TransactionOpts for bindings") + } + + var deployment SymbioticVaultDeployment + // Deploy each vault + for i, vault := range vaults { + var tokenAddr common.Address + switch i { + case 0: + tokenAddr = tokens.WstETH + case 1: + tokenAddr = tokens.RETH + case 2: + tokenAddr = tokens.METH + } + + addr, _ /* transactionType */, _ /* mockVault */, err := bindings.DeployMockSymbioticVault(auth, backend, tokenAddr) + if err != nil { + return nil, errors.Wrap( + err, + "failed to deploy mock symbiotic vault", + "chain", chain.Name, + "vault", vault, + ) + } + + // Store address in deployment struct + switch i { + case 0: + deployment.WstETHVault = addr + case 1: + deployment.RETHVault = addr + case 2: + deployment.METHVault = addr + } + + log.Info(ctx, "Symbiotic vault deployed", + "vault", vault, + "chain", chain.Name, + "address", addr.Hex()) + } + + deployments[chain.ChainID] = deployment + } + + return deployments, nil +} diff --git a/e2e/app/run.go b/e2e/app/run.go index 908932cba..f60f130b5 100644 --- a/e2e/app/run.go +++ b/e2e/app/run.go @@ -107,6 +107,10 @@ func Deploy(ctx context.Context, def Definition, cfg DeployConfig) (*pingpong.XD if err := DeployGasApp(ctx, def); err != nil { return nil, err } + + if _ /* tokenDeployments */, _ /* vaultDeployments */, err := DeployMockSymbiotic(ctx, def); err != nil { + return nil, err + } } if err := setupTokenBridge(ctx, def); err != nil { From c00e5af7d5f01a314633cea73d0030437b507764 Mon Sep 17 00:00:00 2001 From: Zodomo Date: Fri, 1 Nov 2024 09:26:21 -0500 Subject: [PATCH 3/3] remove comment artifact --- e2e/app/mocksymbiotic.go | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/app/mocksymbiotic.go b/e2e/app/mocksymbiotic.go index 0ac40df1a..58f315378 100644 --- a/e2e/app/mocksymbiotic.go +++ b/e2e/app/mocksymbiotic.go @@ -37,7 +37,6 @@ func DeployMockSymbiotic(ctx context.Context, def Definition) (map[uint64]TokenD return deployedTokens, deployedVaults, nil } -// deployTokens deploys OmniGasPump contracts to all chains except Omni's EVM. func deployTokens(ctx context.Context, def Definition) (map[uint64]TokenDeployment, error) { tokens := []struct { name string