-
Notifications
You must be signed in to change notification settings - Fork 145
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 #149 from DA0-DA0/prep-for-launch
Prep for launch
- Loading branch information
Showing
13 changed files
with
83 additions
and
93 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
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
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
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
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 |
---|---|---|
@@ -1,48 +1,24 @@ | ||
# CW20 Gov | ||
# Stake CW20 Gov | ||
|
||
This is a basic implementation of a cw20 governance contract. It implements | ||
the CW20 spec with the addition of a BalanceAtHeight Query Message and | ||
is designed to be deployed as is, or imported into other contracts to easily build | ||
cw20-compatible tokens with custom logic. | ||
This is a governance implementation of a cw20 staking contract with support for vote delegation. Staked tokens can be unbonded with a configurable unbonding period. Staked balances and voting power can be queried at any arbitrary height by external contracts. | ||
|
||
Inspired by the design of the Compound governance token, `BalanceAtHeight` | ||
can be used to get a users balance at the start of a governance proposal. | ||
This contract is used to enable DAO voting. | ||
|
||
Implements: | ||
|
||
- [x] CW20 Base | ||
- [x] Mintable extension | ||
- [x] Allowances extension | ||
- [x] BalanceAtHeight QueryMsg | ||
## Running this contract | ||
|
||
You will need Rust 1.44.1+ with `wasm32-unknown-unknown` target installed. | ||
You will need Rust 1.58.1+ with `wasm32-unknown-unknown` target installed. | ||
|
||
You can run unit tests on this via: | ||
You can run unit tests on this via: | ||
|
||
`cargo test` | ||
|
||
Once you are happy with the content, you can compile it to wasm via: | ||
|
||
``` | ||
RUSTFLAGS='-C link-arg=-s' cargo wasm | ||
cp ../../target/wasm32-unknown-unknown/release/cw20_gov.wasm . | ||
ls -l cw20_gov.wasm | ||
sha256sum cw20_gov.wasm | ||
cp ../../target/wasm32-unknown-unknown/release/stake_cw20_gov.wasm . | ||
ls -l stake_cw20_gov.wasm | ||
sha256sum stake_cw20_gov.wasm | ||
``` | ||
|
||
Or for a production-ready (optimized) build, run a build command in the | ||
the repository root: https://github.com/CosmWasm/cw-plus#compiling. | ||
|
||
## Importing this contract | ||
|
||
You can also import much of the logic of this contract to build another | ||
ERC20-contract, such as a bonding curve, overiding or extending what you | ||
need. | ||
|
||
Basically, you just need to write your handle function and import | ||
`cw20_gov::contract::handle_transfer`, etc and dispatch to them. | ||
This allows you to use custom `ExecuteMsg` and `QueryMsg` with your additional | ||
calls, but then use the underlying implementation for the standard cw20 | ||
messages you want to support. The same with `QueryMsg`. You *could* reuse `instantiate` | ||
as it, but it is likely you will want to change it. And it is rather simple. | ||
Or for a production-ready (optimized) build, run a build command in the the repository root: https://github.com/CosmWasm/cw-plus#compiling. |
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 |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# CW20 Stakeable | ||
# Stake CW20 | ||
|
||
This is an extension of cw20 that allows the token to be staked. Staked tokens can be unbonded with a configurable unbonding period. Staked balances can be queried at any arbitrary height by external contracts. This contract will be used to enable DAO voting. | ||
This is a basic implementation of a cw20 staking contract. Staked tokens can be unbonded with a configurable unbonding period. Staked balances can be queried at any arbitrary height by external contracts. | ||
|
||
## Running this contract | ||
|
||
You will need Rust 1.58.1+ with `wasm32-unknown-unknown` target installed. | ||
|
||
You can run unit tests on this via: | ||
|
||
`cargo test` | ||
|
||
Once you are happy with the content, you can compile it to wasm via: | ||
|
||
``` | ||
RUSTFLAGS='-C link-arg=-s' cargo wasm | ||
cp ../../target/wasm32-unknown-unknown/release/stake_cw20.wasm . | ||
ls -l stake_cw20.wasm | ||
sha256sum stake_cw20.wasm | ||
``` | ||
|
||
Or for a production-ready (optimized) build, run a build command in the the repository root: https://github.com/CosmWasm/cw-plus#compiling. |