Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
e63faeb
ETH bonding contract
nkuba Jun 17, 2020
32ee0d4
ETH staking contract
nkuba Jun 17, 2020
48f2384
Added tests for ETH bonding and staking contracts
nkuba Aug 7, 2020
865b0a4
Added todo about initialization period
nkuba Aug 11, 2020
d6ae3f7
Updated visibility to match abstract contract
nkuba Aug 19, 2020
531690b
Updated events emitted on ETH stake
nkuba Aug 19, 2020
4112c05
Renamed ETHBonding to EthBonding
nkuba Aug 19, 2020
3a5636c
Renamed ETHStaking to EthDelegating
nkuba Aug 19, 2020
f252f4f
Renamed stake to delegate
nkuba Aug 19, 2020
6c71cea
Renamed _from to owner
nkuba Aug 19, 2020
2479778
Expect contract typed addresses in constructors
nkuba Aug 19, 2020
c61e18c
Combined EthDelegating into EthBonding
nkuba Aug 19, 2020
07e5ddb
Added EthBonding to deployment script
nkuba Aug 19, 2020
a8f4489
Initialization period for ETH-only delegation
nkuba Aug 20, 2020
aab2b89
Require minimum ETH value passed on delegation
nkuba Aug 20, 2020
4a75c11
Added getDelegationInfo
nkuba Aug 20, 2020
b98050a
Renamed EthBonding to FullyBackedBonding
nkuba Sep 24, 2020
fd99459
Updated order of imports
nkuba Sep 24, 2020
6bf2f6a
Moved FullyBackedBonding contract to dedicated directory
nkuba Sep 24, 2020
04c8d25
Initial version of FullyBackedBondedECDSAKeep
nkuba Sep 24, 2020
7533b4a
Initial version of FullyBackedBondedECDSAKeepFactory
nkuba Sep 24, 2020
20c375e
Renamed EthBondingTest.js
nkuba Sep 24, 2020
81be402
Added unit tests for FullyBacked keep and bonding
nkuba Sep 25, 2020
7c3d0aa
Added fully backed contracts to migrations scripts
nkuba Sep 25, 2020
0079c13
Claim delegated authority in Fully Backed keep contract
nkuba Sep 25, 2020
d5d6703
Added missing import in Keep Factory contract
nkuba Sep 25, 2020
c2fc5ef
Minor improvements to docs
nkuba Sep 25, 2020
360486f
Lock bonding withdraw just after delegation
nkuba Sep 26, 2020
d65a096
Merge branch 'master' into eth-bonding
pdyraga Oct 27, 2020
742d3cf
Refer to the most recent pre versions of keep dependencies
pdyraga Oct 27, 2020
a9cb6f3
Project version for contracts set to 1.3.0-pre.0
pdyraga Oct 27, 2020
80c6e49
Revert "Expect contract typed addresses in constructors"
nkuba Oct 29, 2020
26eea9d
Removed comment about clone removal
nkuba Oct 29, 2020
cc58f14
Renamed FullyBackedBondedECDSAKeep to FullyBackedECDSAKeep
nkuba Oct 29, 2020
1e088d8
Confirmed bondWeightDivisor to 1 ETH
nkuba Oct 29, 2020
c04038b
Increased DELEGATION_LOCK_PERIOD to 2 weeks
nkuba Oct 29, 2020
c8dc76e
Updated delegation lock period hardcoded in test
nkuba Oct 29, 2020
85c3663
Include delegation value in OperatorDelegated event
nkuba Oct 30, 2020
566cc48
Set minimum delegation deposit to 40 ETH
nkuba Oct 30, 2020
a1ea59b
Decided on 20 ETH as minimum bond value
nkuba Oct 30, 2020
e4c9d82
Improved time increase value in test
nkuba Oct 30, 2020
ff5008c
Updated delegation lock period to 12 hours
nkuba Oct 30, 2020
0c0475a
Improved docs around fully backed bonding
nkuba Oct 30, 2020
ae34de4
Cleaned up truffle deploy script
nkuba Oct 30, 2020
25c6a4d
Assert createdAt and undelegatedAt in delegation test
nkuba Oct 30, 2020
faca5bd
Cleaned truffle init script
nkuba Oct 30, 2020
03daf5f
Removed not used addKeep function from test stubs
nkuba Oct 30, 2020
196880a
Improved time increase margin in tests
nkuba Oct 30, 2020
d1edab3
Merge remote-tracking branch 'origin/master' into eth-bonding
nkuba Oct 30, 2020
ee9a30b
Removed not needed TODO comment in test
nkuba Nov 2, 2020
65186c9
Very minor improvements to tests
nkuba Nov 2, 2020
b92218c
Get delegation lock period from contract in tests
nkuba Nov 2, 2020
766a841
Removed not needed call in initialization script
nkuba Nov 2, 2020
8a4ff82
Defined ini period in truffle deployment script
nkuba Nov 2, 2020
3778ae1
Added tests for operator updates
nkuba Nov 2, 2020
cf0127c
Added top up function to Fully Backed Bonding contract
nkuba Nov 2, 2020
102ce15
Fixed failing test
nkuba Nov 2, 2020
dc04021
Replaced before with beforeEach for topUp test
nkuba Nov 2, 2020
f9f719a
Added details to topup documentation
nkuba Nov 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions solidity/contracts/fully-backed/FullyBackedBonding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ contract FullyBackedBonding is
uint256 value
);

event OperatorToppedUp(address indexed operator, uint256 value);

// The ether value (in wei) that should be passed along with the delegation
// and deposited for bonding.
uint256 public constant MINIMUM_DELEGATION_DEPOSIT = 40 ether;
Expand Down Expand Up @@ -104,6 +106,18 @@ contract FullyBackedBonding is
emit OperatorDelegated(operator, beneficiary, authorizer, msg.value);
}

/// @notice Top-ups operator's unbonded value.
/// @dev This function should be used to add new unbonded value to the system
/// for an operator. The `deposit` function defined in parent abstract contract
/// should be called only by applications returning value that has been already
/// initially deposited and seized later.
/// @param operator Address of the operator.
function topUp(address operator) public payable {
deposit(operator);

emit OperatorToppedUp(operator, msg.value);
}

/// @notice Checks if the operator for the given bond creator contract
/// has passed the initialization period.
/// @param operator The operator address.
Expand Down
48 changes: 48 additions & 0 deletions solidity/test/FullyBackedBondingTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,54 @@ describe("FullyBackedBonding", function () {
})
})

describe("topUp", async () => {
const value = new BN(123)

let initialDeposit

before(async () => {
initialDeposit = minimumDelegationValue

await bonding.delegate(operator, beneficiary, authorizer, {
from: owner,
value: initialDeposit,
})
})

it("adds value to deposited on delegation", async () => {
const expectedFinalBalance = initialDeposit.add(value)

await bonding.topUp(operator, {
value: value,
})

expect(await bonding.unbondedValue(operator)).to.eq.BN(
expectedFinalBalance,
"invalid final unbonded value"
)
})

it("emits event", async () => {
const receipt = await bonding.topUp(operator, {
value: value,
})

expectEvent(receipt, "OperatorToppedUp", {
operator: operator,
value: value,
})
})

it("reverts when no delegation happened", async () => {
await expectRevert(
bonding.topUp(thirdParty, {
value: new BN(123),
}),
"Beneficiary not defined for the operator"
)
})
})

describe("deposit", async () => {
it("adds value to deposited on delegation", async () => {
const initialDeposit = minimumDelegationValue
Expand Down