Conversion from CRC to Time Circles and back

Abstract

Time Circles (TC) are a time-dependent display unit for Circles.

The unit is rooted in the daily UBI payout every user receives in CRC and the fixed inflation rate. It normalizes the daily UBI payout to 24 TC regardless of the inflation.

Conversion

Constants

  • Circles Year: A year in circles is 365.25 days long (in seconds: 31557600).
  • Inflation: 7% per Circles Year.
  • Initial daily payout: In the first year everyone got 8 CRC per day.
  • Circles inception: 2020-10-15 The date when the official Circles contract was deployed.

Procedure

  1. How many circles-years and days have passed between the circles inception and the transaction?
    // Your transaction timestamp and amount in CRC  
    const transactionTimestamp = new Date("2022-05-03T04:21:25.000Z").getTime();  
    const transactionCrcAmount = 8.566935185185093;  
      
    // Constants  
    const circlesInceptionTimestamp = new Date("2020-10-15T00:00:00.000Z").getTime();  
    const oneDayInMilliSeconds = 86400 * 1000;  
    const oneCirclesYearInMilliSeconds = 31557600 * 1000;  
      
    // How many days passed between the circles inception and the transaction?  
    const daysSinceCirclesInception = (transactionTimestamp - circlesInceptionTimestamp) / oneDayInMilliSeconds;  
    // How many circles years passed between the circles inception and the transaction?  
    const circlesYearsSince = (transactionTimestamp - circlesInceptionTimestamp) / oneCirclesYearInMilliSeconds;  
    // How many days passed since the last circles new-year?  
    const daysInCurrentCirclesYear = daysSinceCirclesInception % 365.25;
    // NOTE: Circles.land still uses the code-line below
    // const daysInCurrentCirclesYear = Math.ceil(daysSinceCirclesInception % 365.25);
    
  2. How large is the daily payout for the previous and current circles year?
    // Everyone got 8 CRC per day in the first year  
    const initialDailyCrcPayout = 8;  
      
    let circlesPayoutInCurrentYear = initialDailyCrcPayout;  
    let previousCirclesPerDayValue = initialDailyCrcPayout;  
      
    // Add the yearly inflation to the initial payout and keep track  
    // of the previous and current year's value  
    for (let index = 0; index < circlesYearsSince; index++) {  
        previousCirclesPerDayValue = circlesPayoutInCurrentYear;  
        circlesPayoutInCurrentYear = circlesPayoutInCurrentYear * 1.07;  
    }  
      
    // The daily payout for the previous and current year  
    const payoutPerDayInYear = {  
        current: circlesPayoutInCurrentYear,  
        previous: previousCirclesPerDayValue  
    };
    
  3. Interpolate the exact “Payout per day” value for the transaction timestamp
    const x = payoutPerDayInYear.previous;  
    const y = payoutPerDayInYear.current;  
    const a = daysInCurrentCirclesYear / 365.25;  
      
    const payoutAtTimestamp = x * (1 - a) + y * a;
    
  4. a) Calculate the Time Circles value
    const timeCircles = transactionCrcAmount / payoutAtTimestamp * 24;
    
    b) Calculate the CRC value
    const crc = timeCircles / 24 * payoutAtTimestamp;
    
2 Likes