Address Contract Partially Verified
Address
0xFc1a4a1eaF9e80FA5380ce45d9D12bdF7A81ca18
Balance
0 ETH
Nonce
3
Code Size
20981 bytes
Creator
0x0cCF1498...f21e at tx 0xb42d818e...48213f
Indexed Transactions
0
Contract Bytecode
20981 bytes
0x60806040523480156200001157600080fd5b5060043610620001b45760003560e01c80638b30002911620000f9578063b88a89f71162000099578063d1ea6ce0116200006f578063d1ea6ce01462000631578063eff7319f146200063b578063f90267c4146200065b57620001b4565b8063b88a89f71462000552578063ce9b79ad146200057b578063cf6a4763146200058557620001b4565b80639da0700f11620000cf5780639da0700f14620004f0578063ae4d0bed146200051f578063b04e8868146200052957620001b4565b80638b300029146200044a5780638cbbdf8614620004955780639907288c14620004c757620001b4565b806354fd4d50116200016557806367bca235116200013b57806367bca235146200040d57806375b59c7f14620004175780637bb40aaf146200044057620001b4565b806354fd4d50146200038757806357b4ef6b14620003a7578063606bb62e14620003d057620001b4565b80632c7f64d4116200019b5780632c7f64d4146200021d5780633b5ecefa14620002955780633eb535e914620002e657620001b4565b80631844ec0114620001b95780631ce9ec3314620001f4575b600080fd5b620001e260048036036020811015620001d157600080fd5b50356001600160a01b031662000684565b60408051918252519081900360200190f35b620001e2600480360360208110156200020c57600080fd5b50356001600160a01b031662000818565b62000293600480360360208110156200023557600080fd5b8101906020810181356401000000008111156200025157600080fd5b8201836020820111156200026457600080fd5b803590602001918460018302840111640100000000831117156200028757600080fd5b50909250905062000931565b005b620002bb60048036036040811015620002ad57600080fd5b508035906020013562000dbb565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6200030f60048036036020811015620002fe57600080fd5b50356001600160a01b031662001057565b6040805160208082528351818301528351919283929083019185019080838360005b838110156200034b57818101518382015260200162000331565b50505050905090810190601f168015620003795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b62000391620010c4565b6040805160ff9092168252519081900360200190f35b620001e260048036036020811015620003bf57600080fd5b50356001600160a01b0316620010cd565b620003f960048036036020811015620003e857600080fd5b50356001600160a01b031662001134565b604080519115158252519081900360200190f35b620001e26200119b565b62000293600480360360208110156200042f57600080fd5b50356001600160a01b031662001202565b62000293620014cd565b62000479600480360360408110156200046257600080fd5b506001600160a01b03813516906020013562001980565b604080516001600160a01b039092168252519081900360200190f35b6200047960048036036040811015620004ad57600080fd5b5080356001600160a01b0316906020013560ff1662001aa2565b6200029360048036036020811015620004df57600080fd5b50356001600160a01b03166200233a565b62000479600480360360408110156200050857600080fd5b506001600160a01b038135169060200135620025ef565b620001e2620026db565b62000293600480360360208110156200054157600080fd5b50356001600160a01b031662002804565b620001e2600480360360208110156200056a57600080fd5b50356001600160a01b031662002a7d565b620001e262002ae4565b62000479600480360360208110156200059d57600080fd5b810190602081018135640100000000811115620005b957600080fd5b820183602082011115620005cc57600080fd5b80359060200191846001830284011164010000000083111715620005ef57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955062002c84945050505050565b620001e262002ce6565b62000479600480360360208110156200065357600080fd5b503562002d48565b620001e2600480360360208110156200067357600080fd5b50356001600160a01b031662002e20565b600080620006c76040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b90506000620007308460405160200180807f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e740000815250601e01826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012062002fc5565b90506000826001600160a01b031663c9d6fee98660405160200180807f6e6f64652e6d696e69706f6f6c732e696e646578000000000000000000000000815250601401826001600160a01b031660601b8152601401915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620007d357600080fd5b505afa158015620007e8573d6000803e3d6000fd5b505050506040513d6020811015620007ff57600080fd5b505190506200080f818362003054565b95945050505050565b6000806200085b6040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b9050806001600160a01b031663c9d6fee98460405160200180807f6e6f64652e6d696e69706f6f6c732e696e646578000000000000000000000000815250601401826001600160a01b031660601b8152601401915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620008fc57600080fd5b505afa15801562000911573d6000803e3d6000fd5b505050506040513d60208110156200092857600080fd5b50519392505050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e6167657200000000000000000000008152503062000a0a8260405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083835b60208310620009c95780518252601f199092019160209182019101620009a8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120620030b2565b6001600160a01b0316816001600160a01b03161462000a70576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012062000acb906200310d565b62000b1d576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b600062000b5f6040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b905060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000ba257600080fd5b505afa15801562000bb7573d6000803e3d6000fd5b505050506040513d602081101562000bce57600080fd5b5051604080517f6d696e69706f6f6c2e7075626b657900000000000000000000000000000000006020828101919091523360601b602f83015282516023818403018152604383018085528151918301919091206063601f8e01849004909302840183019094528b815293945062000c6093918c918c918291018382808284376000920191909152506200316892505050565b62000cc3888860405160200180807f76616c696461746f722e6d696e69706f6f6c0000000000000000000000000000815250601201838380828437808301925050509250505060405160208183030381529060405280519060200120336200324e565b604080517f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e646578006020808301919091527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606085901b16603f8301528251603381840301815260538301808552815191909201207f8892716600000000000000000000000000000000000000000000000000000000909152605782015233607782015290516001600160a01b03851691638892716691609780830192600092919082900301818387803b15801562000d9857600080fd5b505af115801562000dad573d6000803e3d6000fd5b505050505050505050505050565b60008060008060008062000e046040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b604080517f6d696e69706f6f6c732e696e64657800000000000000000000000000000000006020808301919091528251808303600f018152602f9092019092528051910120909150600062000e58620026db565b9050600062000e688b8b620032be565b90508181118062000e77575089155b1562000e805750805b8a5b8181101562001048576000856001600160a01b031663f3358a3a86846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562000eda57600080fd5b505afa15801562000eef573d6000803e3d6000fd5b505050506040513d602081101562000f0657600080fd5b5051604080517f4e69d56000000000000000000000000000000000000000000000000000000000815290519192506000916001600160a01b03841691634e69d560916004808301926020929190829003018186803b15801562000f6857600080fd5b505afa15801562000f7d573d6000803e3d6000fd5b505050506040513d602081101562000f9457600080fd5b50519050600081600481111562000fa757fe5b141562000fba576001909b019a6200103d565b600181600481111562000fc957fe5b141562000fdc576001909a01996200103d565b600281600481111562000feb57fe5b141562000ffe576001909901986200103d565b60038160048111156200100d57fe5b141562001020576001909801976200103d565b60048160048111156200102f57fe5b14156200103d576001909701965b505060010162000e82565b50505050509295509295909350565b6060620010be8260405160200180807f6d696e69706f6f6c2e7075626b65790000000000000000000000000000000000815250600f01826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012062003320565b92915050565b60005460ff1681565b6000620010be8260405160200180807f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e7400000000815250601c01826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012062002fc5565b6000620010be8260405160200180807f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815250600f01826001600160a01b031660601b8152601401915050604051602081830303815290604052805190602001206200310d565b60408051808201909152601781527f6d696e69706f6f6c732e7374616b696e672e636f756e740000000000000000006020909101526000620011fd7f3441dc4461171402746c7de6880184ae1bfbc9def01a5bd7508263456c14441962002fc5565b905090565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030620012998260405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b6001600160a01b0316816001600160a01b031614620012ff576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f84015283516023818503018152604390930190935281519101206200135a906200310d565b620013ac576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b604080517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e74000000006020808301919091527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b16603c830152825160308184030181526050909201909252805191012060006200142a8262002fc5565b905062001444826200143e83600162003054565b62003485565b604080517f6d696e69706f6f6c732e7374616b696e672e636f756e7400000000000000000060208083019190915282518083036017018152603790920190925280519101206000620014968262002fc5565b9050620014aa826200143e83600162003054565b620014c38884620014bd81600162003054565b620034f2565b5050505050505050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030620015648260405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b6001600160a01b0316816001600160a01b031614620015ca576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012062001625906200310d565b62001677576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b6000620016b96040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b905060003390506000816001600160a01b03166370dabc9e6040518163ffffffff1660e01b815260040160206040518083038186803b158015620016fc57600080fd5b505afa15801562001711573d6000803e3d6000fd5b505050506040513d60208110156200172857600080fd5b5051604080517f6d696e69706f6f6c2e65786973747300000000000000000000000000000000006020828101919091523360601b602f83015282516023818403018152604390920190925280519101209091506200178890600062003a9d565b604080517f6d696e69706f6f6c732e696e64657800000000000000000000000000000000006020808301919091528251808303600f018152602f8301808552815191909201207ff79b36ad00000000000000000000000000000000000000000000000000000000909152603382015233605382015290516001600160a01b0385169163f79b36ad91607380830192600092919082900301818387803b1580156200183157600080fd5b505af115801562001846573d6000803e3d6000fd5b5050604080517f6e6f64652e6d696e69706f6f6c732e696e6465780000000000000000000000006020808301919091527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606087901b1660348301528251602881840301815260488301808552815191909201207ff79b36ad00000000000000000000000000000000000000000000000000000000909152604c82015233606c82015290516001600160a01b038716935063f79b36ad9250608c80830192600092919082900301818387803b1580156200191f57600080fd5b505af115801562001934573d6000803e3d6000fd5b50506040805142815290516001600160a01b03851693503392507f3097cb0f536cd88115b814915d7030d2fe958943357cd2b1a9e1dba8a673ec699181900360200190a3505050505050565b600080620019c36040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b9050806001600160a01b031663f3358a3a8560405160200180807f6e6f64652e6d696e69706f6f6c732e696e646578000000000000000000000000815250601401826001600160a01b031660601b815260140191505060405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562001a6c57600080fd5b505afa15801562001a81573d6000803e3d6000fd5b505050506040513d602081101562001a9857600080fd5b5051949350505050565b60006040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e6167657200000000000000000000008152503062001b3b8260405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b6001600160a01b0316816001600160a01b03161462001ba1576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b6040518060400160405280601181526020017f726f636b65744e6f64654465706f7369740000000000000000000000000000008152503362001c388260405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b6001600160a01b0316816001600160a01b03161462001c9e576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b600062001ce06040518060400160405280601181526020017f726f636b65744e6f64655374616b696e6700000000000000000000000000000081525062002f04565b9050600062001d246040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b9050816001600160a01b03166390f7ff4c8a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801562001d7457600080fd5b505afa15801562001d89573d6000803e3d6000fd5b505050506040513d602081101562001da057600080fd5b505162001dad8a62000684565b1062001deb5760405162461bcd60e51b81526004018080602001828103825260428152602001806200517e6042913960600191505060405180910390fd5b600062001e116040518060600160405280602181526020016200513c6021913962002f04565b9050600062001e1f62002ae4565b9050816001600160a01b0316636d4f8d3d6040518163ffffffff1660e01b815260040160206040518083038186803b15801562001e5b57600080fd5b505afa15801562001e70573d6000803e3d6000fd5b505050506040513d602081101562001e8757600080fd5b505162001e96826001620032be565b111562001eea576040805162461bcd60e51b815260206004820152601d60248201527f476c6f62616c206d696e69706f6f6c206c696d69742072656163686564000000604482015290519081900360640190fd5b505060008060019054906101000a90046001600160a01b03168a8a60405162001f139062003c3f565b80846001600160a01b03168152602001836001600160a01b0316815260200182600381111562001f3f57fe5b81526020019350505050604051809103906000f08015801562001f66573d6000803e3d6000fd5b509050600081905062001fd58260405160200180807f6d696e69706f6f6c2e6578697374730000000000000000000000000000000000815250600f01826001600160a01b031660601b815260140191505060405160208183030381529060405280519060200120600162003a9d565b826001600160a01b0316638892716660405160200180807f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000815250600f01905060405160208183030381529060405280519060200120846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156200207357600080fd5b505af115801562002088573d6000803e3d6000fd5b50505050826001600160a01b031663889271668c60405160200180807f6e6f64652e6d696e69706f6f6c732e696e646578000000000000000000000000815250601401826001600160a01b031660601b815260140191505060405160208183030381529060405280519060200120846040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156200213e57600080fd5b505af115801562002153573d6000803e3d6000fd5b506003925062002161915050565b8a60038111156200216e57fe5b141562002224576000620021b76040518060400160405280601481526020017f726f636b657444414f4e6f64655472757374656400000000000000000000000081525062002f04565b9050806001600160a01b03166372043ec48d6040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156200220957600080fd5b505af11580156200221e573d6000803e3d6000fd5b50505050505b8a6001600160a01b0316826001600160a01b03167f08b4b91bafaf992145c5dd7e098dfcdb32f879714c154c651c2758a44c7aeae4426040518082815260200191505060405180910390a3620022af6040518060400160405280601381526020017f726f636b65744d696e69706f6f6c51756575650000000000000000000000000081525062002f04565b6001600160a01b031663b2e5fe9b8b846040518363ffffffff1660e01b815260040180836003811115620022df57fe5b8152602001826001600160a01b0316815260200192505050600060405180830381600087803b1580156200231257600080fd5b505af115801562002327573d6000803e3d6000fd5b50929d9c50505050505050505050505050565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e61676572000000000000000000000081525030620023d18260405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b6001600160a01b0316816001600160a01b03161462002437576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f840152835160238185030181526043909301909352815191012062002492906200310d565b620024e4576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b604080517f6e6f64652e6d696e69706f6f6c732e7374616b696e672e636f756e74000000006020808301919091527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b16603c83015282516030818403018152605090920190925280519101206000620025628262002fc5565b905062002576826200143e836001620032be565b604080517f6d696e69706f6f6c732e7374616b696e672e636f756e7400000000000000000060208083019190915282518083036017018152603790920190925280519101206000620025c88262002fc5565b9050620025dc826200143e836001620032be565b620014c38884620014bd816001620032be565b600080620026326040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b9050806001600160a01b031663f3358a3a8560405160200180807f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e64657800815250601f01826001600160a01b031660601b815260140191505060405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562001a6c57600080fd5b6000806200271e6040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b604080518082018252600f81527f6d696e69706f6f6c732e696e646578000000000000000000000000000000000060209182015281517fc9d6fee90000000000000000000000000000000000000000000000000000000081527ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a9184600482015291519293506001600160a01b0384169263c9d6fee9926024808201939291829003018186803b158015620027d057600080fd5b505afa158015620027e5573d6000803e3d6000fd5b505050506040513d6020811015620027fc57600080fd5b505191505090565b6040518060400160405280601581526020017f726f636b65744d696e69706f6f6c4d616e616765720000000000000000000000815250306200289b8260405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b6001600160a01b0316816001600160a01b03161462002901576040805162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206f72206f7574646174656420636f6e747261637400000000604482015290519081900360640190fd5b604080517f6d696e69706f6f6c2e657869737473000000000000000000000000000000000060208083019190915233606081901b602f84015283516023818503018152604390930190935281519101206200295c906200310d565b620029ae576040805162461bcd60e51b815260206004820152601060248201527f496e76616c6964206d696e69706f6f6c00000000000000000000000000000000604482015290519081900360640190fd5b62002a158460405160200180807f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e740000815250601e01826001600160a01b031660601b815260140191505060405160208183030381529060405280519060200120600162003b0b565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e740000000000000060209091015262002a777f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d2600162003b0b565b50505050565b6000620010be8260405160200180807f6e6f64652e6d696e69706f6f6c732e66696e616c697365642e636f756e740000815250601e01826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012062002fc5565b60008062002b276040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b604080518082018252600f81527f6d696e69706f6f6c732e696e646578000000000000000000000000000000000060209182015281517fc9d6fee90000000000000000000000000000000000000000000000000000000081527ffd351ca1580febcf3f7f5a9bf9fd8dff9e6da5ca4df400be6b63fcdc2f2a9184600482015291519293506000926001600160a01b0385169263c9d6fee9926024808301939192829003018186803b15801562002bdc57600080fd5b505afa15801562002bf1573d6000803e3d6000fd5b505050506040513d602081101562002c0857600080fd5b505160408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101529050600062002c6e7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d262002fc5565b905062002c7c828262003054565b935050505090565b6000620010be8260405160200180807f76616c696461746f722e6d696e69706f6f6c0000000000000000000000000000815250601201828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b60408051808201909152601981527f6d696e69706f6f6c732e66696e616c697365642e636f756e74000000000000006020909101526000620011fd7f7600e27d933b4f22ce3529323416023ac97f47a7481431772c019790c3ca57d262002fc5565b60008062002d8b6040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b9050806001600160a01b031663f3358a3a60405160200180807f6d696e69706f6f6c732e696e6465780000000000000000000000000000000000815250600f01905060405160208183030381529060405280519060200120856040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015620008fc57600080fd5b60008062002e636040518060400160405280601181526020017f6164647265737353657453746f7261676500000000000000000000000000000081525062002f04565b9050806001600160a01b031663c9d6fee98460405160200180807f6e6f64652e6d696e69706f6f6c732e76616c69646174696e672e696e64657800815250601f01826001600160a01b031660601b8152601401915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620008fc57600080fd5b60008062002f678360405160200180807f636f6e74726163742e6164647265737300000000000000000000000000000000815250601001828051906020019080838360208310620009c95780518252601f199092019160209182019101620009a8565b90506001600160a01b038116620010be576040805162461bcd60e51b815260206004820152601260248201527f436f6e7472616374206e6f7420666f756e640000000000000000000000000000604482015290519081900360640190fd5b60008060019054906101000a90046001600160a01b03166001600160a01b031663bd02d0f5836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200302057600080fd5b505afa15801562003035573d6000803e3d6000fd5b505050506040513d60208110156200304c57600080fd5b505192915050565b600082821115620030ac576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008060019054906101000a90046001600160a01b03166001600160a01b03166321f8a721836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200302057600080fd5b60008060019054906101000a90046001600160a01b03166001600160a01b0316637ae1cfca836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200302057600080fd5b600060019054906101000a90046001600160a01b03166001600160a01b0316632e28d08483836040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015620031e2578181015183820152602001620031c8565b50505050905090810190601f168015620032105780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156200323157600080fd5b505af115801562003246573d6000803e3d6000fd5b505050505050565b60008054604080517fca446dd9000000000000000000000000000000000000000000000000000000008152600481018690526001600160a01b03858116602483015291516101009093049091169263ca446dd99260448084019382900301818387803b1580156200323157600080fd5b60008282018381101562003319576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60008054604080517fc031a1800000000000000000000000000000000000000000000000000000000081526004810185905290516060936101009093046001600160a01b03169263c031a1809260248082019391829003018186803b1580156200338957600080fd5b505afa1580156200339e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015620033c857600080fd5b8101908080516040519392919084640100000000821115620033e957600080fd5b908301906020820185811115620033ff57600080fd5b82516401000000008111828201881017156200341a57600080fd5b82525081516020918201929091019080838360005b83811015620034495781810151838201526020016200342f565b50505050905090810190601f168015620034775780820380516001836020036101000a031916815260200191505b506040525050509050919050565b60008054604080517fe2a4853a000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263e2a4853a9260448084019382900301818387803b1580156200323157600080fd5b6000620035346040518060400160405280601381526020017f726f636b65744e6574776f726b5072696365730000000000000000000000000081525062002f04565b905060006200355c6040518060600160405280602181526020016200513c6021913962002f04565b90506000620035a06040518060400160405280601d81526020017f726f636b657444414f50726f746f636f6c53657474696e67734e6f646500000081525062002f04565b90506000620035e46040518060400160405280601181526020017f726f636b65744e6f64655374616b696e6700000000000000000000000000000081525062002f04565b9050836001600160a01b03166337ab50046040518163ffffffff1660e01b815260040160206040518083038186803b1580156200362057600080fd5b505afa15801562003635573d6000803e3d6000fd5b505050506040513d60208110156200364c57600080fd5b5051620036a0576040805162461bcd60e51b815260206004820152601b60248201527f4e6574776f726b206973206e6f7420696e20636f6e73656e7375730000000000604482015290519081900360640190fd5b6000816001600160a01b0316639961cee4896040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015620036f057600080fd5b505afa15801562003705573d6000803e3d6000fd5b505050506040513d60208110156200371c57600080fd5b5051604080517f1e72ba86000000000000000000000000000000000000000000000000000000008152905191925060009162003841916001600160a01b03871691631e72ba8691600480820192602092909190829003018186803b1580156200378457600080fd5b505afa15801562003799573d6000803e3d6000fd5b505050506040513d6020811015620037b057600080fd5b5051604080517f162adbfd00000000000000000000000000000000000000000000000000000000815290516001600160a01b0389169163162adbfd916004808301926020929190829003018186803b1580156200380c57600080fd5b505afa15801562003821573d6000803e3d6000fd5b505050506040513d60208110156200383857600080fd5b50519062003b78565b90506000620038c4876001600160a01b031663724d4a096040518163ffffffff1660e01b815260040160206040518083038186803b1580156200388357600080fd5b505afa15801562003898573d6000803e3d6000fd5b505050506040513d6020811015620038af57600080fd5b5051620038bd848c62003b78565b9062003bd6565b9050600062003940886001600160a01b031663724d4a096040518163ffffffff1660e01b815260040160206040518083038186803b1580156200390657600080fd5b505afa1580156200391b573d6000803e3d6000fd5b505050506040513d60208110156200393257600080fd5b5051620038bd858c62003b78565b9050888a1115620039fd578084116200396157505050505050505062003a98565b60006200396f838362003054565b905060006200397f868462003054565b9050818111156200398d5750805b896001600160a01b031663052e5640826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015620039d457600080fd5b505af1158015620039e9573d6000803e3d6000fd5b505050505050505050505050505062003a98565b8989111562003a8f5781841162003a1c57505050505050505062003a98565b600062003a2a828462003054565b9050600062003a3a868562003054565b90508181111562003a485750805b896001600160a01b031663b58d89d3826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015620039d457600080fd5b50505050505050505b505050565b60008054604080517fabfdcced00000000000000000000000000000000000000000000000000000000815260048101869052841515602482015290516101009092046001600160a01b03169263abfdcced9260448084019382900301818387803b1580156200323157600080fd5b60008054604080517fadb353dc000000000000000000000000000000000000000000000000000000008152600481018690526024810185905290516101009092046001600160a01b03169263adb353dc9260448084019382900301818387803b1580156200323157600080fd5b60008262003b8957506000620010be565b8282028284828162003b9757fe5b0414620033195760405162461bcd60e51b81526004018080602001828103825260218152602001806200515d6021913960400191505060405180910390fd5b600080821162003c2d576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838162003c3757fe5b049392505050565b6114ee8062003c4e8339019056fe6080604052600080546001600160a01b0319169055600c805460ff19169055600f805460ff60a01b191690553480156200003857600080fd5b50604051620014ee380380620014ee833981810160405260608110156200005e57600080fd5b50805160208201516040909201519091906001600160a01b038316620000cb576040805162461bcd60e51b815260206004820152601760248201527f496e76616c69642073746f726167652061646472657373000000000000000000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b038516178155600f805460ff60a01b1916600160a01b17905560408051808201909152601681527f726f636b65744d696e69706f6f6c44656c656761746500000000000000000000602082015262000138906200035c565b600c8054610100600160a81b0319166101006001600160a01b0384160217905590506200016581620004ca565b620001b7576040805162461bcd60e51b815260206004820181905260248201527f44656c656761746520636f6e747261637420646f6573206e6f74206578697374604482015290519081900360640190fd5b600080826001600160a01b031685856003811115620001d257fe5b604080516001600160a01b03909316602484015260ff90911660448084019190915281518084039091018152606490920181526020820180516001600160e01b031663dd0ddfcf60e01b17815290518251909182918083835b602083106200024c5780518252601f1990920191602091820191016200022b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114620002ae576040519150601f19603f3d011682016040523d82523d6000602084013e620002b3565b606091505b5091509150816200035057620002c981620004d6565b60405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562000314578181015183820152602001620002fa565b50505050905090810190601f168015620003425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050505050620005f6565b60008060008054906101000a90046001600160a01b03166001600160a01b03166321f8a7218460405160200180806f636f6e74726163742e6164647265737360801b81525060100182805190602001908083835b60208310620003d15780518252601f199092019160209182019101620003b0565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200044157600080fd5b505afa15801562000456573d6000803e3d6000fd5b505050506040513d60208110156200046d57600080fd5b505190506001600160a01b038116620004c2576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081b9bdd08199bdd5b9960721b604482015290519081900360640190fd5b90505b919050565b3b63ffffffff16151590565b60606044825110156200051e575060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c790000006020820152620004c5565b60048201805190926024019060208110156200053957600080fd5b81019080805160405193929190846401000000008211156200055a57600080fd5b9083019060208201858111156200057057600080fd5b82516401000000008111828201881017156200058b57600080fd5b82525081516020918201929091019080838360005b83811015620005ba578181015183820152602001620005a0565b50505050905090810190601f168015620005e85780820380516001836020036101000a031916815260200191505b506040525050509050919050565b610ee880620006066000396000f3fe6080604052600436106100745760003560e01c80638dfe8b2d1161004e5780638dfe8b2d1461034f5780638ee7d0cb14610364578063bc7f3b501461038d578063be1d1d32146103a2576100b4565b80631dcef0bf146102ce57806326d1c0681461030c57806352def61d14610323576100b4565b366100b45760408051348152426020820152815133927f1d57945c1033a96907a78f6e0ebf6a03815725dac25f33cc806558670344ac88928290030190a2005b600c546000903690606090839060ff166100eb57600c54610100900473ffffffffffffffffffffffffffffffffffffffff16610129565b6101296040518060400160405280601681526020017f726f636b65744d696e69706f6f6c44656c6567617465000000000000000000008152506103b7565b905061013481610596565b61019f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f44656c656761746520636f6e747261637420646f6573206e6f74206578697374604482015290519081900360640190fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1686866040518083838082843760405192019450600093509091505080830381855af49150503d806000811461020a576040519150601f19603f3d011682016040523d82523d6000602084013e61020f565b606091505b5091509150816102c057610222816105a2565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561028557818101518382015260200161026d565b50505050905090810190601f1680156102b25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b805195506020019350505050f35b3480156102da57600080fd5b506102e36106b9565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561031857600080fd5b5061032161072c565b005b34801561032f57600080fd5b506103216004803603602081101561034657600080fd5b50351515610a09565b34801561035b57600080fd5b50610321610b7c565b34801561037057600080fd5b50610379610dee565b604080519115158252519081900360200190f35b34801561039957600080fd5b506102e3610df7565b3480156103ae57600080fd5b506102e3610e18565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166321f8a7218460405160200180807f636f6e74726163742e616464726573730000000000000000000000000000000081525060100182805190602001908083835b6020831061046f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610432565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156104de57600080fd5b505afa1580156104f2573d6000803e3d6000fd5b505050506040513d602081101561050857600080fd5b5051905073ffffffffffffffffffffffffffffffffffffffff811661058e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f436f6e7472616374206e6f7420666f756e640000000000000000000000000000604482015290519081900360640190fd5b90505b919050565b3b63ffffffff16151590565b60606044825110156105e8575060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c790000006020820152610591565b600482018051909260240190602081101561060257600080fd5b810190808051604051939291908464010000000082111561062257600080fd5b90830190602082018581111561063757600080fd5b825164010000000081118282018810171561065157600080fd5b82525081516020918201929091019080838360005b8381101561067e578181015183820152602001610666565b50505050905090810190601f1680156106ab5780820380516001836020036101000a031916815260200191505b506040525050509050919050565b600c5460009060ff166106e957600c54610100900473ffffffffffffffffffffffffffffffffffffffff16610727565b6107276040518060400160405280601681526020017f726f636b65744d696e69706f6f6c44656c6567617465000000000000000000008152506103b7565b905090565b6000805460048054604080517f5b49ff6200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff61010090930483169381019390935251921691635b49ff6291602480820192602092909190829003018186803b1580156107a957600080fd5b505afa1580156107bd573d6000803e3d6000fd5b505050506040513d60208110156107d357600080fd5b5051600454909150610100900473ffffffffffffffffffffffffffffffffffffffff1633148061081857503373ffffffffffffffffffffffffffffffffffffffff8216145b61086d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180610e86602d913960400191505060405180910390fd5b600c54600d805461010090920473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff000000000000000000000000000000000000000090921691909117905560408051808201909152601681527f726f636b65744d696e69706f6f6c44656c65676174650000000000000000000060208201526108f7906103b7565b600c80547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010073ffffffffffffffffffffffffffffffffffffffff93841681029190911791829055600d548316910490911614156109a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180610e5a602c913960400191505060405180910390fd5b600d54600c546040805173ffffffffffffffffffffffffffffffffffffffff93841681526101009092049092166020820152428183015290517f720d539b7abaee498c7536b8bf9f854bcd839fb4db9dc00e7494c219b3a20d459181900360600190a150565b6000805460048054604080517f5b49ff6200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff61010090930483169381019390935251921691635b49ff6291602480820192602092909190829003018186803b158015610a8657600080fd5b505afa158015610a9a573d6000803e3d6000fd5b505050506040513d6020811015610ab057600080fd5b5051600454909150610100900473ffffffffffffffffffffffffffffffffffffffff16331480610af557503373ffffffffffffffffffffffffffffffffffffffff8216145b610b4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180610e86602d913960400191505060405180910390fd5b50600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b6000805460048054604080517f5b49ff6200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff61010090930483169381019390935251921691635b49ff6291602480820192602092909190829003018186803b158015610bf957600080fd5b505afa158015610c0d573d6000803e3d6000fd5b505050506040513d6020811015610c2357600080fd5b5051600454909150610100900473ffffffffffffffffffffffffffffffffffffffff16331480610c6857503373ffffffffffffffffffffffffffffffffffffffff8216145b610cbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180610e86602d913960400191505060405180910390fd5b600d5473ffffffffffffffffffffffffffffffffffffffff16610d2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610e356025913960400191505060405180910390fd5b600c8054600d805473ffffffffffffffffffffffffffffffffffffffff8181166101009081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff861617958690557fffffffffffffffffffffffff000000000000000000000000000000000000000090921690925560408051938290048316808552919094049091166020830152428284015291517f01d12a47982bd695d9fa134134fa172f56f650d817bb4fb0bd4ae3754d2fdca69181900360600190a15050565b600c5460ff1690565b600c54610100900473ffffffffffffffffffffffffffffffffffffffff1690565b600d5473ffffffffffffffffffffffffffffffffffffffff169056fe50726576696f75732064656c656761746520636f6e7472616374206973206e6f74207365744e65772064656c6567617465206973207468652073616d6520617320746865206578697374696e67206f6e654f6e6c7920746865206e6f6465206f70657261746f722063616e206163636573732074686973206d6574686f64a264697066735822122012bbc243e49103f27abd3181f2469e30ed5b98e4ae35eccfe433109ed06d709564736f6c63430007060033726f636b657444414f50726f746f636f6c53657474696e67734d696e69706f6f6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774d696e69706f6f6c20636f756e74206166746572206465706f7369742065786365656473206c696d6974206261736564206f6e206e6f64652052504c207374616b65a26469706673582212209275fa7280f6aaa261e74c3518fd3797eb837f7e65c58d4d2be2881d555745ae64736f6c63430007060033
Verified Source Code Partial Match
Compiler: v0.7.6+commit.7338295f
EVM: istanbul
Optimization: Yes (15000 runs)
SafeMath.sol 214 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
RocketMinipool.sol 164 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "./RocketMinipoolStorageLayout.sol";
import "../../interface/RocketStorageInterface.sol";
import "../../types/MinipoolDeposit.sol";
import "../../types/MinipoolStatus.sol";
// An individual minipool in the Rocket Pool network
contract RocketMinipool is RocketMinipoolStorageLayout {
// Events
event EtherReceived(address indexed from, uint256 amount, uint256 time);
event DelegateUpgraded(address oldDelegate, address newDelegate, uint256 time);
event DelegateRolledBack(address oldDelegate, address newDelegate, uint256 time);
// Modifiers
// Only allow access from the owning node address
modifier onlyMinipoolOwner() {
// Only the node operator can upgrade
address withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(nodeAddress);
require(msg.sender == nodeAddress || msg.sender == withdrawalAddress, "Only the node operator can access this method");
_;
}
// Construct
constructor(RocketStorageInterface _rocketStorageAddress, address _nodeAddress, MinipoolDeposit _depositType) {
// Initialise RocketStorage
require(address(_rocketStorageAddress) != address(0x0), "Invalid storage address");
rocketStorage = RocketStorageInterface(_rocketStorageAddress);
// Set storage state to uninitialised
storageState = StorageState.Uninitialised;
// Set the current delegate
address delegateAddress = getContractAddress("rocketMinipoolDelegate");
rocketMinipoolDelegate = delegateAddress;
// Check for contract existence
require(contractExists(delegateAddress), "Delegate contract does not exist");
// Call initialise on delegate
(bool success, bytes memory data) = delegateAddress.delegatecall(abi.encodeWithSignature('initialise(address,uint8)', _nodeAddress, uint8(_depositType)));
if (!success) { revert(getRevertMessage(data)); }
}
// Receive an ETH deposit
receive() external payable {
// Emit ether received event
emit EtherReceived(msg.sender, msg.value, block.timestamp);
}
// Upgrade this minipool to the latest network delegate contract
function delegateUpgrade() external onlyMinipoolOwner {
// Set previous address
rocketMinipoolDelegatePrev = rocketMinipoolDelegate;
// Set new delegate
rocketMinipoolDelegate = getContractAddress("rocketMinipoolDelegate");
// Verify
require(rocketMinipoolDelegate != rocketMinipoolDelegatePrev, "New delegate is the same as the existing one");
// Log event
emit DelegateUpgraded(rocketMinipoolDelegatePrev, rocketMinipoolDelegate, block.timestamp);
}
// Rollback to previous delegate contract
function delegateRollback() external onlyMinipoolOwner {
// Make sure they have upgraded before
require(rocketMinipoolDelegatePrev != address(0x0), "Previous delegate contract is not set");
// Store original
address originalDelegate = rocketMinipoolDelegate;
// Update delegate to previous and zero out previous
rocketMinipoolDelegate = rocketMinipoolDelegatePrev;
rocketMinipoolDelegatePrev = address(0x0);
// Log event
emit DelegateRolledBack(originalDelegate, rocketMinipoolDelegate, block.timestamp);
}
// If set to true, will automatically use the latest delegate contract
function setUseLatestDelegate(bool _setting) external onlyMinipoolOwner {
useLatestDelegate = _setting;
}
// Getter for useLatestDelegate setting
function getUseLatestDelegate() external view returns (bool) {
return useLatestDelegate;
}
// Returns the address of the minipool's stored delegate
function getDelegate() external view returns (address) {
return rocketMinipoolDelegate;
}
// Returns the address of the minipool's previous delegate (or address(0) if not set)
function getPreviousDelegate() external view returns (address) {
return rocketMinipoolDelegatePrev;
}
// Returns the delegate which will be used when calling this minipool taking into account useLatestDelegate setting
function getEffectiveDelegate() external view returns (address) {
return useLatestDelegate ? getContractAddress("rocketMinipoolDelegate") : rocketMinipoolDelegate;
}
// Delegate all other calls to minipool delegate contract
fallback(bytes calldata _input) external payable returns (bytes memory) {
// If useLatestDelegate is set, use the latest delegate contract
address delegateContract = useLatestDelegate ? getContractAddress("rocketMinipoolDelegate") : rocketMinipoolDelegate;
// Check for contract existence
require(contractExists(delegateContract), "Delegate contract does not exist");
// Execute delegatecall
(bool success, bytes memory data) = delegateContract.delegatecall(_input);
if (!success) { revert(getRevertMessage(data)); }
return data;
}
// Get the address of a Rocket Pool network contract
function getContractAddress(string memory _contractName) private view returns (address) {
address contractAddress = rocketStorage.getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
require(contractAddress != address(0x0), "Contract not found");
return contractAddress;
}
// Get a revert message from delegatecall return data
function getRevertMessage(bytes memory _returnData) private pure returns (string memory) {
if (_returnData.length < 68) { return "Transaction reverted silently"; }
assembly {
_returnData := add(_returnData, 0x04)
}
return abi.decode(_returnData, (string));
}
// Returns true if contract exists at _contractAddress (if called during that contract's construction it will return a false negative)
function contractExists(address _contractAddress) private returns (bool) {
uint32 codeSize;
assembly {
codeSize := extcodesize(_contractAddress)
}
return codeSize > 0;
}
}
RocketDAOProtocolSettingsMinipoolInterface.sol 46 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../../../types/MinipoolDeposit.sol";
interface RocketDAOProtocolSettingsMinipoolInterface {
function getLaunchBalance() external view returns (uint256);
function getDepositNodeAmount(MinipoolDeposit _depositType) external view returns (uint256);
function getFullDepositNodeAmount() external view returns (uint256);
function getHalfDepositNodeAmount() external view returns (uint256);
function getEmptyDepositNodeAmount() external view returns (uint256);
function getDepositUserAmount(MinipoolDeposit _depositType) external view returns (uint256);
function getFullDepositUserAmount() external view returns (uint256);
function getHalfDepositUserAmount() external view returns (uint256);
function getEmptyDepositUserAmount() external view returns (uint256);
function getSubmitWithdrawableEnabled() external view returns (bool);
function getLaunchTimeout() external view returns (uint256);
function getMaximumCount() external view returns (uint256);
}
RocketMinipoolManagerInterface.sol 57 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../types/MinipoolDeposit.sol";
import "./RocketMinipoolInterface.sol";
interface RocketMinipoolManagerInterface {
function getMinipoolCount() external view returns (uint256);
function getStakingMinipoolCount() external view returns (uint256);
function getFinalisedMinipoolCount() external view returns (uint256);
function getActiveMinipoolCount() external view returns (uint256);
function getMinipoolCountPerStatus(uint256 offset, uint256 limit) external view returns (uint256, uint256, uint256, uint256, uint256);
function getMinipoolAt(uint256 _index) external view returns (address);
function getNodeMinipoolCount(address _nodeAddress) external view returns (uint256);
function getNodeActiveMinipoolCount(address _nodeAddress) external view returns (uint256);
function getNodeFinalisedMinipoolCount(address _nodeAddress) external view returns (uint256);
function getNodeStakingMinipoolCount(address _nodeAddress) external view returns (uint256);
function getNodeMinipoolAt(address _nodeAddress, uint256 _index) external view returns (address);
function getNodeValidatingMinipoolCount(address _nodeAddress) external view returns (uint256);
function getNodeValidatingMinipoolAt(address _nodeAddress, uint256 _index) external view returns (address);
function getMinipoolByPubkey(bytes calldata _pubkey) external view returns (address);
function getMinipoolExists(address _minipoolAddress) external view returns (bool);
function getMinipoolPubkey(address _minipoolAddress) external view returns (bytes memory);
function createMinipool(address _nodeAddress, MinipoolDeposit _depositType) external returns (RocketMinipoolInterface);
function destroyMinipool() external;
function incrementNodeStakingMinipoolCount(address _nodeAddress) external;
function decrementNodeStakingMinipoolCount(address _nodeAddress) external;
function incrementNodeFinalisedMinipoolCount(address _nodeAddress) external;
function setMinipoolPubkey(bytes calldata _pubkey) external;
}
AddressSetStorageInterface.sol 37 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
interface AddressSetStorageInterface {
function getCount(bytes32 _key) external view returns (uint);
function getItem(bytes32 _key, uint _index) external view returns (address);
function getIndexOf(bytes32 _key, address _value) external view returns (int);
function addItem(bytes32 _key, address _value) external;
function removeItem(bytes32 _key, address _value) external;
}
RocketBase.sol 188 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../interface/RocketStorageInterface.sol";
/// @title Base settings / modifiers for each contract in Rocket Pool
/// @author David Rugendyke
abstract contract RocketBase {
// Calculate using this as the base
uint256 constant calcBase = 1 ether;
// Version of the contract
uint8 public version;
// The main storage contract where primary persistant storage is maintained
RocketStorageInterface rocketStorage = RocketStorageInterface(0);
/*** Modifiers **********************************************************/
/**
* @dev Throws if called by any sender that doesn't match a Rocket Pool network contract
*/
modifier onlyLatestNetworkContract() {
require(getBool(keccak256(abi.encodePacked("contract.exists", msg.sender))), "Invalid or outdated network contract");
_;
}
/**
* @dev Throws if called by any sender that doesn't match one of the supplied contract or is the latest version of that contract
*/
modifier onlyLatestContract(string memory _contractName, address _contractAddress) {
require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered node
*/
modifier onlyRegisteredNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("node.exists", _nodeAddress))), "Invalid node");
_;
}
/**
* @dev Throws if called by any sender that isn't a trusted node DAO member
*/
modifier onlyTrustedNode(address _nodeAddress) {
require(getBool(keccak256(abi.encodePacked("dao.trustednodes.", "member", _nodeAddress))), "Invalid trusted node");
_;
}
/**
* @dev Throws if called by any sender that isn't a registered minipool
*/
modifier onlyRegisteredMinipool(address _minipoolAddress) {
require(getBool(keccak256(abi.encodePacked("minipool.exists", _minipoolAddress))), "Invalid minipool");
_;
}
/**
* @dev Throws if called by any account other than a guardian account (temporary account allowed access to settings before DAO is fully enabled)
*/
modifier onlyGuardian() {
require(msg.sender == rocketStorage.getGuardian(), "Account is not a temporary guardian");
_;
}
/*** Methods **********************************************************/
/// @dev Set the main Rocket Storage address
constructor(RocketStorageInterface _rocketStorageAddress) {
// Update the contract address
rocketStorage = RocketStorageInterface(_rocketStorageAddress);
}
/// @dev Get the address of a network contract by name
function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "Contract not found");
// Return
return contractAddress;
}
/// @dev Get the address of a network contract by name (returns address(0x0) instead of reverting if contract does not exist)
function getContractAddressUnsafe(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Return
return contractAddress;
}
/// @dev Get the name of a network contract by address
function getContractName(address _contractAddress) internal view returns (string memory) {
// Get the contract name
string memory contractName = getString(keccak256(abi.encodePacked("contract.name", _contractAddress)));
// Check it
require(bytes(contractName).length > 0, "Contract not found");
// Return
return contractName;
}
/// @dev Get revert error message from a .call method
function getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return "Transaction reverted silently";
assembly {
// Slice the sighash.
_returnData := add(_returnData, 0x04)
}
return abi.decode(_returnData, (string)); // All that remains is the revert string
}
/*** Rocket Storage Methods ****************************************/
// Note: Unused helpers have been removed to keep contract sizes down
/// @dev Storage get methods
function getAddress(bytes32 _key) internal view returns (address) { return rocketStorage.getAddress(_key); }
function getUint(bytes32 _key) internal view returns (uint) { return rocketStorage.getUint(_key); }
function getString(bytes32 _key) internal view returns (string memory) { return rocketStorage.getString(_key); }
function getBytes(bytes32 _key) internal view returns (bytes memory) { return rocketStorage.getBytes(_key); }
function getBool(bytes32 _key) internal view returns (bool) { return rocketStorage.getBool(_key); }
function getInt(bytes32 _key) internal view returns (int) { return rocketStorage.getInt(_key); }
function getBytes32(bytes32 _key) internal view returns (bytes32) { return rocketStorage.getBytes32(_key); }
/// @dev Storage set methods
function setAddress(bytes32 _key, address _value) internal { rocketStorage.setAddress(_key, _value); }
function setUint(bytes32 _key, uint _value) internal { rocketStorage.setUint(_key, _value); }
function setString(bytes32 _key, string memory _value) internal { rocketStorage.setString(_key, _value); }
function setBytes(bytes32 _key, bytes memory _value) internal { rocketStorage.setBytes(_key, _value); }
function setBool(bytes32 _key, bool _value) internal { rocketStorage.setBool(_key, _value); }
function setInt(bytes32 _key, int _value) internal { rocketStorage.setInt(_key, _value); }
function setBytes32(bytes32 _key, bytes32 _value) internal { rocketStorage.setBytes32(_key, _value); }
/// @dev Storage delete methods
function deleteAddress(bytes32 _key) internal { rocketStorage.deleteAddress(_key); }
function deleteUint(bytes32 _key) internal { rocketStorage.deleteUint(_key); }
function deleteString(bytes32 _key) internal { rocketStorage.deleteString(_key); }
function deleteBytes(bytes32 _key) internal { rocketStorage.deleteBytes(_key); }
function deleteBool(bytes32 _key) internal { rocketStorage.deleteBool(_key); }
function deleteInt(bytes32 _key) internal { rocketStorage.deleteInt(_key); }
function deleteBytes32(bytes32 _key) internal { rocketStorage.deleteBytes32(_key); }
/// @dev Storage arithmetic methods
function addUint(bytes32 _key, uint256 _amount) internal { rocketStorage.addUint(_key, _amount); }
function subUint(bytes32 _key, uint256 _amount) internal { rocketStorage.subUint(_key, _amount); }
}
RocketMinipoolManager.sol 336 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./RocketMinipool.sol";
import "../RocketBase.sol";
import "../../interface/dao/node/RocketDAONodeTrustedInterface.sol";
import "../../interface/minipool/RocketMinipoolInterface.sol";
import "../../interface/minipool/RocketMinipoolManagerInterface.sol";
import "../../interface/minipool/RocketMinipoolQueueInterface.sol";
import "../../interface/node/RocketNodeStakingInterface.sol";
import "../../interface/util/AddressSetStorageInterface.sol";
import "../../types/MinipoolDeposit.sol";
import "../../interface/network/RocketNetworkPricesInterface.sol";
import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
// Minipool creation, removal and management
contract RocketMinipoolManager is RocketBase, RocketMinipoolManagerInterface {
// Libs
using SafeMath for uint;
// Events
event MinipoolCreated(address indexed minipool, address indexed node, uint256 time);
event MinipoolDestroyed(address indexed minipool, address indexed node, uint256 time);
// Construct
constructor(RocketStorageInterface _rocketStorageAddress) RocketBase(_rocketStorageAddress) {
version = 1;
}
// Get the number of minipools in the network
function getMinipoolCount() override public view returns (uint256) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getCount(keccak256(bytes("minipools.index")));
}
// Get the number of minipools in the network in the Staking state
function getStakingMinipoolCount() override external view returns (uint256) {
return getUint(keccak256(bytes("minipools.staking.count")));
}
// Get the number of finalised minipools in the network
function getFinalisedMinipoolCount() override external view returns (uint256) {
return getUint(keccak256(bytes("minipools.finalised.count")));
}
// Get the number of active minipools in the network
function getActiveMinipoolCount() override public view returns (uint256) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
uint256 total = addressSetStorage.getCount(keccak256(bytes("minipools.index")));
uint256 finalised = getUint(keccak256(bytes("minipools.finalised.count")));
return total.sub(finalised);
}
// Get the number of minipools in each status.
// Returns the counts for Initialised, Prelaunch, Staking, Withdrawable, and Dissolved in that order.
function getMinipoolCountPerStatus(uint256 offset, uint256 limit) override external view
returns (uint256 initialisedCount, uint256 prelaunchCount, uint256 stakingCount, uint256 withdrawableCount, uint256 dissolvedCount) {
// Get contracts
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
// Precompute minipool key
bytes32 minipoolKey = keccak256(abi.encodePacked("minipools.index"));
// Iterate over the requested minipool range
uint256 totalMinipools = getMinipoolCount();
uint256 max = offset.add(limit);
if (max > totalMinipools || limit == 0) { max = totalMinipools; }
for (uint256 i = offset; i < max; i++) {
// Get the minipool at index i
RocketMinipoolInterface minipool = RocketMinipoolInterface(addressSetStorage.getItem(minipoolKey, i));
// Get the minipool's status, and update the appropriate counter
MinipoolStatus status = minipool.getStatus();
if (status == MinipoolStatus.Initialised) {
initialisedCount++;
}
else if (status == MinipoolStatus.Prelaunch) {
prelaunchCount++;
}
else if (status == MinipoolStatus.Staking) {
stakingCount++;
}
else if (status == MinipoolStatus.Withdrawable) {
withdrawableCount++;
}
else if (status == MinipoolStatus.Dissolved) {
dissolvedCount++;
}
}
}
// Get a network minipool address by index
function getMinipoolAt(uint256 _index) override external view returns (address) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getItem(keccak256(abi.encodePacked("minipools.index")), _index);
}
// Get the number of minipools owned by a node
function getNodeMinipoolCount(address _nodeAddress) override external view returns (uint256) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getCount(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress)));
}
// Get the number of minipools owned by a node that are not finalised
function getNodeActiveMinipoolCount(address _nodeAddress) override public view returns (uint256) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
uint256 finalised = getUint(keccak256(abi.encodePacked("node.minipools.finalised.count", _nodeAddress)));
uint256 total = addressSetStorage.getCount(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress)));
return total.sub(finalised);
}
// Get the number of minipools owned by a node that are finalised
function getNodeFinalisedMinipoolCount(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked("node.minipools.finalised.count", _nodeAddress)));
}
// Get the number of minipools owned by a node that are in staking status
function getNodeStakingMinipoolCount(address _nodeAddress) override external view returns (uint256) {
return getUint(keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress)));
}
// Get a node minipool address by index
function getNodeMinipoolAt(address _nodeAddress, uint256 _index) override external view returns (address) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getItem(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress)), _index);
}
// Get the number of validating minipools owned by a node
function getNodeValidatingMinipoolCount(address _nodeAddress) override external view returns (uint256) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getCount(keccak256(abi.encodePacked("node.minipools.validating.index", _nodeAddress)));
}
// Get a validating node minipool address by index
function getNodeValidatingMinipoolAt(address _nodeAddress, uint256 _index) override external view returns (address) {
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
return addressSetStorage.getItem(keccak256(abi.encodePacked("node.minipools.validating.index", _nodeAddress)), _index);
}
// Get a minipool address by validator pubkey
function getMinipoolByPubkey(bytes memory _pubkey) override external view returns (address) {
return getAddress(keccak256(abi.encodePacked("validator.minipool", _pubkey)));
}
// Check whether a minipool exists
function getMinipoolExists(address _minipoolAddress) override external view returns (bool) {
return getBool(keccak256(abi.encodePacked("minipool.exists", _minipoolAddress)));
}
// Get a minipool's validator pubkey
function getMinipoolPubkey(address _minipoolAddress) override external view returns (bytes memory) {
return getBytes(keccak256(abi.encodePacked("minipool.pubkey", _minipoolAddress)));
}
// Increments _nodeAddress' number of minipools in staking status
function incrementNodeStakingMinipoolCount(address _nodeAddress) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) {
// Update the node specific count
bytes32 nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress));
uint256 nodeValue = getUint(nodeKey);
setUint(nodeKey, nodeValue.add(1));
// Update the total count
bytes32 totalKey = keccak256(abi.encodePacked("minipools.staking.count"));
uint256 totalValue = getUint(totalKey);
setUint(totalKey, totalValue.add(1));
// Update total effective stake
updateTotalEffectiveRPLStake(_nodeAddress, nodeValue, nodeValue.add(1));
}
// Decrements _nodeAddress' number of minipools in staking status
function decrementNodeStakingMinipoolCount(address _nodeAddress) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) {
// Update the node specific count
bytes32 nodeKey = keccak256(abi.encodePacked("node.minipools.staking.count", _nodeAddress));
uint256 nodeValue = getUint(nodeKey);
setUint(nodeKey, nodeValue.sub(1));
// Update the total count
bytes32 totalKey = keccak256(abi.encodePacked("minipools.staking.count"));
uint256 totalValue = getUint(totalKey);
setUint(totalKey, totalValue.sub(1));
// Update total effective stake
updateTotalEffectiveRPLStake(_nodeAddress, nodeValue, nodeValue.sub(1));
}
// Increments _nodeAddress' number of minipools that have been finalised
function incrementNodeFinalisedMinipoolCount(address _nodeAddress) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) {
// Update the node specific count
addUint(keccak256(abi.encodePacked("node.minipools.finalised.count", _nodeAddress)), 1);
// Update the total count
addUint(keccak256(bytes("minipools.finalised.count")), 1);
}
// Create a minipool
// Only accepts calls from the RocketNodeDeposit contract
function createMinipool(address _nodeAddress, MinipoolDeposit _depositType) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyLatestContract("rocketNodeDeposit", msg.sender) returns (RocketMinipoolInterface) {
// Load contracts
RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking"));
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
// Check node minipool limit based on RPL stake
require(
getNodeActiveMinipoolCount(_nodeAddress) < rocketNodeStaking.getNodeMinipoolLimit(_nodeAddress),
"Minipool count after deposit exceeds limit based on node RPL stake"
);
{ // Local scope to prevent stack too deep error
RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool"));
// Check global minipool limit
uint256 totalMinipoolCount = getActiveMinipoolCount();
require(totalMinipoolCount.add(1) <= rocketDAOProtocolSettingsMinipool.getMaximumCount(), "Global minipool limit reached");
}
// Create minipool contract
address contractAddress = address(new RocketMinipool(RocketStorageInterface(rocketStorage), _nodeAddress, _depositType));
RocketMinipoolInterface minipool = RocketMinipoolInterface(contractAddress);
// Initialize minipool data
setBool(keccak256(abi.encodePacked("minipool.exists", contractAddress)), true);
// Add minipool to indexes
addressSetStorage.addItem(keccak256(abi.encodePacked("minipools.index")), contractAddress);
addressSetStorage.addItem(keccak256(abi.encodePacked("node.minipools.index", _nodeAddress)), contractAddress);
// Update unbonded validator count if minipool is unbonded
if (_depositType == MinipoolDeposit.Empty) {
RocketDAONodeTrustedInterface rocketDAONodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted"));
rocketDAONodeTrusted.incrementMemberUnbondedValidatorCount(_nodeAddress);
}
// Emit minipool created event
emit MinipoolCreated(contractAddress, _nodeAddress, block.timestamp);
// Add minipool to queue
RocketMinipoolQueueInterface(getContractAddress("rocketMinipoolQueue")).enqueueMinipool(_depositType, contractAddress);
// Return created minipool address
return minipool;
}
// Destroy a minipool
// Only accepts calls from registered minipools
function destroyMinipool() override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) {
// Load contracts
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
// Initialize minipool & get properties
RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender);
address nodeAddress = minipool.getNodeAddress();
// Update minipool data
setBool(keccak256(abi.encodePacked("minipool.exists", msg.sender)), false);
// Remove minipool from indexes
addressSetStorage.removeItem(keccak256(abi.encodePacked("minipools.index")), msg.sender);
addressSetStorage.removeItem(keccak256(abi.encodePacked("node.minipools.index", nodeAddress)), msg.sender);
// Emit minipool destroyed event
emit MinipoolDestroyed(msg.sender, nodeAddress, block.timestamp);
}
// Updates the stored total effective rate based on a node's changing minipool count
function updateTotalEffectiveRPLStake(address _nodeAddress, uint256 _oldCount, uint256 _newCount) private {
// Load contracts
RocketNetworkPricesInterface rocketNetworkPrices = RocketNetworkPricesInterface(getContractAddress("rocketNetworkPrices"));
RocketDAOProtocolSettingsMinipoolInterface rocketDAOProtocolSettingsMinipool = RocketDAOProtocolSettingsMinipoolInterface(getContractAddress("rocketDAOProtocolSettingsMinipool"));
RocketDAOProtocolSettingsNodeInterface rocketDAOProtocolSettingsNode = RocketDAOProtocolSettingsNodeInterface(getContractAddress("rocketDAOProtocolSettingsNode"));
RocketNodeStakingInterface rocketNodeStaking = RocketNodeStakingInterface(getContractAddress("rocketNodeStaking"));
// Require price consensus
require(rocketNetworkPrices.inConsensus(), "Network is not in consensus");
// Get node's RPL stake
uint256 rplStake = rocketNodeStaking.getNodeRPLStake(_nodeAddress);
// Get the node's maximum possible stake
uint256 maxRplStakePerMinipool = rocketDAOProtocolSettingsMinipool.getHalfDepositUserAmount()
.mul(rocketDAOProtocolSettingsNode.getMaximumPerMinipoolStake());
uint256 oldMaxRplStake = maxRplStakePerMinipool
.mul(_oldCount)
.div(rocketNetworkPrices.getRPLPrice());
uint256 newMaxRplStake = maxRplStakePerMinipool
.mul(_newCount)
.div(rocketNetworkPrices.getRPLPrice());
// Check if we have to decrease total
if (_oldCount > _newCount) {
if (rplStake <= newMaxRplStake) {
return;
}
uint256 decrease = oldMaxRplStake.sub(newMaxRplStake);
uint256 delta = rplStake.sub(newMaxRplStake);
if (delta > decrease) { delta = decrease; }
rocketNetworkPrices.decreaseEffectiveRPLStake(delta);
return;
}
// Check if we have to increase total
if (_newCount > _oldCount) {
if (rplStake <= oldMaxRplStake) {
return;
}
uint256 increase = newMaxRplStake.sub(oldMaxRplStake);
uint256 delta = rplStake.sub(oldMaxRplStake);
if (delta > increase) { delta = increase; }
rocketNetworkPrices.increaseEffectiveRPLStake(delta);
return;
}
// _oldCount == _newCount (do nothing but shouldn't happen)
}
// Set a minipool's validator pubkey
// Only accepts calls from registered minipools
function setMinipoolPubkey(bytes calldata _pubkey) override external onlyLatestContract("rocketMinipoolManager", address(this)) onlyRegisteredMinipool(msg.sender) {
// Load contracts
AddressSetStorageInterface addressSetStorage = AddressSetStorageInterface(getContractAddress("addressSetStorage"));
// Initialize minipool & get properties
RocketMinipoolInterface minipool = RocketMinipoolInterface(msg.sender);
address nodeAddress = minipool.getNodeAddress();
// Set minipool validator pubkey & validator minipool address
setBytes(keccak256(abi.encodePacked("minipool.pubkey", msg.sender)), _pubkey);
setAddress(keccak256(abi.encodePacked("validator.minipool", _pubkey)), msg.sender);
// Add minipool to node validating minipools index
addressSetStorage.addItem(keccak256(abi.encodePacked("node.minipools.validating.index", nodeAddress)), msg.sender);
}
}
RocketStorageInterface.sol 74 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketStorageInterface {
// Guardian
function getGuardian() external view returns(address);
function setGuardian(address _newAddress) external;
function confirmGuardian() external;
// Getters
function getAddress(bytes32 _key) external view returns (address);
function getUint(bytes32 _key) external view returns (uint);
function getString(bytes32 _key) external view returns (string memory);
function getBytes(bytes32 _key) external view returns (bytes memory);
function getBool(bytes32 _key) external view returns (bool);
function getInt(bytes32 _key) external view returns (int);
function getBytes32(bytes32 _key) external view returns (bytes32);
// Setters
function setAddress(bytes32 _key, address _value) external;
function setUint(bytes32 _key, uint _value) external;
function setString(bytes32 _key, string calldata _value) external;
function setBytes(bytes32 _key, bytes calldata _value) external;
function setBool(bytes32 _key, bool _value) external;
function setInt(bytes32 _key, int _value) external;
function setBytes32(bytes32 _key, bytes32 _value) external;
// Deleters
function deleteAddress(bytes32 _key) external;
function deleteUint(bytes32 _key) external;
function deleteString(bytes32 _key) external;
function deleteBytes(bytes32 _key) external;
function deleteBool(bytes32 _key) external;
function deleteInt(bytes32 _key) external;
function deleteBytes32(bytes32 _key) external;
// Arithmetic
function addUint(bytes32 _key, uint256 _amount) external;
function subUint(bytes32 _key, uint256 _amount) external;
// Protected storage
function getNodeWithdrawalAddress(address _nodeAddress) external view returns (address);
function getNodePendingWithdrawalAddress(address _nodeAddress) external view returns (address);
function setWithdrawalAddress(address _nodeAddress, address _newWithdrawalAddress, bool _confirm) external;
function confirmWithdrawalAddress(address _nodeAddress) external;
}
RocketDAONodeTrustedInterface.sol 54 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketDAONodeTrustedInterface {
function getBootstrapModeDisabled() external view returns (bool);
function getMemberQuorumVotesRequired() external view returns (uint256);
function getMemberAt(uint256 _index) external view returns (address);
function getMemberCount() external view returns (uint256);
function getMemberMinRequired() external view returns (uint256);
function getMemberIsValid(address _nodeAddress) external view returns (bool);
function getMemberLastProposalTime(address _nodeAddress) external view returns (uint256);
function getMemberID(address _nodeAddress) external view returns (string memory);
function getMemberUrl(address _nodeAddress) external view returns (string memory);
function getMemberJoinedTime(address _nodeAddress) external view returns (uint256);
function getMemberProposalExecutedTime(string memory _proposalType, address _nodeAddress) external view returns (uint256);
function getMemberRPLBondAmount(address _nodeAddress) external view returns (uint256);
function getMemberIsChallenged(address _nodeAddress) external view returns (bool);
function getMemberUnbondedValidatorCount(address _nodeAddress) external view returns (uint256);
function incrementMemberUnbondedValidatorCount(address _nodeAddress) external;
function decrementMemberUnbondedValidatorCount(address _nodeAddress) external;
function bootstrapMember(string memory _id, string memory _url, address _nodeAddress) external;
function bootstrapSettingUint(string memory _settingContractName, string memory _settingPath, uint256 _value) external;
function bootstrapSettingBool(string memory _settingContractName, string memory _settingPath, bool _value) external;
function bootstrapUpgrade(string memory _type, string memory _name, string memory _contractAbi, address _contractAddress) external;
function bootstrapDisable(bool _confirmDisableBootstrapMode) external;
function memberJoinRequired(string memory _id, string memory _url) external;
}
RocketMinipoolInterface.sol 64 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../types/MinipoolDeposit.sol";
import "../../types/MinipoolStatus.sol";
import "../RocketStorageInterface.sol";
interface RocketMinipoolInterface {
function initialise(address _nodeAddress, MinipoolDeposit _depositType) external;
function getStatus() external view returns (MinipoolStatus);
function getFinalised() external view returns (bool);
function getStatusBlock() external view returns (uint256);
function getStatusTime() external view returns (uint256);
function getDepositType() external view returns (MinipoolDeposit);
function getNodeAddress() external view returns (address);
function getNodeFee() external view returns (uint256);
function getNodeDepositBalance() external view returns (uint256);
function getNodeRefundBalance() external view returns (uint256);
function getNodeDepositAssigned() external view returns (bool);
function getUserDepositBalance() external view returns (uint256);
function getUserDepositAssigned() external view returns (bool);
function getUserDepositAssignedTime() external view returns (uint256);
function getWithdrawalCredentials() external view returns (bytes memory);
function calculateNodeShare(uint256 _balance) external view returns (uint256);
function calculateUserShare(uint256 _balance) external view returns (uint256);
function nodeDeposit() external payable;
function userDeposit() external payable;
function distributeBalance() external;
function distributeBalanceAndFinalise() external;
function refund() external;
function slash() external;
function finalise() external;
function stake(bytes calldata _validatorPubkey, bytes calldata _validatorSignature, bytes32 _depositDataRoot) external;
function setWithdrawable() external;
function dissolve() external;
function close() external;
}
RocketNodeStakingInterface.sol 44 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketNodeStakingInterface {
function getTotalRPLStake() external view returns (uint256);
function getNodeRPLStake(address _nodeAddress) external view returns (uint256);
function getNodeRPLStakedTime(address _nodeAddress) external view returns (uint256);
function getTotalEffectiveRPLStake() external view returns (uint256);
function calculateTotalEffectiveRPLStake(uint256 offset, uint256 limit, uint256 rplPrice) external view returns (uint256);
function getNodeEffectiveRPLStake(address _nodeAddress) external view returns (uint256);
function getNodeMinimumRPLStake(address _nodeAddress) external view returns (uint256);
function getNodeMaximumRPLStake(address _nodeAddress) external view returns (uint256);
function getNodeMinipoolLimit(address _nodeAddress) external view returns (uint256);
function stakeRPL(uint256 _amount) external;
function withdrawRPL(uint256 _amount) external;
function slashRPL(address _nodeAddress, uint256 _ethSlashAmount) external;
}
RocketMinipoolQueueInterface.sol 44 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../types/MinipoolDeposit.sol";
interface RocketMinipoolQueueInterface {
function getTotalLength() external view returns (uint256);
function getLength(MinipoolDeposit _depositType) external view returns (uint256);
function getTotalCapacity() external view returns (uint256);
function getEffectiveCapacity() external view returns (uint256);
function getNextCapacity() external view returns (uint256);
function getNextDeposit() external view returns (MinipoolDeposit, uint256);
function enqueueMinipool(MinipoolDeposit _depositType, address _minipool) external;
function dequeueMinipool() external returns (address minipoolAddress);
function dequeueMinipoolByDeposit(MinipoolDeposit _depositType) external returns (address minipoolAddress);
function removeMinipool(MinipoolDeposit _depositType) external;
}
MinipoolStatus.sol 39 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
// Represents a minipool's status within the network
enum MinipoolStatus {
Initialised, // The minipool has been initialised and is awaiting a deposit of user ETH
Prelaunch, // The minipool has enough ETH to begin staking and is awaiting launch by the node operator
Staking, // The minipool is currently staking
Withdrawable, // The minipool has become withdrawable on the beacon chain and can be withdrawn from by the node operator
Dissolved // The minipool has been dissolved and its user deposited ETH has been returned to the deposit pool
}
RocketMinipoolStorageLayout.sol 91 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
import "../../interface/RocketStorageInterface.sol";
import "../../types/MinipoolDeposit.sol";
import "../../types/MinipoolStatus.sol";
// The RocketMinipool contract storage layout, shared by RocketMinipoolDelegate
// ******************************************************
// Note: This contract MUST NOT BE UPDATED after launch.
// All deployed minipool contracts must maintain a
// Consistent storage layout with RocketMinipoolDelegate.
// ******************************************************
abstract contract RocketMinipoolStorageLayout {
// Storage state enum
enum StorageState {
Undefined,
Uninitialised,
Initialised
}
// Main Rocket Pool storage contract
RocketStorageInterface internal rocketStorage = RocketStorageInterface(0);
// Status
MinipoolStatus internal status;
uint256 internal statusBlock;
uint256 internal statusTime;
uint256 internal withdrawalBlock;
// Deposit type
MinipoolDeposit internal depositType;
// Node details
address internal nodeAddress;
uint256 internal nodeFee;
uint256 internal nodeDepositBalance;
bool internal nodeDepositAssigned;
uint256 internal nodeRefundBalance;
uint256 internal nodeSlashBalance;
// User deposit details
uint256 internal userDepositBalance;
uint256 internal userDepositAssignedTime;
// Upgrade options
bool internal useLatestDelegate = false;
address internal rocketMinipoolDelegate;
address internal rocketMinipoolDelegatePrev;
// Local copy of RETH address
address internal rocketTokenRETH;
// Local copy of penalty contract
address internal rocketMinipoolPenalty;
// Used to prevent direct access to delegate and prevent calling initialise more than once
StorageState storageState = StorageState.Undefined;
// Whether node operator has finalised the pool
bool internal finalised;
}
RocketDAOProtocolSettingsNodeInterface.sol 36 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketDAOProtocolSettingsNodeInterface {
function getRegistrationEnabled() external view returns (bool);
function getDepositEnabled() external view returns (bool);
function getMinimumPerMinipoolStake() external view returns (uint256);
function getMaximumPerMinipoolStake() external view returns (uint256);
}
RocketNetworkPricesInterface.sol 42 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
interface RocketNetworkPricesInterface {
function getPricesBlock() external view returns (uint256);
function getRPLPrice() external view returns (uint256);
function getEffectiveRPLStake() external view returns (uint256);
function getEffectiveRPLStakeUpdatedBlock() external view returns (uint256);
function getLatestReportableBlock() external view returns (uint256);
function inConsensus() external view returns (bool);
function submitPrices(uint256 _block, uint256 _rplPrice, uint256 _effectiveRplStake) external;
function executeUpdatePrices(uint256 _block, uint256 _rplPrice, uint256 _effectiveRplStake) external;
function increaseEffectiveRPLStake(uint256 _amount) external;
function decreaseEffectiveRPLStake(uint256 _amount) external;
}
MinipoolDeposit.sol 38 lines
/**
* .
* / \
* |.'.|
* |'.'|
* ,'| |`.
* |,-'-|-'-.|
* __|_| | _ _ _____ _
* | ___ \| | | | | | ___ \ | |
* | |_/ /|__ ___| | _____| |_ | |_/ /__ ___ | |
* | // _ \ / __| |/ / _ \ __| | __/ _ \ / _ \| |
* | |\ \ (_) | (__| < __/ |_ | | | (_) | (_) | |
* \_| \_\___/ \___|_|\_\___|\__| \_| \___/ \___/|_|
* +---------------------------------------------------+
* | DECENTRALISED STAKING PROTOCOL FOR ETHEREUM 2.0 |
* +---------------------------------------------------+
*
* Rocket Pool is a first-of-its-kind ETH2 Proof of Stake protocol, designed to be community owned,
* decentralised, trustless and compatible with staking in Ethereum 2.0.
*
* For more information about Rocket Pool, visit https://rocketpool.net
*
* Authors: David Rugendyke, Jake Pospischil, Kane Wallmann, Darren Langley, Joe Clapis, Nick Doherty
*
*/
pragma solidity 0.7.6;
// SPDX-License-Identifier: GPL-3.0-only
// Represents the type of deposits required by a minipool
enum MinipoolDeposit {
None, // Marks an invalid deposit type
Full, // The minipool requires 32 ETH from the node operator, 16 ETH of which will be refinanced from user deposits
Half, // The minipool required 16 ETH from the node operator to be matched with 16 ETH from user deposits
Empty // The minipool requires 0 ETH from the node operator to be matched with 32 ETH from user deposits (trusted nodes only)
}
Read Contract
getActiveMinipoolCount 0xce9b79ad → uint256
getFinalisedMinipoolCount 0xd1ea6ce0 → uint256
getMinipoolAt 0xeff7319f → address
getMinipoolByPubkey 0xcf6a4763 → address
getMinipoolCount 0xae4d0bed → uint256
getMinipoolCountPerStatus 0x3b5ecefa → uint256, uint256, uint256, uint256, uint256
getMinipoolExists 0x606bb62e → bool
getMinipoolPubkey 0x3eb535e9 → bytes
getNodeActiveMinipoolCount 0x1844ec01 → uint256
getNodeFinalisedMinipoolCount 0xb88a89f7 → uint256
getNodeMinipoolAt 0x8b300029 → address
getNodeMinipoolCount 0x1ce9ec33 → uint256
getNodeStakingMinipoolCount 0x57b4ef6b → uint256
getNodeValidatingMinipoolAt 0x9da0700f → address
getNodeValidatingMinipoolCount 0xf90267c4 → uint256
getStakingMinipoolCount 0x67bca235 → uint256
version 0x54fd4d50 → uint8
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
createMinipool 0x8cbbdf86
address _nodeAddress
uint8 _depositType
returns: address
decrementNodeStakingMinipoolCount 0x75b59c7f
address _nodeAddress
destroyMinipool 0x7bb40aaf
No parameters
incrementNodeFinalisedMinipoolCount 0xb04e8868
address _nodeAddress
incrementNodeStakingMinipoolCount 0x9907288c
address _nodeAddress
setMinipoolPubkey 0x2c7f64d4
bytes _pubkey
Recent Transactions
No transactions found for this address