Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create testing scenarios/cases #117

Open
2 of 10 tasks
Tracked by #114
aleeusgr opened this issue Jun 4, 2023 · 3 comments
Open
2 of 10 tasks
Tracked by #114

create testing scenarios/cases #117

aleeusgr opened this issue Jun 4, 2023 · 3 comments

Comments

@aleeusgr
Copy link
Owner

aleeusgr commented Jun 4, 2023

vesting test scenarios:

Rachel for recipient
Graham for Granter
image

  • G locks some funds, and
    • G can Cancel
    • G is unable to Cancel after the deadline
    • R is unable to Claim before the deadline
    • R is able to Claim after deadline
    • Claim or Cancel fails with a wrong wallet
  • G locks some funds and G is able to cancel. same for " and R can claim"
    • only lovelace
    • lovelace and one native asset
    • lovelace and multiple native assets (> 250)

what are possible conditions for an unspendeable utxo?

@aleeusgr
Copy link
Owner Author

aleeusgr commented Jun 4, 2023

HeliosLang/compiler#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)
}

@aleeusgr aleeusgr changed the title emulator params. create testing scenarios Jun 6, 2023
@aleeusgr
Copy link
Owner Author

aleeusgr commented Jun 7, 2023

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

@aleeusgr aleeusgr changed the title create testing scenarios create testing scenarios/cases Jun 11, 2023
@aleeusgr
Copy link
Owner Author

aleeusgr commented Jun 11, 2023

@aleeusgr aleeusgr added this to the f11 milestone Nov 5, 2023
@aleeusgr aleeusgr mentioned this issue Apr 5, 2024
5 tasks
@aleeusgr aleeusgr removed this from the f11 milestone Apr 5, 2024
@aleeusgr aleeusgr added the good first issue Good for newcomers label Apr 5, 2024
@aleeusgr aleeusgr removed the good first issue Good for newcomers label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant