stkMTA
This contract handles the staking functionality for the Staked MTA. Contracts are upgradable.
Some functions of this token contract can only be called from a whitelisted smart contract. Please contract mStable directly if an integration should be whitelisted.
function stake (uint256 _amount) external
Stake an
_amount
of STAKED_TOKEN in the system. This amount is added to the users stake andboosts their voting power.Parameter | Type | Description |
_amount | uint256 | Units of STAKED_TOKEN to stake |
function stake (uint256 _amount, bool _exitCooldown) external
Stake an
_amount
of STAKED_TOKEN in the system. This amount is added to the users stake andboosts their voting power.Parameter | Type | Description |
_amount | uint256 | Units of STAKED_TOKEN to stake |
_exitCooldown | bool | Bool signalling whether to take this opportunity to end any outstanding cooldown andreturn the user back to their full voting power |
function stake (uint256 _amount, address _delegatee) external
Stake an
_amount
of STAKED_TOKEN in the system. This amount is added to the users stake andboosts their voting power. Take the opportunity to change delegatee.Parameter | Type | Description |
_amount | uint256 | Units of STAKED_TOKEN to stake |
_delegatee | address | Address of the user to whom the sender would like to delegate their voting power |
function withdraw (uint256 _amount, address _recipient, bool _amountIncludesFee, bool _exitCooldown) external
Withdraw raw tokens from the system, following an elapsed cooldown period.Note - May be subject to a transfer fee, depending on the users weightedTimestamp
Parameter | Type | Description |
_amount | uint256 | Units of raw token to withdraw |
_recipient | address | Address of beneficiary who will receive the raw tokens |
_amountIncludesFee | bool | Is the _amount specified inclusive of any applicable redemption fee? |
_exitCooldown | bool | Should we take this opportunity to exit the cooldown period? |
function startCooldown (uint256 _units) external
Enters a cooldown period, after which (and before the unstake window elapses) a user will be ableto withdraw part or all of their staked tokens. Note, during this period, a users voting power is significantly reduced.If a user already has a cooldown period, then it will reset to the current block timestamp, so use wisely.
Parameter | Type | Description |
_units | uint256 | Units of stake to cooldown for |
function endCooldown () external
Ends the cooldown of the sender and give them back their full voting power. This can be used to signal thatthe user no longer wishes to exit the system. Note, the cooldown can also be reset, more smoothly, as part of a stake orwithdraw transaction.
function createLock (uint256 _value) external
Allows for backwards compatibility with createLock fn, giving basic args to stake
Parameter | Type | Description |
_value | uint256 | Units to stake |
function increaseLockAmount (uint256 _value) external
Allows for backwards compatibility with increaseLockAmount fn by simply staking more
Parameter | Type | Description |
_value | uint256 | Units to stake |
function exit () external
Backwards compatibility. Previously a lock would run out and a user would call this. Now, it will take 2 callsto exit in order to leave. The first will initiate the cooldown period, and the second will execute a full withdrawal.
function calcRedemptionFeeRate (uint32 _weightedTimestamp) public returns (uint256 _feeRate)
fee = sqrt(300/x)-2.5, where x = weeks since user has staked
Parameter | Type | Description |
_weightedTimestamp | uint32 | The users weightedTimestamp |
function claimBal () external
Claims any $BAL tokens present on this address as part of any potential liquidity mining program
function convertFees () external
Converts fees accrued in BPT into MTA, before depositing to the rewards contract
function getProspectivePriceCoefficient () public returns (uint256 newPriceCoeff)
Fetches most recent priceCoeff from the balancer pool.
PriceCoeff = units of MTA per BPT, scaled to 1:1 = 10000Assuming an 80/20 BPT, it is possible to calculatePriceCoeff (p) = balanceOfMTA in pool (b) / bpt supply (s) / 0.8p = b * 1.25 / s
function name () public returns (string)
function symbol () public returns (string)
function balanceOf () public returns (uint256)
Simply gets scaled balance
function rawBalanceOf () public returns (uint256, uint256)
Simply gets raw balance
function balanceData () external returns (struct Balance)
Raw staked balance without any multipliers
function userPriceCoeff () external returns (uint256)
Raw staked balance without any multipliers
function reviewTimestamp () external
Called by anyone to poke the timestamp of a given account. This allows users to effectively 'claim' any new time Multiplier but will revert if there is no change there.
function checkpoints () public returns (struct GamifiedVotingToken.Checkpoint)
Get the
pos
-th checkpoint for account
.function numCheckpoints () public returns (uint32)
Get number of checkpoints for
account
.function delegates (address delegator) public returns (address)
Get the address the
delegator
is currently delegating to. Return the delegator
account if not delegating to anyone.Parameter | Type | Description |
delegator | address | the account that is delegating the votes from |
function getVotes () public returns (uint256)
Gets the current votes balance for
account
function getPastVotes () public returns (uint256)
Retrieve the number of votes for
account
at the end of blockNumber
.Requirements:- blockNumber
must have been already minedfunction getPastTotalSupply () public returns (uint256)
Retrieve the
totalSupply
at the end of blockNumber
. Note, this value is the sum of all balances. It is but NOT the sum of all the delegated votes! Requirements:- blockNumber
must have been already minedfunction totalSupply () public returns (uint256)
Total sum of all scaled balances
function delegate (address delegatee) public
Delegate votes from the sender to
delegatee
.If delegatee
is zero, the sender gets the voting power.Parameter | Type | Description |
delegatee | address | account that gets the voting power. |
Last modified 1yr ago