Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Add a way for staking piles to store a memo field.
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Nov 8, 2019
1 parent 877b3c9 commit 104ebc5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dir-ethereum/directory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ contract OrchidDirectory is IOrchidDirectory {
uint128 delay_;

address stakee_;
bytes data_;

bytes32 parent_;
Primary left_;
Expand All @@ -103,7 +104,7 @@ contract OrchidDirectory is IOrchidDirectory {
return stake.before_ + stake.after_ + stake.amount_;
}

function scan(uint128 percent) public view returns (bytes32, address, uint128) {
function scan(uint128 percent) public view returns (bytes32, address, uint128, bytes memory) {
require(!nope(root_));

uint128 point = uint128(have() * uint256(percent) / 2**128);
Expand All @@ -121,7 +122,7 @@ contract OrchidDirectory is IOrchidDirectory {
point -= stake.before_;

if (point < stake.amount_)
return (key, stake.stakee_, stake.delay_);
return (key, stake.stakee_, stake.delay_, stake.data_);

point -= stake.amount_;

Expand Down Expand Up @@ -213,6 +214,16 @@ contract OrchidDirectory is IOrchidDirectory {
}


function move(address stakee, bytes memory data) public {
address staker = msg.sender;
bytes32 key = name(staker, stakee);
Stake storage stake = stakes_[key];
require(stake.amount_ != 0);

stake.data_ = data;
}


struct Pending {
uint256 expire_;
address stakee_;
Expand Down

0 comments on commit 104ebc5

Please sign in to comment.