Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit f0f87dd

Browse files
committed
ETH bonding contract
The contract is used for ETH only bonding. It defined withdraw function that is different from the one defined in KeepBonding contract as there is no grantee role. Other parts of the code are common for token bonding and eth bonding.
1 parent 3bf2b1a commit f0f87dd

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

solidity/contracts/ETHBonding.sol

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 "./AbstractBonding.sol";
18+
19+
20+
/// @title ETH Bonding
21+
/// @notice Contract holding deposits from keeps' operators.
22+
contract ETHBonding is AbstractBonding {
23+
/// @notice Initializes Keep Bonding contract.
24+
/// @param registryAddress Keep registry contract address.
25+
/// @param ethStakingAddress ETH Staking contract address.
26+
constructor(address registryAddress, address ethStakingAddress)
27+
public
28+
AbstractBonding(registryAddress, ethStakingAddress)
29+
{}
30+
31+
/// @notice Withdraws amount from operator's value available for bonding.
32+
/// This function can be called only by:
33+
/// - operator,
34+
/// - owner of the stake.
35+
///
36+
/// @param amount Value to withdraw in wei.
37+
/// @param operator Address of the operator.
38+
function withdraw(uint256 amount, address operator) public {
39+
require(
40+
msg.sender == operator || msg.sender == staking.ownerOf(operator),
41+
"Only operator or the owner is allowed to withdraw bond"
42+
);
43+
44+
withdrawBond(amount, operator);
45+
}
46+
}

0 commit comments

Comments
 (0)