corrrect commitment & redeem conditioning
This commit is contained in:
parent
2969ace51b
commit
f853f019d7
@ -60,9 +60,13 @@ contract DelegatedInstance {
|
||||
|
||||
delete _balance;
|
||||
|
||||
IGovernance(_governanceAddress).unlock(stake);
|
||||
IStaking(_stakingAddress).getReward();
|
||||
IERC20(_tokenAddress).transfer(_spender, stake + reward);
|
||||
if (reward > 0) {
|
||||
IStaking(_stakingAddress).getReward();
|
||||
} if (stake > 0) {
|
||||
IGovernance(_governanceAddress).unlock(stake);
|
||||
} if (stake + reward > 0) {
|
||||
IERC20(_tokenAddress).transfer(_spender, stake + reward);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -84,21 +88,25 @@ contract DelegatedVesting {
|
||||
_governanceAddress = governanceAddress;
|
||||
}
|
||||
|
||||
function isCommitment(address stakeholder) public view returns (bool) {
|
||||
return _balances[stakeholder] > 0 && _commitments[stakeholder] > 0;
|
||||
}
|
||||
|
||||
function isActiveCommitment(address stakeholder) public view returns (bool) {
|
||||
return _balances[stakeholder] > 0 && _commitments[stakeholder] > block.timestamp;
|
||||
}
|
||||
|
||||
function isDelegatedCommitment(address stakeholder) public view returns (bool) {
|
||||
return isActiveCommitment(stakeholder) && _instances[stakeholder] != address(0x0);
|
||||
return isCommitment(stakeholder) && _instances[stakeholder] != address(0x0);
|
||||
}
|
||||
|
||||
function isFulfilledCommitment(address stakeholder) public view returns (bool) {
|
||||
return _balances[stakeholder] > 0 && _commitments[stakeholder] < block.timestamp;
|
||||
return isCommitment(stakeholder) && _commitments[stakeholder] < block.timestamp;
|
||||
}
|
||||
|
||||
function makeCommitment(address stakeholder, uint256 amount, uint256 expiry) public {
|
||||
require(block.timestamp < expiry, "INVALID EXPIRY TIMESTAMP");
|
||||
require(_commitments[stakeholder] == 0, "ACTIVE VESTING");
|
||||
require(!isCommitment(stakeholder), "IS ACTIVE COMMITMENT");
|
||||
|
||||
IERC20(_tokenAddress).transferFrom(msg.sender, address(this), amount);
|
||||
|
||||
@ -113,7 +121,7 @@ contract DelegatedVesting {
|
||||
bytes32 r,
|
||||
bytes32 s
|
||||
) public {
|
||||
require(isActiveCommitment(msg.sender), "INVALID COMMITMENT");
|
||||
require(isCommitment(msg.sender), "INVALID COMMITMENT");
|
||||
|
||||
if(isDelegatedCommitment(msg.sender)) {
|
||||
DelegatedInstance(_instances[msg.sender]).delegate(delegateAddress);
|
||||
|
@ -22,7 +22,8 @@ contract Proposal {
|
||||
uint256 AUCTION_WINDOW_LENGTH = 8 hours;
|
||||
|
||||
function executeProposal() external {
|
||||
RDA(auctionAddress).createAuction(
|
||||
IERC20(tokenAddress).approve(auctionAddress, AUCTION_RESERVE_AMOUNT);
|
||||
IRDA(auctionAddress).createAuction(
|
||||
vestingAddress,
|
||||
governanceAddress,
|
||||
tokenAddress,
|
||||
|
@ -28,8 +28,8 @@ interface IRDA {
|
||||
uint256 startingOriginPrice,
|
||||
uint256 startTimestamp,
|
||||
uint256 endTimestamp,
|
||||
uint256 vestingTimestamp,
|
||||
uint256 windowDuration
|
||||
uint256 windowDuration,
|
||||
uint256 vestingDuration
|
||||
) external returns (bytes memory);
|
||||
|
||||
function withdraw(bytes memory auctionId) external;
|
||||
|
Loading…
x
Reference in New Issue
Block a user