View Source: contracts/governance/Vesting/OriginInvestorsClaim.sol
↗ Extends: Ownable
// TODO: fund this contract with a total amount of SOV needed to distribute.
Constants & Variables
uint256 public totalAmount;
uint256 public constant SOV_VESTING_CLIFF;
uint256 public kickoffTS;
uint256 public vestingTerm;
uint256 public investorsQty;
bool public investorsListInitialized;
contract VestingRegistry public vestingRegistry;
contract IStaking public staking;
contract IERC20 public SOVToken;
mapping(address => bool) public admins;
mapping(address => uint256) public investorsAmountsList;
Events
event AdminAdded(address admin);
event AdminRemoved(address admin);
event InvestorsAmountsListAppended(uint256 qty, uint256 amount);
event ClaimVested(address indexed investor, uint256 amount);
event ClaimTransferred(address indexed investor, uint256 amount);
event InvestorsAmountsListInitialized(uint256 qty, uint256 totalAmount);
Throws if called by any account other than the owner or admin.
modifier onlyAuthorized() internal
Throws if called by any account not whitelisted.
modifier onlyWhitelisted() internal
Throws if called w/ an initialized investors list.
modifier notInitialized() internal
Throws if called w/ an uninitialized investors list.
modifier initialized() internal
- constructor(address vestingRegistryAddress)
- addAdmin(address _admin)
- removeAdmin(address _admin)
- authorizedBalanceWithdraw(address toAddress)
- setInvestorsAmountsListInitialized()
- appendInvestorsAmountsList(address[] investors, uint256[] claimAmounts)
- claim()
- createVesting()
- transfer()
Contract deployment requires one parameter:
function (address vestingRegistryAddress) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
vestingRegistryAddress | address | The vestingRegistry contract instance address. |
Source Code
constructor(address vestingRegistryAddress) public {
vestingRegistry = VestingRegistry(vestingRegistryAddress);
staking = IStaking(vestingRegistry.staking());
kickoffTS = staking.kickoffTS();
SOVToken = IERC20(staking.SOVToken());
vestingTerm = kickoffTS + SOV_VESTING_CLIFF;
}
Add account to ACL.
function addAdmin(address _admin) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_admin | address | The addresses of the account to grant permissions. |
Source Code
function addAdmin(address _admin) public onlyOwner {
admins[_admin] = true;
emit AdminAdded(_admin);
}
Remove account from ACL.
function removeAdmin(address _admin) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_admin | address | The addresses of the account to revoke permissions. |
Source Code
function removeAdmin(address _admin) public onlyOwner {
admins[_admin] = false;
emit AdminRemoved(_admin);
}
In case we have unclaimed tokens or in emergency case this function transfers all SOV tokens to a given address.
function authorizedBalanceWithdraw(address toAddress) public nonpayable onlyAuthorized
Arguments
Name | Type | Description |
---|---|---|
toAddress | address | The recipient address of all this contract tokens. |
Source Code
function authorizedBalanceWithdraw(address toAddress) public onlyAuthorized {
require(
SOVToken.transfer(toAddress, SOVToken.balanceOf(address(this))),
"OriginInvestorsClaim::authorizedTransferBalance: transfer failed"
);
}
Should be called after the investors list setup completed. This function checks whether the SOV token balance of the contract is enough and sets status list to initialized.
function setInvestorsAmountsListInitialized() public nonpayable onlyAuthorized notInitialized
Source Code
function setInvestorsAmountsListInitialized() public onlyAuthorized notInitialized {
require(
SOVToken.balanceOf(address(this)) >= totalAmount,
"OriginInvestorsClaim::setInvestorsAmountsList: the contract is not enough financed"
);
investorsListInitialized = true;
emit InvestorsAmountsListInitialized(investorsQty, totalAmount);
}
The contract should be approved or transferred necessary amount of SOV prior to calling the function.
function appendInvestorsAmountsList(address[] investors, uint256[] claimAmounts) external nonpayable onlyAuthorized notInitialized
Arguments
Name | Type | Description |
---|---|---|
investors | address[] | The list of investors addresses to add to the list. Duplicates will be skipped. |
claimAmounts | uint256[] | The list of amounts for investors investors[i] will receive claimAmounts[i] of SOV. |
Source Code
function appendInvestorsAmountsList(
address[] calldata investors,
uint256[] calldata claimAmounts
) external onlyAuthorized notInitialized {
uint256 subQty;
uint256 sumAmount;
require(
investors.length == claimAmounts.length,
"OriginInvestorsClaim::appendInvestorsAmountsList: investors.length != claimAmounts.length"
);
for (uint256 i = 0; i < investors.length; i++) {
if (investorsAmountsList[investors[i]] == 0) {
investorsAmountsList[investors[i]] = claimAmounts[i];
sumAmount = sumAmount.add(claimAmounts[i]);
} else {
subQty = subQty.add(1);
}
}
investorsQty = investorsQty.add(investors.length.sub(subQty));
totalAmount = totalAmount.add(sumAmount);
emit InvestorsAmountsListAppended(investors.length.sub(subQty), sumAmount);
}
Claim tokens from this contract. If vestingTerm is not yet achieved a vesting is created. Otherwise tokens are tranferred.
function claim() external nonpayable onlyWhitelisted initialized
Source Code
function claim() external onlyWhitelisted initialized {
if (now < vestingTerm) {
createVesting();
} else {
transfer();
}
}
Transfer tokens from this contract to a vestingRegistry contract. Sender is removed from investor list and all its unvested tokens are sent to vesting contract.
function createVesting() internal nonpayable
Source Code
function createVesting() internal {
uint256 cliff = vestingTerm.sub(now);
uint256 duration = cliff;
uint256 amount = investorsAmountsList[msg.sender];
address vestingContractAddress;
vestingContractAddress = vestingRegistry.getVesting(msg.sender);
require(
vestingContractAddress == address(0),
"OriginInvestorsClaim::withdraw: the claimer has an active vesting contract"
);
delete investorsAmountsList[msg.sender];
vestingRegistry.createVesting(msg.sender, amount, cliff, duration);
vestingContractAddress = vestingRegistry.getVesting(msg.sender);
require(
SOVToken.transfer(address(vestingRegistry), amount),
"OriginInvestorsClaim::withdraw: SOV transfer failed"
);
vestingRegistry.stakeTokens(vestingContractAddress, amount);
emit ClaimVested(msg.sender, amount);
}
Transfer tokens from this contract to the sender. Sender is removed from investor list and all its unvested tokens are sent to its account.
function transfer() internal nonpayable
Source Code
function transfer() internal {
uint256 amount = investorsAmountsList[msg.sender];
delete investorsAmountsList[msg.sender];
/**
* @dev Withdraw only for those claiming after the cliff, i.e. without vesting contracts.
* Those with vestingContracts should withdraw using Vesting.withdrawTokens
* from Vesting (VestingLogic) contract.
* */
require(
SOVToken.transfer(msg.sender, amount),
"OriginInvestorsClaim::withdraw: SOV transfer failed"
);
emit ClaimTransferred(msg.sender, amount);
}
- 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