# cauuu
cauuu is a Rust library that provides functionality for managing staking and minting operations for the `auuu` token. It includes two main contracts: `Hub` and `Mint`.
- **Hub**: Manages user positions, issues `cauuu` tokens, handles auto-compounding, and communicates with the Mint contract for minting new rewards.
- **Mint**: Responsible for minting `auuus` tokens, and only the Hub contract can request new tokens to be minted.
## Usage
To use this library, add the following to your `Cargo.toml`:
```toml
[dependencies]
cauuu = "0.1.0"
```
### Example
```rust
extern crate example_library;
use example_library::hub::{ExecuteMsg as HubExecuteMsg, QueryMsg as HubQueryMsg};
use example_library::mint::{ExecuteMsg as MintExecuteMsg, QueryMsg as MintQueryMsg};
fn main() {
// Example usage of ExecuteMsg and QueryMsg enums
let pause_hub_msg = HubExecuteMsg::Pause {};
let query_hub_state = HubQueryMsg::State {};
let pause_mint_msg = MintExecuteMsg::Pause {};
let query_mint_config = MintQueryMsg::Config {};
// Here you would typically serialize these messages and send them to the smart contract
}
```
## Modules
### Hub
The `Hub` contract manages user positions, issues `cauuu` tokens, handles auto-compounding, and communicates with the Mint contract for minting new rewards.
#### Execute Messages
The `ExecuteMsg` enum defines the executable actions for the `Hub` contract:
- `Pause {}`: Pause contract functionalities.
- `Unpause {}`: Unpause contract functionalities.
- `UpdateConfig { mint_token: Option<String>, protocol_fee_collector: Option<String> }`: Set the owner.
- `UpdateAdmin { admin: String }`: Change the admin (must be called by current admin).
- `UpdateParams { ... }`: Update the parameters needed for the contract.
- `Bond {}`: Receive `amount` in underlying coin denom from sender and issue `amount` / exchange_rate for the user.
- `UpdateGlobalIndex {}`: Update global index.
- `Unbond { camount: Uint128 }`: Unbond a specific amount.
- `WithdrawUnbonded {}`: Send back unbonded coin to the user.
#### Query Messages
The `QueryMsg` enum defines the queryable actions for the `Hub` contract:
- `Config {}`: Query the config.
- `State {}`: Query the state.
- `TotalWithdrawable { address: String }`: Query total withdrawable amount for a specific address.
- `Parameters {}`: Query the parameters.
- `UnbondRequests { address: String }`: Query unbond requests for a specific address.
- `Admin {}`: Query the admin.
### Mint
The `Mint` contract is responsible for minting `auuus` tokens, and only the Hub contract can request new tokens to be minted.
#### Execute Messages
The `ExecuteMsg` enum defines the executable actions for the `Mint` contract:
- `Pause {}`: Pause contract functionalities.
- `Unpause {}`: Unpause contract functionalities.
- `UpdateAdmin { admin: String }`: Change the admin (must be called by current admin).
- `ProcessRewards { rewards_amount: Uint128 }`: Sends the rewards that have been accumulated on the contract back to the hub contract.
- `MintTokens { recipient: String, amount: Uint128 }`: Mints the tokens to the recipient.
#### Query Messages
The `QueryMsg` enum defines the queryable actions for the `Mint` contract:
- `Config {}`: Query the config.
- `Admin {}`: Query the admin.
## License
This project is licensed under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for details.