Skip to content

Commit

Permalink
feat: add core compounder contract
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmatt committed Feb 29, 2024
1 parent 5436b53 commit 6af55fb
Show file tree
Hide file tree
Showing 18 changed files with 1,352 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

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

109 changes: 109 additions & 0 deletions Cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,112 @@ We need to specify admin and managers
}
}
```
## 8. Auto compounder
This contract implements vesting accounts for the native tokens.
### 8.1 Instantiate
We need to specify admin and managers
```javascript
{
"admin": "cosmos1...",
"managers": ["cosmos1...", "cosmos1..."]
}
```
### 8.2 Execute
#### Admin functions
- **SetAutoCompounderMode** sets the auto compounder mode
```javascript
{
"set_auto_compounder_mode": {
"mode": "true" // true or false
}
}
```
- **Withdraw** allows to withdraw the funds from the contract
```javascript
{
"withdraw": {
"amount": "1000000"
"recipient": "cosmos1..."
}
}
```
- **unstakes** allows to unstake the funds from the contract
```javascript
{
"unstake": {
"unstake_msgs": [
{
"validator": "cosmosvaloper1...",
"amount": "1000000"
},
{
"validator": "cosmosvaloper1...",
"amount": "1000000"
}
]
}
}
```
- **update managers** allows to update the managers of the contract
```javascript
{
"update_managers": {
"managers": ["cosmos1...", "cosmos1..."]
}
}
```
#### Manager functions
- **stake** allows to stake the funds from the contract. The shares are normalized
```javascript
{
"stake": {
"stake_msgs": [
{
"validator": "cosmosvaloper1...",
"share": "1000000"
},
{
"validator": "cosmosvaloper1...",
"share": "1000000"
}
]
},
"amount": "1000000"
}
```
### 8.3 Query
- **auto compounder mode** returns wether the auto compounder mode is enabled or not
```javascript
{
"auto_compounder_mode": {}
}
```
- **AdminAndManagers** returns the admin and managers of the contract
```javascript
{
"admin_and_managers": {}
}
```
7 changes: 7 additions & 0 deletions contracts/core-compounder/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --example schema"

12 changes: 12 additions & 0 deletions contracts/core-compounder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Build results
/target

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
Loading

0 comments on commit 6af55fb

Please sign in to comment.