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

#ntrn-365 credits contract #5

Merged
merged 64 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
8a398f3
#ntrn-365 feat: add basic structure for credits contract
NeverHappened Feb 8, 2023
700695e
fix lint
NeverHappened Feb 8, 2023
6397580
feat: fill missing methods
NeverHappened Feb 9, 2023
9b49f47
feat: implement mint and instantiate cw20 contract
NeverHappened Feb 9, 2023
89a5797
fix instantiation and more adjustments
NeverHappened Feb 9, 2023
a6d506b
feat: add queries to credits contract
NeverHappened Feb 9, 2023
6037b9a
cleanup
NeverHappened Feb 10, 2023
2ac5c19
add test script for credits
NeverHappened Feb 10, 2023
e714df3
add burn_all message
NeverHappened Feb 10, 2023
8f29eb6
fix script
NeverHappened Feb 10, 2023
f5d59d1
add more stuff to script
NeverHappened Feb 10, 2023
0fb4114
add ability to update contract addresses later
NeverHappened Feb 10, 2023
208dd73
add instantiate tests
NeverHappened Feb 10, 2023
44e6a7a
implement add_vesting
NeverHappened Feb 13, 2023
465c446
remove sale_address
NeverHappened Feb 14, 2023
ea826f1
add vesting
NeverHappened Feb 14, 2023
83a587e
add test for compute withdrawable amount
NeverHappened Feb 14, 2023
ced7f93
add query allocation
NeverHappened Feb 14, 2023
290101a
add mint tests
NeverHappened Feb 14, 2023
c72a79b
test mint
NeverHappened Feb 14, 2023
4894b4c
tests for add_vesting
NeverHappened Feb 14, 2023
aa8ada8
add big test about vesting
NeverHappened Feb 14, 2023
8eb65b5
add more test
NeverHappened Feb 14, 2023
80a2609
tmp
NeverHappened Feb 14, 2023
556df27
add tests, fix comments and methods
NeverHappened Feb 14, 2023
7ff3c44
add when_withdrawable, add test for update config
NeverHappened Feb 14, 2023
c301335
add tests for transfer
NeverHappened Feb 14, 2023
fc4431d
finish with tests
NeverHappened Feb 15, 2023
f69be43
Add burn_from
NeverHappened Feb 15, 2023
6804493
remove todos
NeverHappened Feb 15, 2023
aa9538c
fix withdraw after burn rewards
NeverHappened Feb 15, 2023
db551fe
add balanceAtHeight impl
NeverHappened Feb 16, 2023
0306263
add comments
NeverHappened Feb 16, 2023
9b1d77b
add comments
NeverHappened Feb 16, 2023
001a3c6
cleanup, change readme
NeverHappened Feb 16, 2023
4d605f1
refactor tests - withdraw
NeverHappened Feb 17, 2023
312b01c
add tests to withdraw
NeverHappened Feb 17, 2023
1dd087b
add more descriptive comment
NeverHappened Feb 17, 2023
7cd39a7
removed unneeded transfer_from, increase/decrease_allowance
NeverHappened Feb 20, 2023
d723a69
add total_supply_at_height query
NeverHappened Feb 21, 2023
b20c6a7
query_vested_amount
NeverHappened Feb 27, 2023
6892b29
start writing documentation
NeverHappened Feb 27, 2023
92b3121
add more comments
NeverHappened Feb 28, 2023
a028af8
more docs
NeverHappened Feb 28, 2023
1d64e54
more comments
NeverHappened Feb 28, 2023
f5e321c
review fixes
NeverHappened Feb 28, 2023
0578c7a
remove dao_address from instantiate msg
NeverHappened Feb 28, 2023
2995cc4
fix more comments
NeverHappened Feb 28, 2023
7edb8a2
small fix
NeverHappened Feb 28, 2023
0eb9042
move credits tests to testing module
NeverHappened Feb 28, 2023
c591bbe
fix more pr comments
NeverHappened Feb 28, 2023
f571e42
more pr fixes
NeverHappened Feb 28, 2023
80bb8a8
transparent errors
NeverHappened Feb 28, 2023
69df2b3
rename ucntrn -> cntrn
NeverHappened Feb 28, 2023
68bb6c2
rename again
NeverHappened Feb 28, 2023
0b231f2
commit schema for credits contract
NeverHappened Mar 1, 2023
0298cd3
remove config update mechanism since we have all addresses fix on init
NeverHappened Mar 1, 2023
bf7504f
Merge remote-tracking branch 'origin/main' into feat/credits-contract
NeverHappened Mar 1, 2023
2352819
update credits contract after changing cw20base to 0.13.4 version
NeverHappened Mar 1, 2023
389331a
cleanup reviews
NeverHappened Mar 1, 2023
fa20339
fix comments
NeverHappened Mar 1, 2023
487304f
Merge remote-tracking branch 'origin/main' into feat/credits-contract
NeverHappened Mar 2, 2023
f6f6e78
fix clippy warnings
foxpy Mar 2, 2023
d9cfe47
fix token names in comments
NeverHappened Mar 2, 2023
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
65 changes: 62 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions contracts/credits/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --bin schema"
16 changes: 16 additions & 0 deletions contracts/credits/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Build results
/target
/schema

# 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
56 changes: 56 additions & 0 deletions contracts/credits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
name = "credits"
version = "0.1.0"
authors = ["nhpd <dmitry.klpv@gmail.com>"]
edition = "2021"

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[package.metadata.scripts]
optimize = """docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.10
"""

[dependencies]
cosmwasm-schema = "1.1.3"
cosmwasm-std = "1.1.3"
cosmwasm-storage = "1.1.3"
cw-storage-plus = "1.0.1"
cw2 = "1.0.1"
cw20 = { version = "1.0.1" }
cw20-base = { git = "https://github.com/neutron-org/cw-plus_balances-snapshots", rev = "099702818f285ecd7ff3b6ef97f4bf1fecef9099", features = ["library"] }
cw-utils = "1.0.1"
schemars = "0.8.10"
serde = { version = "1.0.145", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.31" }

[dev-dependencies]
cw-multi-test = "0.16.2"
5 changes: 5 additions & 0 deletions contracts/credits/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Credits contract

This is the cw20 like contract that mints CNTRN's and holds vested NTRNs in 1:1 proportion.

Mostly used by airdrop contract to distribute/vest airdropped funds.
11 changes: 11 additions & 0 deletions contracts/credits/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use cosmwasm_schema::write_api;

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

fn main() {
write_api! {
sotnikov-s marked this conversation as resolved.
Show resolved Hide resolved
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg,
}
}
Loading