UNPKG

@gooddollar/goodcontracts

Version:
544 lines 528 kB
{ "contractName": "FuseStaking", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "consensus", "outputs": [ { "internalType": "contract IConsensus", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "consensus2", "outputs": [ { "internalType": "contract IConsensus", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "stateMutability": "payable", "type": "receive" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "_consensus", "type": "address" } ], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "update", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "withdraw", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_v", "type": "address" } ], "name": "addValidator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "totalDelegated", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_validator", "type": "address" } ], "name": "undelegate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "end", "outputs": [], "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_v\",\"type\":\"address\"}],\"name\":\"addValidator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"consensus\",\"outputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"consensus2\",\"outputs\":[{\"internalType\":\"contract IConsensus\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"end\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensus\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDelegated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"update\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"initialize(address,address)\":{\"details\":\"initialize\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/upgradables/contracts/staking/FuseStaking.sol\":\"FuseStaking\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/upgradables/contracts/staking/FuseStaking.sol\":{\"keccak256\":\"0x23115e13b85f6168b52e8051f92c3a57cc416bd4d2a03b4e92aa3072cfb0e06b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6b62b2f7ee85487de65707667b1cfeb7ed1200adf6b35c830143c5b1795cd7a0\",\"dweb:/ipfs/QmTqWY64eheHLsyEEWjvgXkHZRqEBP7644Y77DXv8GcwhG\"]},\"@openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol\":{\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://062688aac76e27ab50157a9d645700cf92e3c0d51d3d860be1d2e1a0c04a87d0\",\"dweb:/ipfs/QmfXxppWAiSTeH8YNn2EtMPDgzrLeJ5rjRq8knEbje88mX\"]},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"keccak256\":\"0xe422bf8bc61fe71acb27de4631400cdbb9b532df4de4f255eab093ac356f9745\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7c2e5ed663c9df8fd44b624cfef92a703803cc72cf356c96e69a6e88c5ce082d\",\"dweb:/ipfs/QmdtPLYhopn3L14o6TCJkwH28o91do8JriAxpFYt67NWGB\"]},\"@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol\":{\"keccak256\":\"0xe9ecc18d06bcc5aa48c40a98333540248b6c1c18ecb6262329c06d3f0cbb45ae\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a81bcbe4f867a4eaf7ec375508a9901ea7517b9854c9a542c242050beda5127\",\"dweb:/ipfs/QmS499VRDhAgMg1pK96PiyRpP3gJZzzMcoNBbe8AV3JNw3\"]},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"keccak256\":\"0xae7044b7c89ed74327b0979ae6f317c65d87b8d17a42d0c62d698d77d5de5511\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d676c978d8ecee5c4510f045b747d94f3a1381e39feb870d2675d5b6d45a371b\",\"dweb:/ipfs/QmUAokuHWPVAf14QkhPtSdYFyNa8HVje9CBEzwCcxH3xkP\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50610fe3806100206000396000f3fe6080604052600436106100c65760003560e01c80638da5cb5b1161007f578063da8be86411610059578063da8be86414610221578063db88536d14610254578063efbe1c1c14610269578063f2fde38b1461027e576100cd565b80638da5cb5b146101c65780638ef3f761146101f7578063a2e620451461020c576100cd565b80633ccfd60b146100d2578063485cc955146100e95780634d238c8e1461012457806370a0823114610157578063715018a61461019c57806380d04de8146101b1576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100e76102b1565b005b3480156100f557600080fd5b506100e76004803603604081101561010c57600080fd5b506001600160a01b0381358116916020013516610565565b34801561013057600080fd5b506100e76004803603602081101561014757600080fd5b50356001600160a01b0316610635565b34801561016357600080fd5b5061018a6004803603602081101561017a57600080fd5b50356001600160a01b03166106df565b60408051918252519081900360200190f35b3480156101a857600080fd5b506100e76106fa565b3480156101bd57600080fd5b5061018a61079c565b3480156101d257600080fd5b506101db610871565b604080516001600160a01b039092168252519081900360200190f35b34801561020357600080fd5b506101db610880565b34801561021857600080fd5b506100e761088f565b34801561022d57600080fd5b506100e76004803603602081101561024457600080fd5b50356001600160a01b03166108b7565b34801561026057600080fd5b506101db610a05565b34801561027557600080fd5b506100e7610a14565b34801561028a57600080fd5b506100e7600480360360208110156102a157600080fd5b50356001600160a01b0316610c02565b336000908152606560205260409020548061030b576040805162461bcd60e51b81526020600482015260156024820152746e6f207374616b652020746f20776974686472617760581b604482015290519081900360640190fd5b60005b60675481101561052957606854606780546000926001600160a01b0316916321429e60913091908690811061033f57fe5b60009182526020918290200154604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015293909116602484015251604480840193829003018186803b15801561039557600080fd5b505afa1580156103a9573d6000803e3d6000fd5b505050506040513d60208110156103bf57600080fd5b50519050806103ce5750610521565b82811161047f57606854606780546001600160a01b039092169163f3fef3a39190859081106103f957fe5b6000918252602082200154604080516001600160e01b031960e086901b1681526001600160a01b03909216600483015260248201869052516044808301939282900301818387803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506104788184610cfb90919063ffffffff16565b9250610514565b606854606780546001600160a01b039092169163f3fef3a39190859081106104a357fe5b6000918252602082200154604080516001600160e01b031960e086901b1681526001600160a01b03909216600483015260248201889052516044808301939282900301818387803b1580156104f757600080fd5b505af115801561050b573d6000803e3d6000fd5b50505050600092505b8261051f5750610529565b505b60010161030e565b503360008181526065602052604080822054905181156108fc0292818181858888f19350505050158015610561573d6000803e3d6000fd5b5050565b600054610100900460ff168061057e575061057e610d44565b8061058c575060005460ff16155b6105c75760405162461bcd60e51b815260040180806020018281038252602e815260200180610f60602e913960400191505060405180910390fd5b600054610100900460ff161580156105f2576000805460ff1961ff0019909116610100171660011790555b6105fa610d4a565b61060383610c02565b606880546001600160a01b0319166001600160a01b0384161790558015610630576000805461ff00191690555b505050565b61063d610e44565b6033546001600160a01b0390811691161461068d576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b606780546001810182556000919091527f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae0180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526065602052604090205490565b610702610e44565b6033546001600160a01b03908116911614610752576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b600080805b60675481101561086b57606854606780546000926001600160a01b0316916321429e6091309190869081106107d257fe5b60009182526020918290200154604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015293909116602484015251604480840193829003018186803b15801561082857600080fd5b505afa15801561083c573d6000803e3d6000fd5b505050506040513d602081101561085257600080fd5b505190506108608382610e48565b9250506001016107a1565b50905090565b6033546001600160a01b031690565b6068546001600160a01b031681565b606980546001600160a01b031916733014ca10b91cb3d0ad85fef7a3cb95bcac9c0f79179055565b6108bf610e44565b6033546001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6068546040805163010a14f360e51b81523060048201526001600160a01b038481166024830152915160009392909216916321429e6091604480820192602092909190829003018186803b15801561096657600080fd5b505afa15801561097a573d6000803e3d6000fd5b505050506040513d602081101561099057600080fd5b50516068546040805163f3fef3a360e01b81526001600160a01b03868116600483015260248201859052915193945091169163f3fef3a39160448082019260009290919082900301818387803b1580156109e957600080fd5b505af11580156109fd573d6000803e3d6000fd5b505050505050565b6069546001600160a01b031681565b610a1c610e44565b6033546001600160a01b03908116911614610a6c576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6000805b606754811015610bd457606854606780546000926001600160a01b0316916321429e609130919086908110610aa157fe5b60009182526020918290200154604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015293909116602484015251604480840193829003018186803b158015610af757600080fd5b505afa158015610b0b573d6000803e3d6000fd5b505050506040513d6020811015610b2157600080fd5b5051606854606780549293506001600160a01b039091169163f3fef3a3919085908110610b4a57fe5b6000918252602082200154604080516001600160e01b031960e086901b1681526001600160a01b03909216600483015260248201869052516044808301939282900301818387803b158015610b9e57600080fd5b505af1158015610bb2573d6000803e3d6000fd5b50505050610bc98184610e4890919063ffffffff16565b925050600101610a70565b50604051339082156108fc029083906000818181858888f19350505050158015610561573d6000803e3d6000fd5b610c0a610e44565b6033546001600160a01b03908116911614610c5a576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6001600160a01b038116610c9f5760405162461bcd60e51b8152600401808060200182810382526026815260200180610f3a6026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d3d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea2565b9392505050565b303b1590565b600054610100900460ff1680610d635750610d63610d44565b80610d71575060005460ff16155b610dac5760405162461bcd60e51b815260040180806020018281038252602e815260200180610f60602e913960400191505060405180910390fd5b600054610100900460ff16158015610dd7576000805460ff1961ff0019909116610100171660011790555b6000610de1610e44565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610e41576000805461ff00191690555b50565b3390565b600082820183811015610d3d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008184841115610f315760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ef6578181015183820152602001610ede565b50505050905090810190601f168015610f235780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220e5c56068afb87014fbdf939212afcb14e37570bc22645522e69a42ed6c89b9b464736f6c634300060c0033", "deployedBytecode": "0x6080604052600436106100c65760003560e01c80638da5cb5b1161007f578063da8be86411610059578063da8be86414610221578063db88536d14610254578063efbe1c1c14610269578063f2fde38b1461027e576100cd565b80638da5cb5b146101c65780638ef3f761146101f7578063a2e620451461020c576100cd565b80633ccfd60b146100d2578063485cc955146100e95780634d238c8e1461012457806370a0823114610157578063715018a61461019c57806380d04de8146101b1576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100e76102b1565b005b3480156100f557600080fd5b506100e76004803603604081101561010c57600080fd5b506001600160a01b0381358116916020013516610565565b34801561013057600080fd5b506100e76004803603602081101561014757600080fd5b50356001600160a01b0316610635565b34801561016357600080fd5b5061018a6004803603602081101561017a57600080fd5b50356001600160a01b03166106df565b60408051918252519081900360200190f35b3480156101a857600080fd5b506100e76106fa565b3480156101bd57600080fd5b5061018a61079c565b3480156101d257600080fd5b506101db610871565b604080516001600160a01b039092168252519081900360200190f35b34801561020357600080fd5b506101db610880565b34801561021857600080fd5b506100e761088f565b34801561022d57600080fd5b506100e76004803603602081101561024457600080fd5b50356001600160a01b03166108b7565b34801561026057600080fd5b506101db610a05565b34801561027557600080fd5b506100e7610a14565b34801561028a57600080fd5b506100e7600480360360208110156102a157600080fd5b50356001600160a01b0316610c02565b336000908152606560205260409020548061030b576040805162461bcd60e51b81526020600482015260156024820152746e6f207374616b652020746f20776974686472617760581b604482015290519081900360640190fd5b60005b60675481101561052957606854606780546000926001600160a01b0316916321429e60913091908690811061033f57fe5b60009182526020918290200154604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015293909116602484015251604480840193829003018186803b15801561039557600080fd5b505afa1580156103a9573d6000803e3d6000fd5b505050506040513d60208110156103bf57600080fd5b50519050806103ce5750610521565b82811161047f57606854606780546001600160a01b039092169163f3fef3a39190859081106103f957fe5b6000918252602082200154604080516001600160e01b031960e086901b1681526001600160a01b03909216600483015260248201869052516044808301939282900301818387803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506104788184610cfb90919063ffffffff16565b9250610514565b606854606780546001600160a01b039092169163f3fef3a39190859081106104a357fe5b6000918252602082200154604080516001600160e01b031960e086901b1681526001600160a01b03909216600483015260248201889052516044808301939282900301818387803b1580156104f757600080fd5b505af115801561050b573d6000803e3d6000fd5b50505050600092505b8261051f5750610529565b505b60010161030e565b503360008181526065602052604080822054905181156108fc0292818181858888f19350505050158015610561573d6000803e3d6000fd5b5050565b600054610100900460ff168061057e575061057e610d44565b8061058c575060005460ff16155b6105c75760405162461bcd60e51b815260040180806020018281038252602e815260200180610f60602e913960400191505060405180910390fd5b600054610100900460ff161580156105f2576000805460ff1961ff0019909116610100171660011790555b6105fa610d4a565b61060383610c02565b606880546001600160a01b0319166001600160a01b0384161790558015610630576000805461ff00191690555b505050565b61063d610e44565b6033546001600160a01b0390811691161461068d576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b606780546001810182556000919091527f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae0180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526065602052604090205490565b610702610e44565b6033546001600160a01b03908116911614610752576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b600080805b60675481101561086b57606854606780546000926001600160a01b0316916321429e6091309190869081106107d257fe5b60009182526020918290200154604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015293909116602484015251604480840193829003018186803b15801561082857600080fd5b505afa15801561083c573d6000803e3d6000fd5b505050506040513d602081101561085257600080fd5b505190506108608382610e48565b9250506001016107a1565b50905090565b6033546001600160a01b031690565b6068546001600160a01b031681565b606980546001600160a01b031916733014ca10b91cb3d0ad85fef7a3cb95bcac9c0f79179055565b6108bf610e44565b6033546001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6068546040805163010a14f360e51b81523060048201526001600160a01b038481166024830152915160009392909216916321429e6091604480820192602092909190829003018186803b15801561096657600080fd5b505afa15801561097a573d6000803e3d6000fd5b505050506040513d602081101561099057600080fd5b50516068546040805163f3fef3a360e01b81526001600160a01b03868116600483015260248201859052915193945091169163f3fef3a39160448082019260009290919082900301818387803b1580156109e957600080fd5b505af11580156109fd573d6000803e3d6000fd5b505050505050565b6069546001600160a01b031681565b610a1c610e44565b6033546001600160a01b03908116911614610a6c576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6000805b606754811015610bd457606854606780546000926001600160a01b0316916321429e609130919086908110610aa157fe5b60009182526020918290200154604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015293909116602484015251604480840193829003018186803b158015610af757600080fd5b505afa158015610b0b573d6000803e3d6000fd5b505050506040513d6020811015610b2157600080fd5b5051606854606780549293506001600160a01b039091169163f3fef3a3919085908110610b4a57fe5b6000918252602082200154604080516001600160e01b031960e086901b1681526001600160a01b03909216600483015260248201869052516044808301939282900301818387803b158015610b9e57600080fd5b505af1158015610bb2573d6000803e3d6000fd5b50505050610bc98184610e4890919063ffffffff16565b925050600101610a70565b50604051339082156108fc029083906000818181858888f19350505050158015610561573d6000803e3d6000fd5b610c0a610e44565b6033546001600160a01b03908116911614610c5a576040805162461bcd60e51b81526020600482018190526024820152600080516020610f8e833981519152604482015290519081900360640190fd5b6001600160a01b038116610c9f5760405162461bcd60e51b8152600401808060200182810382526026815260200180610f3a6026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d3d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea2565b9392505050565b303b1590565b600054610100900460ff1680610d635750610d63610d44565b80610d71575060005460ff16155b610dac5760405162461bcd60e51b815260040180806020018281038252602e815260200180610f60602e913960400191505060405180910390fd5b600054610100900460ff16158015610dd7576000805460ff1961ff0019909116610100171660011790555b6000610de1610e44565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3508015610e41576000805461ff00191690555b50565b3390565b600082820183811015610d3d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008184841115610f315760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ef6578181015183820152602001610ede565b50505050905090810190601f168015610f235780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220e5c56068afb87014fbdf939212afcb14e37570bc22645522e69a42ed6c89b9b464736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "1005:2824:8:-:0;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "1005:2824:8:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1890:561;;;;;;;;;;;;;:::i;:::-;;1309:176;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1309:176:8;;;;;;;;;;:::i;2989:78::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2989:78:8;-1:-1:-1;;;;;2989:78:8;;:::i;1792:95::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1792:95:8;-1:-1:-1;;;;;1792:95:8;;:::i;:::-;;;;;;;;;;;;;;;;1956:145:13;;;;;;;;;;;;;:::i;3070:258:8:-;;;;;;;;;;;;;:::i;1333:77:13:-;;;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;1333:77:13;;;;;;;;;;;;;;1175:27:8;;;;;;;;;;;;;:::i;1488:116::-;;;;;;;;;;;;;:::i;3331:170::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3331:170:8;-1:-1:-1;;;;;3331:170:8;;:::i;1206:28::-;;;;;;;;;;;;;:::i;3504:291::-;;;;;;;;;;;;;:::i;2250:240:13:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2250:240:13;-1:-1:-1;;;;;2250:240:13;;:::i;1890:561:8:-;1950:10;1921:18;1942:19;;;:7;:19;;;;;;1973:14;1965:48;;;;;-1:-1:-1;;;1965:48:8;;;;;;;;;;;;-1:-1:-1;;;1965:48:8;;;;;;;;;;;;;;;2022:9;2017:387;2041:10;:17;2037:21;;2017:387;;;2088:9;;2129:10;:13;;2070:11;;-1:-1:-1;;;;;2088:9:8;;:25;;2122:4;;2129:10;2140:1;;2129:13;;;;;;;;;;;;;;;;;2088:55;;;-1:-1:-1;;;;;;2088:55:8;;;;;;;-1:-1:-1;;;;;2088:55:8;;;;;;;2129:13;;;;2088:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2088:55:8;;-1:-1:-1;2152:8:8;2148:22;;2162:8;;;2148:22;2186:10;2179:3;:17;2175:194;;2204:9;;2223:10;:13;;-1:-1:-1;;;;;2204:9:8;;;;:18;;2223:10;2234:1;;2223:13;;;;;;;;;;;;;;;2204:38;;;-1:-1:-1;;;;;;2204:38:8;;;;;;;-1:-1:-1;;;;;2223:13:8;;;2204:38;;;;;;;;;;;;;;;;2223:13;2204:38;;;;;2223:13;2204:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2261:19;2276:3;2261:10;:14;;:19;;;;:::i;:::-;2248:32;;2175:194;;;2298:9;;2317:10;:13;;-1:-1:-1;;;;;2298:9:8;;;;:18;;2317:10;2328:1;;2317:13;;;;;;;;;;;;;;;2298:45;;;-1:-1:-1;;;;;;2298:45:8;;;;;;;-1:-1:-1;;;;;2317:13:8;;;2298:45;;;;;;;;;;;;;;;;2317:13;2298:45;;;;;2317:13;2298:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2362:1;2349:14;;2175:194;2377:15;2373:26;;2394:5;;;2373:26;2017:387;;2060:3;;2017:387;;;-1:-1:-1;2407:10:8;2427:19;;;;:7;:19;;;;;;;2407:40;;;;;;;;2427:19;2407:40;2427:19;2407:10;:40;;;;;;;;;;;;;;;;;;;;;1890:561;:::o;1309:176::-;1472:13:16;;;;;;;;:33;;;1489:16;:14;:16::i;:::-;1472:50;;;-1:-1:-1;1510:12:16;;;;1509:13;1472:50;1464:109;;;;-1:-1:-1;;;1464:109:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1584:19;1607:13;;;;;;1606:14;1630:98;;;;1664:13;:20;;-1:-1:-1;;;;1664:20:16;;;;;1698:19;1680:4;1698:19;;;1630:98;1388:26:8::1;:24;:26::i;:::-;1418:25;1436:6;1418:17;:25::i;:::-;1447:9;:34:::0;;-1:-1:-1;;;;;;1447:34:8::1;-1:-1:-1::0;;;;;1447:34:8;::::1;;::::0;;1750:66:16;;;;1800:5;1784:21;;-1:-1:-1;;1784:21:16;;;1750:66;1309:176:8;;;:::o;2989:78::-;1547:12:13;:10;:12::i;:::-;1537:6;;-1:-1:-1;;;;;1537:6:13;;;:22;;;1529:67;;;;;-1:-1:-1;;;1529:67:13;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1529:67:13;;;;;;;;;;;;;;;3044:10:8::1;:19:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;3044:19:8;;;;;::::1;::::0;;-1:-1:-1;;;;;;3044:19:8::1;-1:-1:-1::0;;;;;3044:19:8;;;::::1;::::0;;;::::1;::::0;;2989:78::o;1792:95::-;-1:-1:-1;;;;;1868:15:8;1848:7;1868:15;;;:7;:15;;;;;;;1792:95::o;1956:145:13:-;1547:12;:10;:12::i;:::-;1537:6;;-1:-1:-1;;;;;1537:6:13;;;:22;;;1529:67;;;;;-1:-1:-1;;;1529:67:13;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1529:67:13;;;;;;;;;;;;;;;2046:6:::1;::::0;2025:40:::1;::::0;2062:1:::1;::::0;-1:-1:-1;;;;;2046:6:13::1;::::0;2025:40:::1;::::0;2062:1;;2025:40:::1;2075:6;:19:::0;;-1:-1:-1;;;;;;2075:19:13::1;::::0;;1956:145::o;3070:258:8:-;3117:7;;;3151:158;3175:10;:17;3171:21;;3151:158;;;3222:9;;3263:10;:13;;3204:11;;-1:-1:-1;;;;;3222:9:8;;:25;;3256:4;;3263:10;3274:1;;3263:13;;;;;;;;;;;;;;;;;3222:55;;;-1:-1:-1;;;;;;3222:55:8;;;;;;;-1:-1:-1;;;;;3222:55:8;;;;;;;3263:13;;;;3222:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3222:55:8;;-1:-1:-1;3290:14:8;:5;3222:55;3290:9;:14::i;:::-;3282:22;-1:-1:-1;;3194:3:8;;3151:158;;;-1:-1:-1;3319:5:8;-1:-1:-1;3070:258:8;:::o;1333:77:13:-;1397:6;;-1:-1:-1;;;;;1397:6:13;1333:77;:::o;1175:27:8:-;;;-1:-1:-1;;;;;1175:27:8;;:::o;1488:116::-;1517:10;:83;;-1:-1:-1;;;;;;1517:83:8;1553:42;1517:83;;;1488:116::o;3331:170::-;1547:12:13;:10;:12::i;:::-;1537:6;;-1:-1:-1;;;;;1537:6:13;;;:22;;;1529:67;;;;;-1:-1:-1;;;1529:67:13;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1529:67:13;;;;;;;;;;;;;;;3406:9:8::1;::::0;:52:::1;::::0;;-1:-1:-1;;;3406:52:8;;3440:4:::1;3406:52;::::0;::::1;::::0;-1:-1:-1;;;;;3406:52:8;;::::1;::::0;;;;;;3392:11:::1;::::0;3406:9;;;::::1;::::0;:25:::1;::::0;:52;;;;;::::1;::::0;;;;;;;;;:9;:52;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;3406:52:8;3462:9:::1;::::0;:35:::1;::::0;;-1:-1:-1;;;3462:35:8;;-1:-1:-1;;;;;3462:35:8;;::::1;;::::0;::::1;::::0;;;;;;;;;3406:52;;-1:-1:-1;3462:9:8;::::1;::::0;:18:::1;::::0;:35;;;;;:9:::1;::::0;:35;;;;;;;;:9;;:35;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;1606:1:13;3331:170:8::0;:::o;1206:28::-;;;-1:-1:-1;;;;;1206:28:8;;:::o;3504:291::-;1547:12:13;:10;:12::i;:::-;1537:6;;-1:-1:-1;;;;;1537:6:13;;;:22;;;1529:67;;;;;-1:-1:-1;;;1529:67:13;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1529:67:13;;;;;;;;;;;;;;;3540:13:8::1;3566:9:::0;3561:201:::1;3585:10;:17:::0;3581:21;::::1;3561:201;;;3632:9;::::0;3673:10:::1;:13:::0;;3614:11:::1;::::0;-1:-1:-1;;;;;3632:9:8::1;::::0;:25:::1;::::0;3666:4:::1;::::0;3673:10;3684:1;;3673:13;::::1;;;;;;::::0;;;::::1;::::0;;;;::::1;::::0;3632:55:::1;::::0;;-1:-1:-1;;;;;;3632:55:8::1;::::0;;;;;;-1:-1:-1;;;;;3632:55:8;;::::1;;::::0;::::1;::::0;3673:13;;;::::1;3632:55:::0;;;;;;;;;;;;;;;;;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;3632:55:8;3692:9:::1;::::0;3711:10:::1;:13:::0;;3632:55;;-1:-1:-1;;;;;;3692:9:8;;::::1;::::0;:18:::1;::::0;3711:10;3722:1;;3711:13;::::1;;;;;;::::0;;;::::1;::::0;;::::1;::::0;3692:38:::1;::::0;;-1:-1:-1;;;;;;3692:38:8::1;::::0;;;;;;-1:-1:-1;;;;;3711:13:8;;::::1;3692:38;::::0;::::1;::::0;;;;;;;;;;;;;3711:13;3692:38;;;;;3711:13;3692:38;;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;3743:14;3753:3;3743:5;:9;;:14;;;;:::i;:::-;3735:22:::0;-1:-1:-1;;3604:3:8::1;;3561:201;;;-1:-1:-1::0;3765:26:8::1;::::0;:10:::1;::::0;:26;::::1;;;::::0;3785:5;;3765:26:::1;::::0;;;3785:5;3765:10;:26;::::1;;;;;;;;;;;;;::::0;::::1;;;;2250:240:13::0;1547:12;:10;:12::i;:::-;1537:6;;-1:-1:-1;;;;;1537:6:13;;;:22;;;1529:67;;;;;-1:-1:-1;;;1529:67:13;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1529:67:13;;;;;;;;;;;;;;;-1:-1:-1;;;;;2338:22:13;::::1;2330:73;;;;-1:-1:-1::0;;;2330:73:13::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2439:6;::::0;2418:38:::1;::::0;-1:-1:-1;;;;;2418:38:13;;::::1;::::0;2439:6:::1;::::0;2418:38:::1;::::0;2439:6:::1;::::0;2418:38:::1;2466:6;:17:::0;;-1:-1:-1;;;;;;2466:17:13::1;-1:-1:-1::0;;;;;2466:17:13;;;::::1;::::0;;;::::1;::::0;;2250:240::o;1340:134:15:-;1398:7;1424:43;1428:1;1431;1424:43;;;;;;;;;;;;;;;;;:3;:43::i;:::-;1417:50;1340:134;-1:-1:-1;;;1340:134:15:o;1912:593:16:-;2348:4;2456:17;2491:7;1912:593;:::o;1065:192:13:-;1472:13:16;;;;;;;;:33;;;1489:16;:14;:16::i;:::-;1472:50;;;-1:-1:-1;1510:12:16;;;;1509:13;1472:50;1464:109;;;;-1:-1:-1;;;1464:109:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1584:19;1607:13;;;;;;1606:14;1630:98;;;;1664:13;:20;;-1:-1:-1;;;;1664:20:16;;;;;1698:19;1680:4;1698:19;;;1630:98;1132:17:13::1;1152:12;:10;:12::i;:::-;1174:6;:18:::0;;-1:-1:-1;;;;;;1174:18:13::1;-1:-1:-1::0;;;;;1174:18:13;::::1;::::0;;::::1;::::0;;;1207:43:::1;::::0;1174:18;;-1:-1:-1;1174:18:13;-1:-1:-1;;1207:43:13::1;::::0;-1:-1:-1;;1207:43:13::1;1738:1:16;1754:14:::0;1750:66;;;1800:5;1784:21;;-1:-1:-1;;1784:21:16;;;1750:66;1065:192:13;:::o;828:104:12:-;915:10;828:104;:::o;893:176:15:-;951:7;982:5;;;1005:6;;;;997:46;;;;;-1:-1:-1;;;997:46:15;;;;;;;;;;;;;;;;;;;;;;;;;;;1765:187;1851:7;1886:12;1878:6;;;;1870:29;;;;-1:-1:-1;;;1870:29:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1921:5:15;;;1765:187::o", "source": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6;\nimport \"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol\";\n\ninterface IConsensus {\n\t/**\n\t * @dev delegate to a validator\n\t * @param _validator the address of the validator msg.sender is delegating to\n\t */\n\tfunction delegate(address _validator) external payable;\n\n\t/**\n\t * @dev Function to be called when a delegator whishes to withdraw some of his staked funds for a validator\n\t * @param _validator the address of the validator msg.sender has delegating to\n\t * @param _amount the amount msg.sender wishes to withdraw from the contract\n\t */\n\tfunction withdraw(address _validator, uint256 _amount) external;\n\n\tfunction delegatedAmount(address _address, address _validator)\n\t\texternal\n\t\tview\n\t\treturns (uint256);\n\n\tfunction stakeAmount(address _address) external view returns (uint256);\n}\n\ncontract FuseStaking is Initializable, OwnableUpgradeable {\n\tmapping(address => uint256) stakers;\n\tmapping(address => uint256) validatorsStaked;\n\taddress[] validators;\n\n\tIConsensus public consensus;\n\n\tIConsensus public consensus2;\n\n\tusing SafeMathUpgradeable for uint256;\n\n\t/**\n\t * @dev initialize\n\t */\n\tfunction initialize(address _owner, address _consensus) public initializer {\n\t\t__Ownable_init_unchained();\n\t\ttransferOwnership(_owner);\n\t\tconsensus = IConsensus(_consensus);\n\t}\n\n\tfunction update() public {\n\t\tconsensus2 = IConsensus(\n\t\t\taddress(0x3014ca10b91cb3D0AD85fEf7A3Cb95BCAc9c0f79)\n\t\t);\n\t}\n\n\t// function stake() public payable {\n\t// \trequire(msg.value > 0, \"stake must be > 0\");\n\t// \tstakeNextValidator();\n\t// \tstakers[msg.sender] = stakers[msg.sender].add(msg.value);\n\t// }\n\n\tfunction balanceOf(address _owner) public view returns (uint256) {\n\t\treturn stakers[_owner];\n\t}\n\n\tfunction withdraw() public {\n\t\tuint256 toWithdraw = stakers[msg.sender];\n\t\trequire(toWithdraw > 0, \"no stake to withdraw\");\n\t\tfor (uint256 i = 0; i < validators.length; i++) {\n\t\t\tuint256 cur =\n\t\t\t\tconsensus.delegatedAmount(address(this), validators[i]);\n\t\t\tif (cur == 0) continue;\n\t\t\tif (cur <= toWithdraw) {\n\t\t\t\tconsensus.withdraw(validators[i], cur);\n\t\t\t\ttoWithdraw = toWithdraw.sub(cur);\n\t\t\t} else {\n\t\t\t\tconsensus.withdraw(validators[i], toWithdraw);\n\t\t\t\ttoWithdraw = 0;\n\t\t\t}\n\t\t\tif (toWithdraw == 0) break;\n\t\t}\n\t\tmsg.sender.transfer(stakers[msg.sender]);\n\t}\n\n\tfunction stakeNextValidator() internal {\n\t\tif (validators.length == 0) return;\n\t\tuint256 min = validatorsStaked[validators[0]];\n\t\tuint256 minIdx = 0;\n\t\tfor (uint256 i = 1; i < validators.length; i++) {\n\t\t\tuint256 cur =\n\t\t\t\tconsensus.delegatedAmount(address(this), validators[i]);\n\t\t\tif (cur < min) minIdx = i;\n\t\t}\n\t\tuint256 balance = payable(address(this)).balance;\n\n\t\tconsensus.delegate{ value: balance }(validators[minIdx]);\n\t\tvalidatorsStaked[validators[minIdx]] = validatorsStaked[\n\t\t\tvalidators[minIdx]\n\t\t]\n\t\t\t.add(balance);\n\t}\n\n\tfunction addValidator(address _v) public onlyOwner {\n\t\tvalidators.push(_v);\n\t}\n\n\tfunction totalDelegated() public view returns (uint256) {\n\t\tuint256 total = 0;\n\t\tfor (uint256 i = 0; i < validators.length; i++) {\n\t\t\tuint256 cur =\n\t\t\t\tconsensus.delegatedAmount(address(this), validators[i]);\n\t\t\ttotal = total.add(cur);\n\t\t}\n\t\treturn total;\n\t}\n\n\tfunction undelegate(address _validator) public onlyOwner {\n\t\tuint256 cur = consensus.delegatedAmount(address(this), _validator);\n\t\tconsensus.withdraw(_validator, cur);\n\t}\n\n\tfunction end() public onlyOwner {\n\t\tuint256 total = 0;\n\t\tfor (uint256 i = 0; i < validators.length; i++) {\n\t\t\tuint256 cur =\n\t\t\t\tconsensus.delegatedAmount(address(this), validators[i]);\n\t\t\tconsensus.withdraw(validators[i], cur);\n\t\t\ttotal = total.add(cur);\n\t\t}\n\t\tmsg.sender.transfer(total);\n\t}\n\n\treceive() external payable {}\n}\n", "sourcePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/upgradables/contracts/staking/FuseStaking.sol", "ast": { "absolutePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/upgradables/contracts/staking/FuseStaking.sol", "exportedSymbols": { "FuseStaking": [ 5576 ], "IConsensus": [ 5163 ] }, "id": 5577, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 5129, "literals": [ "solidity", ">=", "0.6" ], "nodeType": "PragmaDirective", "src": "33:22:8" }, { "absolutePath": "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol", "file": "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol", "id": 5130, "nodeType": "ImportDirective", "scope": 5577, "sourceUnit": 8212, "src": "56:69:8", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol", "file": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol", "id": 5131, "nodeType": "ImportDirective", "scope": 5577, "sourceUnit": 7874, "src": "126:75:8", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol", "file": "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol", "id": 5132, "nodeType": "ImportDirective", "scope": 5577, "sourceUnit": 8141, "src": "202:74:8", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "interface", "documentation": null, "fullyImplemented": false, "id": 5163, "linearizedBaseContracts": [ 5163 ], "name": "IConsensus", "nodeType": "ContractDefinition", "nodes": [ { "body": null, "documentation": { "id": 5133, "nodeType": "StructuredDocumentation", "src": "302:120:8", "text": " @dev delegate to a validator\n @param _validator the address of the validator msg.sender is delegating to" }, "functionSelector": "5c19a95c", "id": 5138, "implemented": false, "kind": "function", "modifiers": [], "name": "delegate", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5136, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5135, "mutability": "mutable", "name": "_validator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5138, "src": "442:18:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5134, "name": "address", "nodeType": "ElementaryTypeName", "src": "442:7:8", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "441:20:8" }, "returnParameters": { "id": 5137, "nodeType": "ParameterList", "parameters": [], "src": "478:0:8" }, "scope": 5163, "src": "424:55:8", "stateMutability": "payable", "virtual": false, "visibility": "external" }, { "body": null, "documentation": { "id": 5139, "nodeType": "StructuredDocumentation", "src": "482:275:8", "text": " @dev Function to be called when a delegator whishes to withdraw some of his staked funds for a validator\n @param _validator the address of the validator msg.sender has delegating to\n @param _amount the amount msg.sender wishes to withdraw from the contract" }, "functionSelector": "f3fef3a3", "id": 5146, "implemented": false, "kind": "function", "modifiers": [], "name": "withdraw", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5144, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5141, "mutability": "mutable", "name": "_validator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5146, "src": "777:18:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5140, "name": "address", "nodeType": "ElementaryTypeName", "src": "777:7:8", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5143, "mutability": "mutable", "name": "_amount", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5146, "src": "797:15:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5142, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "797:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "776:37:8" }, "returnParameters": { "id": 5145, "nodeType": "ParameterList", "parameters": [], "src": "822:0:8" }, "scope": 5163, "src": "759:64:8", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "body": null, "documentation": null, "functionSelector": "21429e60", "id": 5155, "implemented": false, "kind": "function", "modifiers": [], "name": "delegatedAmount", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 5151, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5148, "mutability": "mutable", "name": "_address", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5155, "src": "851:16:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5147, "name": "address", "nodeType": "ElementaryTypeName", "src": "851:7:8", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 5150, "mutability": "mutable", "name": "_validator", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5155, "src": "869:18:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 5149, "name": "address", "nodeType": "ElementaryTypeName", "src": "869:7:8", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "850:38:8" }, "returnParameters": { "id": 5154, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 5153, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 5155, "src": "918:7:8", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 5152, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "918:7:8", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "917:9:8" }, "scope": 5163, "src": "826:101:8", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "body": null, "documentation": null, "functionSelector": "bf135267", "id": 5162, "implemented": false, "kind": "function", "modifiers": [], "name": "stakeAmo