View Source: contracts/escrow/EscrowReward.sol
↗ Extends: Escrow
Multisig can use this contract for depositing of Reward tokens based on the total token deposit.
Constants & Variables
uint256 public totalRewardDeposit;
contract ILockedSOV public lockedSOV;
Events
event LockedSOVUpdated(address indexed _initiator, address indexed _lockedSOV);
event RewardDepositByMultisig(address indexed _initiator, uint256 _amount);
event RewardTokenWithdraw(address indexed _initiator, uint256 _amount);
- constructor(address _lockedSOV, address _SOV, address _multisig, uint256 _releaseTime, uint256 _depositLimit)
- updateLockedSOV(address _lockedSOV)
- depositRewardByMultisig(uint256 _amount)
- withdrawTokensAndReward()
- getReward(address _addr)
Setup the required parameters.
function (address _lockedSOV, address _SOV, address _multisig, uint256 _releaseTime, uint256 _depositLimit) public nonpayable Escrow
Arguments
Name | Type | Description |
---|---|---|
_lockedSOV | address | The Locked SOV Contract address. |
_SOV | address | The SOV token address. |
_multisig | address | The owner of the tokens & contract. |
_releaseTime | uint256 | The token release time, zero if undecided. |
_depositLimit | uint256 | The amount of tokens we will be accepting. |
Source Code
constructor(
address _lockedSOV,
address _SOV,
address _multisig,
uint256 _releaseTime,
uint256 _depositLimit
) public Escrow(_SOV, _multisig, _releaseTime, _depositLimit) {
if (_lockedSOV != address(0)) {
lockedSOV = ILockedSOV(_lockedSOV);
}
}
Set the Locked SOV Contract Address if not already done.
function updateLockedSOV(address _lockedSOV) external nonpayable onlyMultisig
Arguments
Name | Type | Description |
---|---|---|
_lockedSOV | address | The Locked SOV Contract address. |
Source Code
function updateLockedSOV(address _lockedSOV) external onlyMultisig {
require(_lockedSOV != address(0), "Invalid Reward Token Address.");
lockedSOV = ILockedSOV(_lockedSOV);
emit LockedSOVUpdated(msg.sender, _lockedSOV);
}
Deposit tokens to this contract by the Multisig.
function depositRewardByMultisig(uint256 _amount) external nonpayable onlyMultisig
Arguments
Name | Type | Description |
---|---|---|
_amount | uint256 | the amount of tokens deposited. |
Source Code
function depositRewardByMultisig(uint256 _amount) external onlyMultisig {
require(
status != Status.Withdraw,
"Reward Token deposit is only allowed before User Withdraw starts."
);
require(_amount > 0, "Amount needs to be bigger than zero.");
bool txStatus = SOV.transferFrom(msg.sender, address(this), _amount);
require(txStatus, "Token transfer was not successful.");
totalRewardDeposit = totalRewardDeposit.add(_amount);
txStatus = SOV.approve(address(lockedSOV), totalRewardDeposit);
require(txStatus, "Token Approval was not successful.");
emit RewardDepositByMultisig(msg.sender, _amount);
}
Withdraws token and reward from the contract by User. Reward is gone to lockedSOV contract for future vesting.
function withdrawTokensAndReward() external nonpayable checkRelease checkStatus
Source Code
function withdrawTokensAndReward() external checkRelease checkStatus(Status.Withdraw) {
// Reward calculation have to be done initially as the User Balance is zeroed out .
uint256 reward = userBalances[msg.sender].mul(totalRewardDeposit).div(totalDeposit);
withdrawTokens();
lockedSOV.depositSOV(msg.sender, reward);
emit RewardTokenWithdraw(msg.sender, reward);
}
Function to read the reward a particular user can get.
function getReward(address _addr) external view
returns(reward uint256)
Arguments
Name | Type | Description |
---|---|---|
_addr | address | The address of the user whose reward is to be read. |
Returns
reward The reward received by the user.
Source Code
function getReward(address _addr) external view returns (uint256 reward) {
if (userBalances[_addr].mul(totalRewardDeposit) == 0) {
return 0;
}
return userBalances[_addr].mul(totalRewardDeposit).div(totalDeposit);
}
- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC