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

Treasury #NTRN-286 #9

Merged
merged 36 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9449766
wip
ratik Nov 30, 2022
5be8258
wip
ratik Dec 2, 2022
f3f0a7a
feat: treasury + dsc
ratik Dec 5, 2022
4e1892b
chore: doc
ratik Dec 6, 2022
bc3c5f7
chore: trash
ratik Dec 6, 2022
abd69b7
fix: integration tests afterfixes
ratik Dec 6, 2022
bcd1b6c
fix: remove dao
ratik Dec 7, 2022
469edfb
chore: update versions
ratik Dec 12, 2022
bfed267
fix: typo
ratik Dec 12, 2022
a3e5119
chore: rename fns
ratik Dec 12, 2022
a2ac095
chore: var rename
ratik Dec 12, 2022
56b13ee
chore: wording
ratik Dec 12, 2022
b91e465
chore: -debug
ratik Dec 12, 2022
51ed2c5
chore: rename var
ratik Dec 12, 2022
1a2908d
chore: wording
ratik Dec 12, 2022
e17736e
chore: pass info instead of sender
ratik Dec 12, 2022
9f10170
fix: no need to clone
ratik Dec 12, 2022
359e377
fix: unused var
ratik Dec 12, 2022
c60eed4
fix: -c/p
ratik Dec 12, 2022
d00aba0
fix: no need to get data
ratik Dec 12, 2022
d4a5c67
chore: clone > iter
ratik Dec 12, 2022
759870a
fix: review fixes
ratik Dec 12, 2022
d995418
fix: review fixes
ratik Dec 12, 2022
60c4150
chore: fix wording
ratik Dec 12, 2022
6ecfcb2
fix: add check for messsage
ratik Dec 12, 2022
bb012c5
chore: fix clippy warnings, run fmt and schema
foxpy Dec 13, 2022
6d877f1
chore: doc
ratik Dec 13, 2022
efeba00
feat: eliminate dust
ratik Dec 13, 2022
0d798bb
fix: change sender to messageInfo
ratik Dec 13, 2022
efcc461
feat: &[u8] > Addr
ratik Dec 13, 2022
3b01b4e
feat: bank > reserve contract
ratik Dec 14, 2022
c647f54
fix: moar review fixes
ratik Dec 14, 2022
68b366b
chore: bump cw-storage-plus ver
ratik Dec 14, 2022
9ddf10e
doc: doc
ratik Dec 14, 2022
cfa8fda
fix: distribution rate > decimal
ratik Dec 14, 2022
b05f481
fix: limit distribution rate
ratik Dec 15, 2022
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
6 changes: 6 additions & 0 deletions contracts/distribution/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib --features backtraces"
integration-test = "test --test integration"
schema = "run --example schema"
22 changes: 22 additions & 0 deletions contracts/distribution/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "neutron-distribution"
version = "0.1.0"
authors = ["Sergey Ratiashvili <sergey.r@p2p.org>"]
edition = "2018"
ratik marked this conversation as resolved.
Show resolved Hide resolved
license = "Apache-2.0"
repository = "https://github.com/neutron/neutron-dao"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
backtraces = ["cosmwasm-std/backtraces"]

[dependencies]
cosmwasm-std = { version = "1.0" }
cw-storage-plus = "0.13"
zavgorodnii marked this conversation as resolved.
Show resolved Hide resolved
schemars = "0.8.1"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }

[dev-dependencies]
cosmwasm-schema = { version = "1.0.0", default-features = false }
9 changes: 9 additions & 0 deletions contracts/distribution/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CURRENT_DIR = $(shell pwd)
CURRENT_DIR_RELATIVE = $(notdir $(shell pwd))

clippy:
rustup component add clippy || true
cargo clippy --all-targets --all-features --workspace -- -D warnings

test: clippy
cargo unit-test
1 change: 1 addition & 0 deletions contracts/distribution/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Neutron treasury
31 changes: 31 additions & 0 deletions contracts/distribution/examples/schema.rs
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_distribution::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);
}
84 changes: 84 additions & 0 deletions contracts/distribution/schema/execute_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"oneOf": [
{
"description": "Transfer the contract's ownership to another account",
"type": "object",
"required": [
"transfer_ownership"
],
"properties": {
"transfer_ownership": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"set_shares"
],
"properties": {
"set_shares": {
"type": "object",
"required": [
"shares"
],
"properties": {
"shares": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "string"
},
{
"$ref": "#/definitions/Uint128"
}
],
"maxItems": 2,
"minItems": 2
}
}
}
}
},
"additionalProperties": false
},
{
"description": "Distribute funds to the and distribution accounts according to their shares",
"type": "object",
"required": [
"fund"
],
"properties": {
"fund": {
"type": "object"
}
},
"additionalProperties": false
},
{
"description": "Claim the funds that have been distributed to the contract's account",
"type": "object",
"required": [
"claim"
],
"properties": {
"claim": {
"type": "object"
}
},
"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"
}
}
}
18 changes: 18 additions & 0 deletions contracts/distribution/schema/instantiate_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"required": [
"denom",
"owner"
],
"properties": {
"denom": {
"type": "string"
},
"owner": {
"description": "The contract's owner",
"type": "string"
}
}
}
43 changes: 43 additions & 0 deletions contracts/distribution/schema/query_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"oneOf": [
{
"description": "The contract's configurations; returns [`ConfigResponse`]",
"type": "object",
"required": [
"config"
],
"properties": {
"config": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"pending"
],
"properties": {
"pending": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"shares"
],
"properties": {
"shares": {
"type": "object"
}
},
"additionalProperties": false
}
]
}
Loading