launchpad.rs |
The Rust code defines the smart contract logic for a cosmwasm-based DeFi launchpad, including instantiation, execution messages, and queries. It features structures for setting up and configuring the launchpad such as FactoryInstantiateMsg and InstantiateMsg , with validations for denominations, staked subscriptions, and launch fees. It supports multiple vesting schedules (Schedule ) that can be transformed into monotonic curves. The contract allows operations like registering vaults, updating configurations, and launching projects with structures like FactoryExecuteMsg and ExecuteMsg . It also defines response structures for queries like FactoryConfigResponse and LaunchpadConfigResponse , as well as administrative functions and migration utilities. |
lib.rs |
The lib.rs file serves as the primary library module for a Rust project, publicly exporting six submodules: launchpad , master , staking , test_utils , vault , and vesting_errors , which are defined in their respective files within the src directory. |
staking.rs |
The Rust code defines the structure and behavior for a decentralized finance (DeFi) staking platform, allowing users to instantiate allocator/staking contracts, update configurations, stake/unstake tokens, and manage reward gauges. Gauges represent reward mechanisms with validation rules and timings. Messages to query and execute actions are defined using enums, with serializable structs encapsulating configurations, user actions (like staking and unstaking), and associated metadata. Additionally, the code includes validation logic for reward gauges, ensuring adherence to specified rules and timelines. |
vesting_errors.rs |
The Rust code in src/vesting_errors.rs defines ContractError , an enumeration of custom error types for a vesting contract within a CosmWasm smart contract ecosystem. It includes errors for standard, curve, and denomination issues, incorrect funding amounts, zero or instant vesting, unauthorized actions, funding states, failed delegations, withdrawal constraints, and unsupported CW20 token denominations. Each variant is annotated to produce descriptive error messages, leveraging the thiserror crate for idiomatic error handling. |
test_utils.rs |
The code provides utility functions for creating mock messages and responses related to Automated Market Maker (AMM), Spot, and Derivative markets on the Injective blockchain. It defines messages to instantiate these market types with various parameters, such as market id, leverage, pricing sensitivity, and notional value caps. Additionally, the code includes serialization of a custom message format and wrapping it as a contract reply, supporting variable-length fields according to a binary encoding schema. Predefined constants for mocked owner, master address, and user accounts are also specified for testing purposes. |
vault.rs |
The vault.rs source code defines data structures, messages, and enums for managing Automated Market Makers (AMMs), spot markets, and derivative markets on a blockchain platform, possibly Injective Protocol. It includes configurations, vault/instantiation info, execution messages, and query messages for off-chain and on-chain vaults handling subscriptions, redemptions, ownership, price adjustments, and rewards distribution.Features encompass vault instantiation with market and oracle details, slippage settings, reward commissions, and admin parameters. Execution messages facilitate admin tasks, market-making, and transferring capabilities. Query messages retrieve configurations and market data. Responses and logging traits ensure data is fetched and formatted. The file leverages TypeScript-style decorators for serialization and schematization. |
master.rs |
The Rust module master.rs defines data structures and enums for managing a blockchain smart contract interaction. It includes messages for instantiation (InstantiateMsg ), executing injection related tasks (InjectiveForwardExec , AmmInjectiveForwardExec , MasterAmmExecuteMsg , ExecuteMsg ), querying data (QueryMsg ), and responses for registered vaults and config (RegisteredVaultsResponse , ConfigResponse ). Specific operations include vault registration, configuration updates, execution of messages for vault management, and queries for fetching vaults and contract configurations, utilizing the CosmWasm and Injective CosmWasm standards for blockchain smart contracts. |