[
](https://codecov.io/github/InstrumentalFi/instrumental-contracts/
This repository contains the source code for the Pablo Vault and Fee Distribution Contracts.
This section elaborates on the functionalities and interactions of CosmWasm contracts used for staking and fee distribution within the Cosmos network.
- Functionality: Receives and allocates tokens based on predefined rules.
- Features:
- Supports various Cosmos denominations (denoms), accounts, and percentage-based distributions.
- Enables the transfer of tokens to multiple contracts or addresses, ensuring versatile distribution.
- Suitable for various applications including staking and the Osmosis adapter pool (note: no integration with the pool).
- Functionality: Serves as a recipient for tokens from the Distributor contract, acting as a secure storage.
- Characteristics:
- Receives a specific portion of tokens from the Distributor contract.
- Implements checks and permissions to ensure secure and authorized withdrawals of tokens.
- Allows the Staking contract to withdraw tokens.
- Functionality: Manages the staking of tokens and facilitates the distribution of rewards.
- Features:
- "Tokens per interval" parameter sets a maximum limit for distribution within a specified timeframe.
- Distributes the lesser of total tokens in the collector or "time x tokens per interval."
- Issues stTokens to users in representation of their stake.
- stTokens are value-accruing, allowing holders to collect a portion of fees proportional to their stToken holdings.
- Distribution:
- Occurs at predefined intervals with immediate accrual of user shares upon staking.
- Adopts a pro-rata distribution model, ensuring fee distribution is proportional to each user’s stToken holdings.
- Utilizes a precise user share tracking mechanism akin to other reward systems.
- Passive Stakers: Further investigation is necessary to ensure that passive stakers are adequately protected and fairly treated compared to those who stake at the last minute. The case of one chain accumulates and sends transfers peridocally is important.
-
Install rustup. Once installed, make sure you have the wasm32 target:
rustup default stable rustup update stable rustup target add wasm32-unknown-unknown
-
Install Docker
-
Install cargo-make
cargo install --force cargo-make
-
Compile all contracts:
cargo make rust-optimizer- Download CW20 contract:
wget -P ./artifacts/ https://github.com/CosmWasm/cw-plus/releases/download/v1.1.0/cw20_base.wasmThis compiles and optimizes all contracts, storing them in /artifacts directory along with checksum.txt which contains sha256 hashes of each of the .wasm files (The script just uses CosmWasm's rust-optimizer).
Note: Intel/Amd 64-bit processor is required. While there is experimental ARM support for CosmWasm/rust-optimizer, it's discouraged to use in production.
NOTE: on Apple devices an architecture suffix may be required.
See deployment scripts.
cargo make --makefile Makefile.toml generate-all-schemasCreates JSON schema files for relevant contract calls, queries and query responses (See: cosmwams-schema).
rustfmt is used to format any Rust source code:
cargo +nightly fmtclippy is used as a linting tool:
cargo make clippyIntegration tests (task integration-test or test) use .wasm files. They have to be generated with cargo make build.
Run unit tests:
cargo make unit-testRun all tests:
cargo make test| chain | contract | code id | git commit | store tx |
|---|---|---|---|---|
| osmosis | liquidator | 398 | 27aad556a2c6ac6dbb3a4c078fc523982c2b02dc | 9734C67B5E046BA7AE57D566BFB8FCD7611C842A1D4063CA03D81D4636670C12 |
| neutron | collector | 603 | 27aad556a2c6ac6dbb3a4c078fc523982c2b02dc | D2CDBB27AC03976D239852E01ED43CEB5100574AA4192677E64AC1E4248515A8 |
| neutron | staking | 604 | 27aad556a2c6ac6dbb3a4c078fc523982c2b02dc | 6DA9CAC7377E8D9EBD567E2372A79D8AAD2354D31871586E6AC2927F4E238B95 |
| neutron | distributor | 605 | 27aad556a2c6ac6dbb3a4c078fc523982c2b02dc | FD8A8BA705181B0FFD351B27AEE8DA405D844F972EF67535C5BD7595205D3051 |
Contents of this repository are open source under GNU General Public License v3 or later.