Open aleeusgr opened 1 year ago
https://github.com/Hyperion-BT/helios/issues/89
const theNetwork = new NetworkEmulator();
const params = JSON.parse(await fs.readFile('./src/preprod.json', 'utf8'));
const emuParams = theNetwork.initNetworkParams(params)
emuParams.liveSlot;
this might help
const emuParams = theNetwork.initNetworkParams(params) // as
// NetworkParams & {slotToTimestamp: typeof slotToTimestamp}
emuParams.timeToSlot = function(t) {
const seconds = BigInt(t / 1000n)
return seconds
}
//... could become useful(?):
// emuParams.slotToTimestamp = slotToTimestamp
// function slotToTimestamp (s : bigint) {
// const num = parseInt( BigInt.asIntN(52, s * 1000n).toString())
// return new Date(num)
// }
function waitUntil(time: Date, network, params) {
const targetSlot = params.timeToSlot(BigInt(time.getTime()))
const current = params.liveSlot
const slotsToWait = targetSlot - current;
if (slotsToWait < 1) {
throw new Error(`the indicated time is not in the future`)
}
// console.warn(`waiting ${slotsToWait} until ${time}`);
network.tick(slotsToWait)
}
One time cliff vesting can certainly be a supported scenario.
It is also common to have a smaller percentage on a cliff, then a continuing fractional vest through a longer period.
25 at one year then the remainder over next 3 years, for instance
vesting test scenarios:
Rachel for recipient Graham for Granter
what are possible conditions for an unspendeable utxo?