From 37cd19cdae805aeeae642499c73e763d4ae6e20f Mon Sep 17 00:00:00 2001 From: QUAQ Date: Mon, 21 Oct 2024 15:27:19 -0500 Subject: [PATCH] update params --- contracts/bindings/PaymentVault/binding.go | 394 +++++++++++++----- contracts/src/interfaces/IPaymentVault.sol | 16 +- contracts/src/payments/PaymentVault.sol | 22 +- .../src/payments/PaymentVaultStorage.sol | 10 +- 4 files changed, 333 insertions(+), 109 deletions(-) diff --git a/contracts/bindings/PaymentVault/binding.go b/contracts/bindings/PaymentVault/binding.go index 88976ff24..cb34ddd50 100644 --- a/contracts/bindings/PaymentVault/binding.go +++ b/contracts/bindings/PaymentVault/binding.go @@ -31,17 +31,17 @@ var ( // IPaymentVaultReservation is an auto generated low-level Go binding around an user-defined struct. type IPaymentVaultReservation struct { - DataRate uint64 - StartTimestamp uint64 - EndTimestamp uint64 - QuorumNumbers []byte - QuorumSplits []byte + SymbolsPerSecond uint64 + StartTimestamp uint64 + EndTimestamp uint64 + QuorumNumbers []byte + QuorumSplits []byte } // ContractPaymentVaultMetaData contains all meta data concerning the ContractPaymentVault contract. var ContractPaymentVaultMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_reservationBinInterval\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_reservationBinStartTimestamp\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_priceUpdateCooldown\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"depositOnDemand\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"getOnDemandAmount\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getOnDemandAmounts\",\"inputs\":[{\"name\":\"_accounts\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[{\"name\":\"_payments\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getReservation\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIPaymentVault.Reservation\",\"components\":[{\"name\":\"dataRate\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getReservations\",\"inputs\":[{\"name\":\"_accounts\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[{\"name\":\"_reservations\",\"type\":\"tuple[]\",\"internalType\":\"structIPaymentVault.Reservation[]\",\"components\":[{\"name\":\"dataRate\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"globalBytesPerSecond\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_initialOwner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_minChargeableSize\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_globalBytesPerSecond\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"lastPriceUpdateTime\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"minChargeableSize\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onDemandPayments\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"priceUpdateCooldown\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"reservationBinInterval\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"reservationBinStartTimestamp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"reservations\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"dataRate\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setGlobalBytesPerSec\",\"inputs\":[{\"name\":\"_globalBytesPerSecond\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMinChargeableSize\",\"inputs\":[{\"name\":\"_minChargeableSize\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setReservation\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_reservation\",\"type\":\"tuple\",\"internalType\":\"structIPaymentVault.Reservation\",\"components\":[{\"name\":\"dataRate\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"GlobalBytesPerSecondUpdated\",\"inputs\":[{\"name\":\"previousValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MinChargeableSizeUpdated\",\"inputs\":[{\"name\":\"previousValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OnDemandPaymentUpdated\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"onDemandPayment\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"totalDeposit\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ReservationUpdated\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"reservation\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structIPaymentVault.Reservation\",\"components\":[{\"name\":\"dataRate\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"anonymous\":false}]", - Bin: "0x60e060405234801561001057600080fd5b5060405161187b38038061187b83398101604081905261002f9161010e565b608083905260a082905260c081905261004661004e565b50505061013c565b600554610100900460ff16156100ba5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60055460ff908116101561010c576005805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60008060006060848603121561012357600080fd5b8351925060208401519150604084015190509250925092565b60805160a05160c051611709610172600039600081816101410152610ca0015260006102460152600061027a01526117096000f3fe60806040526004361061012a5760003560e01c80637a1ac61e116100ab578063d996dc991161006f578063d996dc9914610359578063e30c880614610386578063e60a8dd7146103a6578063efb435f8146103c6578063f2fde38b146103fc578063fd3dc53a1461041c57600080fd5b80637a1ac61e146102b15780638bec7d02146102d15780638da5cb5b146102e45780639aec86401461030c578063b2066f801461032c57600080fd5b80634486bfb7116100f25780634486bfb7146101f157806349b9a7af1461021e578063550571b4146102345780635a8a686914610268578063715018a61461029c57600080fd5b8063039f091c1461012f578063109f8fe51461017657806312a76a20146101a357806312cc61b8146101b95780632e1a7d4d146101cf575b600080fd5b34801561013b57600080fd5b506101637f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b34801561018257600080fd5b506101966101913660046111f4565b61044d565b60405161016d9190611351565b3480156101af57600080fd5b5061016360005481565b3480156101c557600080fd5b5061016360015481565b3480156101db57600080fd5b506101ef6101ea3660046113b3565b6106a0565b005b3480156101fd57600080fd5b5061021161020c3660046111f4565b61071d565b60405161016d91906113cc565b34801561022a57600080fd5b5061016360025481565b34801561024057600080fd5b506101637f000000000000000000000000000000000000000000000000000000000000000081565b34801561027457600080fd5b506101637f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a857600080fd5b506101ef6107dc565b3480156102bd57600080fd5b506101ef6102cc366004611410565b6107f0565b6101ef6102df366004611443565b610914565b3480156102f057600080fd5b506038546040516001600160a01b03909116815260200161016d565b34801561031857600080fd5b506101ef6103273660046114eb565b610995565b34801561033857600080fd5b5061034c610347366004611443565b610aa3565b60405161016d91906115c1565b34801561036557600080fd5b50610163610374366004611443565b60046020526000908152604090205481565b34801561039257600080fd5b506101ef6103a13660046113b3565b610c4d565b3480156103b257600080fd5b506101ef6103c13660046113b3565b610c96565b3480156103d257600080fd5b506101636103e1366004611443565b6001600160a01b031660009081526004602052604090205490565b34801561040857600080fd5b506101ef610417366004611443565b610d6c565b34801561042857600080fd5b5061043c610437366004611443565b610de5565b60405161016d9594939291906115d4565b606081516001600160401b038111156104685761046861116a565b6040519080825280602002602001820160405280156104c057816020015b6040805160a08101825260008082526020808301829052928201526060808201819052608082015282526000199092019101816104865790505b50905060005b825181101561069a57600360008483815181106104e5576104e561161a565b6020908102919091018101516001600160a01b03168252818101929092526040908101600020815160a08101835281546001600160401b038082168352600160401b8204811695830195909552600160801b90049093169183019190915260018101805460608401919061055890611630565b80601f016020809104026020016040519081016040528092919081815260200182805461058490611630565b80156105d15780601f106105a6576101008083540402835291602001916105d1565b820191906000526020600020905b8154815290600101906020018083116105b457829003601f168201915b505050505081526020016002820180546105ea90611630565b80601f016020809104026020016040519081016040528092919081815260200182805461061690611630565b80156106635780601f1061063857610100808354040283529160200191610663565b820191906000526020600020905b81548152906001019060200180831161064657829003601f168201915b50505050508152505082828151811061067e5761067e61161a565b6020026020010181905250806106939061167b565b90506104c6565b50919050565b6106a8610f38565b60006106bc6038546001600160a01b031690565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114610706576040519150601f19603f3d011682016040523d82523d6000602084013e61070b565b606091505b505090508061071957600080fd5b5050565b606081516001600160401b038111156107385761073861116a565b604051908082528060200260200182016040528015610761578160200160208202803683370190505b50905060005b825181101561069a57600460008483815181106107865761078661161a565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107c1576107c161161a565b60209081029190910101526107d58161167b565b9050610767565b6107e4610f38565b6107ee6000610f92565b565b600554610100900460ff16158080156108105750600554600160ff909116105b8061082a5750303b15801561082a575060055460ff166001145b6108925760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6005805460ff1916600117905580156108b5576005805461ff0019166101001790555b6108be84610d6c565b60008390556001829055801561090e576005805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6001600160a01b0381166000908152600460205260408120805434929061093c908490611696565b90915550506001600160a01b038116600081815260046020908152604091829020548251348152918201527f56b34df61acb18dada28b541448a4ff3faf4c0970eb58b9980468a2c75383322910160405180910390a250565b61099d610f38565b6109af81606001518260800151610fe4565b6001600160a01b0382166000908152600360209081526040918290208351815483860151948601516001600160401b03908116600160801b0267ffffffffffffffff60801b19968216600160401b026fffffffffffffffffffffffffffffffff199093169190931617179390931692909217825560608301518051849392610a3e9260018501929101906110d1565b5060808201518051610a5a9160028401916020909101906110d1565b50905050816001600160a01b03167fff3054d138559c39b4c0826c43e94b2b2c6bc9a33ea1d0b74f16c916c7b73ec182604051610a9791906115c1565b60405180910390a25050565b6040805160a08082018352600080835260208084018290528385018290526060808501819052608085018190526001600160a01b038716835260038252918590208551938401865280546001600160401b038082168652600160401b8204811693860193909352600160801b9004909116948301949094526001840180549394929391840191610b3290611630565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5e90611630565b8015610bab5780601f10610b8057610100808354040283529160200191610bab565b820191906000526020600020905b815481529060010190602001808311610b8e57829003601f168201915b50505050508152602001600282018054610bc490611630565b80601f0160208091040260200160405190810160405280929190818152602001828054610bf090611630565b8015610c3d5780601f10610c1257610100808354040283529160200191610c3d565b820191906000526020600020905b815481529060010190602001808311610c2057829003601f168201915b5050505050815250509050919050565b610c55610f38565b60015460408051918252602082018390527f8a2a96caad50bb77e6c390a954ed96a23dc59b9c8a7e2c6fdf243b34559c2346910160405180910390a1600155565b610c9e610f38565b7f0000000000000000000000000000000000000000000000000000000000000000600254610ccc9190611696565b421015610d275760405162461bcd60e51b815260206004820152602360248201527f70726963652075706461746520636f6f6c646f776e206e6f74207375727061736044820152621cd95960ea1b6064820152608401610889565b60005460408051918252602082018390527f62caca228682fc3cff59bcae8bdf562027847c9295336694d56a0892bbeed0b9910160405180910390a142600255600055565b610d74610f38565b6001600160a01b038116610dd95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610889565b610de281610f92565b50565b600360205260009081526040902080546001820180546001600160401b0380841694600160401b8504821694600160801b9004909116929091610e2790611630565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5390611630565b8015610ea05780601f10610e7557610100808354040283529160200191610ea0565b820191906000526020600020905b815481529060010190602001808311610e8357829003601f168201915b505050505090806002018054610eb590611630565b80601f0160208091040260200160405190810160405280929190818152602001828054610ee190611630565b8015610f2e5780601f10610f0357610100808354040283529160200191610f2e565b820191906000526020600020905b815481529060010190602001808311610f1157829003601f168201915b5050505050905085565b6038546001600160a01b031633146107ee5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610889565b603880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80518251146110355760405162461bcd60e51b815260206004820181905260248201527f617272617973206d7573742068617665207468652073616d65206c656e6774686044820152606401610889565b6000805b8251811015611078578281815181106110545761105461161a565b01602001516110669060f81c836116ae565b91506110718161167b565b9050611039565b508060ff166064146110cc5760405162461bcd60e51b815260206004820152601f60248201527f73756d206f662071756f72756d53706c697473206d75737420626520313030006044820152606401610889565b505050565b8280546110dd90611630565b90600052602060002090601f0160209004810192826110ff5760008555611145565b82601f1061111857805160ff1916838001178555611145565b82800160010185558215611145579182015b8281111561114557825182559160200191906001019061112a565b50611151929150611155565b5090565b5b808211156111515760008155600101611156565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b03811182821017156111a2576111a261116a565b60405290565b604051601f8201601f191681016001600160401b03811182821017156111d0576111d061116a565b604052919050565b80356001600160a01b03811681146111ef57600080fd5b919050565b6000602080838503121561120757600080fd5b82356001600160401b038082111561121e57600080fd5b818501915085601f83011261123257600080fd5b8135818111156112445761124461116a565b8060051b91506112558483016111a8565b818152918301840191848101908884111561126f57600080fd5b938501935b8385101561129457611285856111d8565b82529385019390850190611274565b98975050505050505050565b6000815180845260005b818110156112c6576020818501810151868301820152016112aa565b818111156112d8576000602083870101525b50601f01601f19169290920160200192915050565b60006001600160401b0380835116845280602084015116602085015280604084015116604085015250606082015160a0606085015261132f60a08501826112a0565b90506080830151848203608086015261134882826112a0565b95945050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156113a657603f198886030184526113948583516112ed565b94509285019290850190600101611378565b5092979650505050505050565b6000602082840312156113c557600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015611404578351835292840192918401916001016113e8565b50909695505050505050565b60008060006060848603121561142557600080fd5b61142e846111d8565b95602085013595506040909401359392505050565b60006020828403121561145557600080fd5b61145e826111d8565b9392505050565b80356001600160401b03811681146111ef57600080fd5b600082601f83011261148d57600080fd5b81356001600160401b038111156114a6576114a661116a565b6114b9601f8201601f19166020016111a8565b8181528460208386010111156114ce57600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156114fe57600080fd5b611507836111d8565b915060208301356001600160401b038082111561152357600080fd5b9084019060a0828703121561153757600080fd5b61153f611180565b61154883611465565b815261155660208401611465565b602082015261156760408401611465565b604082015260608301358281111561157e57600080fd5b61158a8882860161147c565b6060830152506080830135828111156115a257600080fd5b6115ae8882860161147c565b6080830152508093505050509250929050565b60208152600061145e60208301846112ed565b60006001600160401b038088168352808716602084015280861660408401525060a0606083015261160860a08301856112a0565b828103608084015261129481856112a0565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061164457607f821691505b6020821081141561069a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561168f5761168f611665565b5060010190565b600082198211156116a9576116a9611665565b500190565b600060ff821660ff84168060ff038211156116cb576116cb611665565b01939250505056fea2646970667358221220507c3b0360e07502c3577854b76e10f776b4af1bb404b3b0bbb432c98c23d7fa64736f6c634300080c0033", + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_reservationBinInterval\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_reservationBinStartTimestamp\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_priceUpdateCooldown\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"depositOnDemand\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"getOnDemandAmount\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getOnDemandAmounts\",\"inputs\":[{\"name\":\"_accounts\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[{\"name\":\"_payments\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getReservation\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIPaymentVault.Reservation\",\"components\":[{\"name\":\"symbolsPerSecond\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getReservations\",\"inputs\":[{\"name\":\"_accounts\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[{\"name\":\"_reservations\",\"type\":\"tuple[]\",\"internalType\":\"structIPaymentVault.Reservation[]\",\"components\":[{\"name\":\"symbolsPerSecond\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"globalSymbolsPerSecond\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_initialOwner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_minChargeableSize\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_globalSymbolsPerSecond\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_pricePerSymbol\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"lastPriceUpdateTime\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"minChargeableSize\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"onDemandPayments\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pricePerSymbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"priceUpdateCooldown\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"reservationBinInterval\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"reservationBinStartTimestamp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"reservations\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"symbolsPerSecond\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setGlobalSymbolsPerSecond\",\"inputs\":[{\"name\":\"_globalSymbolsPerSecond\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMinChargeableSize\",\"inputs\":[{\"name\":\"_minChargeableSize\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPricePerSymbol\",\"inputs\":[{\"name\":\"_pricePerSymbol\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setReservation\",\"inputs\":[{\"name\":\"_account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_reservation\",\"type\":\"tuple\",\"internalType\":\"structIPaymentVault.Reservation\",\"components\":[{\"name\":\"symbolsPerSecond\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawERC20\",\"inputs\":[{\"name\":\"_token\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"GlobalSymbolsPerSecondUpdated\",\"inputs\":[{\"name\":\"previousValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MinChargeableSizeUpdated\",\"inputs\":[{\"name\":\"previousValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OnDemandPaymentUpdated\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"onDemandPayment\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"totalDeposit\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PricePerSymbolUpdated\",\"inputs\":[{\"name\":\"previousValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newValue\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ReservationUpdated\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"reservation\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structIPaymentVault.Reservation\",\"components\":[{\"name\":\"symbolsPerSecond\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"startTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"endTimestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"quorumNumbers\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"quorumSplits\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"anonymous\":false}]", + Bin: "0x60e060405234801561001057600080fd5b5060405162001a3038038062001a3083398101604081905261003191610110565b608083905260a082905260c0819052610048610050565b50505061013e565b603254610100900460ff16156100bc5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60325460ff908116101561010e576032805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60008060006060848603121561012557600080fd5b8351925060208401519150604084015190509250925092565b60805160a05160c0516118bb62000175600039600081816101620152610e05015260006102a7015260006102db01526118bb6000f3fe60806040526004361061014b5760003560e01c80638bec7d02116100b6578063d996dc991161006f578063d996dc99146103da578063e60a8dd714610407578063efb435f814610427578063f2fde38b1461045d578063f323726a1461047d578063fd3dc53a1461049357600080fd5b80638bec7d02146103125780638da5cb5b146103255780639aec86401461034d578063a1db97821461036d578063b2066f801461038d578063bfafe8bf146103ba57600080fd5b80634486bfb7116101085780634486bfb71461023257806349b9a7af1461025f5780634ec81af114610275578063550571b4146102955780635a8a6869146102c9578063715018a6146102fd57600080fd5b8063039f091c14610150578063109f8fe51461019757806312a76a20146101c45780632e1a7d4d146101da578063316e0299146101fc5780633816885014610212575b600080fd5b34801561015c57600080fd5b506101847f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b3480156101a357600080fd5b506101b76101b2366004611354565b6104c4565b60405161018e91906114b1565b3480156101d057600080fd5b5061018460005481565b3480156101e657600080fd5b506101fa6101f5366004611513565b610717565b005b34801561020857600080fd5b5061018460015481565b34801561021e57600080fd5b506101fa61022d366004611513565b610794565b34801561023e57600080fd5b5061025261024d366004611354565b6107dd565b60405161018e919061152c565b34801561026b57600080fd5b5061018460035481565b34801561028157600080fd5b506101fa610290366004611570565b61089c565b3480156102a157600080fd5b506101847f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d557600080fd5b506101847f000000000000000000000000000000000000000000000000000000000000000081565b34801561030957600080fd5b506101fa6109c6565b6101fa6103203660046115a9565b6109da565b34801561033157600080fd5b506065546040516001600160a01b03909116815260200161018e565b34801561035957600080fd5b506101fa610368366004611651565b610a5b565b34801561037957600080fd5b506101fa610388366004611727565b610b69565b34801561039957600080fd5b506103ad6103a83660046115a9565b610c08565b60405161018e9190611751565b3480156103c657600080fd5b506101fa6103d5366004611513565b610db2565b3480156103e657600080fd5b506101846103f53660046115a9565b60056020526000908152604090205481565b34801561041357600080fd5b506101fa610422366004611513565b610dfb565b34801561043357600080fd5b506101846104423660046115a9565b6001600160a01b031660009081526005602052604090205490565b34801561046957600080fd5b506101fa6104783660046115a9565b610ed1565b34801561048957600080fd5b5061018460025481565b34801561049f57600080fd5b506104b36104ae3660046115a9565b610f4a565b60405161018e959493929190611764565b606081516001600160401b038111156104df576104df6112ca565b60405190808252806020026020018201604052801561053757816020015b6040805160a08101825260008082526020808301829052928201526060808201819052608082015282526000199092019101816104fd5790505b50905060005b8251811015610711576004600084838151811061055c5761055c6117aa565b6020908102919091018101516001600160a01b03168252818101929092526040908101600020815160a08101835281546001600160401b038082168352600160401b8204811695830195909552600160801b9004909316918301919091526001810180546060840191906105cf906117c0565b80601f01602080910402602001604051908101604052809291908181526020018280546105fb906117c0565b80156106485780601f1061061d57610100808354040283529160200191610648565b820191906000526020600020905b81548152906001019060200180831161062b57829003601f168201915b50505050508152602001600282018054610661906117c0565b80601f016020809104026020016040519081016040528092919081815260200182805461068d906117c0565b80156106da5780601f106106af576101008083540402835291602001916106da565b820191906000526020600020905b8154815290600101906020018083116106bd57829003601f168201915b5050505050815250508282815181106106f5576106f56117aa565b60200260200101819052508061070a9061180b565b905061053d565b50919050565b61071f61109d565b60006107336065546001600160a01b031690565b6001600160a01b03168260405160006040518083038185875af1925050503d806000811461077d576040519150601f19603f3d011682016040523d82523d6000602084013e610782565b606091505b505090508061079057600080fd5b5050565b61079c61109d565b60025460408051918252602082018390527f590fdc6eef6046429b66dbdf71f0317122a79e082956279f70104cd907112c67910160405180910390a1600255565b606081516001600160401b038111156107f8576107f86112ca565b604051908082528060200260200182016040528015610821578160200160208202803683370190505b50905060005b82518110156107115760056000848381518110610846576108466117aa565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610881576108816117aa565b60209081029190910101526108958161180b565b9050610827565b603254610100900460ff16158080156108bc5750603254600160ff909116105b806108d65750303b1580156108d6575060325460ff166001145b61093e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6032805460ff191660011790558015610961576032805461ff0019166101001790555b61096a85610ed1565b60008490556001839055600282905580156109bf576032805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6109ce61109d565b6109d860006110f7565b565b6001600160a01b03811660009081526005602052604081208054349290610a02908490611826565b90915550506001600160a01b038116600081815260056020908152604091829020548251348152918201527f56b34df61acb18dada28b541448a4ff3faf4c0970eb58b9980468a2c75383322910160405180910390a250565b610a6361109d565b610a7581606001518260800151611149565b6001600160a01b0382166000908152600460209081526040918290208351815483860151948601516001600160401b03908116600160801b0267ffffffffffffffff60801b19968216600160401b026fffffffffffffffffffffffffffffffff199093169190931617179390931692909217825560608301518051849392610b04926001850192910190611231565b5060808201518051610b20916002840191602090910190611231565b50905050816001600160a01b03167fff3054d138559c39b4c0826c43e94b2b2c6bc9a33ea1d0b74f16c916c7b73ec182604051610b5d9190611751565b60405180910390a25050565b610b7161109d565b816001600160a01b031663a9059cbb610b926065546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610bdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c03919061183e565b505050565b6040805160a08082018352600080835260208084018290528385018290526060808501819052608085018190526001600160a01b038716835260048252918590208551938401865280546001600160401b038082168652600160401b8204811693860193909352600160801b9004909116948301949094526001840180549394929391840191610c97906117c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc3906117c0565b8015610d105780601f10610ce557610100808354040283529160200191610d10565b820191906000526020600020905b815481529060010190602001808311610cf357829003601f168201915b50505050508152602001600282018054610d29906117c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610d55906117c0565b8015610da25780601f10610d7757610100808354040283529160200191610da2565b820191906000526020600020905b815481529060010190602001808311610d8557829003601f168201915b5050505050815250509050919050565b610dba61109d565b60015460408051918252602082018390527f33ec972d20d3bef7c2f239466a44f6c7335a4faf21f7b135c2b30138d71f8807910160405180910390a1600155565b610e0361109d565b7f0000000000000000000000000000000000000000000000000000000000000000600354610e319190611826565b421015610e8c5760405162461bcd60e51b815260206004820152602360248201527f70726963652075706461746520636f6f6c646f776e206e6f74207375727061736044820152621cd95960ea1b6064820152608401610935565b60005460408051918252602082018390527f62caca228682fc3cff59bcae8bdf562027847c9295336694d56a0892bbeed0b9910160405180910390a142600355600055565b610ed961109d565b6001600160a01b038116610f3e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610935565b610f47816110f7565b50565b600460205260009081526040902080546001820180546001600160401b0380841694600160401b8504821694600160801b9004909116929091610f8c906117c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610fb8906117c0565b80156110055780601f10610fda57610100808354040283529160200191611005565b820191906000526020600020905b815481529060010190602001808311610fe857829003601f168201915b50505050509080600201805461101a906117c0565b80601f0160208091040260200160405190810160405280929190818152602001828054611046906117c0565b80156110935780601f1061106857610100808354040283529160200191611093565b820191906000526020600020905b81548152906001019060200180831161107657829003601f168201915b5050505050905085565b6065546001600160a01b031633146109d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610935565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b805182511461119a5760405162461bcd60e51b815260206004820181905260248201527f617272617973206d7573742068617665207468652073616d65206c656e6774686044820152606401610935565b6000805b82518110156111dd578281815181106111b9576111b96117aa565b01602001516111cb9060f81c83611860565b91506111d68161180b565b905061119e565b508060ff16606414610c035760405162461bcd60e51b815260206004820152601f60248201527f73756d206f662071756f72756d53706c697473206d75737420626520313030006044820152606401610935565b82805461123d906117c0565b90600052602060002090601f01602090048101928261125f57600085556112a5565b82601f1061127857805160ff19168380011785556112a5565b828001600101855582156112a5579182015b828111156112a557825182559160200191906001019061128a565b506112b19291506112b5565b5090565b5b808211156112b157600081556001016112b6565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b0381118282101715611302576113026112ca565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611330576113306112ca565b604052919050565b80356001600160a01b038116811461134f57600080fd5b919050565b6000602080838503121561136757600080fd5b82356001600160401b038082111561137e57600080fd5b818501915085601f83011261139257600080fd5b8135818111156113a4576113a46112ca565b8060051b91506113b5848301611308565b81815291830184019184810190888411156113cf57600080fd5b938501935b838510156113f4576113e585611338565b825293850193908501906113d4565b98975050505050505050565b6000815180845260005b818110156114265760208185018101518683018201520161140a565b81811115611438576000602083870101525b50601f01601f19169290920160200192915050565b60006001600160401b0380835116845280602084015116602085015280604084015116604085015250606082015160a0606085015261148f60a0850182611400565b9050608083015184820360808601526114a88282611400565b95945050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561150657603f198886030184526114f485835161144d565b945092850192908501906001016114d8565b5092979650505050505050565b60006020828403121561152557600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561156457835183529284019291840191600101611548565b50909695505050505050565b6000806000806080858703121561158657600080fd5b61158f85611338565b966020860135965060408601359560600135945092505050565b6000602082840312156115bb57600080fd5b6115c482611338565b9392505050565b80356001600160401b038116811461134f57600080fd5b600082601f8301126115f357600080fd5b81356001600160401b0381111561160c5761160c6112ca565b61161f601f8201601f1916602001611308565b81815284602083860101111561163457600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561166457600080fd5b61166d83611338565b915060208301356001600160401b038082111561168957600080fd5b9084019060a0828703121561169d57600080fd5b6116a56112e0565b6116ae836115cb565b81526116bc602084016115cb565b60208201526116cd604084016115cb565b60408201526060830135828111156116e457600080fd5b6116f0888286016115e2565b60608301525060808301358281111561170857600080fd5b611714888286016115e2565b6080830152508093505050509250929050565b6000806040838503121561173a57600080fd5b61174383611338565b946020939093013593505050565b6020815260006115c4602083018461144d565b60006001600160401b038088168352808716602084015280861660408401525060a0606083015261179860a0830185611400565b82810360808401526113f48185611400565b634e487b7160e01b600052603260045260246000fd5b600181811c908216806117d457607f821691505b6020821081141561071157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561181f5761181f6117f5565b5060010190565b60008219821115611839576118396117f5565b500190565b60006020828403121561185057600080fd5b815180151581146115c457600080fd5b600060ff821660ff84168060ff0382111561187d5761187d6117f5565b01939250505056fea2646970667358221220e500c71a831bcab2febcc1fc64db7e8b2d678b720b319304875542504ab04c0864736f6c634300080c0033", } // ContractPaymentVaultABI is the input ABI used to generate the binding from. @@ -335,12 +335,12 @@ func (_ContractPaymentVault *ContractPaymentVaultCallerSession) GetReservations( return _ContractPaymentVault.Contract.GetReservations(&_ContractPaymentVault.CallOpts, _accounts) } -// GlobalBytesPerSecond is a free data retrieval call binding the contract method 0x12cc61b8. +// GlobalSymbolsPerSecond is a free data retrieval call binding the contract method 0x316e0299. // -// Solidity: function globalBytesPerSecond() view returns(uint256) -func (_ContractPaymentVault *ContractPaymentVaultCaller) GlobalBytesPerSecond(opts *bind.CallOpts) (*big.Int, error) { +// Solidity: function globalSymbolsPerSecond() view returns(uint256) +func (_ContractPaymentVault *ContractPaymentVaultCaller) GlobalSymbolsPerSecond(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _ContractPaymentVault.contract.Call(opts, &out, "globalBytesPerSecond") + err := _ContractPaymentVault.contract.Call(opts, &out, "globalSymbolsPerSecond") if err != nil { return *new(*big.Int), err @@ -352,18 +352,18 @@ func (_ContractPaymentVault *ContractPaymentVaultCaller) GlobalBytesPerSecond(op } -// GlobalBytesPerSecond is a free data retrieval call binding the contract method 0x12cc61b8. +// GlobalSymbolsPerSecond is a free data retrieval call binding the contract method 0x316e0299. // -// Solidity: function globalBytesPerSecond() view returns(uint256) -func (_ContractPaymentVault *ContractPaymentVaultSession) GlobalBytesPerSecond() (*big.Int, error) { - return _ContractPaymentVault.Contract.GlobalBytesPerSecond(&_ContractPaymentVault.CallOpts) +// Solidity: function globalSymbolsPerSecond() view returns(uint256) +func (_ContractPaymentVault *ContractPaymentVaultSession) GlobalSymbolsPerSecond() (*big.Int, error) { + return _ContractPaymentVault.Contract.GlobalSymbolsPerSecond(&_ContractPaymentVault.CallOpts) } -// GlobalBytesPerSecond is a free data retrieval call binding the contract method 0x12cc61b8. +// GlobalSymbolsPerSecond is a free data retrieval call binding the contract method 0x316e0299. // -// Solidity: function globalBytesPerSecond() view returns(uint256) -func (_ContractPaymentVault *ContractPaymentVaultCallerSession) GlobalBytesPerSecond() (*big.Int, error) { - return _ContractPaymentVault.Contract.GlobalBytesPerSecond(&_ContractPaymentVault.CallOpts) +// Solidity: function globalSymbolsPerSecond() view returns(uint256) +func (_ContractPaymentVault *ContractPaymentVaultCallerSession) GlobalSymbolsPerSecond() (*big.Int, error) { + return _ContractPaymentVault.Contract.GlobalSymbolsPerSecond(&_ContractPaymentVault.CallOpts) } // LastPriceUpdateTime is a free data retrieval call binding the contract method 0x49b9a7af. @@ -490,6 +490,37 @@ func (_ContractPaymentVault *ContractPaymentVaultCallerSession) Owner() (common. return _ContractPaymentVault.Contract.Owner(&_ContractPaymentVault.CallOpts) } +// PricePerSymbol is a free data retrieval call binding the contract method 0xf323726a. +// +// Solidity: function pricePerSymbol() view returns(uint256) +func (_ContractPaymentVault *ContractPaymentVaultCaller) PricePerSymbol(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ContractPaymentVault.contract.Call(opts, &out, "pricePerSymbol") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// PricePerSymbol is a free data retrieval call binding the contract method 0xf323726a. +// +// Solidity: function pricePerSymbol() view returns(uint256) +func (_ContractPaymentVault *ContractPaymentVaultSession) PricePerSymbol() (*big.Int, error) { + return _ContractPaymentVault.Contract.PricePerSymbol(&_ContractPaymentVault.CallOpts) +} + +// PricePerSymbol is a free data retrieval call binding the contract method 0xf323726a. +// +// Solidity: function pricePerSymbol() view returns(uint256) +func (_ContractPaymentVault *ContractPaymentVaultCallerSession) PricePerSymbol() (*big.Int, error) { + return _ContractPaymentVault.Contract.PricePerSymbol(&_ContractPaymentVault.CallOpts) +} + // PriceUpdateCooldown is a free data retrieval call binding the contract method 0x039f091c. // // Solidity: function priceUpdateCooldown() view returns(uint256) @@ -585,29 +616,29 @@ func (_ContractPaymentVault *ContractPaymentVaultCallerSession) ReservationBinSt // Reservations is a free data retrieval call binding the contract method 0xfd3dc53a. // -// Solidity: function reservations(address ) view returns(uint64 dataRate, uint64 startTimestamp, uint64 endTimestamp, bytes quorumNumbers, bytes quorumSplits) +// Solidity: function reservations(address ) view returns(uint64 symbolsPerSecond, uint64 startTimestamp, uint64 endTimestamp, bytes quorumNumbers, bytes quorumSplits) func (_ContractPaymentVault *ContractPaymentVaultCaller) Reservations(opts *bind.CallOpts, arg0 common.Address) (struct { - DataRate uint64 - StartTimestamp uint64 - EndTimestamp uint64 - QuorumNumbers []byte - QuorumSplits []byte + SymbolsPerSecond uint64 + StartTimestamp uint64 + EndTimestamp uint64 + QuorumNumbers []byte + QuorumSplits []byte }, error) { var out []interface{} err := _ContractPaymentVault.contract.Call(opts, &out, "reservations", arg0) outstruct := new(struct { - DataRate uint64 - StartTimestamp uint64 - EndTimestamp uint64 - QuorumNumbers []byte - QuorumSplits []byte + SymbolsPerSecond uint64 + StartTimestamp uint64 + EndTimestamp uint64 + QuorumNumbers []byte + QuorumSplits []byte }) if err != nil { return *outstruct, err } - outstruct.DataRate = *abi.ConvertType(out[0], new(uint64)).(*uint64) + outstruct.SymbolsPerSecond = *abi.ConvertType(out[0], new(uint64)).(*uint64) outstruct.StartTimestamp = *abi.ConvertType(out[1], new(uint64)).(*uint64) outstruct.EndTimestamp = *abi.ConvertType(out[2], new(uint64)).(*uint64) outstruct.QuorumNumbers = *abi.ConvertType(out[3], new([]byte)).(*[]byte) @@ -619,26 +650,26 @@ func (_ContractPaymentVault *ContractPaymentVaultCaller) Reservations(opts *bind // Reservations is a free data retrieval call binding the contract method 0xfd3dc53a. // -// Solidity: function reservations(address ) view returns(uint64 dataRate, uint64 startTimestamp, uint64 endTimestamp, bytes quorumNumbers, bytes quorumSplits) +// Solidity: function reservations(address ) view returns(uint64 symbolsPerSecond, uint64 startTimestamp, uint64 endTimestamp, bytes quorumNumbers, bytes quorumSplits) func (_ContractPaymentVault *ContractPaymentVaultSession) Reservations(arg0 common.Address) (struct { - DataRate uint64 - StartTimestamp uint64 - EndTimestamp uint64 - QuorumNumbers []byte - QuorumSplits []byte + SymbolsPerSecond uint64 + StartTimestamp uint64 + EndTimestamp uint64 + QuorumNumbers []byte + QuorumSplits []byte }, error) { return _ContractPaymentVault.Contract.Reservations(&_ContractPaymentVault.CallOpts, arg0) } // Reservations is a free data retrieval call binding the contract method 0xfd3dc53a. // -// Solidity: function reservations(address ) view returns(uint64 dataRate, uint64 startTimestamp, uint64 endTimestamp, bytes quorumNumbers, bytes quorumSplits) +// Solidity: function reservations(address ) view returns(uint64 symbolsPerSecond, uint64 startTimestamp, uint64 endTimestamp, bytes quorumNumbers, bytes quorumSplits) func (_ContractPaymentVault *ContractPaymentVaultCallerSession) Reservations(arg0 common.Address) (struct { - DataRate uint64 - StartTimestamp uint64 - EndTimestamp uint64 - QuorumNumbers []byte - QuorumSplits []byte + SymbolsPerSecond uint64 + StartTimestamp uint64 + EndTimestamp uint64 + QuorumNumbers []byte + QuorumSplits []byte }, error) { return _ContractPaymentVault.Contract.Reservations(&_ContractPaymentVault.CallOpts, arg0) } @@ -664,25 +695,25 @@ func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) DepositOnDem return _ContractPaymentVault.Contract.DepositOnDemand(&_ContractPaymentVault.TransactOpts, _account) } -// Initialize is a paid mutator transaction binding the contract method 0x7a1ac61e. +// Initialize is a paid mutator transaction binding the contract method 0x4ec81af1. // -// Solidity: function initialize(address _initialOwner, uint256 _minChargeableSize, uint256 _globalBytesPerSecond) returns() -func (_ContractPaymentVault *ContractPaymentVaultTransactor) Initialize(opts *bind.TransactOpts, _initialOwner common.Address, _minChargeableSize *big.Int, _globalBytesPerSecond *big.Int) (*types.Transaction, error) { - return _ContractPaymentVault.contract.Transact(opts, "initialize", _initialOwner, _minChargeableSize, _globalBytesPerSecond) +// Solidity: function initialize(address _initialOwner, uint256 _minChargeableSize, uint256 _globalSymbolsPerSecond, uint256 _pricePerSymbol) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactor) Initialize(opts *bind.TransactOpts, _initialOwner common.Address, _minChargeableSize *big.Int, _globalSymbolsPerSecond *big.Int, _pricePerSymbol *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.contract.Transact(opts, "initialize", _initialOwner, _minChargeableSize, _globalSymbolsPerSecond, _pricePerSymbol) } -// Initialize is a paid mutator transaction binding the contract method 0x7a1ac61e. +// Initialize is a paid mutator transaction binding the contract method 0x4ec81af1. // -// Solidity: function initialize(address _initialOwner, uint256 _minChargeableSize, uint256 _globalBytesPerSecond) returns() -func (_ContractPaymentVault *ContractPaymentVaultSession) Initialize(_initialOwner common.Address, _minChargeableSize *big.Int, _globalBytesPerSecond *big.Int) (*types.Transaction, error) { - return _ContractPaymentVault.Contract.Initialize(&_ContractPaymentVault.TransactOpts, _initialOwner, _minChargeableSize, _globalBytesPerSecond) +// Solidity: function initialize(address _initialOwner, uint256 _minChargeableSize, uint256 _globalSymbolsPerSecond, uint256 _pricePerSymbol) returns() +func (_ContractPaymentVault *ContractPaymentVaultSession) Initialize(_initialOwner common.Address, _minChargeableSize *big.Int, _globalSymbolsPerSecond *big.Int, _pricePerSymbol *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.Initialize(&_ContractPaymentVault.TransactOpts, _initialOwner, _minChargeableSize, _globalSymbolsPerSecond, _pricePerSymbol) } -// Initialize is a paid mutator transaction binding the contract method 0x7a1ac61e. +// Initialize is a paid mutator transaction binding the contract method 0x4ec81af1. // -// Solidity: function initialize(address _initialOwner, uint256 _minChargeableSize, uint256 _globalBytesPerSecond) returns() -func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) Initialize(_initialOwner common.Address, _minChargeableSize *big.Int, _globalBytesPerSecond *big.Int) (*types.Transaction, error) { - return _ContractPaymentVault.Contract.Initialize(&_ContractPaymentVault.TransactOpts, _initialOwner, _minChargeableSize, _globalBytesPerSecond) +// Solidity: function initialize(address _initialOwner, uint256 _minChargeableSize, uint256 _globalSymbolsPerSecond, uint256 _pricePerSymbol) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) Initialize(_initialOwner common.Address, _minChargeableSize *big.Int, _globalSymbolsPerSecond *big.Int, _pricePerSymbol *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.Initialize(&_ContractPaymentVault.TransactOpts, _initialOwner, _minChargeableSize, _globalSymbolsPerSecond, _pricePerSymbol) } // RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. @@ -706,25 +737,25 @@ func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) RenounceOwne return _ContractPaymentVault.Contract.RenounceOwnership(&_ContractPaymentVault.TransactOpts) } -// SetGlobalBytesPerSec is a paid mutator transaction binding the contract method 0xe30c8806. +// SetGlobalSymbolsPerSecond is a paid mutator transaction binding the contract method 0xbfafe8bf. // -// Solidity: function setGlobalBytesPerSec(uint256 _globalBytesPerSecond) returns() -func (_ContractPaymentVault *ContractPaymentVaultTransactor) SetGlobalBytesPerSec(opts *bind.TransactOpts, _globalBytesPerSecond *big.Int) (*types.Transaction, error) { - return _ContractPaymentVault.contract.Transact(opts, "setGlobalBytesPerSec", _globalBytesPerSecond) +// Solidity: function setGlobalSymbolsPerSecond(uint256 _globalSymbolsPerSecond) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactor) SetGlobalSymbolsPerSecond(opts *bind.TransactOpts, _globalSymbolsPerSecond *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.contract.Transact(opts, "setGlobalSymbolsPerSecond", _globalSymbolsPerSecond) } -// SetGlobalBytesPerSec is a paid mutator transaction binding the contract method 0xe30c8806. +// SetGlobalSymbolsPerSecond is a paid mutator transaction binding the contract method 0xbfafe8bf. // -// Solidity: function setGlobalBytesPerSec(uint256 _globalBytesPerSecond) returns() -func (_ContractPaymentVault *ContractPaymentVaultSession) SetGlobalBytesPerSec(_globalBytesPerSecond *big.Int) (*types.Transaction, error) { - return _ContractPaymentVault.Contract.SetGlobalBytesPerSec(&_ContractPaymentVault.TransactOpts, _globalBytesPerSecond) +// Solidity: function setGlobalSymbolsPerSecond(uint256 _globalSymbolsPerSecond) returns() +func (_ContractPaymentVault *ContractPaymentVaultSession) SetGlobalSymbolsPerSecond(_globalSymbolsPerSecond *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.SetGlobalSymbolsPerSecond(&_ContractPaymentVault.TransactOpts, _globalSymbolsPerSecond) } -// SetGlobalBytesPerSec is a paid mutator transaction binding the contract method 0xe30c8806. +// SetGlobalSymbolsPerSecond is a paid mutator transaction binding the contract method 0xbfafe8bf. // -// Solidity: function setGlobalBytesPerSec(uint256 _globalBytesPerSecond) returns() -func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) SetGlobalBytesPerSec(_globalBytesPerSecond *big.Int) (*types.Transaction, error) { - return _ContractPaymentVault.Contract.SetGlobalBytesPerSec(&_ContractPaymentVault.TransactOpts, _globalBytesPerSecond) +// Solidity: function setGlobalSymbolsPerSecond(uint256 _globalSymbolsPerSecond) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) SetGlobalSymbolsPerSecond(_globalSymbolsPerSecond *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.SetGlobalSymbolsPerSecond(&_ContractPaymentVault.TransactOpts, _globalSymbolsPerSecond) } // SetMinChargeableSize is a paid mutator transaction binding the contract method 0xe60a8dd7. @@ -748,6 +779,27 @@ func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) SetMinCharge return _ContractPaymentVault.Contract.SetMinChargeableSize(&_ContractPaymentVault.TransactOpts, _minChargeableSize) } +// SetPricePerSymbol is a paid mutator transaction binding the contract method 0x38168850. +// +// Solidity: function setPricePerSymbol(uint256 _pricePerSymbol) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactor) SetPricePerSymbol(opts *bind.TransactOpts, _pricePerSymbol *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.contract.Transact(opts, "setPricePerSymbol", _pricePerSymbol) +} + +// SetPricePerSymbol is a paid mutator transaction binding the contract method 0x38168850. +// +// Solidity: function setPricePerSymbol(uint256 _pricePerSymbol) returns() +func (_ContractPaymentVault *ContractPaymentVaultSession) SetPricePerSymbol(_pricePerSymbol *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.SetPricePerSymbol(&_ContractPaymentVault.TransactOpts, _pricePerSymbol) +} + +// SetPricePerSymbol is a paid mutator transaction binding the contract method 0x38168850. +// +// Solidity: function setPricePerSymbol(uint256 _pricePerSymbol) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) SetPricePerSymbol(_pricePerSymbol *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.SetPricePerSymbol(&_ContractPaymentVault.TransactOpts, _pricePerSymbol) +} + // SetReservation is a paid mutator transaction binding the contract method 0x9aec8640. // // Solidity: function setReservation(address _account, (uint64,uint64,uint64,bytes,bytes) _reservation) returns() @@ -811,9 +863,30 @@ func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) Withdraw(_am return _ContractPaymentVault.Contract.Withdraw(&_ContractPaymentVault.TransactOpts, _amount) } -// ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator is returned from FilterGlobalBytesPerSecondUpdated and is used to iterate over the raw logs and unpacked data for GlobalBytesPerSecondUpdated events raised by the ContractPaymentVault contract. -type ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator struct { - Event *ContractPaymentVaultGlobalBytesPerSecondUpdated // Event containing the contract specifics and raw log +// WithdrawERC20 is a paid mutator transaction binding the contract method 0xa1db9782. +// +// Solidity: function withdrawERC20(address _token, uint256 _amount) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactor) WithdrawERC20(opts *bind.TransactOpts, _token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.contract.Transact(opts, "withdrawERC20", _token, _amount) +} + +// WithdrawERC20 is a paid mutator transaction binding the contract method 0xa1db9782. +// +// Solidity: function withdrawERC20(address _token, uint256 _amount) returns() +func (_ContractPaymentVault *ContractPaymentVaultSession) WithdrawERC20(_token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.WithdrawERC20(&_ContractPaymentVault.TransactOpts, _token, _amount) +} + +// WithdrawERC20 is a paid mutator transaction binding the contract method 0xa1db9782. +// +// Solidity: function withdrawERC20(address _token, uint256 _amount) returns() +func (_ContractPaymentVault *ContractPaymentVaultTransactorSession) WithdrawERC20(_token common.Address, _amount *big.Int) (*types.Transaction, error) { + return _ContractPaymentVault.Contract.WithdrawERC20(&_ContractPaymentVault.TransactOpts, _token, _amount) +} + +// ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator is returned from FilterGlobalSymbolsPerSecondUpdated and is used to iterate over the raw logs and unpacked data for GlobalSymbolsPerSecondUpdated events raised by the ContractPaymentVault contract. +type ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator struct { + Event *ContractPaymentVaultGlobalSymbolsPerSecondUpdated // 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 @@ -827,7 +900,7 @@ type ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator struct { // 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 *ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator) Next() bool { +func (it *ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -836,7 +909,7 @@ func (it *ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ContractPaymentVaultGlobalBytesPerSecondUpdated) + it.Event = new(ContractPaymentVaultGlobalSymbolsPerSecondUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -851,7 +924,7 @@ func (it *ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ContractPaymentVaultGlobalBytesPerSecondUpdated) + it.Event = new(ContractPaymentVaultGlobalSymbolsPerSecondUpdated) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -867,42 +940,42 @@ func (it *ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator) Error() error { +func (it *ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator) Close() error { +func (it *ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ContractPaymentVaultGlobalBytesPerSecondUpdated represents a GlobalBytesPerSecondUpdated event raised by the ContractPaymentVault contract. -type ContractPaymentVaultGlobalBytesPerSecondUpdated struct { +// ContractPaymentVaultGlobalSymbolsPerSecondUpdated represents a GlobalSymbolsPerSecondUpdated event raised by the ContractPaymentVault contract. +type ContractPaymentVaultGlobalSymbolsPerSecondUpdated struct { PreviousValue *big.Int NewValue *big.Int Raw types.Log // Blockchain specific contextual infos } -// FilterGlobalBytesPerSecondUpdated is a free log retrieval operation binding the contract event 0x8a2a96caad50bb77e6c390a954ed96a23dc59b9c8a7e2c6fdf243b34559c2346. +// FilterGlobalSymbolsPerSecondUpdated is a free log retrieval operation binding the contract event 0x33ec972d20d3bef7c2f239466a44f6c7335a4faf21f7b135c2b30138d71f8807. // -// Solidity: event GlobalBytesPerSecondUpdated(uint256 previousValue, uint256 newValue) -func (_ContractPaymentVault *ContractPaymentVaultFilterer) FilterGlobalBytesPerSecondUpdated(opts *bind.FilterOpts) (*ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator, error) { +// Solidity: event GlobalSymbolsPerSecondUpdated(uint256 previousValue, uint256 newValue) +func (_ContractPaymentVault *ContractPaymentVaultFilterer) FilterGlobalSymbolsPerSecondUpdated(opts *bind.FilterOpts) (*ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator, error) { - logs, sub, err := _ContractPaymentVault.contract.FilterLogs(opts, "GlobalBytesPerSecondUpdated") + logs, sub, err := _ContractPaymentVault.contract.FilterLogs(opts, "GlobalSymbolsPerSecondUpdated") if err != nil { return nil, err } - return &ContractPaymentVaultGlobalBytesPerSecondUpdatedIterator{contract: _ContractPaymentVault.contract, event: "GlobalBytesPerSecondUpdated", logs: logs, sub: sub}, nil + return &ContractPaymentVaultGlobalSymbolsPerSecondUpdatedIterator{contract: _ContractPaymentVault.contract, event: "GlobalSymbolsPerSecondUpdated", logs: logs, sub: sub}, nil } -// WatchGlobalBytesPerSecondUpdated is a free log subscription operation binding the contract event 0x8a2a96caad50bb77e6c390a954ed96a23dc59b9c8a7e2c6fdf243b34559c2346. +// WatchGlobalSymbolsPerSecondUpdated is a free log subscription operation binding the contract event 0x33ec972d20d3bef7c2f239466a44f6c7335a4faf21f7b135c2b30138d71f8807. // -// Solidity: event GlobalBytesPerSecondUpdated(uint256 previousValue, uint256 newValue) -func (_ContractPaymentVault *ContractPaymentVaultFilterer) WatchGlobalBytesPerSecondUpdated(opts *bind.WatchOpts, sink chan<- *ContractPaymentVaultGlobalBytesPerSecondUpdated) (event.Subscription, error) { +// Solidity: event GlobalSymbolsPerSecondUpdated(uint256 previousValue, uint256 newValue) +func (_ContractPaymentVault *ContractPaymentVaultFilterer) WatchGlobalSymbolsPerSecondUpdated(opts *bind.WatchOpts, sink chan<- *ContractPaymentVaultGlobalSymbolsPerSecondUpdated) (event.Subscription, error) { - logs, sub, err := _ContractPaymentVault.contract.WatchLogs(opts, "GlobalBytesPerSecondUpdated") + logs, sub, err := _ContractPaymentVault.contract.WatchLogs(opts, "GlobalSymbolsPerSecondUpdated") if err != nil { return nil, err } @@ -912,8 +985,8 @@ func (_ContractPaymentVault *ContractPaymentVaultFilterer) WatchGlobalBytesPerSe select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ContractPaymentVaultGlobalBytesPerSecondUpdated) - if err := _ContractPaymentVault.contract.UnpackLog(event, "GlobalBytesPerSecondUpdated", log); err != nil { + event := new(ContractPaymentVaultGlobalSymbolsPerSecondUpdated) + if err := _ContractPaymentVault.contract.UnpackLog(event, "GlobalSymbolsPerSecondUpdated", log); err != nil { return err } event.Raw = log @@ -934,12 +1007,12 @@ func (_ContractPaymentVault *ContractPaymentVaultFilterer) WatchGlobalBytesPerSe }), nil } -// ParseGlobalBytesPerSecondUpdated is a log parse operation binding the contract event 0x8a2a96caad50bb77e6c390a954ed96a23dc59b9c8a7e2c6fdf243b34559c2346. +// ParseGlobalSymbolsPerSecondUpdated is a log parse operation binding the contract event 0x33ec972d20d3bef7c2f239466a44f6c7335a4faf21f7b135c2b30138d71f8807. // -// Solidity: event GlobalBytesPerSecondUpdated(uint256 previousValue, uint256 newValue) -func (_ContractPaymentVault *ContractPaymentVaultFilterer) ParseGlobalBytesPerSecondUpdated(log types.Log) (*ContractPaymentVaultGlobalBytesPerSecondUpdated, error) { - event := new(ContractPaymentVaultGlobalBytesPerSecondUpdated) - if err := _ContractPaymentVault.contract.UnpackLog(event, "GlobalBytesPerSecondUpdated", log); err != nil { +// Solidity: event GlobalSymbolsPerSecondUpdated(uint256 previousValue, uint256 newValue) +func (_ContractPaymentVault *ContractPaymentVaultFilterer) ParseGlobalSymbolsPerSecondUpdated(log types.Log) (*ContractPaymentVaultGlobalSymbolsPerSecondUpdated, error) { + event := new(ContractPaymentVaultGlobalSymbolsPerSecondUpdated) + if err := _ContractPaymentVault.contract.UnpackLog(event, "GlobalSymbolsPerSecondUpdated", log); err != nil { return nil, err } event.Raw = log @@ -1514,6 +1587,141 @@ func (_ContractPaymentVault *ContractPaymentVaultFilterer) ParseOwnershipTransfe return event, nil } +// ContractPaymentVaultPricePerSymbolUpdatedIterator is returned from FilterPricePerSymbolUpdated and is used to iterate over the raw logs and unpacked data for PricePerSymbolUpdated events raised by the ContractPaymentVault contract. +type ContractPaymentVaultPricePerSymbolUpdatedIterator struct { + Event *ContractPaymentVaultPricePerSymbolUpdated // 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 *ContractPaymentVaultPricePerSymbolUpdatedIterator) 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(ContractPaymentVaultPricePerSymbolUpdated) + 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(ContractPaymentVaultPricePerSymbolUpdated) + 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 *ContractPaymentVaultPricePerSymbolUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractPaymentVaultPricePerSymbolUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractPaymentVaultPricePerSymbolUpdated represents a PricePerSymbolUpdated event raised by the ContractPaymentVault contract. +type ContractPaymentVaultPricePerSymbolUpdated struct { + PreviousValue *big.Int + NewValue *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPricePerSymbolUpdated is a free log retrieval operation binding the contract event 0x590fdc6eef6046429b66dbdf71f0317122a79e082956279f70104cd907112c67. +// +// Solidity: event PricePerSymbolUpdated(uint256 previousValue, uint256 newValue) +func (_ContractPaymentVault *ContractPaymentVaultFilterer) FilterPricePerSymbolUpdated(opts *bind.FilterOpts) (*ContractPaymentVaultPricePerSymbolUpdatedIterator, error) { + + logs, sub, err := _ContractPaymentVault.contract.FilterLogs(opts, "PricePerSymbolUpdated") + if err != nil { + return nil, err + } + return &ContractPaymentVaultPricePerSymbolUpdatedIterator{contract: _ContractPaymentVault.contract, event: "PricePerSymbolUpdated", logs: logs, sub: sub}, nil +} + +// WatchPricePerSymbolUpdated is a free log subscription operation binding the contract event 0x590fdc6eef6046429b66dbdf71f0317122a79e082956279f70104cd907112c67. +// +// Solidity: event PricePerSymbolUpdated(uint256 previousValue, uint256 newValue) +func (_ContractPaymentVault *ContractPaymentVaultFilterer) WatchPricePerSymbolUpdated(opts *bind.WatchOpts, sink chan<- *ContractPaymentVaultPricePerSymbolUpdated) (event.Subscription, error) { + + logs, sub, err := _ContractPaymentVault.contract.WatchLogs(opts, "PricePerSymbolUpdated") + 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(ContractPaymentVaultPricePerSymbolUpdated) + if err := _ContractPaymentVault.contract.UnpackLog(event, "PricePerSymbolUpdated", 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 +} + +// ParsePricePerSymbolUpdated is a log parse operation binding the contract event 0x590fdc6eef6046429b66dbdf71f0317122a79e082956279f70104cd907112c67. +// +// Solidity: event PricePerSymbolUpdated(uint256 previousValue, uint256 newValue) +func (_ContractPaymentVault *ContractPaymentVaultFilterer) ParsePricePerSymbolUpdated(log types.Log) (*ContractPaymentVaultPricePerSymbolUpdated, error) { + event := new(ContractPaymentVaultPricePerSymbolUpdated) + if err := _ContractPaymentVault.contract.UnpackLog(event, "PricePerSymbolUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + // ContractPaymentVaultReservationUpdatedIterator is returned from FilterReservationUpdated and is used to iterate over the raw logs and unpacked data for ReservationUpdated events raised by the ContractPaymentVault contract. type ContractPaymentVaultReservationUpdatedIterator struct { Event *ContractPaymentVaultReservationUpdated // Event containing the contract specifics and raw log diff --git a/contracts/src/interfaces/IPaymentVault.sol b/contracts/src/interfaces/IPaymentVault.sol index e5ce0c79e..84993306b 100644 --- a/contracts/src/interfaces/IPaymentVault.sol +++ b/contracts/src/interfaces/IPaymentVault.sol @@ -4,11 +4,11 @@ pragma solidity ^0.8.9; interface IPaymentVault { struct Reservation { - uint64 dataRate; // Bandwidth being reserved - uint64 startTimestamp; // timestamp of epoch where reservation begins - uint64 endTimestamp; // timestamp of epoch where reservation ends - bytes quorumNumbers; // quorum numbers in an ordered bytes array - bytes quorumSplits; // quorum splits in a bytes array that correspond to the quorum numbers + uint64 symbolsPerSecond; // Number of symbols reserved per second + uint64 startTimestamp; // timestamp of epoch where reservation begins + uint64 endTimestamp; // timestamp of epoch where reservation ends + bytes quorumNumbers; // quorum numbers in an ordered bytes array + bytes quorumSplits; // quorum splits in a bytes array that correspond to the quorum numbers } /// @notice Emitted when a reservation is created or updated @@ -17,8 +17,10 @@ interface IPaymentVault { event OnDemandPaymentUpdated(address indexed account, uint256 onDemandPayment, uint256 totalDeposit); /// @notice Emitted when minChargeableSize is updated event MinChargeableSizeUpdated(uint256 previousValue, uint256 newValue); - /// @notice Emitted when globalBytesPerSecond is updated - event GlobalBytesPerSecondUpdated(uint256 previousValue, uint256 newValue); + /// @notice Emitted when globalSymbolsPerSecond is updated + event GlobalSymbolsPerSecondUpdated(uint256 previousValue, uint256 newValue); + /// @notice Emitted when pricePerSymbol is updated + event PricePerSymbolUpdated(uint256 previousValue, uint256 newValue); /** * @notice This function is called by EigenDA governance to store reservations diff --git a/contracts/src/payments/PaymentVault.sol b/contracts/src/payments/PaymentVault.sol index f1db2cb1b..39fb86562 100644 --- a/contracts/src/payments/PaymentVault.sol +++ b/contracts/src/payments/PaymentVault.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.9; import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol"; import {PaymentVaultStorage} from "./PaymentVaultStorage.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Entrypoint for making reservations and on demand payments for EigenDA. @@ -25,11 +26,13 @@ contract PaymentVault is PaymentVaultStorage, OwnableUpgradeable { function initialize( address _initialOwner, uint256 _minChargeableSize, - uint256 _globalBytesPerSecond + uint256 _globalSymbolsPerSecond, + uint256 _pricePerSymbol ) public initializer { transferOwnership(_initialOwner); minChargeableSize = _minChargeableSize; - globalBytesPerSecond = _globalBytesPerSecond; + globalSymbolsPerSecond = _globalSymbolsPerSecond; + pricePerSymbol = _pricePerSymbol; } /** @@ -62,9 +65,14 @@ contract PaymentVault is PaymentVaultStorage, OwnableUpgradeable { minChargeableSize = _minChargeableSize; } - function setGlobalBytesPerSec(uint256 _globalBytesPerSecond) external onlyOwner { - emit GlobalBytesPerSecondUpdated(globalBytesPerSecond, _globalBytesPerSecond); - globalBytesPerSecond = _globalBytesPerSecond; + function setGlobalSymbolsPerSecond(uint256 _globalSymbolsPerSecond) external onlyOwner { + emit GlobalSymbolsPerSecondUpdated(globalSymbolsPerSecond, _globalSymbolsPerSecond); + globalSymbolsPerSecond = _globalSymbolsPerSecond; + } + + function setPricePerSymbol(uint256 _pricePerSymbol) external onlyOwner { + emit PricePerSymbolUpdated(pricePerSymbol, _pricePerSymbol); + pricePerSymbol = _pricePerSymbol; } function withdraw(uint256 _amount) external onlyOwner { @@ -72,6 +80,10 @@ contract PaymentVault is PaymentVaultStorage, OwnableUpgradeable { require(success); } + function withdrawERC20(address _token, uint256 _amount) external onlyOwner { + IERC20(_token).transfer(owner(), _amount); + } + function _checkQuorumSplit(bytes memory _quorumNumbers, bytes memory _quorumSplits) internal pure { require(_quorumNumbers.length == _quorumSplits.length, "arrays must have the same length"); uint8 total; diff --git a/contracts/src/payments/PaymentVaultStorage.sol b/contracts/src/payments/PaymentVaultStorage.sol index ab64d08f2..977b85209 100644 --- a/contracts/src/payments/PaymentVaultStorage.sol +++ b/contracts/src/payments/PaymentVaultStorage.sol @@ -24,15 +24,17 @@ abstract contract PaymentVaultStorage is IPaymentVault { /// @notice minimum chargeable size for on-demand payments uint256 public minChargeableSize; - /// @notice maximum number of bytes to disperse per second network-wide for on-demand payments (applied to only ETH and EIGEN) - uint256 public globalBytesPerSecond; + /// @notice maximum number of symbols to disperse per second network-wide for on-demand payments (applied to only ETH and EIGEN) + uint256 public globalSymbolsPerSecond; + /// @notice price per symbol in wei + uint256 public pricePerSymbol; /// @notice timestamp of the last price update - uint256 public lastPriceUpdateTime; + uint256 public lastPriceUpdateTime; /// @notice mapping from user address to current reservation mapping(address => Reservation) public reservations; /// @notice mapping from user address to current on-demand payment mapping(address => uint256) public onDemandPayments; - uint256[45] private __GAP; + uint256[44] private __GAP; } \ No newline at end of file