-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from neutron-org/feat/investors-vesting-vault
Feat: Investors Voting Vault
- Loading branch information
Showing
28 changed files
with
1,639 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[alias] | ||
wasm = "build --release --target wasm32-unknown-unknown" | ||
unit-test = "test --lib" | ||
schema = "run --example schema" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Build results | ||
/target | ||
|
||
# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327) | ||
.cargo-ok | ||
|
||
# Text file backups | ||
**/*.rs.bk | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# IDEs | ||
*.iml | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[package] | ||
name = "investors-vesting-vault" | ||
version = "0.2.0" | ||
authors = ["Callum Anderson <callumanderson745@gmail.com>", "Mikhail Mozhaev <misha.m@p2p.org>"] | ||
edition = "2021" | ||
repository = "https://github.com/neutron-org/neutron-dao" | ||
description = "A DAO vault contract." | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
# for more explicit tests, cargo test --features=backtraces | ||
backtraces = ["cosmwasm-std/backtraces"] | ||
# use library feature to disable all instantiate/execute/query exports | ||
library = [] | ||
|
||
[dependencies] | ||
cosmwasm-schema = { version = "1.1.3" } | ||
cosmwasm-std = { version = "1.1.3" } | ||
cosmwasm-storage = { version = "1.1.3" } | ||
cw-storage-plus = "1.0.1" | ||
cw2 = "0.13" | ||
cw20 = { version = "1.0.1" } | ||
cw-utils = "1.0.1" | ||
cw-controllers = "1.0.1" | ||
schemars = "0.8" | ||
serde = { version = "1.0.147", default-features = false, features = ["derive"] } | ||
thiserror = { version = "1.0" } | ||
cwd-macros = { path = "../../../../packages/cwd-macros" } | ||
cwd-interface = { path = "../../../../packages/cwd-interface" } | ||
cw-paginate = { path = "../../../../packages/cw-paginate" } | ||
cwd-voting = { path = "../../../../packages/cwd-voting" } | ||
vesting-base = { git = "https://github.com/neutron-org/neutron-tge-contracts.git" } | ||
|
||
[dev-dependencies] | ||
cw-multi-test = "0.16.2" | ||
anyhow = "1.0.57" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Neutron Vesting Vault | ||
|
||
This vault will allow its users to query voting power represented by NTRN tokens in the vesting contracts. Just as with normal DAO DAO voting modules, for each specific proposal, you can only use the voting power that was available to you at the time of proposal submission. No additional restrictions are imposed on the vault funds. You can not directly add money to this vault or get it out of this vault. This is a proxy-vault that only queries information from the investors vesting contract. |
34 changes: 34 additions & 0 deletions
34
contracts/dao/voting/investors-vesting-vault/examples/schema.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::env::current_dir; | ||
use std::fs::create_dir_all; | ||
|
||
use cosmwasm_schema::{export_schema, export_schema_with_title, remove_schemas, schema_for}; | ||
use cosmwasm_std::Addr; | ||
use cw_controllers::ClaimsResponse; | ||
use cwd_interface::voting::{ | ||
InfoResponse, IsActiveResponse, TotalPowerAtHeightResponse, VotingPowerAtHeightResponse, | ||
}; | ||
use investors_vesting_vault::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; | ||
use investors_vesting_vault::state::Config; | ||
|
||
fn main() { | ||
let mut out_dir = current_dir().unwrap(); | ||
out_dir.push("schema"); | ||
create_dir_all(&out_dir).unwrap(); | ||
remove_schemas(&out_dir).unwrap(); | ||
|
||
export_schema(&schema_for!(InstantiateMsg), &out_dir); | ||
export_schema(&schema_for!(ExecuteMsg), &out_dir); | ||
export_schema(&schema_for!(QueryMsg), &out_dir); | ||
export_schema(&schema_for!(MigrateMsg), &out_dir); | ||
|
||
export_schema(&schema_for!(InfoResponse), &out_dir); | ||
export_schema(&schema_for!(TotalPowerAtHeightResponse), &out_dir); | ||
export_schema(&schema_for!(VotingPowerAtHeightResponse), &out_dir); | ||
export_schema(&schema_for!(IsActiveResponse), &out_dir); | ||
export_schema(&schema_for!(ClaimsResponse), &out_dir); | ||
|
||
// Auto TS code generation expects the query return type as QueryNameResponse | ||
// Here we map query resonses to the correct name | ||
export_schema_with_title(&schema_for!(Addr), &out_dir, "DaoResponse"); | ||
export_schema_with_title(&schema_for!(Config), &out_dir, "GetConfigResponse"); | ||
} |
98 changes: 98 additions & 0 deletions
98
contracts/dao/voting/investors-vesting-vault/schema/claims_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ClaimsResponse", | ||
"type": "object", | ||
"required": [ | ||
"claims" | ||
], | ||
"properties": { | ||
"claims": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/Claim" | ||
} | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"definitions": { | ||
"Claim": { | ||
"type": "object", | ||
"required": [ | ||
"amount", | ||
"release_at" | ||
], | ||
"properties": { | ||
"amount": { | ||
"$ref": "#/definitions/Uint128" | ||
}, | ||
"release_at": { | ||
"$ref": "#/definitions/Expiration" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"Expiration": { | ||
"description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", | ||
"oneOf": [ | ||
{ | ||
"description": "AtHeight will expire when `env.block.height` >= height", | ||
"type": "object", | ||
"required": [ | ||
"at_height" | ||
], | ||
"properties": { | ||
"at_height": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"description": "AtTime will expire when `env.block.time` >= time", | ||
"type": "object", | ||
"required": [ | ||
"at_time" | ||
], | ||
"properties": { | ||
"at_time": { | ||
"$ref": "#/definitions/Timestamp" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"description": "Never will never expire. Used to express the empty variant", | ||
"type": "object", | ||
"required": [ | ||
"never" | ||
], | ||
"properties": { | ||
"never": { | ||
"type": "object", | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
] | ||
}, | ||
"Timestamp": { | ||
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/Uint64" | ||
} | ||
] | ||
}, | ||
"Uint128": { | ||
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", | ||
"type": "string" | ||
}, | ||
"Uint64": { | ||
"description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", | ||
"type": "string" | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
contracts/dao/voting/investors-vesting-vault/schema/dao_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "DaoResponse", | ||
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", | ||
"type": "string" | ||
} |
50 changes: 50 additions & 0 deletions
50
contracts/dao/voting/investors-vesting-vault/schema/execute_msg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ExecuteMsg", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"update_config" | ||
], | ||
"properties": { | ||
"update_config": { | ||
"type": "object", | ||
"properties": { | ||
"description": { | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"manager": { | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"name": { | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"owner": { | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
}, | ||
"vesting_contract_address": { | ||
"type": [ | ||
"string", | ||
"null" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
] | ||
} |
Oops, something went wrong.