|
| 1 | +/** |
| 2 | +▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄ |
| 3 | +▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ |
| 4 | + ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ |
| 5 | + ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ |
| 6 | + ▓▓▓▓▓▓▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ |
| 7 | + ▓▓▓▓▓▓▀▀▓▓▓▓▓▓▄ ▐▓▓▓▓▓▓▀▀▀▀ ▓▓▓▓▓▓▀▀▀▀ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▀ |
| 8 | + ▓▓▓▓▓▓ ▀▓▓▓▓▓▓▄ ▐▓▓▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ |
| 9 | +▓▓▓▓▓▓▓▓▓▓ █▓▓▓▓▓▓▓▓▓ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ |
| 10 | +▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ |
| 11 | +
|
| 12 | + Trust math, not hardware. |
| 13 | +*/ |
| 14 | + |
| 15 | +pragma solidity 0.5.17; |
| 16 | + |
| 17 | +import "@keep-network/keep-core/contracts/KeepRegistry.sol"; |
| 18 | +import "@keep-network/keep-core/contracts/KeepStaking.sol"; |
| 19 | + |
| 20 | +import "openzeppelin-solidity/contracts/math/SafeMath.sol"; |
| 21 | + |
| 22 | + |
| 23 | +/// @title ETH Staking |
| 24 | +/// @notice A staking contract for ETH staking. An owner of the ETH can delegate |
| 25 | +/// ETH as a stake to an operator. The value of ETH the owner is willing to stake |
| 26 | +/// should be deposited in `ETHBonding` contract for the given operator. |
| 27 | +contract ETHStaking is KeepStaking { |
| 28 | + constructor(address keepRegistryAddress) |
| 29 | + public |
| 30 | + KeepStaking(keepRegistryAddress) |
| 31 | + {} |
| 32 | + |
| 33 | + event Staked( |
| 34 | + address indexed owner, |
| 35 | + address indexed beneficiary, |
| 36 | + address indexed authorizer |
| 37 | + ); |
| 38 | + |
| 39 | + function stake( |
| 40 | + address operator, |
| 41 | + address payable beneficiary, |
| 42 | + address authorizer |
| 43 | + ) external payable { |
| 44 | + address _from = msg.sender; |
| 45 | + |
| 46 | + operators[operator] = Operator(0, _from, beneficiary, authorizer); |
| 47 | + ownerOperators[_from].push(operator); |
| 48 | + |
| 49 | + emit Staked(_from, beneficiary, authorizer); |
| 50 | + } |
| 51 | +} |
0 commit comments