-
Notifications
You must be signed in to change notification settings - Fork 223
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
Vesting contract #900
Vesting contract #900
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thing that scares me the most is my arch nemesis - unbounded call for the delegations...
7408f46
to
089f5a5
Compare
contracts/mixnet/src/contract.rs
Outdated
@@ -42,6 +42,8 @@ pub const DEFAULT_SYBIL_RESISTANCE_PERCENT: u8 = 30; | |||
// We'll be assuming a few more things, profit margin and cost function. Since we don't have reliable package measurement, we'll be using uptime. We'll also set the value of 1 Nym to 1 $, to be able to translate epoch costs to Nyms. We'll also assume a cost of 40$ per epoch(month), converting that to Nym at our 1$ rate translates to 40_000_000 uNyms | |||
pub const DEFAULT_COST_PER_EPOCH: u32 = 40_000_000; | |||
|
|||
pub const VESTING_CONTRACT_ADDR: &str = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about passing it in an InitMsg
so that we wouldn't need to remember to update this constant before deployment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then... Isn't it a chicken and an egg problem? Vesting contract needs to know about mixnet contract and mixnet contract needs to know about the vesting contract...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't have a good take on here, we should probably do what ever feels more ergonomic, we can also put it in contract state, so that we can update it more easily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we even need a vesting address here, since we control on the proxy, noone can undelegate/unbond except the proxy that did the original bonding/delegation, so there is no specific need to further gate on the vesting contract, as far as we care anyone can delegate on behalf of someone else, as long as they pay the bonding/delegation fee... This way we can have multiple vesting contracts, that implement the same interface...
After everything is merged, I'll definitely have another look at it all |
4a17449
to
e7236cc
Compare
I'm mostly happy here, we can probably optimize storage some more tough, although lets defer that until the testnet |
…h/nym into vesting-staking-cointract
* Upgraded code to be cosmwasm 1.0-beta.2 compatible (#923) * Upgraded code to be cosmwasm 1.0-beta.2 compatible * [ci skip] Generate TS types Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com> * Feature/cosmwasm plus storage (#924) * Upgraded code to be cosmwasm 1.0-beta.2 compatible * Added cw-storage-plus dependency * Experimentally replaced storage for config and layers with cw plus Item * The same for main mixnode storage * Usingn IndexedMap for mixnodes * Split delegations from mixnodes into separate module * MixnodeIndex on Addr directly * Moved namespace values to constants * Outdated comment * [ci skip] Generate TS types * Removed redundant identity index on mixnodes * IndexMap for gateways storage * Moved total delegation into a Map * Compiling contract code after delegation storage upgrades Tests dont compile yet and neither, I would assume, the client code * Delegation type cleanup * Client fixes * Migrated delegation tests + fixed them * Moved Rewarding Status to rewards * Reward pool * Rewarding status migrated * Made clippy happier * Added explorer API to default workspace members * Updated delegation types in explorer-api * Fixed tauri wallet Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com> * Vesting contract (#900) * Initial interface spec * .gitignore * Finalize implementation * Correct assumptions, use wasm_execute * Cleanup * Track delegation balance * Add delegation flow img * Proper messaging from the vesting side * Add proxy_address to RawDelegationData * Wrap up (un)delegation * Add proxy: Addr to MixNodeBond * Stub in bonding/unbonding * Migrate vesting to cosmwasm 1.0 * Rebase on top of 1.0.0-pre1 * Reimplement delegations tracking with a Map * Migrate to cw-storage-plus * Restructure code, add tests * Streamline contract code, as per review * Address review comments * Pre-merge rebase * Few more nits * Few more nits * Fix test * cargo fmt * Fix beta CI Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com> Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com> Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
TODO: