Update REV issuance timer

This guide describes how to update the block height numbers on the REV issuance timer to be published on https://developer.rchain.coop/token-swap. Once the timer launches, the block height numbers will be updated on a weekly cadence.

Step-by-step guide

  1. Use the bash script shown below. Save as a text file to your local environment (for example, with the filename "blocks").
  2. In the terminal make the file executable

    chmod 755 blocks
  3. Execute the script with the specification of how many days before 2018-12-05 and how many days after.  In this example, it computes the expected block numbers for a window 30 days before and 90 days after:

    ./blocks 30 90

    These numbers should both be decreased every time the website timer is updated.  If the release date changes from 2018-12-05, the script will have to be updated and a new window calculated that's still within the previous one.

  4. After the script runs, find the new numbers in the log

  5. Use these numbers to update the numbers on the timer.

Example

 

Timer bash script

#!/bin/bash
block=$((curl etherscan.io 2> /dev/null) | tr '<' '\n' | tr '>' '\n' | grep -e ^[0-9][0-9]*$)
# echo block=$block

rate=$((curl etherscan.io 2> /dev/null) | tr '<' '\n' | tr '(' '\n' | grep [0-9]s\) | sed -n "s/^\([0-9][0-9].[0-9]\).*$/\1/p")
# echo rate=$rate s/blk

now=$(date +%s)
let seconds=1543968000-now
# echo seconds till 2018-12-05=$seconds

openWindow=$1
let afterSec=seconds-\(openWindow*86400\)
closeWindow=$2
let beforeSec=seconds+\(closeWindow*86400\)

after=$(echo $block+\($afterSec/$rate\) | bc -l | sed -n "s/^\([0-9]*\).*$/\1/p")
echo $after

before=$(echo $block+\($beforeSec/$rate\) | bc -l | sed -n "s/^\([0-9]*\).*$/\1/p")
echo $before