Collateral Size Determination & Oracle
How Will The Collateral Size Determined Against The Issued Bonds?
To determine the price of RDTN tokens and how many tokens to lock in the collateral pool, an oracle will be used. The oracle will provide a price feed for RDTN and the smart contract will use this price to calculate the required amount of RDTN tokens to lock in the collateral pool. The formula for calculating the required amount of RDTN tokens is:
requiredRDTN = requiredCollateral / RDTNPrice |
Where RDTNPrice is the current price of RDTN as provided by the oracle.
For example, if the collateralized assets are $100,000 and the current price of RDTN tokens is $0.10, the amount of RDTN tokens required to be locked in the pool will be 1,000,000 RDTN tokens.
here's an example of how the oracle integration function will look like in Solidity programming language:
In this example, we are using the Chainlink AggregatorV3Interface to fetch the latest RDTN price feed data. We set the RDTN price feed contract address in the constructor function, and then define a ‘getRDTNPrice()’
function to return the current RDTN price in USD.
We also define a ‘calculateCollateralAmount()’
function that takes the total bond amount as input and uses the RDTN price to calculate the amount of RDTN tokens that need to be locked in the collateral pool to back the bonds at a 1:1 ratio. This function will be called by the smart contract to determine the amount of collateral to be locked in the pool.
We can further integrate these functions in our smart contract, along with other functions and workflows that we have discussed earlier, to create a fully functional Redemption Bonds system on the blockchain.
Last updated