REDEMPTION
  • REDEMPTION
    • Redemption Token (RDTN)
    • RDBN (Puttable Bonds)
    • Redemption Platform / dApps
    • Redemption DAO
  • How to Earn?
    • Redemption Bonds
      • Features
      • Redemption Bonds Prizes & Lucky Draw Periods
      • Bond Serial Number & Important Terms
      • Bonds Issuing, Locking & Lucky Draw Dates
      • How Do Redemption Bonds Work?
      • Why Redemption bonds?
      • Technical Specifications
        • Issuance of Redemption Bonds
        • Collateral Pool Management
        • Collateral Size Determination & Oracle
        • Management of Bonds
        • Redemption of Bonds
        • Prize Pool Calculation
        • Burning The Bonds
        • Redemption Bonds Workflows
    • Staking
      • Staking Pools Duration
      • Why Stake Redemption Tokens?
      • How To Earn With Staking?
    • Lottery
      • Lottery Pools & Probability to Win
      • Lottery Pool Value & Prize Distribution
      • How The Winning No Is Drawn?
      • How To Play The Lottery?
  • How to Get RDTN?
  • DAO
    • Functions of DAO
    • Guilds, Their Selection & Compensation
    • Why Participate in The DAO?
    • How DAO Voting Works
    • How Does DAO Treasury Work?
    • Funds Management With Multisig Wallets
    • Funds Allocation to Guilds
    • How To Vote?
  • Invest in Pre-IDO
    • Why Invest in Pre-IDO?
    • How to Buy Redemption Before IDO?
Powered by GitBook
On this page

Was this helpful?

  1. How to Earn?
  2. Redemption Bonds
  3. Technical Specifications

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:

Collateral Size Determination
// Importing the required contracts and libraries
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

// Defining the contract for RDTN price oracle
contract RDTNPriceOracle {
    
    // Defining the aggregator contract for RDTN price feed
    AggregatorV3Interface internal priceFeed;
    
    // Constructor function to set the RDTN price feed contract address
    constructor() public {
        priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
    }
    
    // Function to get the current RDTN price in USD
    function getRDTNPrice() public view returns (uint256) {
        (
            uint80 roundID, 
            int256 price,
            uint256 startedAt,
            uint256 timeStamp,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        return uint256(price);
    }
    
    // Function to calculate the amount of RDTN to be locked in collateral pool
    function calculateCollateralAmount(uint256 totalBondAmount) public view returns (uint256) {
        uint256 rdtPrice = getRDTNPrice();
        uint256 collateralAmount = totalBondAmount * rdtPrice / 1e18;
        return collateralAmount;
    }
    
}

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.

PreviousCollateral Pool ManagementNextManagement of Bonds

Last updated 2 years ago

Was this helpful?