TMP-7: Withdraw polls
tmp: 7
title: Withdraw polls
author: Evert Kors (@Evert0x)
discussions-to: #7
status: Draft
type: Module
created: 2021/01/22
requires (*optional):
replaces (*optional):
Simple Summary
Interface to propose a withdraw with an amount and a beneficiary
Abstract
Depending on the other modules implemented, this TMP can be used to withdraw assets from the pool.
Motivation
...
Specification
Interface
interface IWithdraw {
event WithdrawPollCreated(uint256 id, uint256 indexed member);
function proposeWithdraw(uint256 _amount, address _beneficiary) external;
function setProposeWithdrawPollDuration(uint256 _duration) external;
function getProposeWithdrawPollDuration() external returns (uint256);
}
interface IWithdrawPoll {
event Withdrawn(uint256 id, address indexed member, uint256 reward);
event WithdrawPollVoted(uint256 id, address indexed member, bool vote);
event WithdrawPollFinalized(uint256 id, bool approved);
event WithdrawPollRevokedVote(uint256 id, address indexed member);
function getBeneficiary(uint256 _id) external view returns (uint256);
function getAmount(uint256 _id) external view returns (uint256);
function _withdrawPollVote(bool _agree) external;
function _withdrawPollRevokeVote() external;
function _withdrawPollFinalize() external;
function _withdrawPollApprovalState() external view returns (bool);
}
interface IWithdrawPollProxy {
function withdrawPollVote(uint256 _id, bool _agree) external;
function withdrawPollRevokeVote(uint256 _id) external;
function withdrawPollFinalize(uint256 _id) external;
function withdrawPollApprovalState(uint256 _id)
external
view
returns (bool);
}
Storage
struct WithdrawStorage {
uint256 proposeWithdrawPollDuration;
}
struct WithdrawPollStorage {
uint256 beneficiary;
uint256 amount;
}
function getPosition(uint256 _id) internal pure returns (bytes32) {
return
keccak256(abi.encode("diamond.contract.assetpool.withdrawpoll", _id));
}
function withdrawStorage() internal pure returns (WithdrawStorage storage bs) {
bytes32 position = WITHDRAW_STORAGE;
assembly {
bs.slot := position
}
}
function withdrawPollStorage(bytes32 _pos) internal pure returns (WithdrawPollStorage storage bs) {
assembly {
bs.slot := _pos
}
}
function withdrawPollStorageId(uint256 _id) internal pure returns (WithdrawPollStorage storage bs) {
bytes32 position = getPosition(_id);
assembly {
bs.slot := position
}
}
Rationale
Backwards Compatibility
Reference Implementation
Security Considerations
Copyright
TMP-7: Withdraw polls
tmp: 7
title: Withdraw polls
author: Evert Kors (@Evert0x)
discussions-to: #7
status: Draft
type: Module
created: 2021/01/22
requires (*optional):
replaces (*optional):
Simple Summary
Interface to propose a withdraw with an amount and a beneficiary
Abstract
Depending on the other modules implemented, this TMP can be used to withdraw assets from the pool.
Motivation
...
Specification
Interface
Storage
Rationale
Backwards Compatibility
Reference Implementation
Security Considerations
Copyright