Skip to content

Commit

Permalink
External staking rewards (#182)
Browse files Browse the repository at this point in the history
* add and remove hooks

* hook file

* query hooks

* admin -> owner

* add owner and manager roles

* owner and manager can update hooks

* clippy warnings

* cargo fmt

* cargo schema

* cargo fmt

* properly wrap hooks

* update cargo for new file

* wip

* full contract no tests

* cargo fix

* handle update rewards error

* native reward tests

* cw20 reward tests

* owner and manger dual admins

* test for edge cases when adding funds

* import library feature stake-cw20

* cargo schema

* add response schemas

* test for insantiating rewards before any tokens are staked

* add debugging info to get pending rewards response

* return error if rewards not claimable

* scale before dividing and do computations in u256

* lint: run cargo fmt + clippy

* rf: cleanup staking rewards contract

* fix: contract name

* fix: branch cleanup + fix multiplication overflow

* fix: add unwrap for add hook helper in tests

* fix: lint with clippy

* addr -> string

* tests break when rewards are over

* fix broken tests

* add attributes to instatiation

* switch strings to addresses in msgs

* use zero as default

* better addr validation

* better fund validationf

* respond to comment, better divide by zero validation

* clean

* remove debugging prints

* add reward duration to instantiation msg

* verify contract is a staking contract at instantiation

* cargo fmt

* cargo schema

Co-authored-by: Vernon Johnson <vtj2105@columbia.edu>
Co-authored-by: Vernon Johnson <25010543+verminator23@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 14, 2022
1 parent edda6c2 commit fcfcd97
Show file tree
Hide file tree
Showing 19 changed files with 3,625 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ incremental = false
codegen-units = 1
incremental = false


[profile.release.package.stake-cw20-external-rewards]
codegen-units = 1
incremental = false

[profile.release]
opt-level = 3
debug = false
Expand Down
4 changes: 4 additions & 0 deletions contracts/stake-cw20-external-rewards/.cargo/config
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"
Loading

0 comments on commit fcfcd97

Please sign in to comment.