Summary
To incentivize long term holding of AST, we should encourage re-investment of staking rewards back into staked tokens. This proposal aims to provide stakers with a convenient user interface for converting fee rewards back into staked AST tokens.
Specification
A new function will be introduce on the pool contract which will perform a swap between the token and AST, and send it to the locker contract on behalf of the claimant’s wallet.
In terms of user interface, it can be a simple <compounded stake mode> toggle button which can be toggled on or off during the claiming phase. When toggled on, the claiming interface should show the amount of AST which could be potentially claimed based on the fee reward and the current AST price.
Updated stake function
AIP17 introduced a new staking contract where each new stake would require it’s own timestamp. This means that unstaking of multiple small stakes (which would happen in AIP18) starts to become impractical in terms of gas fees. To combat this, auto-compounding on AIP18 would extend the last existing stake based on the fraction of the new stake to the existing staked amount. If the last stake has already finished it’s vesting period (i.e. 100% available to unstake), then the new stake will form a new pool.
IF (CURRENT - TIMESTAMP) < MAX_VESTING_TIME;
TIMESTAMP = TIMESTAMP + (CURRENT - TIMESTAMP) * NEWSTAKE/(NEWSTAKE + OLDSTAKE) #updates timestamp
STAKE = NEWSTAKE + OLDSTAKE #updates staked amount
ELSE;
CREATE_NEW_STAKE()
This means that rapidly incoming small stakes will simply shift the starting time of the existing stake slightly rather than form a new stake pool. Any vesting period remains the same as defined by the locker contract, albeit shifted by a certain time frame.
Example
We will use the parameters from AIP17 in this example (i.e. 4 weeks cliff, 5% unlocked per week, with 100% unlocked at week 20)
Adam has 100,000 AST staked on week 0. He uses his stake to vote on an AIP which he receives 100,000 points. At week 4, he uses his 100,000 points to claim 9.09% of a USDC pool worth 5,000 USDC. His reward is 454.54 USDC and he wishes to convert this reward into staked AST.
By using the auto-compounding function, the smart contract swaps 454.54 USDC into 2272 AST (at a rate of 0.2 USDC/AST from the market) using a Dex aggregator. The 2272 AST is deposited into the locker contract on behalf of his wallet.
CURRENT = 2419200 #This is the current time (4 weeks in seconds)
TIMESTAMP = 0 #Original time of stake at time 0
CURRENT-TIMESTAMP = 2419200 < 12096000 #the last stake is still active
TIMESTAMP = 0 + (2419200 - 0) * 2272/(2272 + 100000) = 53743 #New time stamp is moved forward to 53743
STAKE = 2272 + 100000 = 102272
The vesting period is extended by 0.62 days due to the re-staking event. His new staked amount for that pool is updated to 102,272.
Rationale
Possible Benefits
AST holders benefit as this would increase the buy pressure on AST (locking it up according to the staking rules)
The staker would benefit by allowing compounding of the fee rewards while paying less gas for the transactions (manually would require claim + transfer + swap + stake, auto-compounding should just be claim + swap + stake).
Possible Drawbacks
Potentially, this might allow traders to game the system since it would be known that there might be a large wave of buy orders at the end of an AIP voting period. Traders might try to buy up AST just before voting ends to drive up the price before dumping it again.
This problem is solved by AIP21 or AIP22 which smoothens the claiming process. This removes the claim load at specific times (e.g. at the end of a vote)
Credits
Thanks to VladislavW and 2x for help with the AIP
Copyright — All proposals are public domain via CC0.