core-contracts icon indicating copy to clipboard operation
core-contracts copied to clipboard

test(lockup): add test of unlocking schedule with termination

Open telezhnaya opened this issue 2 years ago • 6 comments

Warn: it should never be merged, it's based on v2 of lockup contract

The reason of this code is to test the lockup functionality that is used most widely nowadays. We want to be sure how current lockups work

telezhnaya avatar Dec 09 '21 14:12 telezhnaya

Warn: it should never be merged, it's based on v2 of lockup contract

Hmm, how is it based on v2 if the code is from the master branch?

I suggest we create lockup-v2 branch that corresponds to lockup-v2.0.0 tag, and we create a PR with lockup-v2-extra-tests branch, and once we review it, we can close the PR (while keeping the branch), and also update the README on master with the link to all those tags and branches to clarify the situation there.

Also, we need the same test on master (lockup v3), so we can at least demonstrate how the behavior is different between the versions.

frol avatar Dec 10 '21 11:12 frol

test_unlocking_schedule_with_termination_and_vesting_started_before_phase2 Picture for test 1

telezhnaya avatar Dec 17 '21 16:12 telezhnaya

test_unlocking_schedule_with_termination_and_vesting_started_after_phase2 Test 2

telezhnaya avatar Dec 17 '21 16:12 telezhnaya

We discussed some ideas on how to improve these tests. One of the ideas was to make the same tests on the master branch. I'm not sure it makes sense with the same setup. lockup_duration is deprecated. Moreover, not sure someone will lock the tokens before vesting starts. I think it makes sense to write one test on master, where lockup is not connected to Phase II AND lockup goes after vesting. @frol what do you think?

This PR is ready to review.

telezhnaya avatar Dec 17 '21 17:12 telezhnaya

Actually, I'm not sure whether we need these tests on master at all. I hope no one will use this contract right now; it means that we can stop spending time on it and invest it in other issues. It was important to make the work of v2.0.0 more transparent, and I hope these tests help with it at least somehow.

telezhnaya avatar Dec 17 '21 17:12 telezhnaya

Created the test for v3.0.0 https://github.com/near/core-contracts/commit/9b08fe4c6e90b0effffe831363b9673102ba6c27

telezhnaya avatar Dec 28 '21 14:12 telezhnaya