Before actually making a deposit, you'd undoubtedly want to estimate how much premium the investment could yield, the settlement price at maturity, and the additional $DYSN rewards you might receive. In this section, we'll walk through the calculations, focusing on three key aspects:
How to calculate the premium and the strike price used for settlement of a Dual-Investment position.
How to compute the discounted value of a Dual-Investment position before maturity.
How to determine the type of assets (token0 or token1) redeemable after the maturity of a Dual-Investment position.
How to calculate the extra DYSN rewards obtained from a dual-currency transaction.
We'll illustrate these concepts using the WETH-USDC Pair as an example.
As the assets stay locked in a pool for a longer duration, investors can expect higher returns. The premium calculation is outlined by the formula below:
The PremiumCalculator Presented here is a Solidity smart contract that enables you to pre-calculate the principal plus interest based on your input and lock time, providing an overview before making an actual deposit within the pair.
To determine the amounts of token and token1 you'll receive after maturity, you can invoke the functions calculateDeposit0Premium and calculateDeposit1Premium. For instance:
The token0AmtWithPremium and token1AmtWithPremium represent the principal plus interest of token0 and token1. The choice of which token you can redeem will be determined by the fair price at maturity.
Strike Price
Continuing from the previous section, you can directly compute the Strike Price using the following formula:
When investors redeem, if the fair price surpasses the strike price, they will receive token1AmtWithPremium of token1. Conversely, if the fair price is lower, they will obtain token0AmtWithPremium of token0. About the details of fair price, please refer to fair price section in our white paper.
The discounted value of your position prior to maturity
First and foremost, it's essential to clarify that the discounted value serves as a reference for estimating the value of your position. The actual redemption of the position can only occur after reaching maturity.
The redeemable fund after maturity will be token0Amt or token1Amt which is calculated in Strike Price, the calculation of the discounted value before the maturity please refer to the below formulas:
time refers to the remaining time until the position's maturity.
Based on the formula above, we can calculate the discounted value of our position prior maturity. Below is the smart contract which demonstrates the calculation:
pragmasolidity 0.8.17;interface IPair {functionbasis() externalviewreturns (uint);}interface IPremiumCalculator {functioncalculateDeposit0Premium(uint input,uint time) externalviewreturns (uint token0AmtWithPremium,uint token1AmtWithPremium);functioncalculateDeposit1Premium(uint input,uint time) externalviewreturns (uint token0AmtWithPremium,uint token1AmtWithPremium);}// https://github.com/Gaussian-Process/solidity-sqrt/blob/main/src/FixedPointMathLib.sollibrarySqrtMath {functionsqrt(uint256 x) internalpurereturns (uint256 z) { ... }}contract DiscountedValueCalculator {using SqrtMath for*;address pair =0xEce7244a0e861C841651401fC22cEE577fEE90AF; // WETH-USDC Pair on Polygon zkEVMaddress premiumCalculator =0x....; // Deploy the PremiumCalculator contract/** // @param input Amount of token0 to deposit // @param totalLockTime Total lock time in seconds // @param timeRemaining Time remaining prior maturity in days */functioncalculateDeposit0DiscountedValue(uint input,uint totalLockTime,uint timeRemaining) publicviewreturns (uint token0DiscountedValue,uint token1DiscountedValue) {uint discountedPremium =getDiscountedPremium(timeRemaining);// Calculate discounted value = token0AmtWithPremium / discounted premium (uint token0AmtWithPremium,uint token1AmtWithPremium) =IPremiumCalculator(premiumCalculator).calculateDeposit0Premium(input, totalLockTime); token0DiscountedValue = token0AmtWithPremium / discountedPremium; token1DiscountedValue = token1AmtWithPremium / discountedPremium; }/** // @param input Amount of token0 to deposit // @param totalLockTime Total lock time in seconds // @param timeRemaining Time remaining prior maturity in days */functioncalculateDeposit1DiscountedValue(uint input,uint totalLockTime,uint timeRemaining) publicviewreturns (uint token0DiscountedValue,uint token1DiscountedValue) {uint discountedPremium =getDiscountedPremium(timeRemaining);// Calculate discounted value = token0AmtWithPremium / discounted premium (uint token0AmtWithPremium,uint token1AmtWithPremium) =IPremiumCalculator(premiumCalculator).calculateDeposit1Premium(input, totalLockTime); token0DiscountedValue = token0AmtWithPremium / discountedPremium; token1DiscountedValue = token1AmtWithPremium / discountedPremium; }/** // @param timeRemaining Time remaining prior maturity in days */functiongetDiscountedPremium(uint timeRemaining) internalviewreturns (uint discountedPremium) {uint basis =IPair(pair).basis(); // basis in WETH-USDC pair currently is set to 0.7e18// Calculate discounted premium = 1 + basis * 0.4 * sqrt(timeRemaining/365). // The discountedPremium will be scaled in 1e18 discountedPremium =1e18+ basis *0.4e18* (timeRemaining *1e36/365).sqrt() /1e36; }}
To calculate the discounted value of your position, you can call
calculateDeposit0DiscountedValue or calculateDeposit1DiscountedValue .
The token0DiscountedValue and token1DiscountedValue are the discounted value of token0 and token1.
Determining Token Redemption at Position Maturity
After maturity, the redeemable fund will consist of either token0Amt or token1Amt. The system's decision on which token users can redeem depends on the Strike Price and Fair Price at the maturity date. If, during redemption, the fair price surpasses the strike price, investors will receive token1Amt of token1. Conversely, if the fair price is lower than the strike price, they will receive token0Amt of token0.
Comparing the formula above, we can express it as follows:
Upon maturity, we can utilize the above formula, incorporating the current state of pools, to determine which token can be redeemed. In Solidity code, this can be implemented as follows:
Upon maturity, you can invoke the decide function to ascertain which token is eligible for redemption. This determination relies on the prevailing pool conditions, including reserves and fee ratios.
How to Calculate Additional DYSN Rewards in a Dual Investment
Investing in Dual Investment on Dyson Finance allows Dyson members to instantly receive Points, which can later be converted to $DYSN. Below is the flow of conversion process.
About membership, please refer to Membership section in our white paper.
Convert flow:
Dual Investment -> localPoint
localPoint -> Point
Point -> $DYSN
The DysonRewardCalculator contract showcases the calculation for converting a local point generated through dual investment into $DYSN rewards.
To determine the $DYSN reward generated from a dual investment, you can make use of the PremiumCalculator and DysonRewardCalculator contracts. These contracts facilitate the calculation of rewards based on the lock time and input amount in the dual investment.