Pool View Add Stake
Preparing Stake
The user selects the maximum they want to stake on either side first.
They then adjust how much is staked by the slider, which increases/decreases the amount (up to the maximum) staked, so that it goes from 100% RUNE, to 100% Token.
The old and new prices can be calculated.
newPrice = priceRune * (r + R) / (t + T)
newDepth = priceRune * (1 + ((r)/(R) + (t)/(T) ) / 2) * R)
share = ((r)/(r + R) + (t)/(t + T) ) / 2
Transaction
The transaction is a multi-send of both assets with the prescriptive MEMO.
MEMO = STAKE:SYMBOL(t)
the user needs 0.000375 BNB to send the transaction, so do a balance validation check.
Edited by JP