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

feat: vesting and vault interface #18

Merged
merged 18 commits into from
Mar 29, 2023
Merged

Conversation

swelf19
Copy link
Contributor

@swelf19 swelf19 commented Mar 17, 2023

Implemets the besing vesting contract with interface for VotingVault type contract.
The following things have been done during moving contract into new type:

  1. Astroports vesting contract exctracted into separate type. All contract entripoits - struct methods. All storages - struct fields. The aim of changes - to be able configure basic contract behavior. For now we are only able configure snapshot stategy for snapshot-like storages.
  2. Incorporated whitelisted vesting managers - the persons who able to create/delete vesting schedules. The only owner manages the managers.
  3. Storage type of VestingInfo changed to SnapshotMap
  4. Added new storage VestingState - tracks total amount of granted/claimed tokens

Basic Vesting(vesting-lp) contract implementation in addition to parent type:

  1. Added two queries: UnclaimedAmountAtHeight and UnclaimedTotalAmountAtHeight

contracts/vesting-lp/src/lib.rs Outdated Show resolved Hide resolved
swelf19 and others added 2 commits March 27, 2023 10:58
contracts/vesting-lp/src/contract.rs Outdated Show resolved Hide resolved
packages/astroport/src/vesting.rs Outdated Show resolved Hide resolved
packages/astroport/src/vesting.rs Outdated Show resolved Hide resolved
contracts/vesting-lp/src/msg.rs Outdated Show resolved Hide resolved
contracts/vesting-lp/src/tests/integration.rs Show resolved Hide resolved
packages/vesting-base/README.md Outdated Show resolved Hide resolved
@@ -0,0 +1,25 @@
[package]
name = "vesting-lp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it vesting-lp? what does lp mean here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually lp stands for liquidity provider, but to be honest I don't see anything related to market making in this contract.

packages/vesting-base/src/contract.rs Outdated Show resolved Hide resolved
packages/vesting-base/src/contract.rs Outdated Show resolved Hide resolved
packages/vesting-base/src/contract.rs Outdated Show resolved Hide resolved
packages/vesting-base/src/contract.rs Show resolved Hide resolved
Copy link
Contributor

@foxpy foxpy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, make check_contracts fails on this branch with a following error:

artifacts/vesting_lp.wasm: failure
Error compiling Wasm: Could not compile: WebAssembly translation error: Error in middleware Gatekeeper: Float operator detected: F32Load { memarg: MemoryImmediate { align: 2, offset: 0, memory: 0 } }. The use of floats is not supported.

@swelf19 swelf19 marked this pull request as ready for review March 28, 2023 08:50
zavgorodnii and others added 2 commits March 28, 2023 21:15
* feat: added managed vesting #NTRN-409

* added tests for register_vesting_accounts()

* more remove_vesting_accounts() tests, added a VestingState query

* added cliff test cases, cargo fmt & cargo clippy

* merged base, more clippy fixes

* more cargo fmt

* restore astroport contracts

* 300 -> 400

* fixed #2 scenario comment (300 -> 400)

* review fixes
packages/astroport/src/vesting.rs Outdated Show resolved Hide resolved
packages/vesting-base/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@sotnikov-s sotnikov-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename the vesting-lp contract as we discussed

Copy link

@oldremez oldremez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm in general but I made a really quick look. Hope I got the tests logic properly btw

assert_eq!(vesting_res, Uint128::new(0u128));
let max_unclaimed_user1: u128 = 200;
let max_unclaimed_total: u128 = 1200;
for i in 0..=10 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic with loops in tests looks a bit non-obvious to me… Like, I got to think to understand it. It's not a request for change though

@zavgorodnii zavgorodnii merged commit 499dbb7 into main Mar 29, 2023
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

Successfully merging this pull request may close these issues.

6 participants