stkMTA

This contract handles the staking functionality for the Staked MTA. Contracts are upgradable.

Contract: StakedTokenMTA.sol

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.

Functions Staked Token

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.

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.

stake()

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.

withdraw()

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

startCooldown()

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.

endCooldown()

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.

createLock()

function createLock (uint256 _value) external

Allows for backwards compatibility with createLock fn, giving basic args to stake

increaseLockAmount()

function increaseLockAmount (uint256 _value) external

Allows for backwards compatibility with increaseLockAmount fn by simply staking more

exit()

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.

calcRedemptionFeeRate()

function calcRedemptionFeeRate (uint32 _weightedTimestamp) public returns (uint256 _feeRate)

fee = sqrt(300/x)-2.5, where x = weeks since user has staked

claimBal()

function claimBal () external

Claims any $BAL tokens present on this address as part of any potential liquidity mining program

convertFees()

function convertFees () external

Converts fees accrued in BPT into MTA, before depositing to the rewards contract

getProspectivePriceCoefficient()

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

Functions Gamified Token

name()

function name () public returns (string)

symbol()

function symbol () public returns (string)

balanceOf()

function balanceOf () public returns (uint256)

Simply gets scaled balance

rawBalanceOf()

function rawBalanceOf () public returns (uint256, uint256)

Simply gets raw balance

balanceData()

function balanceData () external returns (struct Balance)

Raw staked balance without any multipliers

userPriceCoeff()

function userPriceCoeff () external returns (uint256)

Raw staked balance without any multipliers

reviewTimestamp()

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 Gamified Voting Token

checkpoints()

function checkpoints () public returns (struct GamifiedVotingToken.Checkpoint)

Get the pos-th checkpoint for account.

numCheckpoints()

function numCheckpoints () public returns (uint32)

Get number of checkpoints for account.

delegates()

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.

getVotes()

function getVotes () public returns (uint256)

Gets the current votes balance for account

getPastVotes()

function getPastVotes () public returns (uint256)

Retrieve the number of votes for account at the end of blockNumber.Requirements:- blockNumber must have been already mined

getPastTotalSupply()

function 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 mined

totalSupply()

function totalSupply () public returns (uint256)

Total sum of all scaled balances

delegate()

function delegate (address delegatee) public

Delegate votes from the sender to delegatee.If delegatee is zero, the sender gets the voting power.

Last updated