diff --git a/bindings/bindings/validatorrewardvault.go b/bindings/bindings/validatorrewardvault.go index 59a3c06110..c33fb0dc70 100644 --- a/bindings/bindings/validatorrewardvault.go +++ b/bindings/bindings/validatorrewardvault.go @@ -31,8 +31,8 @@ var ( // ValidatorRewardVaultMetaData contains all meta data concerning the ValidatorRewardVault contract. var ValidatorRewardVaultMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorPool\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rewardDivider\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"l2BlockNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Rewarded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_WITHDRAWAL_AMOUNT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RECIPIENT\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REWARD_DIVIDER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATOR_POOL\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_l2BlockNumber\",\"type\":\"uint256\"}],\"name\":\"reward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalProcessed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalReserved\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x61016060405234801561001157600080fd5b50604051610db0380380610db083398101604081905261003091610063565b6000608081905260a0819052600160c05260e0819052610100526001600160a01b0391909116610120526101405261009d565b6000806040838503121561007657600080fd5b82516001600160a01b038116811461008d57600080fd5b6020939093015192949293505050565b60805160a05160c05160e051610100516101205161014051610ca561010b6000396000818161018a015261085701526000818161022501526102a801526000610809015260006107e0015260006107b70152600060d301526000818161026f01526105e20152610ca56000f3fe6080604052600436106100b55760003560e01c806370a0823111610069578063b98debbf1161004e578063b98debbf14610213578063c71b0e1c14610247578063d3e5792b1461025d57600080fd5b806370a08231146101ba57806384411d65146101fd57600080fd5b80633ccfd60b1161009a5780633ccfd60b1461014157806354fd4d501461015657806362aba76b1461017857600080fd5b80630d9019e1146100c157806321670f221461011f57600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506100f57f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012b57600080fd5b5061013f61013a366004610a5d565b610291565b005b34801561014d57600080fd5b5061013f6105d0565b34801561016257600080fd5b5061016b6107b0565b6040516101169190610b01565b34801561018457600080fd5b506101ac7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610116565b3480156101c657600080fd5b506101ac6101d5366004610b1b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b34801561020957600080fd5b506101ac60005481565b34801561021f57600080fd5b506100f57f000000000000000000000000000000000000000000000000000000000000000081565b34801561025357600080fd5b506101ac60035481565b34801561026957600080fd5b506101ac7f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff16146103b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604860248201527f56616c696461746f725265776172645661756c743a2066756e6374696f6e206360448201527f616e206f6e6c792062652063616c6c65642066726f6d207468652056616c696460648201527f61746f72506f6f6c000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821661045c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f56616c696461746f725265776172645661756c743a2076616c696461746f722060448201527f616464726573732063616e6e6f7420626520300000000000000000000000000060648201526084016103b0565b60008181526002602052604090205460ff1615610521576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604e60248201527f56616c696461746f725265776172645661756c743a207468652072657761726460448201527f2068617320616c7265616479206265656e207061696420666f7220746865204c60648201527f3220626c6f636b206e756d626572000000000000000000000000000000000000608482015260a4016103b0565b600061052b610853565b600380548201905573ffffffffffffffffffffffffffffffffffffffff84166000818152600160208181526040808420805487019055878452600282529283902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155905183815292935084927f291e8ba3c0f4b0bd86e6e2346fcee1e7ca0975b1cc1886bfbc722d34f3f24d91910160405180910390a3505050565b336000908152600160205260409020547f00000000000000000000000000000000000000000000000000000000000000008110156106b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605660248201527f56616c696461746f725265776172645661756c743a207769746864726177616c60448201527f20616d6f756e74206d7573742062652067726561746572207468616e206d696e60648201527f696d756d207769746864726177616c20616d6f756e7400000000000000000000608482015260a4016103b0565b33600081815260016020908152604080832083905560038054869003905582548501909255815184815290810183905280820192909252517fc8a211cc64b6ed1b50595a9fcb1932b6d1e5a6e8ef15b60e5b1f988ea9086bba9181900360600190a1604080516020810182526000815290517fe11013dd0000000000000000000000000000000000000000000000000000000081527342000000000000000000000000000000000000099163e11013dd91849161077b9133916188b891600401610b36565b6000604051808303818588803b15801561079457600080fd5b505af11580156107a8573d6000803e3d6000fd5b505050505050565b60606107db7f0000000000000000000000000000000000000000000000000000000000000000610893565b6108047f0000000000000000000000000000000000000000000000000000000000000000610893565b61082d7f0000000000000000000000000000000000000000000000000000000000000000610893565b60405160200161083f93929190610b7a565b604051602081830303815290604052905090565b60007f0000000000000000000000000000000000000000000000000000000000000000600354476108849190610bf0565b61088e9190610c2e565b905090565b606060006108a083610951565b600101905060008167ffffffffffffffff8111156108c0576108c0610c69565b6040519080825280601f01601f1916602001820160405280156108ea576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846108f457509392505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061099a577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef810000000083106109c6576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106109e457662386f26fc10000830492506010015b6305f5e10083106109fc576305f5e100830492506008015b6127108310610a1057612710830492506004015b60648310610a22576064830492506002015b600a8310610a2e576001015b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a5857600080fd5b919050565b60008060408385031215610a7057600080fd5b610a7983610a34565b946020939093013593505050565b60005b83811015610aa2578181015183820152602001610a8a565b83811115610ab1576000848401525b50505050565b60008151808452610acf816020860160208601610a87565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b146020830184610ab7565b9392505050565b600060208284031215610b2d57600080fd5b610b1482610a34565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff83166020820152606060408201526000610b716060830184610ab7565b95945050505050565b60008451610b8c818460208901610a87565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610bc8816001850160208a01610a87565b60019201918201528351610be3816002840160208801610a87565b0160020195945050505050565b600082821015610c29577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600082610c64577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c634300080f000a", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorPool\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_rewardDivider\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"l2BlockNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Rewarded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MIN_WITHDRAWAL_AMOUNT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RECIPIENT\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REWARD_DIVIDER\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATOR_POOL\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_l2BlockNumber\",\"type\":\"uint256\"}],\"name\":\"reward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalProcessed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalReserved\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawToL2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x61016060405234801561001157600080fd5b50604051610eb9380380610eb983398101604081905261003091610063565b6000608081905260a0819052600160c05260e0819052610100526001600160a01b0391909116610120526101405261009d565b6000806040838503121561007657600080fd5b82516001600160a01b038116811461008d57600080fd5b6020939093015192949293505050565b60805160a05160c05160e051610100516101205161014051610dae61010b6000396000818161019501526107f901526000818161024501526102c8015260006106ef015260006106c60152600061069d0152600060de01526000818161028f01526108470152610dae6000f3fe6080604052600436106100c05760003560e01c80636ed39f6211610074578063b98debbf1161004e578063b98debbf14610233578063c71b0e1c14610267578063d3e5792b1461027d57600080fd5b80636ed39f62146101c557806370a08231146101da57806384411d651461021d57600080fd5b80633ccfd60b116100a55780633ccfd60b1461014c57806354fd4d501461016157806362aba76b1461018357600080fd5b80630d9019e1146100cc57806321670f221461012a57600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561013657600080fd5b5061014a610145366004610b66565b6102b1565b005b34801561015857600080fd5b5061014a6105f0565b34801561016d57600080fd5b50610176610696565b6040516101219190610c0a565b34801561018f57600080fd5b506101b77f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610121565b3480156101d157600080fd5b5061014a610739565b3480156101e657600080fd5b506101b76101f5366004610c24565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b34801561022957600080fd5b506101b760005481565b34801561023f57600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b34801561027357600080fd5b506101b760035481565b34801561028957600080fd5b506101b77f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff16146103d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604860248201527f56616c696461746f725265776172645661756c743a2066756e6374696f6e206360448201527f616e206f6e6c792062652063616c6c65642066726f6d207468652056616c696460648201527f61746f72506f6f6c000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821661047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f56616c696461746f725265776172645661756c743a2076616c696461746f722060448201527f616464726573732063616e6e6f7420626520300000000000000000000000000060648201526084016103d0565b60008181526002602052604090205460ff1615610541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604e60248201527f56616c696461746f725265776172645661756c743a207468652072657761726460448201527f2068617320616c7265616479206265656e207061696420666f7220746865204c60648201527f3220626c6f636b206e756d626572000000000000000000000000000000000000608482015260a4016103d0565b600061054b6107f5565b600380548201905573ffffffffffffffffffffffffffffffffffffffff84166000818152600160208181526040808420805487019055878452600282529283902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155905183815292935084927f291e8ba3c0f4b0bd86e6e2346fcee1e7ca0975b1cc1886bfbc722d34f3f24d91910160405180910390a3505050565b60006105fa610835565b604080516020810182526000815290517fe11013dd0000000000000000000000000000000000000000000000000000000081529192507342000000000000000000000000000000000000099163e11013dd9184916106619133916188b89190600401610c3f565b6000604051808303818588803b15801561067a57600080fd5b505af115801561068e573d6000803e3d6000fd5b505050505050565b60606106c17f0000000000000000000000000000000000000000000000000000000000000000610982565b6106ea7f0000000000000000000000000000000000000000000000000000000000000000610982565b6107137f0000000000000000000000000000000000000000000000000000000000000000610982565b60405160200161072593929190610c83565b604051602081830303815290604052905090565b6000610743610835565b90506000610762335a8460405180602001604052806000815250610a40565b9050806107f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f56616c696461746f725265776172645661756c743a20455448207472616e736660448201527f6572206661696c6564000000000000000000000000000000000000000000000060648201526084016103d0565b5050565b60007f0000000000000000000000000000000000000000000000000000000000000000600354476108269190610cf9565b6108309190610d37565b905090565b336000908152600160205260408120547f000000000000000000000000000000000000000000000000000000000000000081101561091b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605660248201527f56616c696461746f725265776172645661756c743a207769746864726177616c60448201527f20616d6f756e74206d7573742062652067726561746572207468616e206d696e60648201527f696d756d207769746864726177616c20616d6f756e7400000000000000000000608482015260a4016103d0565b33600081815260016020908152604080832083905560038054869003905582548501909255815184815290810183905280820192909252517fc8a211cc64b6ed1b50595a9fcb1932b6d1e5a6e8ef15b60e5b1f988ea9086bba9181900360600190a1919050565b6060600061098f83610a5a565b600101905060008167ffffffffffffffff8111156109af576109af610d72565b6040519080825280601f01601f1916602001820160405280156109d9576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846109e357509392505050565b600080600080845160208601878a8af19695505050505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610aa3577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610acf576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610aed57662386f26fc10000830492506010015b6305f5e1008310610b05576305f5e100830492506008015b6127108310610b1957612710830492506004015b60648310610b2b576064830492506002015b600a8310610b37576001015b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610b6157600080fd5b919050565b60008060408385031215610b7957600080fd5b610b8283610b3d565b946020939093013593505050565b60005b83811015610bab578181015183820152602001610b93565b83811115610bba576000848401525b50505050565b60008151808452610bd8816020860160208601610b90565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610c1d6020830184610bc0565b9392505050565b600060208284031215610c3657600080fd5b610c1d82610b3d565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff83166020820152606060408201526000610c7a6060830184610bc0565b95945050505050565b60008451610c95818460208901610b90565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610cd1816001850160208a01610b90565b60019201918201528351610cec816002840160208801610b90565b0160020195945050505050565b600082821015610d32577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600082610d6d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c634300080f000a", } // ValidatorRewardVaultABI is the input ABI used to generate the binding from. @@ -492,6 +492,27 @@ func (_ValidatorRewardVault *ValidatorRewardVaultTransactorSession) Withdraw() ( return _ValidatorRewardVault.Contract.Withdraw(&_ValidatorRewardVault.TransactOpts) } +// WithdrawToL2 is a paid mutator transaction binding the contract method 0x6ed39f62. +// +// Solidity: function withdrawToL2() returns() +func (_ValidatorRewardVault *ValidatorRewardVaultTransactor) WithdrawToL2(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ValidatorRewardVault.contract.Transact(opts, "withdrawToL2") +} + +// WithdrawToL2 is a paid mutator transaction binding the contract method 0x6ed39f62. +// +// Solidity: function withdrawToL2() returns() +func (_ValidatorRewardVault *ValidatorRewardVaultSession) WithdrawToL2() (*types.Transaction, error) { + return _ValidatorRewardVault.Contract.WithdrawToL2(&_ValidatorRewardVault.TransactOpts) +} + +// WithdrawToL2 is a paid mutator transaction binding the contract method 0x6ed39f62. +// +// Solidity: function withdrawToL2() returns() +func (_ValidatorRewardVault *ValidatorRewardVaultTransactorSession) WithdrawToL2() (*types.Transaction, error) { + return _ValidatorRewardVault.Contract.WithdrawToL2(&_ValidatorRewardVault.TransactOpts) +} + // Receive is a paid mutator transaction binding the contract receive function. // // Solidity: receive() payable returns() diff --git a/bindings/bindings/validatorrewardvault_more.go b/bindings/bindings/validatorrewardvault_more.go index d2d5943a2f..c7d20ed907 100644 --- a/bindings/bindings/validatorrewardvault_more.go +++ b/bindings/bindings/validatorrewardvault_more.go @@ -13,7 +13,7 @@ const ValidatorRewardVaultStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"c var ValidatorRewardVaultStorageLayout = new(solc.StorageLayout) -var ValidatorRewardVaultDeployedBin = "0x6080604052600436106100b55760003560e01c806370a0823111610069578063b98debbf1161004e578063b98debbf14610213578063c71b0e1c14610247578063d3e5792b1461025d57600080fd5b806370a08231146101ba57806384411d65146101fd57600080fd5b80633ccfd60b1161009a5780633ccfd60b1461014157806354fd4d501461015657806362aba76b1461017857600080fd5b80630d9019e1146100c157806321670f221461011f57600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506100f57f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012b57600080fd5b5061013f61013a366004610a5d565b610291565b005b34801561014d57600080fd5b5061013f6105d0565b34801561016257600080fd5b5061016b6107b0565b6040516101169190610b01565b34801561018457600080fd5b506101ac7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610116565b3480156101c657600080fd5b506101ac6101d5366004610b1b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b34801561020957600080fd5b506101ac60005481565b34801561021f57600080fd5b506100f57f000000000000000000000000000000000000000000000000000000000000000081565b34801561025357600080fd5b506101ac60035481565b34801561026957600080fd5b506101ac7f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff16146103b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604860248201527f56616c696461746f725265776172645661756c743a2066756e6374696f6e206360448201527f616e206f6e6c792062652063616c6c65642066726f6d207468652056616c696460648201527f61746f72506f6f6c000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821661045c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f56616c696461746f725265776172645661756c743a2076616c696461746f722060448201527f616464726573732063616e6e6f7420626520300000000000000000000000000060648201526084016103b0565b60008181526002602052604090205460ff1615610521576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604e60248201527f56616c696461746f725265776172645661756c743a207468652072657761726460448201527f2068617320616c7265616479206265656e207061696420666f7220746865204c60648201527f3220626c6f636b206e756d626572000000000000000000000000000000000000608482015260a4016103b0565b600061052b610853565b600380548201905573ffffffffffffffffffffffffffffffffffffffff84166000818152600160208181526040808420805487019055878452600282529283902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155905183815292935084927f291e8ba3c0f4b0bd86e6e2346fcee1e7ca0975b1cc1886bfbc722d34f3f24d91910160405180910390a3505050565b336000908152600160205260409020547f00000000000000000000000000000000000000000000000000000000000000008110156106b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605660248201527f56616c696461746f725265776172645661756c743a207769746864726177616c60448201527f20616d6f756e74206d7573742062652067726561746572207468616e206d696e60648201527f696d756d207769746864726177616c20616d6f756e7400000000000000000000608482015260a4016103b0565b33600081815260016020908152604080832083905560038054869003905582548501909255815184815290810183905280820192909252517fc8a211cc64b6ed1b50595a9fcb1932b6d1e5a6e8ef15b60e5b1f988ea9086bba9181900360600190a1604080516020810182526000815290517fe11013dd0000000000000000000000000000000000000000000000000000000081527342000000000000000000000000000000000000099163e11013dd91849161077b9133916188b891600401610b36565b6000604051808303818588803b15801561079457600080fd5b505af11580156107a8573d6000803e3d6000fd5b505050505050565b60606107db7f0000000000000000000000000000000000000000000000000000000000000000610893565b6108047f0000000000000000000000000000000000000000000000000000000000000000610893565b61082d7f0000000000000000000000000000000000000000000000000000000000000000610893565b60405160200161083f93929190610b7a565b604051602081830303815290604052905090565b60007f0000000000000000000000000000000000000000000000000000000000000000600354476108849190610bf0565b61088e9190610c2e565b905090565b606060006108a083610951565b600101905060008167ffffffffffffffff8111156108c0576108c0610c69565b6040519080825280601f01601f1916602001820160405280156108ea576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846108f457509392505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061099a577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef810000000083106109c6576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106109e457662386f26fc10000830492506010015b6305f5e10083106109fc576305f5e100830492506008015b6127108310610a1057612710830492506004015b60648310610a22576064830492506002015b600a8310610a2e576001015b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a5857600080fd5b919050565b60008060408385031215610a7057600080fd5b610a7983610a34565b946020939093013593505050565b60005b83811015610aa2578181015183820152602001610a8a565b83811115610ab1576000848401525b50505050565b60008151808452610acf816020860160208601610a87565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610b146020830184610ab7565b9392505050565b600060208284031215610b2d57600080fd5b610b1482610a34565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff83166020820152606060408201526000610b716060830184610ab7565b95945050505050565b60008451610b8c818460208901610a87565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610bc8816001850160208a01610a87565b60019201918201528351610be3816002840160208801610a87565b0160020195945050505050565b600082821015610c29577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600082610c64577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c634300080f000a" +var ValidatorRewardVaultDeployedBin = "0x6080604052600436106100c05760003560e01c80636ed39f6211610074578063b98debbf1161004e578063b98debbf14610233578063c71b0e1c14610267578063d3e5792b1461027d57600080fd5b80636ed39f62146101c557806370a08231146101da57806384411d651461021d57600080fd5b80633ccfd60b116100a55780633ccfd60b1461014c57806354fd4d501461016157806362aba76b1461018357600080fd5b80630d9019e1146100cc57806321670f221461012a57600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561013657600080fd5b5061014a610145366004610b66565b6102b1565b005b34801561015857600080fd5b5061014a6105f0565b34801561016d57600080fd5b50610176610696565b6040516101219190610c0a565b34801561018f57600080fd5b506101b77f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610121565b3480156101d157600080fd5b5061014a610739565b3480156101e657600080fd5b506101b76101f5366004610c24565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b34801561022957600080fd5b506101b760005481565b34801561023f57600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b34801561027357600080fd5b506101b760035481565b34801561028957600080fd5b506101b77f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff16146103d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604860248201527f56616c696461746f725265776172645661756c743a2066756e6374696f6e206360448201527f616e206f6e6c792062652063616c6c65642066726f6d207468652056616c696460648201527f61746f72506f6f6c000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821661047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f56616c696461746f725265776172645661756c743a2076616c696461746f722060448201527f616464726573732063616e6e6f7420626520300000000000000000000000000060648201526084016103d0565b60008181526002602052604090205460ff1615610541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604e60248201527f56616c696461746f725265776172645661756c743a207468652072657761726460448201527f2068617320616c7265616479206265656e207061696420666f7220746865204c60648201527f3220626c6f636b206e756d626572000000000000000000000000000000000000608482015260a4016103d0565b600061054b6107f5565b600380548201905573ffffffffffffffffffffffffffffffffffffffff84166000818152600160208181526040808420805487019055878452600282529283902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909217909155905183815292935084927f291e8ba3c0f4b0bd86e6e2346fcee1e7ca0975b1cc1886bfbc722d34f3f24d91910160405180910390a3505050565b60006105fa610835565b604080516020810182526000815290517fe11013dd0000000000000000000000000000000000000000000000000000000081529192507342000000000000000000000000000000000000099163e11013dd9184916106619133916188b89190600401610c3f565b6000604051808303818588803b15801561067a57600080fd5b505af115801561068e573d6000803e3d6000fd5b505050505050565b60606106c17f0000000000000000000000000000000000000000000000000000000000000000610982565b6106ea7f0000000000000000000000000000000000000000000000000000000000000000610982565b6107137f0000000000000000000000000000000000000000000000000000000000000000610982565b60405160200161072593929190610c83565b604051602081830303815290604052905090565b6000610743610835565b90506000610762335a8460405180602001604052806000815250610a40565b9050806107f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f56616c696461746f725265776172645661756c743a20455448207472616e736660448201527f6572206661696c6564000000000000000000000000000000000000000000000060648201526084016103d0565b5050565b60007f0000000000000000000000000000000000000000000000000000000000000000600354476108269190610cf9565b6108309190610d37565b905090565b336000908152600160205260408120547f000000000000000000000000000000000000000000000000000000000000000081101561091b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605660248201527f56616c696461746f725265776172645661756c743a207769746864726177616c60448201527f20616d6f756e74206d7573742062652067726561746572207468616e206d696e60648201527f696d756d207769746864726177616c20616d6f756e7400000000000000000000608482015260a4016103d0565b33600081815260016020908152604080832083905560038054869003905582548501909255815184815290810183905280820192909252517fc8a211cc64b6ed1b50595a9fcb1932b6d1e5a6e8ef15b60e5b1f988ea9086bba9181900360600190a1919050565b6060600061098f83610a5a565b600101905060008167ffffffffffffffff8111156109af576109af610d72565b6040519080825280601f01601f1916602001820160405280156109d9576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846109e357509392505050565b600080600080845160208601878a8af19695505050505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610aa3577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610acf576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610aed57662386f26fc10000830492506010015b6305f5e1008310610b05576305f5e100830492506008015b6127108310610b1957612710830492506004015b60648310610b2b576064830492506002015b600a8310610b37576001015b92915050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610b6157600080fd5b919050565b60008060408385031215610b7957600080fd5b610b8283610b3d565b946020939093013593505050565b60005b83811015610bab578181015183820152602001610b93565b83811115610bba576000848401525b50505050565b60008151808452610bd8816020860160208601610b90565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610c1d6020830184610bc0565b9392505050565b600060208284031215610c3657600080fd5b610c1d82610b3d565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff83166020820152606060408201526000610c7a6060830184610bc0565b95945050505050565b60008451610c95818460208901610b90565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610cd1816001850160208a01610b90565b60019201918201528351610cec816002840160208801610b90565b0160020195945050505050565b600082821015610d32577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b600082610d6d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea164736f6c634300080f000a" func init() { if err := json.Unmarshal([]byte(ValidatorRewardVaultStorageLayoutJSON), ValidatorRewardVaultStorageLayout); err != nil { diff --git a/packages/contracts/contracts/L2/ValidatorRewardVault.sol b/packages/contracts/contracts/L2/ValidatorRewardVault.sol index 0df322a49d..61ac4de8d5 100644 --- a/packages/contracts/contracts/L2/ValidatorRewardVault.sol +++ b/packages/contracts/contracts/L2/ValidatorRewardVault.sol @@ -3,6 +3,7 @@ pragma solidity 0.8.15; import { L2StandardBridge } from "../L2/L2StandardBridge.sol"; import { Predeploys } from "../libraries/Predeploys.sol"; +import { SafeCall } from "../libraries/SafeCall.sol"; import { FeeVault } from "../universal/FeeVault.sol"; import { Semver } from "../universal/Semver.sol"; import { AddressAliasHelper } from "../vendor/AddressAliasHelper.sol"; @@ -95,33 +96,51 @@ contract ValidatorRewardVault is FeeVault, Semver { } /** - * @notice Withdraws all of the sender's balance. - * Reverts if the balance is less than the minimum withdrawal amount. + * @notice Checks if the withdrawal is possible, and returns the withdrawal amount. + * When a withdrawal is available, it resets the balance and updates the total processed amount. */ - function withdraw() external override { - uint256 balance = rewards[msg.sender]; - + function processWithdrawal() internal returns (uint256) { + uint256 amount = rewards[msg.sender]; require( - balance >= MIN_WITHDRAWAL_AMOUNT, + amount >= MIN_WITHDRAWAL_AMOUNT, "ValidatorRewardVault: withdrawal amount must be greater than minimum withdrawal amount" ); rewards[msg.sender] = 0; - unchecked { - totalReserved -= balance; - totalProcessed += balance; + totalReserved -= amount; + totalProcessed += amount; } - emit Withdrawal(balance, msg.sender, msg.sender); + emit Withdrawal(amount, msg.sender, msg.sender); + return amount; + } + + /** + * @notice Withdraws all of the sender's balance. + * Reverts if the balance is less than the minimum withdrawal amount. + */ + function withdraw() external override { + uint256 amount = processWithdrawal(); - L2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).bridgeETHTo{ value: balance }( + L2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).bridgeETHTo{ value: amount }( msg.sender, WITHDRAWAL_MIN_GAS, bytes("") ); } + /** + * @notice Withdraws all of the sender's balance to L2. + * Reverts if the balance is less than the minimum withdrawal amount. + */ + function withdrawToL2() external { + uint256 amount = processWithdrawal(); + + bool success = SafeCall.call(msg.sender, gasleft(), amount, bytes("")); + require(success, "ValidatorRewardVault: ETH transfer failed"); + } + /** * @notice Determines the reward amount. * diff --git a/packages/contracts/contracts/test/ValidatorRewardVault.t.sol b/packages/contracts/contracts/test/ValidatorRewardVault.t.sol index e838058059..64c2adfdbf 100644 --- a/packages/contracts/contracts/test/ValidatorRewardVault.t.sol +++ b/packages/contracts/contracts/test/ValidatorRewardVault.t.sol @@ -124,6 +124,31 @@ contract ValidatorRewardVault_Test is Bridge_Initializer { assertEq(vault.totalReserved(), reserved - amount); } + function test_withdrawL2_succeeds() external { + vm.deal(address(vault), vault.REWARD_DIVIDER() * vault.MIN_WITHDRAWAL_AMOUNT()); + vm.prank(AddressAliasHelper.applyL1ToL2Alias(address(pool))); + vault.reward(recipient, l2BlockNumber); + + uint256 amount = vault.balanceOf(recipient); + uint256 reserved = vault.totalReserved(); + + // No ether has been withdrawn yet + assertEq(vault.totalProcessed(), 0); + + vm.expectEmit(true, true, true, true, address(Predeploys.VALIDATOR_REWARD_VAULT)); + emit Withdrawal(amount, recipient, recipient); + + uint256 prevBalance = payable(msg.sender).balance; + vm.prank(recipient); + vault.withdrawToL2(); + // The withdrawal was successful + assertEq(vault.totalProcessed(), amount); + // Check the total determined reward amount was decreased. + assertEq(vault.totalReserved(), reserved - amount); + + assertEq(payable(msg.sender).balance, prevBalance + amount); + } + function test_balanceOf_succeeds() external { uint256 vaultBalance = vault.MIN_WITHDRAWAL_AMOUNT(); vm.deal(address(vault), vaultBalance);