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

PCL pools migration #90

Merged
merged 15 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
479 changes: 380 additions & 99 deletions Cargo.lock

Large diffs are not rendered by default.

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"
36 changes: 36 additions & 0 deletions contracts/dao/voting/lockdrop-vault-for-cl-pools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "lockdrop-vault-for-cl-pools"
version = "0.1.0"
authors = ["Sergei Sotnikov <sergei.s@p2p.org>"]
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/neutron/neutron-dao"

[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-std = { version = "1.3.0" }
cw-storage-plus = "1.1.0"
cw2 = "1.1.0"
cw20 = "1.1.0"
schemars = "0.8.8"
serde = { version = "1.0.175", default-features = false, features = ["derive"] }
thiserror = { version = "1.0" }
cwd-macros = { path = "../../../../packages/cwd-macros" }
cwd-interface = { path = "../../../../packages/cwd-interface" }
cwd-voting = { path = "../../../../packages/cwd-voting" }
neutron-lockdrop-vault-for-cl-pools = { path = "../../../../packages/neutron-lockdrop-vault-for-cl-pools" }
astroport-periphery = { package="astroport-periphery", git = "https://github.com/neutron-org/neutron-tge-contracts.git", rev = "e306308dd23d567399c15d899f295a910ede945b" }
astroport = { package="astroport", git = "https://github.com/neutron-org/neutron-tge-contracts.git", rev = "e306308dd23d567399c15d899f295a910ede945b" }

[dev-dependencies]
cosmwasm-schema = { version = "^1.2.1" }
cw-multi-test = "0.16.5"
anyhow = "1.0.57"
3 changes: 3 additions & 0 deletions contracts/dao/voting/lockdrop-vault-for-cl-pools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Neutron Lockdrop Voting Vault

This contract is not really a voting vault. It's rather an interface to get voting power from a Lockdrop contract. It's not possible to Bond or Unbond funds to this vault cause these ExecuteMsg handlers are introduced just to make the contract comply with the voting vault interface.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2022 Neutron
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::env::current_dir;
use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};

use neutron_lockdrop_vault_for_cl_pools::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

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);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"oneOf": [
{
"type": "object",
"required": [
"update_config"
],
"properties": {
"update_config": {
"type": "object",
"properties": {
"atom_cl_pool_contract": {
"type": [
"string",
"null"
]
},
"description": {
"type": [
"string",
"null"
]
},
"lockdrop_contract": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"owner": {
"type": [
"string",
"null"
]
},
"usdc_cl_pool_contract": {
"type": [
"string",
"null"
]
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"bond"
],
"properties": {
"bond": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"unbond"
],
"properties": {
"unbond": {
"type": "object",
"required": [
"amount"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
}
}
}
},
"additionalProperties": false
}
],
"definitions": {
"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"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"required": [
"atom_cl_pool_contract",
"description",
"lockdrop_contract",
"name",
"owner",
"usdc_cl_pool_contract"
],
"properties": {
"atom_cl_pool_contract": {
"description": "The ATOM/NTRN CL pool oracle contract.",
"type": "string"
},
"description": {
"description": "Description contains information that characterizes the vault.",
"type": "string"
},
"lockdrop_contract": {
"description": "The lockdrop contract behind the vault.",
"type": "string"
},
"name": {
"description": "Name contains the vault name which is used to ease the vault's recognition.",
"type": "string"
},
"owner": {
"description": "Owner can update all configs including changing the owner. This will generally be a DAO.",
"type": "string"
},
"usdc_cl_pool_contract": {
"description": "The USDC/NTRN CL pool contract.",
"type": "string"
}
}
}
181 changes: 181 additions & 0 deletions contracts/dao/voting/lockdrop-vault-for-cl-pools/schema/query_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"oneOf": [
{
"type": "object",
"required": [
"config"
],
"properties": {
"config": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"voting_power_at_height"
],
"properties": {
"voting_power_at_height": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
},
"height": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"total_power_at_height"
],
"properties": {
"total_power_at_height": {
"type": "object",
"properties": {
"height": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"bonding_status"
],
"properties": {
"bonding_status": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
},
"height": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"dao"
],
"properties": {
"dao": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"description"
],
"properties": {
"description": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"list_bonders"
],
"properties": {
"list_bonders": {
"type": "object",
"properties": {
"limit": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
},
"start_after": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
}
]
}
Loading
Loading