From 7931cf4d57f313890e754461304e06bff993ae08 Mon Sep 17 00:00:00 2001 From: dancreee Date: Mon, 22 Jul 2024 17:07:05 +0800 Subject: [PATCH] Delete the develop section --- docs/develop/connect/_category_.json | 5 - docs/develop/connect/connect-intro.mdx | 1 - docs/develop/connect/cosmjs.mdx | 198 -- docs/develop/connect/endpoints.mdx | 25 - docs/develop/connect/mars-cli/_category_.json | 5 - ...-signing-and-broadcasting-transactions.mdx | 109 - .../connect/mars-cli/mars-cli-intro.mdx | 7 - docs/develop/connect/mars-cli/marsd.mdx | 184 -- docs/develop/contracts-api/_category_.json | 5 - .../contracts-api/contracts-api-intro.mdx | 196 -- docs/develop/contracts-api/execute-msgs.mdx | 667 ---- docs/develop/contracts/_category_.json | 5 - docs/develop/contracts/contracts-intro.mdx | 78 - .../liquidation-helpers/_category_.json | 5 - .../liquidation-filterer.mdx | 306 -- .../liquidation-helpers-intro.mdx | 7 - .../contracts/mars-hub/_category_.json | 5 - docs/develop/contracts/mars-hub/delegator.mdx | 193 -- .../contracts/mars-hub/mars-hub-intro.mdx | 7 - docs/develop/contracts/mars-hub/vesting.mdx | 593 ---- .../contracts/red-bank/_category_.json | 5 - .../contracts/red-bank/address-provider.mdx | 439 --- .../develop/contracts/red-bank/incentives.mdx | 582 ---- .../contracts/red-bank/oracle/_category_.json | 6 - .../contracts/red-bank/oracle/base.mdx | 546 ---- .../red-bank/oracle/oracle-intro.mdx | 7 - .../contracts/red-bank/oracle/osmosis.mdx | 68 - docs/develop/contracts/red-bank/params.mdx | 504 --- .../contracts/red-bank/red-bank-intro.mdx | 7 - docs/develop/contracts/red-bank/red-bank.mdx | 2858 ---------------- .../rewards-collector/_category_.json | 5 - .../red-bank/rewards-collector/base.mdx | 553 ---- .../red-bank/rewards-collector/osmosis.mdx | 29 - .../rewards-collector-intro.mdx | 7 - .../red-bank/swapper/_category_.json | 5 - .../contracts/red-bank/swapper/astroport.mdx | 75 - .../contracts/red-bank/swapper/base.mdx | 209 -- .../contracts/red-bank/swapper/osmosis.mdx | 41 - .../red-bank/swapper/swapper-intro.mdx | 10 - docs/develop/contracts/rover/_category_.json | 5 - docs/develop/contracts/rover/account-nft.mdx | 2291 ------------- .../contracts/rover/credit-manager.mdx | 2871 ----------------- docs/develop/contracts/rover/health.mdx | 176 - docs/develop/contracts/rover/rover-intro.mdx | 7 - docs/develop/contracts/rover/swapper.mdx | 626 ---- .../contracts/rover/v2-zapper/_category_.json | 5 - .../contracts/rover/v2-zapper/base.mdx | 158 - .../rover/v2-zapper/v2-zapper-intro.mdx | 2 - docs/develop/frontend/_category_.json | 5 - docs/develop/frontend/frontend-intro.mdx | 70 - docs/develop/indexers/_category_.json | 5 - docs/develop/indexers/indexers-intro.mdx | 7 - docs/develop/indexers/subquery.mdx | 25 - docs/develop/liquidation-bots/_category_.json | 5 - .../liquidation-bots-intro.mdx | 95 - docs/develop/modules/_category_.json | 5 - .../cosmos-sdk-modules/_category_.json | 5 - .../modules/cosmos-sdk-modules/auth.mdx | 206 -- .../modules/cosmos-sdk-modules/authz.mdx | 210 -- .../modules/cosmos-sdk-modules/bank.mdx | 368 --- .../modules/cosmos-sdk-modules/capability.mdx | 9 - .../cosmos-sdk-modules-intro.mdx | 7 - .../modules/cosmos-sdk-modules/crisis.mdx | 45 - .../cosmos-sdk-modules/distribution.mdx | 423 --- .../modules/cosmos-sdk-modules/evidence.mdx | 113 - .../modules/cosmos-sdk-modules/feegrant.mdx | 180 -- .../modules/cosmos-sdk-modules/group.mdx | 912 ------ .../modules/cosmos-sdk-modules/mint.mdx | 93 - .../modules/cosmos-sdk-modules/nft.mdx | 242 -- .../modules/cosmos-sdk-modules/params.mdx | 73 - .../modules/cosmos-sdk-modules/slashing.mdx | 131 - .../modules/cosmos-sdk-modules/staking.mdx | 679 ---- .../modules/cosmos-sdk-modules/upgrade.mdx | 236 -- .../modules/cosmos-sdk-modules/vesting.mdx | 103 - .../modules/cosmwasm-module/_category_.json | 5 - .../cosmwasm-module/cosmwasm-module-intro.mdx | 7 - docs/develop/modules/cosmwasm-module/wasm.mdx | 680 ---- .../modules/custom-modules/_category_.json | 5 - .../custom-modules/custom-modules-intro.mdx | 7 - docs/develop/modules/custom-modules/gov.mdx | 412 --- .../modules/custom-modules/incentives.mdx | 153 - .../develop/modules/custom-modules/safety.mdx | 87 - .../modules/ibc-modules/_category_.json | 5 - .../modules/ibc-modules/ibc-modules-intro.mdx | 7 - .../ibc-modules/interchain-accounts.mdx | 52 - docs/develop/modules/ibc-modules/transfer.mdx | 173 - docs/develop/modules/module-accounts.mdx | 32 - docs/develop/modules/modules-intro.mdx | 7 - docs/develop/overview.mdx | 11 - docusaurus.config.js | 24 - 90 files changed, 20617 deletions(-) delete mode 100644 docs/develop/connect/_category_.json delete mode 100644 docs/develop/connect/connect-intro.mdx delete mode 100644 docs/develop/connect/cosmjs.mdx delete mode 100644 docs/develop/connect/endpoints.mdx delete mode 100644 docs/develop/connect/mars-cli/_category_.json delete mode 100644 docs/develop/connect/mars-cli/generating-signing-and-broadcasting-transactions.mdx delete mode 100644 docs/develop/connect/mars-cli/mars-cli-intro.mdx delete mode 100644 docs/develop/connect/mars-cli/marsd.mdx delete mode 100644 docs/develop/contracts-api/_category_.json delete mode 100644 docs/develop/contracts-api/contracts-api-intro.mdx delete mode 100644 docs/develop/contracts-api/execute-msgs.mdx delete mode 100644 docs/develop/contracts/_category_.json delete mode 100644 docs/develop/contracts/contracts-intro.mdx delete mode 100644 docs/develop/contracts/liquidation-helpers/_category_.json delete mode 100644 docs/develop/contracts/liquidation-helpers/liquidation-filterer.mdx delete mode 100644 docs/develop/contracts/liquidation-helpers/liquidation-helpers-intro.mdx delete mode 100644 docs/develop/contracts/mars-hub/_category_.json delete mode 100644 docs/develop/contracts/mars-hub/delegator.mdx delete mode 100644 docs/develop/contracts/mars-hub/mars-hub-intro.mdx delete mode 100644 docs/develop/contracts/mars-hub/vesting.mdx delete mode 100644 docs/develop/contracts/red-bank/_category_.json delete mode 100644 docs/develop/contracts/red-bank/address-provider.mdx delete mode 100644 docs/develop/contracts/red-bank/incentives.mdx delete mode 100644 docs/develop/contracts/red-bank/oracle/_category_.json delete mode 100644 docs/develop/contracts/red-bank/oracle/base.mdx delete mode 100644 docs/develop/contracts/red-bank/oracle/oracle-intro.mdx delete mode 100644 docs/develop/contracts/red-bank/oracle/osmosis.mdx delete mode 100644 docs/develop/contracts/red-bank/params.mdx delete mode 100644 docs/develop/contracts/red-bank/red-bank-intro.mdx delete mode 100644 docs/develop/contracts/red-bank/red-bank.mdx delete mode 100644 docs/develop/contracts/red-bank/rewards-collector/_category_.json delete mode 100644 docs/develop/contracts/red-bank/rewards-collector/base.mdx delete mode 100644 docs/develop/contracts/red-bank/rewards-collector/osmosis.mdx delete mode 100644 docs/develop/contracts/red-bank/rewards-collector/rewards-collector-intro.mdx delete mode 100644 docs/develop/contracts/red-bank/swapper/_category_.json delete mode 100644 docs/develop/contracts/red-bank/swapper/astroport.mdx delete mode 100644 docs/develop/contracts/red-bank/swapper/base.mdx delete mode 100644 docs/develop/contracts/red-bank/swapper/osmosis.mdx delete mode 100644 docs/develop/contracts/red-bank/swapper/swapper-intro.mdx delete mode 100644 docs/develop/contracts/rover/_category_.json delete mode 100644 docs/develop/contracts/rover/account-nft.mdx delete mode 100644 docs/develop/contracts/rover/credit-manager.mdx delete mode 100644 docs/develop/contracts/rover/health.mdx delete mode 100644 docs/develop/contracts/rover/rover-intro.mdx delete mode 100644 docs/develop/contracts/rover/swapper.mdx delete mode 100644 docs/develop/contracts/rover/v2-zapper/_category_.json delete mode 100644 docs/develop/contracts/rover/v2-zapper/base.mdx delete mode 100644 docs/develop/contracts/rover/v2-zapper/v2-zapper-intro.mdx delete mode 100644 docs/develop/frontend/_category_.json delete mode 100644 docs/develop/frontend/frontend-intro.mdx delete mode 100644 docs/develop/indexers/_category_.json delete mode 100644 docs/develop/indexers/indexers-intro.mdx delete mode 100644 docs/develop/indexers/subquery.mdx delete mode 100644 docs/develop/liquidation-bots/_category_.json delete mode 100644 docs/develop/liquidation-bots/liquidation-bots-intro.mdx delete mode 100644 docs/develop/modules/_category_.json delete mode 100644 docs/develop/modules/cosmos-sdk-modules/_category_.json delete mode 100644 docs/develop/modules/cosmos-sdk-modules/auth.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/authz.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/bank.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/capability.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/cosmos-sdk-modules-intro.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/crisis.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/distribution.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/evidence.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/feegrant.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/group.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/mint.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/nft.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/params.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/slashing.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/staking.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/upgrade.mdx delete mode 100644 docs/develop/modules/cosmos-sdk-modules/vesting.mdx delete mode 100644 docs/develop/modules/cosmwasm-module/_category_.json delete mode 100644 docs/develop/modules/cosmwasm-module/cosmwasm-module-intro.mdx delete mode 100644 docs/develop/modules/cosmwasm-module/wasm.mdx delete mode 100644 docs/develop/modules/custom-modules/_category_.json delete mode 100644 docs/develop/modules/custom-modules/custom-modules-intro.mdx delete mode 100644 docs/develop/modules/custom-modules/gov.mdx delete mode 100644 docs/develop/modules/custom-modules/incentives.mdx delete mode 100644 docs/develop/modules/custom-modules/safety.mdx delete mode 100644 docs/develop/modules/ibc-modules/_category_.json delete mode 100644 docs/develop/modules/ibc-modules/ibc-modules-intro.mdx delete mode 100644 docs/develop/modules/ibc-modules/interchain-accounts.mdx delete mode 100644 docs/develop/modules/ibc-modules/transfer.mdx delete mode 100644 docs/develop/modules/module-accounts.mdx delete mode 100644 docs/develop/modules/modules-intro.mdx delete mode 100644 docs/develop/overview.mdx diff --git a/docs/develop/connect/_category_.json b/docs/develop/connect/_category_.json deleted file mode 100644 index 180351c..0000000 --- a/docs/develop/connect/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Connect", - "position": 2, - "link": { "type": "doc", "id": "connect-intro" } -} \ No newline at end of file diff --git a/docs/develop/connect/connect-intro.mdx b/docs/develop/connect/connect-intro.mdx deleted file mode 100644 index a18966a..0000000 --- a/docs/develop/connect/connect-intro.mdx +++ /dev/null @@ -1 +0,0 @@ -# Connect \ No newline at end of file diff --git a/docs/develop/connect/cosmjs.mdx b/docs/develop/connect/cosmjs.mdx deleted file mode 100644 index abf02d0..0000000 --- a/docs/develop/connect/cosmjs.mdx +++ /dev/null @@ -1,198 +0,0 @@ ---- -sidebar_position: 3 ---- - -# CosmJs - -### Step 1: Setting up your Development Environment - -Before you start, make sure you have Node.js and npm (Node Package Manager) installed on your system. You can verify the installation by running the following commands: - -```bash -node -v -npm -v -``` - -Next, create a new Node.js project by running: - -```bash -npm init -y -``` - -Install the necessary dependencies: - -```bash -npm install @cosmjs/cosmwasm-stargate @cosmjs/proto-signing -``` - -### Step 2: Connecting to Osmosis with CosmJS - -In this section, we will create a script that connects to the Osmosis network using CosmJs. - -```js -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; - -const rpc = 'https://rpc-osmosis.keplr.app'; // Osmosis RPC -const mnemonic = 'your mnemonic here'; // Replace with your mnemonic -const prefix = 'osmo'; // Prefix for Osmosis - -const start = async () => { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix }); - - const [firstAccount] = await wallet.getAccounts(); - const walletAddress = firstAccount.address; - - const signingClient = await SigningCosmWasmClient.connectWithSigner(rpc, wallet, { - gasPrice: GasPrice.fromString("0.1uosmo"), - }); - - console.log( - "Connected to Osmosis, chain id:", - await signingClient.getChainId(), - ", height:", - await signingClient.getHeight() - ); -}; - -start(); -``` - -### Step 3: Querying Data - -Now we will create a script to query smart contract data from the Osmosis network. - -```js -import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate"; - -const rpc = 'https://rpc-osmosis.keplr.app'; // Osmosis RPC -const contractAddress = 'osmosis-contract-address-here'; // Replace with actual contract address - -const start = async () => { - try { - const client = new CosmWasmClient(rpc); - - // Generic Contract Query - This should be adapted based on the actual contract's query methods - const contractQuery = await client.queryContractSmart(contractAddress, { - "custom_query": { - // ... your custom query parameters here - } - }); - - console.log('Contract Query Result:', contractQuery); - - } catch (err) { - console.error(err); - } -}; - -start(); -``` - -### Step 4: Sign and Broadcast Transactions - -Lastly, let's create a script to sign broadcast transactions to the Osmosis network. - -```js focus=20:31 -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; - -const rpc = 'https://rpc-osmosis.keplr.app'; // Osmosis RPC -const mnemonic = 'your mnemonic here'; // Replace with your mnemonic -const contractAddress = 'osmosis-contract-address-here'; // Replace with actual contract address -const prefix = 'osmo'; // Prefix for Osmosis - -const start = async () => { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix }); - - const [firstAccount] = await wallet.getAccounts(); - const walletAddress = firstAccount.address; - - const signingClient = await SigningCosmWasmClient.connectWithSigner(rpc, wallet, { - gasPrice: GasPrice.fromString("0.1uosmo"), - }); - - const msg = { - // Your transaction message here - }; - - const result = await signingClient.execute( - walletAddress, - contractAddress, - msg, - "auto", - "", - [{ denom: "uosmo", amount: "1000000" }] - ); - - console.log(JSON.stringify(result)); -}; - -start(); -``` - -Remember to replace `your mnemonic here` and `osmosis-contract-address-here` with actual values. - -### Step 5: IBC Transactions - -In this step, we will create a script to facilitate Inter-Blockchain Communication (IBC) transactions, which allow for the transfer of tokens between different blockchains within the Cosmos ecosystem. Create a file named ibc-transaction.js and add the following generalized code: - -```js focus=29:50 -import { - CosmWasmClient, - SigningCosmWasmClient, -} from "@cosmjs/cosmwasm-stargate"; -import { coins, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; -import { SigningStargateClient } from "@cosmjs/stargate"; - -const rpc = 'YOUR_RPC_URL_HERE'; -const mnemonic = 'YOUR_MNEMONIC_HERE'; -const prefix = 'YOUR_CHAIN_PREFIX_HERE'; - -const start = async () => { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { - prefix: prefix - }); - - const [firstAccount] = await wallet.getAccounts(); - const walletAddress = firstAccount.address; - - console.log('Wallet Address:', walletAddress); - - const signingClient = await SigningStargateClient.connectWithSigner( - rpc, - wallet, - { gasPrice: GasPrice.fromString("0.1YOUR_GAS_TOKEN_HERE") } - ); - - // Replace with the recipient's address - const recipient = 'RECIPIENT_ADDRESS_HERE'; - // Replace with the appropriate token denomination and amount to transfer - const amount = { - denom: "YOUR_TOKEN_DENOMINATION_HERE", - amount: "YOUR_TOKEN_AMOUNT_HERE", - }; - - // The timeout is set to one hour in the future as an example, adjust as needed - const timeoutTimestamp = Math.floor(Date.now() / 1000) + 60 * 60; - - const tx = await signingClient.sendIbcTokens( - walletAddress, - recipient, - amount, - 'YOUR_PORT_HERE', // Usually 'transfer', replace if different - 'YOUR_CHANNEL_HERE', // Replace with the channel identifier (e.g., 'channel-0') - undefined, // Timeout block height, leave undefined if using timeout timestamp - timeoutTimestamp, - "auto", // Fee, set to "auto" to automatically calculate the fee - "" // Memo, optional - ); - - console.log(JSON.stringify(tx)); -}; - -start(); -``` diff --git a/docs/develop/connect/endpoints.mdx b/docs/develop/connect/endpoints.mdx deleted file mode 100644 index dd4c60b..0000000 --- a/docs/develop/connect/endpoints.mdx +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Endpoints - -## Mars Hub - -### Testnet (`ares-1`) - -| Network | Endpoint | -| --- | ----------- | -| LCD | https://testnet-rest.marsprotocol.io/ | -| RCP | https://testnet-rpc.marsprotocol.io/ | -| gRCP | https://testnet-grpc.marsprotocol.io/ | -| Explorer | https://testnet-explorer.marsprotocol.io/ | -| Faucet | https://faucet.marsprotocol.io/ | - -## Osmosis - -Visit the [Osmosis docs](https://docs.osmosis.zone/networks/). - -## Neutron - -Visit the [Neutron docs](https://docs.neutron.org/neutron/faq#where-can-i-get-the-public-rest-and-rpc-nodes). \ No newline at end of file diff --git a/docs/develop/connect/mars-cli/_category_.json b/docs/develop/connect/mars-cli/_category_.json deleted file mode 100644 index edb8e35..0000000 --- a/docs/develop/connect/mars-cli/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Mars CLI", - "position": 1, - "link": { "type": "doc", "id": "mars-cli-intro" } -} \ No newline at end of file diff --git a/docs/develop/connect/mars-cli/generating-signing-and-broadcasting-transactions.mdx b/docs/develop/connect/mars-cli/generating-signing-and-broadcasting-transactions.mdx deleted file mode 100644 index 151a395..0000000 --- a/docs/develop/connect/mars-cli/generating-signing-and-broadcasting-transactions.mdx +++ /dev/null @@ -1,109 +0,0 @@ ---- -sidebar_position: 3 ---- - -import Admonition from '@theme/Admonition' - -# Transact - -## Using the Marsd CLI - -The easiest way to send transactions is using the CLI. For example, running the following command: - -```bash -marsd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000stake --chain-id my-test-chain --keyring-backend test -``` - -will run the following steps: - -- generate a transaction with one Msg `(x/bank's MsgSend)`, and print the generated transaction to the console. -- ask the user for confirmation to send the transaction from the `$MY_VALIDATOR_ADDRESS` account. -- fetch `$MY_NODE_ADDRESS` from the keyring. This is possible if you have set you have set up the CLI's keyring. -- sign the generated transaction with the keyring's account. -- broadcast the signed transaction to the network. This is possible because the CLI connects to the node's Tendermint RPC endpoint. - -The CLI bundles all the necessary steps into a simple-to-use user experience. However, it's possible to run all the steps individually too. - -## Generating a Transaction - -Generating a transaction can simply be done by appending the `--generate-only` flag on any `tx` command, e.g.: - -```bash -marsd tx bank send $MY_NODE_ADDRESS $RECIPIENT 1000stake --chain-id my-test-chain --generate-only -``` - -This will output the unsigned transaction as JSON in the console. We can also save the unsigned transaction to a file (to be passed around between signers more easily) by appending `> unsigned_tx.json` to the above command. - -## Signing a Transaction - -Signing a transaction using the CLI requires the unsigned transaction to be saved in a file. Let's assume the unsigned transaction is in a file called `unsigned_tx.json` in the current directory (see previous paragraph on how to do that). Then, simply run the following command: - -```bash -marsd tx sign unsigned_tx.json --chain-id my-test-chain --keyring-backend test --from $MY_NODE_ADDRESS -``` - -This command will decode the unsigned transaction and sign it with `SIGN_MODE_DIRECT` with `$MY_VALIDATOR_ADDRESS`'s key, which we already set up in the keyring. The signed transaction will be output as JSON to the console, and, as above, we can save it to a file by appending `> signed_tx.json`. - -Some useful flags to consider in the `tx sign` command: - -- `--sign-mode`: you may use amino-json to sign the transaction using `SIGN_MODE_LEGACY_AMINO_JSON`, -- `--offline`: sign in offline mode. This means that the tx sign command doesn't connect to the node to retrieve the signer's account number and sequence, both needed for signing. In this case, you must manually supply the `--account-number` and `--sequence flags`. This is useful for offline signing, i.e. signing in a secure environment which doesn't have access to the internet. - -## Signing with Multiple Signers - - -Please note that signing a transaction with multiple signers or with a multisig account, where at least one signer uses `SIGN_MODE_DIRECT`, is not yet possible. You may follow this [Github issue](https://github.com/cosmos/cosmos-sdk/issues/8141) for more info. - - -Signing with multiple signers is done with the `tx multisign` command. This command assumes that all signers use `SIGN_MODE_LEGACY_AMINO_JSON`. The flow is similar to the `tx sign` command flow, but instead of signing an unsigned transaction file, each signer signs the file signed by previous signer(s). The tx multisign command will append signatures to the existing transactions. It is important that signers sign the transaction **in the same order** as given by the transaction, which is retrievable using the `GetSigners()` method. - -For example, starting with the `unsigned_tx.json`, and assuming the transaction has 4 signers, we would run: - -```bash -# Let signer1 sign the unsigned tx. -marsd tx multisign unsigned_tx.json signer_key_1 --chain-id my-test-chain --keyring-backend test > partial_tx_1.json - -# Now signer1 will send the partial_tx_1.json to the signer2. -# Signer2 appends their signature: -marsd tx multisign partial_tx_1.json signer_key_2 --chain-id my-test-chain --keyring-backend test > partial_tx_2.json - -# Signer2 sends the partial_tx_2.json file to signer3, and signer3 can append his signature: -marsd tx multisign partial_tx_2.json signer_key_3 --chain-id my-test-chain --keyring-backend test > partial_tx_3.json -``` - -## Broadcasting a Transaction - -Broadcasting a transaction is done using the following command: - -```bash -marsd tx broadcast tx_signed.json -``` - -You may optionally pass the `--broadcast-mode` flag to specify which response to receive from the node: -- `block`: the CLI waits for the tx to be committed in a block. -- `sync`: the CLI waits for a CheckTx execution response only. -- `async`: the CLI returns immediately (transaction might fail). - -## Encoding a Transaction - -In order to broadcast a transaction using the gRPC or REST endpoints, the transaction will need to be encoded first. This can be done using the CLI. - -Encoding a transaction is done using the following command: - -```bash -marsd tx encode tx_signed.json -``` - -This will read the transaction from the file, serialize it using Protobuf, and output the transaction bytes as `base64` in the console. - -## Decoding a Transaction - -The CLI can also be used to decode transaction bytes. - -Decoding a transaction is done using the following command: - -```bash -marsd tx decode [protobuf-byte-string] -``` - -This will decode the transaction bytes and output the transaction as JSON in the console. You can also save the transaction to a file by appending `> tx.json` to the above command. \ No newline at end of file diff --git a/docs/develop/connect/mars-cli/mars-cli-intro.mdx b/docs/develop/connect/mars-cli/mars-cli-intro.mdx deleted file mode 100644 index 4fde687..0000000 --- a/docs/develop/connect/mars-cli/mars-cli-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Mars CLI - -Interact with Mars' functions via the terminal - - \ No newline at end of file diff --git a/docs/develop/connect/mars-cli/marsd.mdx b/docs/develop/connect/mars-cli/marsd.mdx deleted file mode 100644 index 8a2e7ee..0000000 --- a/docs/develop/connect/mars-cli/marsd.mdx +++ /dev/null @@ -1,184 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Marsd - -This guide will explain how to install the marsd binary (Mars CLI) onto your system as a command-line interface tool for interacting with nodes on Mars Hub. - -While `marsd` is a requirement to run a full node, you don't have to run a full local node yourself to interact with the network. You can specify a remote node with the `—node` flag. - -With `marsd` connected to a remote node you can: -- Generates keys -- Send transactions -- Deploy and interact with contracts -- and more - -## Requirements - -To install Marsd, you will need the following: - -- Linux or macOS operating system -- [Go v1.19+](https://go.dev/dl/) - - -## Setup - -Login to your user account (you don't want to use root) and install some essential packages: - -```shell -sudo apt update -sudo apt upgrade -sudo apt install build-essential git vim jq libleveldb-dev -sudo apt autoremove -``` - -Install the Go programming language: - -```shell -curl -LO https://golang.org/dl/go1.18.3.linux-amd64.tar.gz -tar xfz ./go1.18.3.linux-amd64.tar.gz -sudo mv go /usr/local -go version -``` - -## Configure Environment Variables - -After installing Go, it is recommended to configure related environment variables: - - -```bash -# ~/.bashrc -export GOROOT=/usr/local/go -export GOPATH=$HOME/.go -export GOBIN=$GOPATH/bin -export PATH=$PATH:$GOPATH/bin:$GOROOT/bin -``` - -The provided code block is a set of environment variable assignments in a bash configuration file (~/.bashrc). These environment variables are commonly used in Go programming and their purpose is to specify the location of Go installation, workspace, and executable files: - -- `export GOROOT=/usr/local/go` assigns the location of the Go installation directory to the GOROOT environment variable. The export keyword ensures that this variable is accessible to child processes. If using a package manager such as homebrew, this location may vary. -- `export GOPATH=$HOME/.go` assigns the location of the Go workspace directory to the GOPATH environment variable. The workspace is where Go source code and its dependencies are stored. By default, the workspace is located in $HOME/go but can be customized using this environment variable. -- `export GOBIN=$GOPATH/bin` assigns the location of the Go executable files to the GOBIN environment variable. This variable specifies the directory where Go binary files will be installed when using go install command. -- Finally, `export PATH=$PATH:$GOPATH/bin:$GOROOT/bin` adds the directories specified in GOPATH/bin and GOROOT/bin to the system's PATH variable. This makes it possible to execute Go binaries from any directory in the terminal by simply typing their name. - -Overall, this is a convenient way to set up the Go development environment by specifying the important directories and their locations as environment variables. - -## Installing Marsd - -To install Marsd, clone the Mars Hub repository, checkout the latest tag (e.g. v1.0.0), and compile the code: - -```bash -git clone https://github.com/mars-protocol/hub.git -cd hub -git checkout -make install -``` -A `marsd` executable will be created in the $GOBIN directory. - -## Generate Operator Key - -Each node comes with three private keys: an operator key, a consensus key, and a node key. If you are connecting to a remote node, you only need an operator key to transact. Later sections will cover consensus and node keys as well. - -To generate your operator key, run the following command: - -```bash -marsd keys add -``` - -Make sure you save the mnemonics! After you end your terminal session, your keys cannot be recovered. - -To use an existing seed phrase, run the following command: - -```bash -marsd keys add --recover -``` - -## Connect to a Remote Node - -At this point, you can begin interacting with the Mars blockchain by connecting to a remote note. - -Martians who prefer to not operate a node can connect to a remote node with Marsd by appending the `--node` flag at the end of requests along with an RPC endpoint in the `https://:` format. Alternatively, Martians can configure a default node using the following command: - -```bash -marsd config node https://: -``` - -If you are connecting to a remote node, select a node operator that you can trust. Malicious operators can alter query results and censor transactions. Mars contributors currently maintain the following RPC endpoints for public use: - -Mainnet (`mars-1`): [https://rpc.marsprotocol.io:443](https://rpc.marsprotocol.io:443) -Testnet (`ares-1`): [https://testnet-rpc.marsprotocol.io:443](https://testnet-rpc.marsprotocol.io:443) - -A list of public RPC endpoints can also be found in the [Cosmos chain registry](https://github.com/cosmos/chain-registry/blob/master/mars/chain.json). - -To learn about the list of available commands, run `marsd --help` in your terminal. For more information about a specific command, append the `--help` flag at the end of your request, for example: - -``` -marsd query --help -marsd query bank --help -``` - -## Commands - -This section describes essential commands for validators from marsd, the command line interface that connects a running marsd process. - -#### `keys` - -Manages Keyring commands. For a list of syntax and subcommands, see the keys subcommands. - -#### `query` - -Manages queries. For a list of syntax and subcommands, see the query subcommands. - -#### `start` - -Runs the full node application with Tendermint in or out of process. By default, the application runs with Tendermint in process: - -```bash -marsd start -``` - -#### `status` - -Displays the status of a remote node: - -```bash -marsd status -``` - -#### `tx` - -Retrieves a transaction by its hash, account sequence, or signature. For a list of full syntax and subcommands, see the tx subcommands. - -Syntax to query by hash: - -```bash -marsd query tx -``` - -Syntax to query by account sequence: - -```bash -marsd query tx --type=acc_seq
: -``` - -Syntax to query by signature: - -```bash -marsd query tx --type=signature -``` - -#### `txs` - -Retrieves transactions that match the specified events where results are paginated: - -```bash -marsd query txs --events '' --page --limit -``` - -Example: - - -```bash -marsd query txs --events 'message.sender=cosmos1...&message.action=withdraw_delegator_reward' --page 1 --limit 30 -``` \ No newline at end of file diff --git a/docs/develop/contracts-api/_category_.json b/docs/develop/contracts-api/_category_.json deleted file mode 100644 index d8d77b7..0000000 --- a/docs/develop/contracts-api/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Contracts API", - "position": 4, - "link": { "type": "doc", "id": "contracts-api-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts-api/contracts-api-intro.mdx b/docs/develop/contracts-api/contracts-api-intro.mdx deleted file mode 100644 index 2c21d62..0000000 --- a/docs/develop/contracts-api/contracts-api-intro.mdx +++ /dev/null @@ -1,196 +0,0 @@ -# Contracts API - -## CosmJs - -### Step 1: Setting up your Development Environment - -Before you start, make sure you have Node.js and npm (Node Package Manager) installed on your system. You can verify the installation by running the following commands: - -```bash -node -v -npm -v -``` - -Next, create a new Node.js project by running: - -```bash -npm init -y -``` - -Install the necessary dependencies: - -```bash -npm install @cosmjs/cosmwasm-stargate @cosmjs/proto-signing -``` - -### Step 2: Connecting to Osmosis with CosmJS - -In this section, we will create a script that connects to the Osmosis network using CosmJs. - -```js -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; - -const rpc = 'https://rpc-osmosis.keplr.app'; // Osmosis RPC -const mnemonic = 'your mnemonic here'; // Replace with your mnemonic -const prefix = 'osmo'; // Prefix for Osmosis - -const start = async () => { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix }); - - const [firstAccount] = await wallet.getAccounts(); - const walletAddress = firstAccount.address; - - const signingClient = await SigningCosmWasmClient.connectWithSigner(rpc, wallet, { - gasPrice: GasPrice.fromString("0.1uosmo"), - }); - - console.log( - "Connected to Osmosis, chain id:", - await signingClient.getChainId(), - ", height:", - await signingClient.getHeight() - ); -}; - -start(); -``` - -### Step 3: Querying Data - -Now we will create a script to query smart contract data from the Osmosis network. - -```js -import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate"; - -const rpc = 'https://rpc-osmosis.keplr.app'; // Osmosis RPC -const contractAddress = 'osmosis-contract-address-here'; // Replace with actual contract address - -const start = async () => { - try { - const client = new CosmWasmClient(rpc); - - // Generic Contract Query - This should be adapted based on the actual contract's query methods - const contractQuery = await client.queryContractSmart(contractAddress, { - "custom_query": { - // ... your custom query parameters here - } - }); - - console.log('Contract Query Result:', contractQuery); - - } catch (err) { - console.error(err); - } -}; - -start(); -``` - -### Step 4: Sign and Broadcast Transactions - -Lastly, let's create a script to sign broadcast transactions to the Osmosis network. - -```js focus=20:31 -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; - -const rpc = 'https://rpc-osmosis.keplr.app'; // Osmosis RPC -const mnemonic = 'your mnemonic here'; // Replace with your mnemonic -const contractAddress = 'osmosis-contract-address-here'; // Replace with actual contract address -const prefix = 'osmo'; // Prefix for Osmosis - -const start = async () => { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix }); - - const [firstAccount] = await wallet.getAccounts(); - const walletAddress = firstAccount.address; - - const signingClient = await SigningCosmWasmClient.connectWithSigner(rpc, wallet, { - gasPrice: GasPrice.fromString("0.1uosmo"), - }); - - const msg = { - // Your transaction message here - }; - - const result = await signingClient.execute( - walletAddress, - contractAddress, - msg, - "auto", - "", - [{ denom: "uosmo", amount: "1000000" }] - ); - - console.log(JSON.stringify(result)); -}; - -start(); -``` - -Remember to replace `your mnemonic here` and `osmosis-contract-address-here` with actual values. - -### Step 5: IBC Transactions - -In this step, we will create a script to facilitate Inter-Blockchain Communication (IBC) transactions, which allow for the transfer of tokens between different blockchains within the Cosmos ecosystem. Create a file named ibc-transaction.js and add the following generalized code: - -```js focus=29:50 -import { - CosmWasmClient, - SigningCosmWasmClient, -} from "@cosmjs/cosmwasm-stargate"; -import { coins, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { GasPrice } from "@cosmjs/stargate"; -import { SigningStargateClient } from "@cosmjs/stargate"; - -const rpc = 'YOUR_RPC_URL_HERE'; -const mnemonic = 'YOUR_MNEMONIC_HERE'; -const prefix = 'YOUR_CHAIN_PREFIX_HERE'; - -const start = async () => { - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { - prefix: prefix - }); - - const [firstAccount] = await wallet.getAccounts(); - const walletAddress = firstAccount.address; - - console.log('Wallet Address:', walletAddress); - - const signingClient = await SigningStargateClient.connectWithSigner( - rpc, - wallet, - { gasPrice: GasPrice.fromString("0.1YOUR_GAS_TOKEN_HERE") } - ); - - // Replace with the recipient's address - const recipient = 'RECIPIENT_ADDRESS_HERE'; - // Replace with the appropriate token denomination and amount to transfer - const amount = { - denom: "YOUR_TOKEN_DENOMINATION_HERE", - amount: "YOUR_TOKEN_AMOUNT_HERE", - }; - - // The timeout is set to one hour in the future as an example, adjust as needed - const timeoutTimestamp = Math.floor(Date.now() / 1000) + 60 * 60; - - const tx = await signingClient.sendIbcTokens( - walletAddress, - recipient, - amount, - 'YOUR_PORT_HERE', // Usually 'transfer', replace if different - 'YOUR_CHANNEL_HERE', // Replace with the channel identifier (e.g., 'channel-0') - undefined, // Timeout block height, leave undefined if using timeout timestamp - timeoutTimestamp, - "auto", // Fee, set to "auto" to automatically calculate the fee - "" // Memo, optional - ); - - console.log(JSON.stringify(tx)); -}; - -start(); -``` diff --git a/docs/develop/contracts-api/execute-msgs.mdx b/docs/develop/contracts-api/execute-msgs.mdx deleted file mode 100644 index 3a071fa..0000000 --- a/docs/develop/contracts-api/execute-msgs.mdx +++ /dev/null @@ -1,667 +0,0 @@ ---- -sidebar_position: 2 ---- - -# ExecuteMsgs - -## Credit Accounts - -### Create Account - -```json -{ - "create_credit_account": "default" -} -``` - -### Fund Account - -```json -{ - "update_credit_account": { - "account_id": "number", - "actions": [ - { - "deposit": { - "denom": "uosmo", - "amount": "number" - } - } - ] - } -} -``` - -### Fund Account and Lend Assets - -```json -{ - "update_credit_account": { - "account_id": "number", - "actions": [ - { - "deposit": { - "denom": "uosmo", - "amount": "number" - } - }, - { - "lend": { - "denom": "uosmo", - "amount": "account_balance" - } - } - ] - } -} -``` - -### Withdraw from Account - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "withdraw": { - "denom": "uosmo", - "amount": { - "exact": "63793713" - } - } - } - ] - } -} -``` - -## Lending - -### Lend Assets - -```json -{ - "update_credit_account": { - "account_id": "number", - "actions": [ - { - "lend": { - "denom": "string", - "amount": { - "exact": "number" - } - } - } - ] - } -} -``` - -### Withdraw - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "reclaim": { - "denom": "uosmo", - "amount": { - "exact": "165163425" - } - } - } - ] - } -} -``` - -## Borrowing - -### Borrow Assets - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "borrow": { - "denom": "uosmo", - "amount": "663131255" - } - } - ] - } -} -``` - -### Borrow and Withdraw to Wallet - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "borrow": { - "denom": "uosmo", - "amount": "179045439" - } - }, - { - "withdraw": { - "denom": "uosmo", - "amount": { - "exact": "179045439" - } - } - } - ] - } -} -``` - -### Repaying Loan - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "repay": { - "coin": { - "denom": "uosmo", - "amount": { - "exact": "497354158" - } - } - } - } - ] - } -} -``` - -## Trading - -### Spot Trade - -```json -{ - "update_credit_account": { - "account_id": "number", - "actions": [ - { - "swap_exact_in": { - "coin_in": { - "denom": "string", - "amount": { - "exact": "number" - } - }, - "denom_out": "string", - "slippage": "0.02" - } - } - ] - } -} -``` - -## Margin Trading - -### Margin Long - -```json -{ - "update_credit_account": { - "account_id": "22", - "actions": [ - { - "borrow": { - "denom": "stablecoin address", - "amount": "number" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "stablecoin address", - "amount": { - "exact": "number" - } - }, - "denom_out": "long asset", - "slippage": "0.02" - } - } - ] - } -} -``` - -### Margin Short - -```json -{ - "update_credit_account": { - "account_id": "22", - "actions": [ - { - "borrow": { - "denom": "short asset", - "amount": "number" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "short asset", - "amount": { - "exact": "number" - } - }, - "denom_out": "stabecoin address", - "slippage": "0.02" - } - } - ] - } -} -``` - -## Trading + Lending - -### Spot Trade and Lend - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "swap_exact_in": { - "coin_in": { - "denom": "uosmo", - "amount": { - "exact": "94983584" - } - }, - "denom_out": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "slippage": "0.02" - } - }, - { - "lend": { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": "account_balance" - } - } - ] - } -} -``` - -### Reclaim Lent Assets and Trade - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "reclaim": { - "denom": "uosmo", - "amount": { - "exact": "94983584" - } - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "uosmo", - "amount": { - "exact": "94983584" - } - }, - "denom_out": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "slippage": "0.02" - } - } - ] - } -} -``` - -### Margin Trade and Lending - Long - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "borrow": { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": "39671962" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": { - "exact": "39671962" - } - }, - "denom_out": "uosmo", - "slippage": "0.02" - } - }, - { - "lend": { - "denom": "uosmo", - "amount": "account_balance" - } - } - ] - } -} -``` - -### Margin Trade and Lending - Short - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "borrow": { - "denom": "uosmo", - "amount": "343368619" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "uosmo", - "amount": { - "exact": "531474119" - } - }, - "denom_out": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "slippage": "0.02" - } - }, - { - "lend": { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": "account_balance" - } - } - ] - } -} -``` - -## Farm - -### Deposit 50/50 Farm - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "provide_liquidity": { - "coins_in": [ - { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": { - "exact": "38928713" - } - }, - { - "denom": "uosmo", - "amount": { - "exact": "120072695" - } - } - ], - "lp_token_out": "gamm/pool/678", - "slippage": "0.02" - } - }, - { - "enter_vault": { - "coin": { - "denom": "gamm/pool/678", - "amount": "account_balance" - }, - "vault": { - "address": "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j" - } - } - } - ] - } -} -``` - -### Leveraged Yield Farming - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "borrow": { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": "242378470" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": { - "exact": "121189235" - } - }, - "denom_out": "uosmo", - "slippage": "0.02" - } - }, - { - "provide_liquidity": { - "coins_in": [ - { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": { - "exact": "144599161" - } - }, - { - "denom": "uosmo", - "amount": { - "exact": "446005258" - } - } - ], - "lp_token_out": "gamm/pool/678", - "slippage": "0.02" - } - }, - { - "enter_vault": { - "coin": { - "denom": "gamm/pool/678", - "amount": "account_balance" - }, - "vault": { - "address": "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j" - } - } - } - ] - } -} -``` - -### Unlock Vault - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "request_vault_unlock": { - "vault": { - "address": "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j" - }, - "amount": "37601963208325379423921404" - } - } - ] - } -} -``` - -### Farm + Margin Trade - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "provide_liquidity": { - "coins_in": [ - { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": { - "exact": "38928713" - } - }, - { - "denom": "uosmo", - "amount": { - "exact": "120072695" - } - } - ], - "lp_token_out": "gamm/pool/678", - "slippage": "0.02" - } - }, - { - "enter_vault": { - "coin": { - "denom": "gamm/pool/678", - "amount": "account_balance" - }, - "vault": { - "address": "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j" - } - } - }, - { - "borrow": { - "denom": "stablecoin address", - "amount": "number" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "stablecoin address", - "amount": { - "exact": "number" - } - }, - "denom_out": "long asset", - "slippage": "0.02" - } - } - ] - } -} -``` - -### Farm + Margin Trade + Lend - -```json -{ - "update_credit_account": { - "account_id": "24", - "actions": [ - { - "provide_liquidity": { - "coins_in": [ - { - "denom": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", - "amount": { - "exact": "38928713" - } - }, - { - "denom": "uosmo", - "amount": { - "exact": "120072695" - } - } - ], - "lp_token_out": "gamm/pool/678", - "slippage": "0.02" - } - }, - { - "enter_vault": { - "coin": { - "denom": "gamm/pool/678", - "amount": "account_balance" - }, - "vault": { - "address": "osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j" - } - } - }, - { - "borrow": { - "denom": "stablecoin address", - "amount": "number" - } - }, - { - "swap_exact_in": { - "coin_in": { - "denom": "stablecoin address", - "amount": { - "exact": "number" - } - }, - "denom_out": "long asset", - "slippage": "0.02" - } - }, - { - "lend": { - "denom": "string", - "amount": { - "exact": "number" - } - } - } - ] - } -} -``` \ No newline at end of file diff --git a/docs/develop/contracts/_category_.json b/docs/develop/contracts/_category_.json deleted file mode 100644 index 786e864..0000000 --- a/docs/develop/contracts/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Contracts", - "position": 3, - "link": { "type": "doc", "id": "contracts-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/contracts-intro.mdx b/docs/develop/contracts/contracts-intro.mdx deleted file mode 100644 index f817036..0000000 --- a/docs/develop/contracts/contracts-intro.mdx +++ /dev/null @@ -1,78 +0,0 @@ -# Contracts - -import DocCardList from '@theme/DocCardList'; -import Cards from '@site/src/components/Cards'; - -Overview of all Martian smart contracts. - - -{/* */} - -## List of Contracts - -**Red Bank** - -- [**Address Provider:**](./red-bank/address-provider) Holds addresses of the main contracts of the core protocol. -- [**Incentives:**](./red-bank/incentives) Manage MARS incentives for depositors. -- [**Oracle:**](../../develop/contracts/red-bank/oracle/oracle-intro) Provides prices in uusd for assets used in the protocol. -- [**Red Bank:**](./red-bank/) Exposes all interactions that are done between the user and the money market. Holds all protocol liquidity. -- [**Reward Collector:**](../../develop/contracts/red-bank/rewards-collector/rewards-collector-intro) Receives protocol revenue; swaps various coins into MARS or other specified assets; forwards assets to Mars Hub via IBC to be distributed as staking rewards or be deposited into the safety fund. - -**Farm Vaults** - -- [**Account NFT:**](./rover/account-nft) Extension of the c721 NFT base contract. -- [**Credit Manager:**](./rover/credit-manager) Core contract for creating and managing credit accounts. -- [**Swapper:**](./rover/swapper) Helper contract for making swaps. -- **Zapper:** Helper contract for adding/removing liquidity. - -**Liquidation Helpers** - -- [**Liquidation Filterer:**](./liquidation-helpers/liquidation-filterer) Queries the health status of each account to be liquidated on the current block height, and if the account is no longer health factor < 1 it will remove that liquidation from the msg in order to let other liquidation messages go through successfully. - -**Periphery** - -{/* - [**Airdrop:**](./mars-hub/airdrop) Distributes the MARS token airdrop on Mars Hub. */} -- [**Delegator:**](./mars-hub/delegator) Bootstraps the security of Mars Hub blockchain. -- [**Vesting:**](./mars-hub/vesting) Distributes the MARS token to Mars contributors. - -## Contract Addresses - -### Mainnet - -```json -{ - // periphery - "delegator": "...", - "vesting": "...", - - // red-bank - "address_provider": "osmo1g677w7mfvn78eeudzwylxzlyz69fsgumqrscj6tekhdvs8fye3asufmvxr", - "incentives": "osmo1nkahswfr8shg8rlxqwup0vgahp0dk4x8w6tkv3rra8rratnut36sk22vrm", - "oracle": "osmo1mhznfr60vjdp2gejhyv2gax9nvyyzhd3z0qcwseyetkfustjauzqycsy2g", - "red_bank": "osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg", - "reward_collector": "osmo1urvqe5mw00ws25yqdd4c4hlh8kdyf567mpcml7cdve9w08z0ydcqvsrgdy", - - // liquidation-helpers - "liquidation_filterer": "" -} -``` - -### Testnet - -```json -{ - // periphery - "delegator": "...", - "vesting": "...", - - // red-bank - "address_provider": "osmo17dyy6hyzzy6u5khy5lau7afa2y9kwknu0aprwqn8twndw2qhv8ls6msnjr", - "incentives": "osmo1zxs8fry3m8j94pqg7h4muunyx86en27cl0xgk76fc839xg2qnn6qtpjs48", - "oracle": "osmo1dqz2u3c8rs5e7w5fnchsr2mpzzsxew69wtdy0aq4jsd76w7upmsstqe0s8", - "red_bank": "osmo1t0dl6r27phqetfu0geaxrng0u9zn8qgrdwztapt5xr32adtwptaq6vwg36", - "reward_collector": "osmo14kzsqw5tatdvwlkj383lgkh6gcdetwn7kfqm7488uargyy2lpucqsyv53j", - - // liquidation-helpers - "liquidation_filterer": "osmo1lnjyeyr5vtnsj4sv9guv7z322kmeytt3curm9u840yg2y2hk5w6qsdjjzu" -} -``` \ No newline at end of file diff --git a/docs/develop/contracts/liquidation-helpers/_category_.json b/docs/develop/contracts/liquidation-helpers/_category_.json deleted file mode 100644 index 329c36f..0000000 --- a/docs/develop/contracts/liquidation-helpers/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Liquidation Helpers", - "position": 3, - "link": { "type": "doc", "id": "liquidation-helpers-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/liquidation-helpers/liquidation-filterer.mdx b/docs/develop/contracts/liquidation-helpers/liquidation-filterer.mdx deleted file mode 100644 index 48439de..0000000 --- a/docs/develop/contracts/liquidation-helpers/liquidation-filterer.mdx +++ /dev/null @@ -1,306 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Liquidation Filterer - -The `liquidation-filterer` contract queries the health status of each account to be liquidated on the current block height, and if the account is no longer health factor < 1 it will remove that liquidation from the msg in order to let other liquidation messages go through successfully. - -## Links - -- **Contract address:** -- **Testnet address:** `osmo1lnjyeyr5vtnsj4sv9guv7z322kmeytt3curm9u840yg2y2hk5w6qsdjjzu` -- **Contract repo:** https://github.com/mars-protocol/liquidation-helpers/tree/main/contracts/liquidation-filterer - -## InstantiateMsg - - - - - ```json json - { - "owner": "...", - "address_provider": "..." - } - ``` - - ```rust msg.rs - #[cw_serde] - pub struct InstantiateMsg { - pub owner: String, - pub address_provider: String, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | Contract owner | -| [`address_provider`](focus://json#3) | `String` | Address provider returns addresses for all protocol contracts | - - - -## ExecuteMsg - -### `update_owner` - -Manages admin role state. - - - - - ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust msg.rs focus=1:3,13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateConfig { - address_provider: Option, - }, - LiquidateMany { - liquidations: Vec, - }, - Refund { - recipient: String, - }, - } - ``` - - - - -### `update_config` - -Update contract config (only callable by owner). - - - - - ```json json - { - "update_config": { - "address_provider": "..." - } - } - ``` - - ```rust msg.rs focus=1:2,4:6,13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateConfig { - address_provider: Option, - }, - LiquidateMany { - liquidations: Vec, - }, - Refund { - recipient: String, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address_provider`](focus://json#3) | `Option` | Address provider returns addresses for all protocol contracts | - - - -### `liquidate_many` - -Liquidate many position for a user. - - - - - ```json json - { - "liquidate_many": { - "liquidations": [ - { - "collateral_denom": "...", - "debt_denom": "...", - "user_address": "...", - "amount": "12345" - }, - { - "collateral_denom": "...", - "debt_denom": "...", - "user_address": "...", - "amount": "12345" - } - ] - } - } - ``` - - ```rust msg.rs focus=1:2,7:9,13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateConfig { - address_provider: Option, - }, - LiquidateMany { - liquidations: Vec, - }, - Refund { - recipient: String, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`liquidations`](focus://json#3:16) | [`Vec`](#liquidate) | Vector containing objects of type [Liquidate](#liquidate) | - - - -#### `Liquidate` - -Liquidate under-collateralized native loans. Coins used to repay must be sent in the transaction this call is made. - - - - - ```json json - { - "collateral_denom": "...", - "debt_denom": "...", - "user_address": "...", - "amount": "12345" - } - ``` - - ```rust types.rs - #[cw_serde] - pub struct Liquidate { - pub collateral_denom: String, - pub debt_denom: String, - pub user_address: String, - pub amount: Uint128, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`collateral_denom`](focus://json#2) | `String` | Denom of the collateral asset, which liquidator gets from the borrower | -| [`debt_denom`](focus://json#3) | `String` | Denom of the debt asset | -| [`user_address`](focus://json#4) | `String` | The address of the borrower getting liquidated | -| [`amount`](focus://json#5) | `Uint128` | Amount of debt to be repayed | - - - -### `refund` - -Withdraw all coins held by the contract to the designated recipient. - - - - - ```json json - { - "refund": { - "recipient": "..." - } - } - ``` - - ```rust msg.rs focus=1:2,10:13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateConfig { - address_provider: Option, - }, - LiquidateMany { - liquidations: Vec, - }, - Refund { - recipient: String, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`recipient`](focus://json#3) | `String` | Designated recipient | - - - -## QueryMsg - -### `config` - -Queries contract config. - - - - - ```json json - { - "config": {} - } - ``` - - ```rust msg.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - } - ``` - - - - -#### `ConfigResponse` - - - - - ```json json - { - "owner": "...", - "proposed_new_owner": "...", - "address_provider": "..." - } - ``` - - ```rust msg.rs - #[cw_serde] - pub struct ConfigResponse { - pub owner: Option, - pub proposed_new_owner: Option, - pub address_provider: String, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `Option` | Contract owner | -| [`proposed_new_owner`](focus://json#3) | `Option` | The contract's proposed owner | -| [`address_provider`](focus://json#4) | `String` | Address provider returns addresses for all protocol contracts | - - \ No newline at end of file diff --git a/docs/develop/contracts/liquidation-helpers/liquidation-helpers-intro.mdx b/docs/develop/contracts/liquidation-helpers/liquidation-helpers-intro.mdx deleted file mode 100644 index 63dc2bf..0000000 --- a/docs/develop/contracts/liquidation-helpers/liquidation-helpers-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Liquidation Helpers - -Helper contracts facilitating liquidations on the Red Bank. - - \ No newline at end of file diff --git a/docs/develop/contracts/mars-hub/_category_.json b/docs/develop/contracts/mars-hub/_category_.json deleted file mode 100644 index 505ed2d..0000000 --- a/docs/develop/contracts/mars-hub/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Periphery", - "position": 4, - "link": { "type": "doc", "id": "mars-hub-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/mars-hub/delegator.mdx b/docs/develop/contracts/mars-hub/delegator.mdx deleted file mode 100644 index 711af30..0000000 --- a/docs/develop/contracts/mars-hub/delegator.mdx +++ /dev/null @@ -1,193 +0,0 @@ ---- -sidebar_position: 2 ---- - -# delegator - -The purpose of this contract is **to bootstrap the security of Mars Hub blockchain.** - -At launch, Mars Hub will have a genesis validator set of 10–20 members, each having exactly 1 MARS token. The decision was made that each genesis validator only gets 1 token and not more, such that they don't have an unfair advantage over those who join post-genesis. However, this also means that for a brief period after launch, the network will have a very low security (10–20 MARS worth of security, to be specific). If a user is eligible for a big airdrop, they can potentially create a validator with the airdrop tokens right after launch and hijack the network. - -To mitigate this risk, the Mars community pool will have a portion of its tokens (~1% of total supply may be a reasonable amount) deposited into this "delegator" contract, which then delegates the tokens evenly to each of the genesis validators. At instantiation, the contract will be given an `ending_time` for these delegations. Once the ending time is elapsed, anyone can invoke a method on the contract to unbond these delegations. Once unbonding is completed, anyone can invoke `refund` to return all funds to the community pool. - -## Links - -- **Contract address:** -- **Testnet address:** -- **Contract repo:** https://github.com/mars-protocol/periphery/tree/main/contracts/delegator -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/periphery - -## InstantiateMsg - -Instantiates the Delegator contract. - - - - -```json json -{ - "bond_denom": "...", - "ending_time": 123 -} -``` - -```rust msg.rs -pub type InstantiateMsg = Config; - -#[cw_serde] -pub struct Config { - pub bond_denom: String, - pub ending_time: u64, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`bond_denom`](focus://json#2) | `String` | Denomination of the coin that will be staked | -| [`ending_time`](focus://json#3) | `u64` | The ending time for the delegation program, as UNIX timestamp. Once this time has elapsed, anyone can invoke the `unbond` method to unbond the delegations. Additionally, Mars Hub governance can decide to prematurely end the delegation program if they see fit, ignoring the ending time, by invoking the `force_unbond` sudo message. | - - - - -## ExecuteMsg - -### `bond` - -Delegate tokens that the contract holds evenly to the current validator set. - - - - -```json json -{ - "bond": {} -} -``` - -```rust msg.rs focus=1:3,6 -#[cw_serde] -pub enum ExecuteMsg { - Bond {}, - Unbond {}, - Refund {}, -} -``` - - - - - - - - -### `unbond` - -Unbond the delegations. Can be invoked by anyone after `ending_time` is reached. - - - - -```json json -{ - "unbond": {} -} -``` - -```rust msg.rs focus=1:2,4,6 -#[cw_serde] -pub enum ExecuteMsg { - Bond {}, - Unbond {}, - Refund {}, -} -``` - - - - - - -### `refund` - -Donate all coins held by the contract to the community pool. - - - - -```json json -{ - "refund": {} -} -``` - -```rust msg.rs focus=1:2,5:6 -#[cw_serde] -pub enum ExecuteMsg { - Bond {}, - Unbond {}, - Refund {}, -} -``` - - - - -## SudoMsg - -Forcibly unbond the delegations. - -This "sudo" message can only be invoked by the gov module, and ignores whether the `ending_time` has been reached. - -### `force_unbond` - - - - -```json json -{ - "force_unbond": {} -} -``` - -```rust msg.rs -#[cw_serde] -pub enum SudoMsg { - ForceUnbond {}, -} -``` - - - - - -## QueryMsg - -### `config` - -Return the contract configuration. - - - - -```json json -{ - "config": {} -} -``` - -```rust msg.rs -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, -} -``` - - - - -#### [`Config` (response)](#instantiatemsg) - diff --git a/docs/develop/contracts/mars-hub/mars-hub-intro.mdx b/docs/develop/contracts/mars-hub/mars-hub-intro.mdx deleted file mode 100644 index a93978e..0000000 --- a/docs/develop/contracts/mars-hub/mars-hub-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Periphery - -Periphery smart contracts deployed on Mars Hub. - - \ No newline at end of file diff --git a/docs/develop/contracts/mars-hub/vesting.mdx b/docs/develop/contracts/mars-hub/vesting.mdx deleted file mode 100644 index 2eba1bf..0000000 --- a/docs/develop/contracts/mars-hub/vesting.mdx +++ /dev/null @@ -1,593 +0,0 @@ ---- -sidebar_position: 3 ---- - -# vesting - -The Vesting contract is responsible for distributing the MARS token to Mars contributors. - -## Links - -- **Contract address:** -- **Testnet address:** -- **Contract repo:** https://github.com/mars-protocol/periphery/tree/main/contracts/vesting -- **Video walkthrough:** https://youtu.be/VeRMEtyLxyk -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/periphery - -## InstantiateMsg - -Instantiates the Vesting contract. Takes in a contract owner and an `unlock_schedule` for token unlocking. Schedule is the same for all users. - - - - -```json json -{ - "owner": "...", - "unlock_schedule": { - "start_time": 123, - "cliff": 123, - "duration": 123 - } -} -``` - -```rust msg.rs -#[cw_serde] -pub struct InstantiateMsg { - pub owner: String, - pub unlock_schedule: Schedule, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | The contract's owner | -| [`unlock_schedule`](focus://json#3:7) | [`Schedule`](#schedule) | Schedule for token unlocking; this schedule is the same for all users | - - - -#### `Schedule` - - - - -```json json -{ - "start_time": 123, - "cliff": 123, - "duration": 123 -} -``` - -```rust msg.rs -#[cw_serde] -pub struct Schedule { - pub start_time: u64, - pub cliff: u64, - pub duration: u64, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_time`](focus://json#2) | `u64` | Time when vesting/unlocking starts | -| [`cliff`](focus://json#3) | `u64` | Time before with no token is to be vested/unlocked | -| [`duration`](focus://json#4) | `u64` | Duration of the vesting/unlocking process. At time `start_time + duration`, the tokens are vested/unlocked in full | - - - -## ExecuteMsg - -### `create_position` - -Creates a new vesting position for a user. - - - - -```json json -{ - "create_position": { - "user" "mars...", - "vest_schedule": { - "start_time": 123, - "cliff": 123, - "duration": 123 - } - } -} -``` - -```rust msg.rs focus=1:6,12 -#[cw_serde] -pub enum ExecuteMsg { - CreatePosition { - user: String, - vest_schedule: Schedule, - }, - TerminatePosition { - user: String, - }, - Withdraw {}, - TransferOwnership(String), -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address receiving vested tokens | -| [`vest_schedule`](focus://json#4:8) | [`Schedule`](#schedule) | Schedule for token unlocking; this schedule is the same for all users | - - - -### `terminate_position` - -Terminates a vesting position, and collects all unvested tokens. - - - - -```json json -{ - "terminate_position": { - "user": "..." - } -} -``` - -```rust msg.rs focus=1:2,7:9,12 -#[cw_serde] -pub enum ExecuteMsg { - CreatePosition { - user: String, - vest_schedule: Schedule, - }, - TerminatePosition { - user: String, - }, - Withdraw {}, - TransferOwnership(String), -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address being terminated | - - - -### `withdraw` - -Withdraws vested and unlocked MARS tokens. - - - - -```json json -{ - "withdraw": {} -} -``` - -```rust msg.rs focus=1:2,10,12 -#[cw_serde] -pub enum ExecuteMsg { - CreatePosition { - user: String, - vest_schedule: Schedule, - }, - TerminatePosition { - user: String, - }, - Withdraw {}, - TransferOwnership(String), -} -``` - - - - -### `transfer_ownership` - -Transfers the contract's ownership to another account. - - - - -```json json -{ - "transfer_ownership": {} -} -``` - -```rust msg.rs focus=1:2,11:12 -#[cw_serde] -pub enum ExecuteMsg { - CreatePosition { - user: String, - vest_schedule: Schedule, - }, - TerminatePosition { - user: String, - }, - Withdraw {}, - TransferOwnership(String), -} -``` - - - - -## QueryMsg - -### `config` - -Returns the contract's configuration parameters. - - - - -```json json -{ - "config": {} -} -``` - -```rust msg.rs focus=1:5,24 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(VotingPowerResponse)] - VotingPower { - user: String, - }, - #[returns(Vec)] - VotingPowers { - start_after: Option, - limit: Option, - }, - #[returns(PositionResponse)] - Position { - user: String, - }, - #[returns(Vec)] - Positions { - start_after: Option, - limit: Option, - }, -} -``` - - - - -#### `ConfigResponse` - - - - -```json json -{ - "owner": "...", - "unlock_schedule": { - "start_time": 123, - "cliff": 123, - "duration": 123 - } -} -``` - -```rust msg.rs -pub type ConfigResponse = InstantiateMsg; - -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | The contract's owner | -| [`unlock_schedule`](focus://json#3:7) | [`Schedule`](#schedule) | Schedule for token unlocking; this schedule is the same for all users | - - - -### `voting_power` - -Returns the amount of MARS tokens of a vesting recipient currently locked in the contract. - - - - -```json json -{ - "voting_power": { - "user": "mars..." - } -} -``` - -```rust msg.rs focus=1:3,6:9,24 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(VotingPowerResponse)] - VotingPower { - user: String, - }, - #[returns(Vec)] - VotingPowers { - start_after: Option, - limit: Option, - }, - #[returns(PositionResponse)] - Position { - user: String, - }, - #[returns(Vec)] - Positions { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | Address of the user | - - - -#### `VotingPowerResponse` - - - - -```json json -{ - "user": "mars...", - "voting_power": 123 -} -``` - -```rust msg.rs -#[cw_serde] -pub struct VotingPowerResponse { - pub user: String, - pub voting_power: Uint128, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#2) | `String` | Address of the user | -| [`voting_power`](focus://json#3) | `Uint128` | The user's current voting power, i.e. the amount of MARS tokens locked in vesting contract | - - - -### `voting_powers` - -Enumerates all vesting recipients and returns their current voting power. - - - - -```json json -{ - "voting_powers": { - "start_after": "mars...", - "limit": 123 - } -} -``` - -```rust msg.rs focus=1:3,10:14,24 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(VotingPowerResponse)] - VotingPower { - user: String, - }, - #[returns(Vec)] - VotingPowers { - start_after: Option, - limit: Option, - }, - #[returns(PositionResponse)] - Position { - user: String, - }, - #[returns(Vec)] - Positions { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `Option` | A Mars account address to start after | -| [`limit`](focus://json#4) | `Option` | The amount of addresses to list | - - - -#### `Vec` - -`voting_powers` returns a vector of the [`VotingPowerResponse`](#votingpowerresponse) struct defined above. - -### `position` - -Returns details of a recipient's vesting position. Note: This query depends on block time, therefore it may not work with time travel queries. In such cases, use WASM raw query instead. - - - - -```json json -{ - "position": { - "user": "mars..." - } -} -``` - -```rust msg.rs focus=1:3,15:18,24 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(VotingPowerResponse)] - VotingPower { - user: String, - }, - #[returns(Vec)] - VotingPowers { - start_after: Option, - limit: Option, - }, - #[returns(PositionResponse)] - Position { - user: String, - }, - #[returns(Vec)] - Positions { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | Address of the user | - - - -#### `PositionResponse` - - - - -```json json -{ - "user": "mars...", - "total": 123, - "vested": 123, - "unlocked": 123, - "withdrawn": 123, - "withdrawable": 123, - "vest_schedule": { - "start_time": 123, - "cliff": 123, - "duration": 123 - } -} -``` - -```rust msg.rs -#[cw_serde] -pub struct PositionResponse { - pub user: String, - pub total: Uint128, - pub vested: Uint128, - pub unlocked: Uint128, - pub withdrawn: Uint128, - pub withdrawable: Uint128, - pub vest_schedule: Schedule, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#2) | `String` | Address of the user | -| [`total`](focus://json#3) | `Uint128` | Total amount of MARS tokens allocated to this recipient | -| [`vested`](focus://json#4) | `Uint128` | Amount of tokens that have been vested, according to the vesting schedule | -| [`unlocked`](focus://json#5) | `Uint128` | Amount of tokens that have been unlocked, according to the unlocking schedule | -| [`withdrawn`](focus://json#6) | `Uint128` | Amount of tokens that have already been withdrawn | -| [`withdrawable`](focus://json#7) | `Uint128` | Amount of tokens that can be withdrawn now, defined as the smaller of vested and unlocked amounts, minus the amount already withdrawn | -| [`vest_schedule`](focus://json#8:12) | [`Schedule`](#schedule) | The vesting position's vesting schedule | - - - -### `positions` - -Enumerates all vesting positions. Note: This query depends on block time, therefore it may not work with time travel queries. In such cases, use WASM raw query instead. - - - - -```json json -{ - "positions": { - "start_after": "mars...", - "limit": 123, - } -} -``` - -```rust msg.rs focus=1:3,19:24 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(VotingPowerResponse)] - VotingPower { - user: String, - }, - #[returns(Vec)] - VotingPowers { - start_after: Option, - limit: Option, - }, - #[returns(PositionResponse)] - Position { - user: String, - }, - #[returns(Vec)] - Positions { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `Option` | A Mars account address to start after | -| [`limit`](focus://json#4) | `Option` | The amount of addresses to list | - - - -#### `Vec` - -`positions` returns a vector of the [`PositionResponse`](#positionresponse) struct defined above. - \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/_category_.json b/docs/develop/contracts/red-bank/_category_.json deleted file mode 100644 index 50a9d23..0000000 --- a/docs/develop/contracts/red-bank/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Red Bank", - "position": 2, - "link": { "type": "doc", "id": "red-bank-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/address-provider.mdx b/docs/develop/contracts/red-bank/address-provider.mdx deleted file mode 100644 index 94b5b5e..0000000 --- a/docs/develop/contracts/red-bank/address-provider.mdx +++ /dev/null @@ -1,439 +0,0 @@ ---- -sidebar_position: 1 ---- - -import Admonition from '@theme/Admonition' - -import AddressProviderSetAddressUrl from '@site/static/img//develop/contracts/address-provider-set-address.png'; - -# address-provider - -Holds addresses of the main contracts of the core protocol. - -## Links - -- **Contract address:** `osmo1g677w7mfvn78eeudzwylxzlyz69fsgumqrscj6tekhdvs8fye3asufmvxr` -- **Testnet address:** `osmo17dyy6hyzzy6u5khy5lau7afa2y9kwknu0aprwqn8twndw2qhv8ls6msnjr` -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/address-provider -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## InstantiateMsg - -Instantiates the Address Provider contract. - -Essentially, `mars_address_provider` is a required init param for all other contracts, so it needs to be initialised first (Only owner can be set on initialization). So the deployment looks like this: - -1. Init the address provider -2. Init all other contracts, passing in the address provider address (not ALL contracts need this but many do) -3. Update the address provider, with an update config call to contain all the other contract addresses from step 2, this is why we need it to be owned by an EOA (externally owned account) - so we can do this update as part of the deployment -4. Update the owner of the address provider contract at the end of deployment to be either a. the multisig or b. the gov/council contract - - - - -```json json -{ - "owner": "...", - "prefix": "..." -} -``` - -```rust address_provider.rs -#[cw_serde] -pub struct InstantiateMsg { - pub owner: String, - pub prefix: String, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | Contract owner | -| [`prefix`](focus://json#3) | `String` | The address prefix of the chain this contract is deployed on | - - - -## ExecuteMsg - -### `set_address` - -Set address. - - - - -```json json -{ - "set_address": { - "address_type": { - "incentives": {} - }, - "address": "..." - } -} -``` - -```rust address_provider.rs focus=1:6,10 -#[cw_serde] -pub enum ExecuteMsg { - SetAddress { - address_type: MarsAddressType, - address: String, - }, - TransferOwnership { - new_owner: String, - }, -} -``` - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address_type`](focus://json#3:5) | [`MarsAddressType`](#marsaddresstype) | Mars address type | -| [`address`](focus://json#6) | `String` | | - - - -{/* */} - -#### `MarsAddressType` - - - - -```rust address_provider.rs -#[cw_serde] -#[derive(Copy, Eq, Hash)] -pub enum MarsAddressType { - Incentives, - Oracle, - RedBank, - RewardsCollector, - ProtocolAdmin, - FeeCollector, - SafetyFund, -} -``` - - - - - -`protocol_admin` `fee_collector` and `safety_fund` are Mars Hub addresses with `mars` `bech32` prefixes, which may not be recognizeded by the `api.addr_validate` method. - - - -| **Variants** |**Description** | -| ----------- | ----------- | -| [`Incentives`](focus://address_provider.rs#4) | Incentives contract address | -| [`Oracle`](focus://address_provider.rs#5) | Oracles contract address | -| [`RedBank`](focus://address_provider.rs#6) |Red Bank contract address | -| [`RewardsCollector`](focus://address_provider.rs#7) | Rewards collector contract address | -| [`ProtocolAdmin`](focus://address_provider.rs#8) | Protocol admin is an ICS-27 interchain account controlled by Mars Hub's x/gov module. This account will take the owner and admin roles of outpost contracts. | -| [`FeeCollector`](focus://address_provider.rs#9) | The `fee_collector` module account controlled by Mars Hub's x/distribution module. Funds sent to this account will be distributed as staking rewards. | -| [`SafetyFund`](focus://address_provider.rs#10) | The module account controlled by the by Mars Hub's x/safety module. Funds sent to this account will be deposited into the safety fund. | - - - -### `update_owner` - -Manages admin role state. - - - - - ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust address_provider.rs focus=1:2,7:8 - #[cw_serde] - pub enum ExecuteMsg { - SetAddress { - address_type: MarsAddressType, - address: String, - }, - UpdateOwner(OwnerUpdate), - } - ``` - - - - - -{/* ### `transfer_ownership` - -Propose to transfer the contract's ownership to another account. - - - - -```json json -{ - "transfer_ownership": { - "new_owner": "..." - } -} -``` - -```rust address_provider.rs focus=1:2,7:10 -#[cw_serde] -pub enum ExecuteMsg { - SetAddress { - address_type: MarsAddressType, - address: String, - }, - TransferOwnership { - new_owner: String, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`new_owner`](focus://json#3) | `String` | Address of new owner | - - */} - - -## QueryMsg - - - -### `config` - -Queries contract config. - - - - -```json json -{ - "config": {} -} -``` - -```rust address_provider.rs focus=1:5,15 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AddressResponseItem)] - Address(MarsAddressType), - #[returns(Vec)] - Addresses(Vec), - #[returns(Vec)] - AllAddresses { - start_after: Option, - limit: Option, - }, -} -``` - - - - -#### `Config` (response) - - - - - -```json json -{ - "owner": "...", - "prefix": "..." -} -``` - -```rust address_provider.rs -pub type Config = InstantiateMsg; - -#[cw_serde] -pub struct InstantiateMsg { - pub owner: String, - pub prefix: String, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | Contract owner | -| [`prefix`](focus://json#3) | `String` | The address prefix of the chain this contract is deployed on | - - - - -### `address` - -Queries a single address. - - - - -```json json -{ - "address": "incentives" -} -``` - -```rust address_provider.rs focus=1:3,6:7,15 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AddressResponseItem)] - Address(MarsAddressType), - #[returns(Vec)] - Addresses(Vec), - #[returns(Vec)] - AllAddresses { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address`](focus://json#2) | [`MarsAddressType`](#marsaddresstype) | Address to return | - - - -#### `AddressResponseItem` - - - - -```json json -{ - "address_type": "incentive", - "address": "..." -} -``` - -```rust address_provider.rs -#[cw_serde] -pub struct AddressResponseItem { - pub address_type: MarsAddressType, - pub address: String, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address_type`](focus://json#2) | [`MarsAddressType`](#marsaddresstype) | The type of address | -| [`address`](focus://json#3) | `String` | Address value | - - - - -### `addresses` - -Queries a list of addresses. - - - - -```json json -{ - "addresses": [ - "incentives", - "red_bank", - "oracle" - ] -} -``` - -```rust address_provider.rs focus=1:3,8:9,15 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AddressResponseItem)] - Address(MarsAddressType), - #[returns(Vec)] - Addresses(Vec), - #[returns(Vec)] - AllAddresses { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`addresses`](focus://json#2:6) | [`Vec`](#marsaddresstype) | Addresses to return | - - - -Returns a vector that contains objects of type [`AddressResponseItem`](#addressresponseitem). - - -### `all_addresses` - -Query all stored addresses with pagination. - - - - -```json json -{ - "all_addresses": { - "start_after": "incentives", - "limit": 5 - } -} -``` - -```rust address_provider.rs focus=1:3,10:15 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AddressResponseItem)] - Address(MarsAddressType), - #[returns(Vec)] - Addresses(Vec), - #[returns(Vec)] - AllAddresses { - start_after: Option, - limit: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | [`Option`](#marsaddresstype) | Address to start list with | -| [`limit`](focus://json#4) | `Option` | Amount of addresses to list | - - - - -Returns a vector that contains objects of type [`AddressResponseItem`](#addressresponseitem). \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/incentives.mdx b/docs/develop/contracts/red-bank/incentives.mdx deleted file mode 100644 index 9ce5366..0000000 --- a/docs/develop/contracts/red-bank/incentives.mdx +++ /dev/null @@ -1,582 +0,0 @@ ---- -sidebar_position: 2 ---- - - -import IncentivesSetAssetIncentiveUrl from '@site/static/img//develop/contracts/incentives-set-asset-incentive.png'; -import IncentivesBalanceChangeUrl from '@site/static/img//develop/contracts/incentives-balance-change.png'; -import IncentivesClaimRewardsUrl from '@site/static/img//develop/contracts/incentives-claim-rewards.png'; -import IncentivesUpdateConfigUrl from '@site/static/img//develop/contracts/incentives-update-config.png'; - - -# incentives - -Manage MARS incentives for depositors. - -## Links - -- **Contract address:** `osmo1nkahswfr8shg8rlxqwup0vgahp0dk4x8w6tkv3rra8rratnut36sk22vrm` -- **Testnet address:** `osmo1zxs8fry3m8j94pqg7h4muunyx86en27cl0xgk76fc839xg2qnn6qtpjs48` -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/incentives -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## InstantiateMsg - -Instantiates the Incentives contract. - - - - -```json json -{ - "owner": "...", - "address_provider": "...", - "mars_denom": "..." -} -``` - -```rust incentives.rs -#[cw_serde] -pub struct InstantiateMsg { - pub owner: String, - pub address_provider: String, - pub mars_denom: String, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | Contract owner | -| [`address_provider`](focus://json#3) | `String` | Address provider | -| [`mars_denom`](focus://json#4) | `String` | Mars token denom | - - - -## ExecuteMsg - -### `set_asset_incentive` - -Set emission per second for an asset to its depositor at Red Bank. - - - - -```json json -{ - "set_asset_incentive": { - "denom": "...", - "emission_per_second": "123", - "start_time": 123, - "duration": 123 - } -} -``` - -```rust incentives.rs focus=1:8,21 -#[cw_serde] -pub enum ExecuteMsg { - SetAssetIncentive { - denom: String, - emission_per_second: Option, - start_time: Option, - duration: Option, - }, - BalanceChange { - user_addr: Addr, - denom: String, - user_amount_scaled_before: Uint128, - total_amount_scaled_before: Uint128, - }, - ClaimRewards {}, - UpdateConfig { - owner: Option, - address_provider: Option, - mars_denom: Option, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Asset denom associated with the incentives | -| [`emission_per_second`](focus://json#4) | `Option` | How many MARS will be assigned per second to be distributed among all Red Bank depositors | -| [`start_time`](focus://json#5) | `Option` | Start time of the incentive (in seconds) since the UNIX epoch (00:00:00 on 1970-01-01 UTC) | -| [`duration`](focus://json#6) | `Option` | How many seconds the incentives last | - - - -{/* */} - - -### `balance_change` - -Handle balance change updating user and asset rewards. Sent from an external contract, triggered on user balance changes. Will return an empty response if no incentive is applied for the asset - - - - -```json json -{ - "balance_change": { - "user_addr": "mars...", - "denom": "...", - "user_amount_scaled_before": 123, - "total_amount_scaled_before": 123 - } -} -``` - -```rust incentives.rs focus=1:2,7:12,19 -#[cw_serde] -pub enum ExecuteMsg { - SetAssetIncentive { - denom: String, - emission_per_second: Uint128, - }, - BalanceChange { - user_addr: Addr, - denom: String, - user_amount_scaled_before: Uint128, - total_amount_scaled_before: Uint128, - }, - ClaimRewards {}, - UpdateConfig { - owner: Option, - address_provider: Option, - mars_denom: Option, - }, -} -``` - - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user_addr`](focus://json#3) | `Addr` | User address. Address is trusted as it must be validated by the Red Bank contract before calling this method | -| [`denom`](focus://json#4) | `String` | Denom of the asset of which deposited balance is changed | -| [`user_amount_scaled_before`](focus://json#5) | `Uint128` | The user's scaled collateral amount up to the instant before the change | -| [`total_amount_scaled_before`](focus://json#6) | `Uint128` | The market's total scaled collateral amount up to the instant before the change | - - - -{/* */} - - -### `claim_rewards` - -Claim rewards. MARS rewards accrued by the user will be staked before being sent. - - - - -```json json -{ - "claim_rewards": {} -} -``` - -```rust incentives.rs focus=1:2,13,19 -#[cw_serde] -pub enum ExecuteMsg { - SetAssetIncentive { - denom: String, - emission_per_second: Uint128, - }, - BalanceChange { - user_addr: Addr, - denom: String, - user_amount_scaled_before: Uint128, - total_amount_scaled_before: Uint128, - }, - ClaimRewards {}, - UpdateConfig { - owner: Option, - address_provider: Option, - mars_denom: Option, - }, -} -``` - - - - -{/* */} - - -### `update_config` - -Update contract config (only callable by owner). - - - - -```json json -{ - "update_config": { - "address_provider": "...", - "mars_denom": "..." - } -} -``` - -```rust incentives.rs focus=1:2,14:18 -#[cw_serde] -pub enum ExecuteMsg { - SetAssetIncentive { - denom: String, - emission_per_second: Uint128, - }, - BalanceChange { - user_addr: Addr, - denom: String, - user_amount_scaled_before: Uint128, - total_amount_scaled_before: Uint128, - }, - ClaimRewards {}, - UpdateConfig { - address_provider: Option, - mars_denom: Option, - } -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address_provider`](focus://json#3) | `Option` | Address provider | -| [`mars_denom`](focus://json#4) | `Option` | Mars token denom | - - - - -### `update_owner` - -Manages admin role state. - - - - - ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust address_provider.rs focus=1:2,17:18 - #[cw_serde] - pub enum ExecuteMsg { - SetAssetIncentive { - denom: String, - emission_per_second: Uint128, - }, - BalanceChange { - user_addr: Addr, - denom: String, - user_amount_scaled_before: Uint128, - total_amount_scaled_before: Uint128, - }, - ClaimRewards {}, - UpdateConfig { - address_provider: Option, - mars_denom: Option, - }, - UpdateOwner(OwnerUpdate), - } - ``` - - - - - -{/* */} - -## QueryMsg - -### `config` - -Get contract config. - - - - -```json json -{ - "config": {} -} -``` - -```rust incentives.rs focus=1:5,14 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(AssetIncentiveResponse)] - AssetIncentive { - denom: String, - }, - #[returns(Uint128)] - UserUnclaimedRewards { - user: String, - }, -} -``` - - - - -#### `ConfigResponse` - - - - -```json json -{ - "owner": "...", - "proposed_new_owner": "...", - "address_provider": "...", - "mars_denom": "...", -} -``` - -```rust incentives.rs -#[cw_serde] -pub struct ConfigResponse { - pub owner: Option, - pub proposed_new_owner: Option, - pub address_provider: Addr, - pub mars_denom: String, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `Option` | Contract owner | -| [`proposed_new_owner`](focus://json#3) | `Option` | The contract's proposed owner | -| [`address_provider`](focus://json#4) | `Addr` | Address provider | -| [`mars_denom`](focus://json#5) | `String` | Mars Token Denom | - - - - - -### `asset_incentive` - -Get info about asset incentive for a given denom. - - - - -```json json -{ - "asset_incentive": { - "denom": "..." - } -} -``` - -```rust incentives.rs focus=1:3,6:9,14 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AssetIncentiveResponse)] - AssetIncentive { - denom: String, - }, - #[returns(Uint128)] - UserUnclaimedRewards { - user: String, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | - - - -#### `AssetIncentiveResponse` - - - - -```json json -{ - "denom": "...", - "emission_per_second": "123", - "start_time": 123, - "duration": 123, - "index": "0.123", - "last_updated": 123 -} -``` - -```rust incentives.rs -#[cw_serde] -pub struct AssetIncentiveResponse { - pub denom: String, - pub emission_per_second: Uint128, - pub start_time: u64, - pub duration: u64, - pub index: Decimal, - pub last_updated: u64, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Asset denom | -| [`emission_per_second`](focus://json#3) | `Uint128` | How much MARS per second is emitted to be then distributed to all Red Bank depositors | -| [`start_time`](focus://json#4) | `u64` | Start time of the incentive (in seconds) since the UNIX epoch (00:00:00 on 1970-01-01 UTC) | -| [`duration`](focus://json#5) | `u64` | How many seconds the incentives last | -| [`index`](focus://json#6) | `u64` | Total MARS assigned for distribution since the start of the incentive | -| [`last_updated`](focus://json#7) | `u64` | Last time (in seconds) index was updated | - - - -{/* #### `AssetIncentive` - - - - -```json json -{ - "emission_per_second": 123, - "index: 0.123", - "last_updated"": 123 -} -``` - -```rust incentives.rs -#[cw_serde] -pub struct AssetIncentive { - pub emission_per_second: Uint128, - pub index: Decimal, - pub last_updated: u64, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`emission_per_second`](focus://json#2) | `Uint128` | How much MARS per second is emitted to be then distributed to all Red Bank depositors | -| [`index`](focus://json#3) | `Decimal` | Total MARS assigned for distribution since the start of the incentive | -| [`last_updated`](focus://json#4) | `u64` | Last time (in seconds) index was updated | - - - */} - -### asset_incentives - -Enumerate asset incentives with pagination - - - - -```json json -{ - "asset_incentives": { - "start_after": "...", - "limit": 5 - } -} -``` - -```rust incentives.rs focus=1:3,10:14,19 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AssetIncentiveResponse)] - AssetIncentive { - denom: String, - }, - #[returns(Vec)] - AssetIncentives { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - UserUnclaimedRewards { - user: String, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `String` | Denom of asset to start after | -| [`limit`](focus://json#4) | `String` | Number of asset incentives to list | - -`asset_incentives` returns a vector of the [`AssetIncentiveResponse`](#assetincentiveresponse) response struct defined above. - - - - - - - -### `user_unclaimed_rewards` - -Get user current unclaimed rewards. - - - - -```json json -{ - "user_unclaimed_rewards": { - "user": "mars..." - } -} -``` - -```rust incentives.rs focus=1:3,10:14 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(AssetIncentiveResponse)] - AssetIncentive { - denom: String, - }, - #[returns(Uint128)] - UserUnclaimedRewards { - user: String, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address | - - - -Returns `Uint128` diff --git a/docs/develop/contracts/red-bank/oracle/_category_.json b/docs/develop/contracts/red-bank/oracle/_category_.json deleted file mode 100644 index 9d54e09..0000000 --- a/docs/develop/contracts/red-bank/oracle/_category_.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "label": "oracle", - "position": 3, - "link": { "type": "doc", "id": "oracle-intro" } -} - diff --git a/docs/develop/contracts/red-bank/oracle/base.mdx b/docs/develop/contracts/red-bank/oracle/base.mdx deleted file mode 100644 index 45ae34d..0000000 --- a/docs/develop/contracts/red-bank/oracle/base.mdx +++ /dev/null @@ -1,546 +0,0 @@ ---- -sidebar_position: 1 ---- - -import Admonition from '@theme/Admonition' - -# base - -Chain-agnostic logics for the Oracle contract. - -## Links - -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/oracle/base -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## InstantiateMsg - - - - - ```json json - { - "owner": "...", - "base_denom": "..." - } - ``` - - ```rust oracle.rs - pub type InstantiateMsg = Config; - - #[cw_serde] - pub struct Config { - pub owner: T, - pub base_denom: String, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | The contract's owner, who can update config and price sources | -| [`base_denom`](focus://json#3) | `String` | The asset in which prices are denominated in | - - - -## ExecuteMsg - -{/* ### `update_config` - -Updates the contract's config. - - - - - ```json json - { - "update_config": { - "owner": "..." - } - } - ``` - - ```rust oracle.rs focus=1:5,13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - owner: String, - }, - SetPriceSource { - denom: String, - price_source: T, - }, - RemovePriceSource { - denom: String, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#3) | `String` | The contract's owner, who can update config and price sources | - - - */} - -### `set_price_source` - -Specifies the price source to be used for a coin. - - -The input parameters for method are chain-specific. - - - - - - ```json json - { - "set_price_source": { - "denom": "...", - "price_source": { - // PriceSource (chain-specific) - } - } - } - ``` - - ```rust oracle.rs focus=1:2,6:9,13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - owner: String, - }, - SetPriceSource { - denom: String, - price_source: T, - }, - RemovePriceSource { - denom: String, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`price_source`](focus://json#4:6) | `T` | Coin's price source. See [`OsmosisPriceSource`](./osmosis#osmosispricesource) for an example of a chain specific integration. | - - - -### `remove_price_source` - -Removes price source for a coin. - - - - - ```json json - { - "remove_price_source": { - "denom": "..." - } - } - ``` - - ```rust oracle.rs focus=1:2,10:13 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - owner: String, - }, - SetPriceSource { - denom: String, - price_source: T, - }, - RemovePriceSource { - denom: String, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | - - - - -### `update_owner` - -Manages admin role state. - - - - - ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust address_provider.rs focus=1:2,13:14 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - owner: String, - }, - SetPriceSource { - denom: String, - price_source: T, - }, - RemovePriceSource { - denom: String, - }, - UpdateOwner(OwnerUpdate), - } - ``` - - - - - - -## QueryMsg - -### `config` - -Queries contract config. - - - - - ```json json - { - "config": {} - } - ``` - - ```rust oracle.rs focus=1:5,24 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(PriceSourceResponse)] - PriceSource { - denom: String, - }, - #[returns(Vec>)] - PriceSources { - start_after: Option, - limit: Option, - }, - #[returns(PriceResponse)] - Price { - denom: String, - }, - #[returns(Vec)] - Prices { - start_after: Option, - limit: Option, - }, - } - ``` - - - - -Returns a [`Config`](#instantiatemsg) response. - -### `price_source` - -Queries a coin's price source. - - -The response type of this query is chain-specific. - - - - - - ```json json - { - "price_source": { - "denom": "..." - } - } - ``` - - ```rust oracle.rs focus=1:3,6:9,24 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(PriceSourceResponse)] - PriceSource { - denom: String, - }, - #[returns(Vec>)] - PriceSources { - start_after: Option, - limit: Option, - }, - #[returns(PriceResponse)] - Price { - denom: String, - }, - #[returns(Vec)] - Prices { - start_after: Option, - limit: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | - - - -#### `PriceSourceResponse` - - - - - ```json json - { - "denom": "...", - "price_source": { - // PriceSource (chain-specific) - } - } - ``` - - ```rust oracle.rs - #[cw_serde] - pub struct PriceSourceResponse { - pub denom: String, - pub price_source: T, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Denom of the asset | -| [`price_source`](focus://json#3:5) | `T` | Coin's price source. See [`OsmosisPriceSource`](./osmosis#osmosispricesource) for an example of a chain specific integration. | - - - -### `price_sources` - -Enumerates all coins' price sources. - - -The response type of this query is chain-specific. - - - - - - - ```json json - { - "price_sources": { - "start_after": "...", - "limit": 5 - } - } - ``` - - ```rust oracle.rs focus=1:3,10:14,24 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(PriceSourceResponse)] - PriceSource { - denom: String, - }, - #[returns(Vec>)] - PriceSources { - start_after: Option, - limit: Option, - }, - #[returns(PriceResponse)] - Price { - denom: String, - }, - #[returns(Vec)] - Prices { - start_after: Option, - limit: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `Option` | Denom to start after. | -| [`limit`](focus://json#4) | `Option` | Amount of price sources to list. | - - - -Returns a vector that contains objects of type [`PriceSourceResponse`](#pricesourceresponsestring). - -### `price` - -Queries a coin's price. - - -This query may be dependent on block time (e.g. if the price source is TWAP), so may not work properly with time travel queries on archive nodes. - - - - - - ```json json - { - "price": { - "denom": "..." - } - } - ``` - - ```rust oracle.rs focus=1:3,15:18,24 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(PriceSourceResponse)] - PriceSource { - denom: String, - }, - #[returns(Vec>)] - PriceSources { - start_after: Option, - limit: Option, - }, - #[returns(PriceResponse)] - Price { - denom: String, - }, - #[returns(Vec)] - Prices { - start_after: Option, - limit: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | - - - -#### `PriceResponse` - - - - - ```json json - { - "denom": "...", - "price": "1.27" - } - ``` - - ```rust oracle.rs - #[cw_serde] - pub struct PriceResponse { - pub denom: String, - pub price: Decimal, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Denom of the asset | -| [`price`](focus://json#3) | `Decimal` | Price of the asset | - - - - -### `prices` - -Enumerates all coins' prices. - - -This query may be dependent on block time (e.g. if the price source is TWAP), so may not work properly with time travel queries on archive nodes. - - - - - - ```json json - { - "prices": { - "start_after": "...", - "limit": 5 - } - } - ``` - - ```rust oracle.rs focus=1:3,19:24 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(PriceSourceResponse)] - PriceSource { - denom: String, - }, - #[returns(Vec>)] - PriceSources { - start_after: Option, - limit: Option, - }, - #[returns(PriceResponse)] - Price { - denom: String, - }, - #[returns(Vec)] - Prices { - start_after: Option, - limit: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `Option` | Price to start after. | -| [`limit`](focus://json#4) | `Option` | Amount of prices to list. | - - - -Returns a vector that contains objects of type [`PriceResponse`](#priceresponse). \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/oracle/oracle-intro.mdx b/docs/develop/contracts/red-bank/oracle/oracle-intro.mdx deleted file mode 100644 index d074fca..0000000 --- a/docs/develop/contracts/red-bank/oracle/oracle-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# oracle - -Provides prices in uusd for assets used in the protocol. - - \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/oracle/osmosis.mdx b/docs/develop/contracts/red-bank/oracle/osmosis.mdx deleted file mode 100644 index c674da2..0000000 --- a/docs/develop/contracts/red-bank/oracle/osmosis.mdx +++ /dev/null @@ -1,68 +0,0 @@ ---- -sidebar_position: 2 ---- - -import Admonition from '@theme/Admonition' - -# osmosis - -The Osmosis Oracle contract inherits logics from the base Oracle contract, with the Osmosis query and price source plugins. The contract provides prices denominated in `uosmo` for assets used in the protocol. - -## Links - -- **Contract address:** `osmo1mhznfr60vjdp2gejhyv2gax9nvyyzhd3z0qcwseyetkfustjauzqycsy2g` -- **Testnet address:** `osmo1dqz2u3c8rs5e7w5fnchsr2mpzzsxew69wtdy0aq4jsd76w7upmsstqe0s8` -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/oracle/osmosis -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## ExecuteMsg - -### `OsmosisPriceSource` - -Osmosis [`PriceSource`](./base#price_source) response type. - - - - - - ```rust price_source.rs - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] - #[serde(rename_all = "snake_case")] - pub enum OsmosisPriceSource { - Fixed { - price: Decimal, - }, - Spot { - pool_id: u64, - }, - ArithmeticTwap { - pool_id: u64, - window_size: u64, - downtime_detector: Option, - }, - GeometricTwap { - pool_id: u64, - window_size: u64, - downtime_detector: Option, - }, - XykLiquidityToken { - pool_id: u64, - }, - } - ``` - - - - -For `Spot` and `Twap` variants, `pool_id` must point to an Osmosis pool consists of the asset of interest and OSMO. - - -| **Variants** | **Description** | -| ----------- | ----------- | -| [`Fixed`](focus://price_source.rs#4:6) | Returns a fixed value | -| [`Spot`](focus://price_source.rs#7:9) | Osmosis spot price quoted in OSMO | -| [`ArithmeticTwap`](focus://price_source.rs#10:14) | Osmosis arithmetic twap price quoted in OSMO | -| [`GeometricTwap`](focus://price_source.rs#15:19) | Osmosis geometric twap price quoted in OSMO | -| [`XykLiquidityToken`](focus://price_source.rs#20:22) | Osmosis LP token (of an XYK pool) price quoted in OSMO | - - diff --git a/docs/develop/contracts/red-bank/params.mdx b/docs/develop/contracts/red-bank/params.mdx deleted file mode 100644 index 648fb76..0000000 --- a/docs/develop/contracts/red-bank/params.mdx +++ /dev/null @@ -1,504 +0,0 @@ ---- -sidebar_position: 4 ---- - -import Admonition from '@theme/Admonition' - -# params - -## Overview - -The Mars Params Contract is published to [Crates.io](https://crates.io/crates/mars-params) - -This contract holds the following values for all the assets in Mars Protocol: - -- **Max Loan To Value**: Max percentage of collateral that can be borrowed -- **Liquidation Threshold**: LTV at which the loan is defined as under collateralized and can be liquidated -- **Liquidation Bonus**: Percentage of extra collateral the liquidator gets as a bonus -- **Deposit Enabled**: Is the asset able to be deposited into the Red Bank -- **Borrow Enabled**: Is the asset able to be borrowed from the Red Bank -- **Deposit Cap**: Max amount that can be deposited into the Red Bank -- **Asset Settings**: Credit Manager and Red Bank Permission Settings - - -Credit Manager Vaults only utilize max loan to value, liquidation threshold, and deposit cap parameters, while Red Bank Markets utilize all of the above parameters. - - -## High Levered Strategies (HLS) - -An HLS is a position where the borrowed asset is highly correlated to the collateral asset (e.g. atom debt -> stAtom collateral). This has a low risk of liquidation. For this reason, Credit Manager grants higher MaxLTV & LiqThreshold parameters, granting higher leverage. An asset's HLS parameters are stored in this contract and are applied to credit accounts of the HLS type during a health check. - -### De-listing an HLS asset - -There are a few scenarios depending on what denom is being de-listed. Always communicate each step to the users! - -- **De-listing a collateral denom**: - - Set the MaxLTV of the denom to zero. - - Gradually reduce the HLS Liquidation Threshold to zero. - - Do not set HLS parameters to None or remove it from correlations list for debt denom. This would result in freezing the HLS accounts that have that collateral. -- **De-listing a debt denom**: - - Set the MaxLTV of all denoms in the debt denom's correlations list to zero. - - Gradually reduce the HLS Liquidation Threshold to zero. - - Do not set HLS parameters to None. This would result in freezing the HLS accounts that have that debt denom. - -## Links - -- **Deployments**: -- **Types**: - - **Rust**: - - **Typescript**: -- **Contract repo**: -- **Audits**: https://github.com/mars-protocol/mars-audits - -## InstantiateMsg - - - - - ```json - { - "address_provider": "string", // Address of the address provider contract - "owner": "string", // Contract's owner - "target_health_factor": "Decimal" // Determines the ideal HF a position should be left at immediately after the position has been liquidated. - } - ``` - - - - -## ExecuteMsg - -### `update_owner` - - - - - ```json - { - "update_owner": OwnerUpdate - } - ``` - - - - -#### `OwnerUpdate` - - - - - ```json - | { - "propose_new_owner": { - "proposed": "string" - } - } - | "clear_proposed" - | "accept_proposed" - | "abolish_owner_role" - | { - "set_emergency_owner": { - "emergency_owner": "string" - } - } - | "clear_emergency_owner" - ``` - - - - -### `update_asset_params` - - - - - ```json - { - "update_asset_params": AssetParamsUpdate - } - ``` - - - - -#### `AssetParamsUpdate` - - - - - ```json - { - "add_or_update": { - "params": AssetParamsBaseForString - } - } - ``` - - - - -#### `AssetParamsBaseForString` - - - - - ```json - { - "credit_manager": CmSettingsForString, - "denom": "string", - "deposit_cap": "Uint128", - "liquidation_bonus": LiquidationBonus, - "liquidation_threshold": "Decimal", - "max_loan_to_value": "Decimal", - "protocol_liquidation_fee": "Decimal", - "red_bank": RedBankSettings - } - ``` - - - - -#### `CmSettingsForString` - - - - - ```json - { - "hls"?: HlsParamsBaseForString | null, - "whitelisted": boolean - } - ``` - - - - -#### `HlsParamsBaseForString` - - - - - ```json - { - "correlations": HlsAssetTypeForString[], - "liquidation_threshold": "Decimal", - "max_loan_to_value": "Decimal" - } - ``` - - - - -#### `HlsAssetTypeForString` - - - - - ```json - | { - "coin": { - "denom": "string" - } - } - | { - "vault": { - "addr": "string" - } - } - ``` - - - - -#### `LiquidationBonus` - - - - - ```json - { - "max_lb": "Decimal", - "min_lb": "Decimal", - "slope": "Decimal", - "starting_lb": "Decimal" - } - ``` - - - - -#### `RedBankSettings` - - - - - ```json - { - "borrow_enabled": boolean, - "deposit_enabled": boolean - } - ``` - - - - -### `update_target_health_factor` - - - - - ```json - { - "update_target_health_factor": "Decimal" - } - ``` - - - - -### `update_vault_config` - - - - - ```json - { - "update_vault_config": VaultConfigUpdate - } - ``` - - - - -#### `VaultConfigUpdate` - - - - - ```json - { - "add_or_update": { - "config": VaultConfigBaseForString - } - } - ``` - - - - -#### `VaultConfigBaseForString` - - - - - ```json - { - "addr": "string", - "deposit_cap": Coin, - "hls"?: HlsParamsBaseForString | null, - "liquidation_threshold": "Decimal", - "max_loan_to_value": "Decimal", - "whitelisted": boolean - } - ``` - - - - -#### `Coin` - - - - - ```json - { - "amount": "Uint128", - "denom": "string" - } - ``` - - - - -#### `HlsParamsBaseForString` - -See [above](#hlsparamsbaseforstring). - -### `emergency_update` - - - - - ```json - { - "emergency_update": EmergencyUpdate - } - ``` - - - - -#### `EmergencyUpdate` - - - - - ```json - | { - "credit_manager": CmEmergencyUpdate - } - | { - "red_bank": RedBankEmergencyUpdate - } - ``` - - - - -#### `CmEmergencyUpdate` - - - - - ```json - | { - "set_zero_max_ltv_on_vault": "string" - } - | { - "set_zero_deposit_cap_on_vault": "string" - } - | { - "disallow_coin": "string" - } - ``` - - - - -#### `RedBankEmergencyUpdate` - - - - - ```json - { - "disable_borrowing": "string" - } - ``` - - - - -## QueryMsg - -### `owner` - - - - - ```json - { - "owner": {} - } - ``` - - - - -### `asset_params` - - - - - ```json - { - "asset_params": { - "denom": "string" - } - } - ``` - - - - -### `all_asset_params` - - - - - ```json - { - "all_asset_params": { - "limit"?: number | null, - "start_after"?: "string" | null - } - } - ``` - - - - -### `vault_config` - - - - - ```json - { - "vault_config": { - "address": "string" - } - } - ``` - - - - -### `all_vault_configs` - - - - - ```json - { - "all_vault_configs": { - "limit"?: number | null, - "start_after"?: "string" | null - } - } - ``` - - - - -### `target_health_factor` - - - - - ```json - { - "target_health_factor": {} - } - ``` - - - - -### `total_deposit` - -Computes the total amount deposited of the given asset across Red Bank and Credit Manager. - - - - - ```json - { - "total_deposit": { - "denom": "string" - } - } - ``` - - - diff --git a/docs/develop/contracts/red-bank/red-bank-intro.mdx b/docs/develop/contracts/red-bank/red-bank-intro.mdx deleted file mode 100644 index 4694dc2..0000000 --- a/docs/develop/contracts/red-bank/red-bank-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Red Bank - -Enter the decentralized & fully automated, on-chain credit facility. - - \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/red-bank.mdx b/docs/develop/contracts/red-bank/red-bank.mdx deleted file mode 100644 index 69a5a17..0000000 --- a/docs/develop/contracts/red-bank/red-bank.mdx +++ /dev/null @@ -1,2858 +0,0 @@ ---- -sidebar_position: 4 ---- - -import RedBankInitAssetUrl from '@site/static/img//develop/contracts/red-bank-init-asset.png'; -import RedBankUpdateAssetUrl from '@site/static/img//develop/contracts/red-bank-update-asset.png'; -import RedBankDepositUrl from '@site/static/img//develop/contracts/red-bank-deposit.png'; -import RedBankWithdrawUrl from '@site/static/img//develop/contracts/red-bank-withdraw.png'; -import RedBankBorrowUrl from '@site/static/img//develop/contracts/red-bank-borrow.png'; -import RedBankRepayUrl from '@site/static/img//develop/contracts/red-bank-repay.png'; -import RedBankLiquidateUrl from '@site/static/img//develop/contracts/red-bank-liquidate.png'; - -# red-bank - -The Red Bank exposes all interactions that are done between the user and the money market. It also holds all protocol liquidity. - -## Links - -- **Contract address:** `osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg` -- **Testnet address:** `osmo1t0dl6r27phqetfu0geaxrng0u9zn8qgrdwztapt5xr32adtwptaq6vwg36` -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/red-bank -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## InstantiateMsg - -Instantiates the Red Bank contract. - - - - -```json json -{ - "owner": "...", - "emergency_owner": "...", - "config": { - "address_provider": "...", - "close_factor": 0.123 - } -} -``` - -```rust msg.rs -#[cw_serde] -pub struct InstantiateMsg { - pub owner: String, - pub emergency_owner: String, - pub config: CreateOrUpdateConfig, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `String` | Contract's owner | -| [`emergency_owner`](focus://json#3) | `String` | Contract's emergency owner | -| [`config`](focus://json#4:7) | [`CreateOrUpdateConfig`](#createorupdateconfig) | Market configuration | - - - -#### `CreateOrUpdateConfig` - - - - -```json json -{ - "address_provider": "...", - "close_factor": 0.123 -} -``` - -```rust msg.rs -#[cw_serde] -pub struct CreateOrUpdateConfig { - pub address_provider: Option, - pub close_factor: Option, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address_provider`](focus://json#2) | `Option` | Address provider returns addresses for all protocol contracts | -| [`close_factor`](focus://json#3) | `Option` | Maximum percentage of outstanding debt that can be covered by a liquidator | - - - -## ExecuteMsg - -### `update_owner` - -Manages owner state. - - - - - ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust address_provider.rs focus=1:3,46 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateEmergencyOwner(OwnerUpdate), - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, - } - ``` - - - - -### `update_emergency_owner` - -Manages emergency owner state. - - - - - ```json json - { - "update_emergency_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust address_provider.rs focus=1:2,4,46 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateEmergencyOwner(OwnerUpdate), - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, - } - ``` - - - - -### `update_config` - -Updates the contract's config (only the owner of the contract can call) - - - - - -```json json -{ - "update_config": { - "config": { - "address_provider": "...", - "closer_factor": 0.123 - } - } -} -``` - -```rust msg.rs focus=1:6,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`config`](focus://json#3:7) | [`CreateOrUpdateConfig`](#createorupdateconfig) | Market configuration | - - - -### `init_asset` - -Initializes an asset on the money market (only the owner of the contract can call) - - - - - -```json json -{ - "init_asset": { - "denom": "...", - "params": { - "initial_borrow_rate": 0.123, - "reserve_factor": 0.123, - "max_loan_to_value": 0.123, - "liquidation_threshold": 0.123, - "interest_rate_model": { - "optimal_utilization_rate": 0.123, - "base": 0.123, - "slope_1": 0.123, - "slope_2": 0.123 - }, - "desposit_enabled": true, - "borrow_enabled": true, - "deposit_cap": 123 - } - } -} -``` - -```rust msg.rs focus=1:3,7:10,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Asset related info | -| [`params`](focus://json#4:18) | [`InitOrUpdateAssetParams`](#initorupdateassetparams) | Asset parameters | - - - -{/* */} - -#### `InitOrUpdateAssetParams` - - - - -```json json -{ - "initial_borrow_rate": 0.123, - "reserve_factor": 0.123, - "max_loan_to_value": 0.123, - "liquidation_treshold": 0.123, - "liquidation_bonus": 0.123, - "interest_rate_model": { - "optimal_utilization_rate": 0.123, - "base": 0.123, - "slope_1": 0.123, - "slope_2": 0.123 - }, - "desposit_enabled": true, - "borrow_enabled": true, - "deposit_cap": 123 -} -``` - -```rust msg.rs -#[cw_serde] -pub struct InitOrUpdateAssetParams { - pub initial_borrow_rate: Option, - pub reserve_factor: Option, - pub max_loan_to_value: Option, - pub liquidation_threshold: Option, - pub liquidation_bonus: Option, - pub interest_rate_model: Option, - pub deposit_enabled: Option, - pub borrow_enabled: Option, - pub deposit_cap: Option, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`initial_borrow_rate`](focus://json#2) | `Option` | Initial borrow rate | -| [`reserve_factor`](focus://json#3) | `Option` | Portion of the borrow rate that is kept as protocol rewards | -| [`max_loan_to_value`](focus://json#4) | `Option` | Max `base_denom` that can be borrowed per uusd of collateral when using the asset as collateral | -| [`liquidation_threshold`](focus://json#5) | `Option` | uusd amount in debt position per uusd of asset collateral that if surpassed makes the user's position liquidatable | -| [`liquidation_bonus`](focus://json#6) | `Option` | Bonus amount of collateral liquidator get when repaying user's debt (Will get collateral from user in an amount equal to debt repayed + bonus) | -| [`interest_rate_model`](focus://json#7:12) | [`Option`](#interestratemodel) | Interest rate strategy to calculate borrow_rate and liquidity_rate | -| [`deposit_enabled`](focus://json#13) | `Option` | If false cannot deposit | -| [`borrow_enabled`](focus://json#14) | `Option` | If false cannot borrow | -| [`deposit_cap`](focus://json#15) | `Option` | Deposit Cap defined in terms of the asset (Unlimited by default) | - - - - - -#### `InterestRateModel` - - - - - -```json json -{ - "optimal_utilization_rate": 0.123, - "base": 0.123, - "slope_1": 0.123, - "slope_2": 0.123 -} -``` - -```rust interest_rate_model.rs -#[cw_serde] -#[derive(Eq, Default)] -pub struct InterestRateModel { - pub optimal_utilization_rate: Decimal, - pub base: Decimal, - pub slope_1: Decimal, - pub slope_2: Decimal, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`optimal_utilization_rate`](focus://json#2) | `Decimal` | Optimal utilization rate | -| [`base`](focus://json#3) | `Decimal` | Base rate | -| [`slope_1`](focus://json#4) | `Decimal` | Slope parameter for interest rate model function when utilization_rate < optimal_utilization_rate | -| [`slope_2`](focus://json#5) | `Decimal` | Slope parameter for interest rate model function when utilization_rate >= optimal_utilization_rate | - - - -### `update_asset` - -Update an asset on the money market (only owner can call) - - - - - -```json json -{ - "update_asset": { - "denom": "...", - "params": { - "initial_borrow_rate": 0.123, - "reserve_factor": 0.123, - "max_loan_to_value": 0.123, - "liquidation_threshold": 0.123, - "interest_rate_model": { - "optimal_utilization_rate": 0.123, - "base": 0.123, - "slope_1": 0.123, - "slope_2": 0.123 - }, - "desposit_enabled": true, - "borrow_enabled": true, - "deposit_cap": 123 - } - } -} -``` - -```rust msg.rs focus=1:3,11:14,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Asset related info | -| [`params`](focus://json#4:18) | [`InitOrUpdateAssetParams`](#initorupdateassetparams) | Asset parameters | - - - -{/* */} - -### `update_uncollateralized_loan_limit` - -Update uncollateralized loan limit for a given user and asset. Overrides previous value if any. A limit of zero means no uncollateralized limit and the debt in that asset needs to be collateralized (only owner can call). - - - - -```json json -{ - "update_uncollateralized_loan_limit": { - "user": "...", - "denom": "...", - "new_limit": 123 - } -} -``` - -```rust msg.rs focus=1:3,15:19,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | Address that receives the credit | -| [`denom`](focus://json#4) | `String` | Asset the user receives the credit in | -| [`new_limit`](focus://json#5) | `Uint128` | Limit for the uncolateralize loan | - - - -### `deposit` - -Deposits native coins. Deposited coins must be sent in the transaction this call is made. - - - - - -```json json -{ - "deposit": { - "on_behalf_of": "..." - } -} -``` - -```rust msg.rs focus=1:3,20:22,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`on_behalf_of`](focus://json#3) | `Option` | Address that will receive deposited tokens | - - - -{/* */} - -### `withdraw` - -Withdraws an amount of the asset burning an equivalent amount deposited tokens. - - - - -```json json -{ - "withdraw": { - "denom": "...", - "amount": 123, - "recipient": "..." - } -} -``` - -```rust msg.rs focus=1:3,23:27,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Asset to withdraw | -| [`amount`](focus://json#4) | `Option` | Amount to be withdrawn. If None is specified, the full amount will be withdrawn | -| [`recipient`](focus://json#5) | `Option` | The address where the withdrawn amount is sent | - - - -{/* */} - -### `borrow` - -Borrows native coins. If borrow allowed, amount is added to caller's debt and sent to the address. - - - - -```json json -{ - "borrow": { - "denom": "...", - "amount": 123, - "recipient" "mars..." - } -} -``` - -```rust msg.rs focus=1:3,28:32,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Asset to borrow | -| [`amount`](focus://json#4) | `Option` | Amount to borrow | -| [`recipient`](focus://json#5) | `Option` | The address where the borrowed amount is sent | - - - -{/* */} - - -### `repay` - -Repay native coins loan. Coins used to repay must be sent in the transaction this call is made. - - - - -```json json -{ - "repay": { - "on_behalf_of": "..." - } -} -``` - -```rust msg.rs focus=1:3,33:35,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`on_behalf_of`](focus://json#3) | `Option` | Repay the funds for the user | - - - -{/* */} - - -### `liquidate` - -Liquidate under-collateralized native loans. Coins used to repay must be sent in the transaction this call is made. The liquidator will receive collateral shares. To get the underlying asset, consider sending a separate [`withdraw`](#withdraw) execute message. - - - - -```json json -{ - "liquidate": { - "user": "mars...", - "collateral_denom": "...", - "recipient": "..." - } -} -``` - -```rust msg.rs focus=1:3,36:40,45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | The address of the borrower getting liquidated | -| [`collateral_denom`](focus://json#4) | `String` | Denom of the collateral asset, which liquidator gets from the borrower | -| [`recipient`](focus://json#5) | `Option` | The address for receiving underlying collateral | - - - -{/* */} - - -### `update_asset_collateral_status` - -Update (enable/disable) asset as collateral for the caller. - - - - -```json json -{ - "update_asset_collateral_status": { - "denom": "...", - "enable": true - } -} -``` - -```rust msg.rs focus=1:3,41:45 -#[cw_serde] -#[allow(clippy::large_enum_variant)] -pub enum ExecuteMsg { - UpdateConfig { - config: CreateOrUpdateConfig, - }, - InitAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateAsset { - denom: String, - params: InitOrUpdateAssetParams, - }, - UpdateUncollateralizedLoanLimit { - user: String, - denom: String, - new_limit: Uint128, - }, - Deposit { - on_behalf_of: Option, - }, - Withdraw { - denom: String, - amount: Option, - recipient: Option, - }, - Borrow { - denom: String, - amount: Uint128, - recipient: Option, - }, - Repay { - on_behalf_of: Option, - }, - Liquidate { - user: String, - collateral_denom: String, - recipient: Option, - }, - UpdateAssetCollateralStatus { - denom: String, - enable: bool, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Asset to update status for | -| [`enable`](focus://json#4) | `bool` | Option to enable (true) / disable (false) asset as collateral | - - - - -## QueryMsg - -### `config` - -Get config. - - - - -```json json -{ - "config": {} -} -``` - -```rust msg.rs focus=1:5,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - - -#### `ConfigResponse` - - - - -```json json -{ - "owner": "...", - "proposed_new_owner": "...", - "emergency_owner": "...", - "proposed_new_emergency_owner": "...", - "address_provider": "...", - "close_factor": 0.123 -} -``` - -```rust types.rs -#[cw_serde] -pub struct ConfigResponse { - pub owner: Option, - pub proposed_new_owner: Option, - pub emergency_owner: Option, - pub proposed_new_emergency_owner: Option, - pub address_provider: String, - pub close_factor: Decimal, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `Option` | The contract's owner | -| [`proposed_new_owner`](focus://json#3) | `Option` | The contract's proposed owner | -| [`emergency_owner`](focus://json#4) | `Option` | The contract's emergency owner | -| [`proposed_new_emergency_owner`](focus://json#5) | `Option` | The contract's proposed emergency owner | -| [`address_provider`](focus://json#6) | `String` | Address provider returns addresses for all protocol contracts | -| [`close_factor`](focus://json#7) | `Decimal` | Maximum percentage of outstanding debt that can be covered by a liquidator | - - - -{/* #### `Config` - - - - -```json json -{ - "owner": "...", - "address_provider": "...", - "close_factor": 0.123 -} -``` - -```rust types.rs -#[cw_serde] -pub struct Config { - pub owner: T, - pub address_provider: T, - pub close_factor: Decimal, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `T` | Contract owner | -| [`address_provider`](focus://json#3) | `T` | Address provider returns addresses for all protocol contracts | -| [`close_factor`](focus://json#4) | `Decimal` | Maximum percentage of outstanding debt that can be covered by a liquidator | - - */} - -### `market` - -Get asset market. - - - - -```json json -{ - "market": { - "denom": "..." - } -} -``` - -```rust msg.rs focus=1:3,6:9,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - - -#### `Market` (response) - - - - -```json json -{ - "denom": "...", - "max_loan_to_value": 0.123, - "liquidation_threshold": 0.123, - "liquidation_bonus": 0.123, - "reserve_factor": 0.123, - "interest_rate_model": { - "optimal_utilization_rate": 0.123, - "base": 0.123, - "slope_1": 0.123, - "slope_2": 0.123 - }, - "borrow_index": 0.123, - "liquidity_index": 0.123, - "borrow_rate": 0.123, - "liquidity_rate": 0.123, - "indexes_last_updated": 123, - "collateral_total_scaled": 123, - "debt_total_scaled": 123, - "deposit_enabled": true, - "borrow_enabled": true, - "deposit_cap": 123456 -} -``` - -```rust market.rs -#[cw_serde] -pub struct Market { - pub denom: String, - pub max_loan_to_value: Decimal, - pub liquidation_threshold: Decimal, - pub liquidation_bonus: Decimal, - pub reserve_factor: Decimal, - pub interest_rate_model: InterestRateModel, - pub borrow_index: Decimal, - pub liquidity_index: Decimal, - pub borrow_rate: Decimal, - pub liquidity_rate: Decimal, - pub indexes_last_updated: u64, - pub collateral_total_scaled: Uint128, - pub debt_total_scaled: Uint128, - pub deposit_enabled: bool, - pub borrow_enabled: bool, - pub deposit_cap: Uint128, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Denom of the asset | -| [`max_loan_to_value`](focus://json#3) | `Decimal` | Max base asset that can be borrowed per "base asset" collateral when using the asset as collateral | -| [`liquidation_threshold`](focus://json#4) | `Decimal` | Base asset amount in debt position per "base asset" of asset collateral that if surpassed makes the user's position liquidatable | -| [`liquidation_bonus`](focus://json#5) | `Decimal` | Bonus amount of collateral liquidator get when repaying user's debt (Will get collateral from user in an amount equal to debt repayed + bonus) | -| [`reserve_factor`](focus://json#6) | `Decimal` | Portion of the borrow rate that is kept as protocol rewards | -| [`interest_rate_model`](focus://json#7:12) | [`InterestRateModel`](#interestratemodel) | model (params + internal state) that defines how interest rate behaves | -| [`borrow_index`](focus://json#13) | `Decimal` | Borrow index (Used to compute borrow interest) | -| [`liquidity_index`](focus://json#14) | `Decimal` | Liquidity index (Used to compute deposit interest) | -| [`borrow_rate`](focus://json#15) | `Decimal` | Rate charged to borrowers | -| [`liquidity_rate`](focus://json#16) | `Decimal` | Rate paid to depositors | -| [`indexes_last_updated`](focus://json#17) | `u64` | Timestamp (seconds) where indexes and where last updated | -| [`collateral_total_scaled`](focus://json#18) | `Uint128` | Total collateral scaled for the market's currency | -| [`debt_total_scaled`](focus://json#19) | `Uint128` | Total debt scaled for the market's currency | -| [`deposit_enabled`](focus://json#20) | `bool` | If false cannot deposit | -| [`borrow_enabled`](focus://json#21) | `bool` | If false cannot borrow | -| [`deposit_cap`](focus://json#22) | `Uint128` | Deposit Cap (defined in terms of the asset) | - - - -### `markets` - -Enumerate markets with pagination. - - - - -```json json -{ - "markets": { - "start_after": "...", - "limit": 10 - } -} -``` - -```rust msg.rs focus=1:3,10:14,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `Option` | A market to start after | -| [`limit`](focus://json#4) | `Option` | The amount of markets to list | - - - -#### `Vec` - -`markets` returns a vector of the [`Market`](#market) response struct defined above. - -### `uncollateralized_loan_limit` - -Get uncollateralized limit for given user and asset. - - - - -```json json -{ - "uncollateralized_loan_limit": { - "user": "mars...", - "denom": "..." - } -} -``` - -```rust msg.rs focus=1:3,15:19,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address with uncollateralized loan | -| [`denom`](focus://json#4) | `String` | Asset denom | - - - - - -#### `UncollateralizedLoanLimitResponse` - - - - -```json json -{ - "denom": "...", - "limit": 123 -} -``` - -```rust types.rs -#[cw_serde] -pub struct UncollateralizedLoanLimitResponse { - pub denom: String, - pub limit: Uint128, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Asset denom | -| [`limit`](focus://json#3) | `Uint128` | Limit for uncollateralized loan | - - - -### `uncollateralized_loan_limits` - -Get all uncollateralized limits for a given user. - - - - -```json json -{ - "uncollateralized_loan_limits": { - "user": "mars...", - "start_after": "...", - "limit": 123 - } -} -``` - -```rust msg.rs focus=1:3,20:25,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address with uncollateralized loans | -| [`start_after`](focus://json#4) | `Option` | The amount of loans to list | -| [`limit`](focus://json#5) | `Option` | Limit for uncollateralized loan | - - - - -#### `Vec` - -`uncollateralized_loan_limits` returns a vector of the [`UncollateralizedLoanLimitResponse`](#uncollateralizedloanlimitresponse) struct defined above. - -### `user_debt` - -Get user debt position for a specific asset. - - - - -```json json -{ - "user_debt": { - "user": "mars...", - "denom": "..." - } -} -``` - -```rust msg.rs focus=1:3,26:30,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address with debt | -| [`denom`](focus://json#4) | `String` | Asset denom | - - - -#### `UserDebtResponse` - - - - -```json json -{ - "denom": "...", - "amount_scaled": 123, - "amount": 123, - "uncollateralized": false -} -``` - -```rust types.rs -#[cw_serde] -pub struct UserDebtResponse { - pub denom: String, - pub amount_scaled: Uint128, - pub amount: Uint128, - pub uncollateralized: bool, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Asset denom | -| [`amount_scaled`](focus://json#3) | `Uint128` | Scaled debt amount stored in contract state | -| [`amount`](focus://json#4) | `Uint128` | Underlying asset amount that is actually owed at the current block | -| [`uncollateralized`](focus://json#5) | `bool` | Marker for uncollateralized debt | - - - -### `user_debts` - -Get all debt positions for a user. - - - - -```json json -{ - "user_debts": { - "user": "...", - "start_after": "...", - "limit": 123 - } -} -``` - -```rust msg.rs focus=1:3,31:36,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address with debt | -| [`start_after`](focus://json#4) | `Option` | Position to start after | -| [`limit`](focus://json#5) | `Option` | The amount of positions to list | - - - -#### `Vec` - -`user_debts` returns a vector of the [`UserDebtResponse`](#userdebtresponse) struct defined above. - -### `user_collateral` - -Get user collateral position for a specific asset. - - - - -```json json -{ - "user_collateral": { - "user": "mars...", - "denom": "..." - } -} -``` - -```rust msg.rs focus=1:3,37:41,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address with collateral | -| [`denom`](focus://json#4) | `String` | Denom of the asset | - - - -#### `UserCollateralResponse` - - - - -```json json -{ - "denom": "...", - "amount_scaled": 123, - "amount": 123, - "enabled": true -} -``` - -```rust types.rs -#[cw_serde] -pub struct UserCollateralResponse { - pub denom: String, - pub amount_scaled: Uint128, - pub amount: Uint128, - pub enabled: bool, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#2) | `String` | Asset denom | -| [`amount_scaled`](focus://json#3) | `Uint128` | Scaled collateral amount stored in contract state | -| [`amount`](focus://json#4) | `Uint128` | Underlying asset amount that is actually deposited at the current block | -| [`enabled`](focus://json#5) | `boold` | Wether the user is using asset as collateral or not | - - - -### `user_collaterals` - -Get all collateral positions for a user. - - - - -```json json -{ - "user_collaterals": { - "user": "...", - "start_after": "...", - "limit": 123 - } -} -``` - -```rust msg.rs focus=1:3,42:47,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address with collateral | -| [`start_after`](focus://json#4) | `Option` | Position to start after | -| [`limit`](focus://json#5) | `Option` | The amount of positions to list | - - - -#### `UserCollateralResponse` - -`user_collaterals` returns a vector of the [`UserCollateralResponse`](#usercollateralresponse) struct defined above. - -### `user_position` - -Get user position. - - - - -```json json -{ - "user_position": { - "user": "mars..." - } -} -``` - -```rust msg.rs focus=1:3,48:51,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`user`](focus://json#3) | `String` | User address | - - - -#### `UserPositionResponse` - - - - -```json json -{ - - "total_enabled_collateral": "123", - "total_collateralized_debt": "123", - "weighted_max_ltv_collateral": "123", - "weighted_liquidation_threshold_collateral": "123", - "health_status": { - "max_ltv_hf": 0.123, - "liq_threshold_hf": 0.123 - } -} -``` - -```rust types.rs -#[cw_serde] -pub struct UserPositionResponse { - pub total_enabled_collateral: Uint128, - pub total_collateralized_debt: Uint128, - pub weighted_max_ltv_collateral: Uint128, - pub weighted_liquidation_threshold_collateral: Uint128, - pub health_status: UserHealthStatus, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`total_enabled_collateral`](focus://json#3) | `Uint128` | Total value of all enabled collateral assets. If an asset is disabled as collateral, it will not be included. | -| [`total_collateralized_debt`](focus://json#4) | `Uint128` | Total value of all collateralized debts. If the user has an uncollateralized loan limit in an asset, the debt in this asset will not be included. | -| [`weighted_max_ltv_collateral`](focus://json#5) | `Uint128` | | -| [`weighted_liquidation_threshold_collateral`](focus://json#6) | `Uint128` | | -| [`health_status`](focus://json#3) | [`UserHealthStatus`](#userhealthstatus) | | - - - - - - -#### `UserHealthStatus` - - - - -```json json -{ - "user_health_status": { - "not_borrowing": {}, - "borrowing": { - "max_ltv_hf": 0.123, - "liq_threshold_hf": 0.123 - } - } -} -``` - -```rust types.rs -#[cw_serde] -pub enum UserHealthStatus { - NotBorrowing, - Borrowing { - max_ltv_hf: Decimal, - liq_threshold_hf: Decimal, - }, -} -``` - - - -Params when borrowing. - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`max_ltv_hf`](focus://json#5) | `Decimal` | | -| [`liq_threshold_hf`](focus://json#6) | `Decimal` | | - - - - -### `scaled_liquidity_amount` - -Get liquidity scaled amount for a given underlying asset amount. (i.e: how much scaled collateral is added if the given amount is deposited). - - - - -```json json -{ - "scaled_liquidity_amount": { - "denom": "...", - "amount_scaled": 123 - } -} -``` - -```rust msg.rs focus=1:3,52:56,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount_scaled`](focus://json#4) | `Uint128` | Amount scaled by | - - - -Returns `Uint128` - -### `scaled_debt_amount` - -Get equivalent scaled debt for a given underlying asset amount. (i.e: how much scaled debt is added if the given amount is borrowed). - - - - -```json json -{ - "scaled_debt_amount": { - "denom": "...", - "amount": 123 - } -} -``` - -```rust msg.rs focus=1:3,57:61,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount`](focus://json#4) | `Uint128` | Amount scaled by | - - - -Returns `Uint128` - -### `underlying_liquidity_amount` - -Get underlying asset amount for a given asset and scaled amount. (i.e. How much underlying asset will be released if withdrawing by burning a given scaled collateral amount stored in state). - - - - -```json json -{ - "underlying_liquidity_amount": { - "denom": "...", - "amount_scaled": 123 - } -} -``` - -```rust msg.rs focus=1:3,62:66,72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount_scaled`](focus://json#4) | `Uint128` | Amount scaled by | - - - -Returns `Uint128` - -### `underlying_debt_amount` - -Get underlying debt amount for a given asset and scaled amounts. (i.e: How much underlying asset needs to be repaid to cancel a given scaled debt amount stored in state). - - - - -```json json -{ - "underlying_debt_amount": { - "denom": "...", - "amount_scaled": 123 - } -} -``` - -```rust msg.rs focus=1:3,67:72 -#[cw_serde] -#[derive(QueryResponses)] -pub enum QueryMsg { - #[returns(crate::red_bank::ConfigResponse)] - Config {}, - #[returns(crate::red_bank::Market)] - Market { - denom: String, - }, - #[returns(Vec)] - Markets { - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UncollateralizedLoanLimitResponse)] - UncollateralizedLoanLimit { - user: String, - denom: String, - }, - #[returns(Vec)] - UncollateralizedLoanLimits { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserDebtResponse)] - UserDebt { - user: String, - denom: String, - }, - #[returns(Vec)] - UserDebts { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserCollateralResponse)] - UserCollateral { - user: String, - denom: String, - }, - #[returns(Vec)] - UserCollaterals { - user: String, - start_after: Option, - limit: Option, - }, - #[returns(crate::red_bank::UserPositionResponse)] - UserPosition { - user: String, - }, - #[returns(Uint128)] - ScaledLiquidityAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - ScaledDebtAmount { - denom: String, - amount: Uint128, - }, - #[returns(Uint128)] - UnderlyingLiquidityAmount { - denom: String, - amount_scaled: Uint128, - }, - #[returns(Uint128)] - UnderlyingDebtAmount { - denom: String, - amount_scaled: Uint128, - }, -} -``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount_scaled`](focus://json#4) | `Uint128` | Amount scaled by | - - - -Returns `Uint128` - diff --git a/docs/develop/contracts/red-bank/rewards-collector/_category_.json b/docs/develop/contracts/red-bank/rewards-collector/_category_.json deleted file mode 100644 index 3ee0749..0000000 --- a/docs/develop/contracts/red-bank/rewards-collector/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "rewards-collector", - "position": 5, - "link": { "type": "doc", "id": "rewards-collector-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/rewards-collector/base.mdx b/docs/develop/contracts/red-bank/rewards-collector/base.mdx deleted file mode 100644 index 1d23d44..0000000 --- a/docs/develop/contracts/red-bank/rewards-collector/base.mdx +++ /dev/null @@ -1,553 +0,0 @@ ---- -sidebar_position: 1 ---- - -import Admonition from '@theme/Admonition' - -# base - -Chain-agnostic logics for the rewards collector contract. - -## Links - -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/rewards-collector/base -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## InstantiateMsg - - - - - ```json json - { - "owner": "...", - "address_provider": "...", - "safety_tax_rate": "1.27", - "safety_fund_denom": "...", - "fee_collector_denom": "...", - "channel_id": "...", - "timeout_seconds": 123, - "slippage_tolerance": "0.01" - } - ``` - - ```rust rewards_collector.rs - #[cw_serde] - pub struct Config { - pub owner: T, - pub address_provider: T, - pub safety_tax_rate: Decimal, - pub safety_fund_denom: String, - pub fee_collector_denom: String, - pub channel_id: String, - pub timeout_seconds: u64, - pub slippage_tolerance: Decimal, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`owner`](focus://json#2) | `T` | The contract's owner | -| [`address_provider`](focus://json#3) | `T` | Address provider returns addresses for all protocol contracts | -| [`safety_tax_rate`](focus://json#4) | `Decimal` | Percentage of fees that are sent to the safety fund | -| [`safety_fund_denom`](focus://json#5) | `String` | The asset to which the safety fund share is converted | -| [`fee_collector_denom`](focus://json#6) | `String` | The asset to which the fee collector share is converted | -| [`channel_id`](focus://json#7) | `String` | The channel ID of the mars hub | -| [`timeout_seconds`](focus://json#8) | `u64` | Number of seconds after which an IBC transfer is to be considered failed, if no acknowledgement is received | -| [`slippage_tolerance`](focus://json#9) | `Decimal` | Maximum percentage of price movement (minimum amount you accept to receive during swap) | - - - - -## ExecuteMsg - -### `update_owner` - -Manages admin role state. - - - - - ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust address_provider.rs focus=1:3,24 - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - UpdateConfig { - new_cfg: CreateOrUpdateConfig, - }, - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - WithdrawFromRedBank { - denom: String, - amount: Option, - }, - DistributeRewards { - denom: String, - amount: Option, - }, - SwapAsset { - denom: String, - amount: Option, - }, - } - ``` - - - - -### `update_config` - -Updates contract config. - - - - - ```json json - { - "update_config": { - "new_cfg": { - "address_provider": "...", - "safety_tax_rate": "1.27", - "safety_fund_denom": "...", - "fee_collector_denom": "...", - "channel_id": "...", - "timeout_seconds": 123, - "slippage_tolerance": "0.01" - } - } - } - ``` - - ```rust rewards_collector.rs focus=1:5,23 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - new_cfg: CreateOrUpdateConfig, - }, - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - WithdrawFromRedBank { - denom: String, - amount: Option, - }, - DistributeRewards { - denom: String, - amount: Option, - }, - SwapAsset { - denom: String, - amount: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`new_cfg`](focus://json#3:14) | [`CreateOrUpdateConfig`](#createorupdateconfig) | New config parameters | - - - -#### `CreateOrUpdateConfig` - - - - - ```json json - { - "address_provider": "...", - "safety_tax_rate": "1.27", - "safety_fund_denom": "...", - "fee_collector_denom": "...", - "channel_id": "...", - "timeout_seconds": 123, - "slippage_tolerance": "0.01" - } - ``` - - ```rust rewards_collector.rs - #[cw_serde] - #[derive(Default)] - pub struct CreateOrUpdateConfig { - pub address_provider: Option, - pub safety_tax_rate: Option, - pub safety_fund_denom: Option, - pub fee_collector_denom: Option, - pub channel_id: Option, - pub timeout_seconds: Option, - pub slippage_tolerance: Option, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`address_provider`](focus://json#2) | `Option` | Address provider returns addresses for all protocol contracts | -| [`safety_tax_rate`](focus://json#3) | `Option` | Percentage of fees that are sent to the safety fund | -| [`safety_fund_denom`](focus://json#4) | `Option` | The asset to which the safety fund share is converted | -| [`fee_collector_denom`](focus://json#5) | `Option` | The asset to which the fee collector share is converted | -| [`channel_id`](focus://json#6) | `Option` | The channel id of the Mars Hub | -| [`timeout_seconds`](focus://json#7) | `Option` | Number of seconds after which an IBC transfer is to be considered failed, if no acknowledgement is received | -| [`slippage_tolerance`](focus://json#8) | `Option` | Maximum percentage of price movement (minimum amount you accept to receive during swap) | - - - -### `set_route` - -Configure the route for swapping an asset. This is chain-specific, and can include parameters such as slippage tolerance and the routes for multi-step swaps. - - - - - ```json json - { - "set_route": { - "denom_in": "...", - "denom_out": "...", - "route": [ - // Route (chain-specific) - ] - } - } - ``` - - ```rust rewards_collector.rs focus=1:2,6:10,23 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - new_cfg: CreateOrUpdateConfig, - }, - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - WithdrawFromRedBank { - denom: String, - amount: Option, - }, - DistributeRewards { - denom: String, - amount: Option, - }, - SwapAsset { - denom: String, - amount: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom_in`](focus://json#3) | `Option` | Denom of the asset going in | -| [`denom_out`](focus://json#4) | `Option` | Denom of the asset going out | -| [`route`](focus://json#5:7) | `Route` | Route for swapping an assets. See [`OsmosisRoute`](./osmosis#osmosisroute) for an example of a chain specific integration. | - - - -### `withdraw_from_red_bank` - -Withdraw maTokens from the Red Bank. - - - - - ```json json - { - "withdraw_from_red_bank": { - "denom": "...", - "amount": "100000" - } - } - ``` - - ```rust rewards_collector.rs focus=1:2,11:14,23 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - new_cfg: CreateOrUpdateConfig, - }, - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - WithdrawFromRedBank { - denom: String, - amount: Option, - }, - DistributeRewards { - denom: String, - amount: Option, - }, - SwapAsset { - denom: String, - amount: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount`](focus://json#4) | `Option` | Amount to withdraw | - - - -### `distribute_rewards` - -Distribute the accrued protocol income between the safety fund and the fee modules on Mars Hub, according to the split set in config. Callable by any address. - - - - - ```json json - { - "distribute_rewards": { - "denom": "...", - "amount": "100000" - } - } - ``` - - ```rust rewards_collector.rs focus=1:2,15:18,23 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - new_cfg: CreateOrUpdateConfig, - }, - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - WithdrawFromRedBank { - denom: String, - amount: Option, - }, - DistributeRewards { - denom: String, - amount: Option, - }, - SwapAsset { - denom: String, - amount: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount`](focus://json#4) | `Option` | Amount of rewards to distribute | - - - -### `swap_asset` - -Swap any asset on the contract. - - - - - ```json json - { - "swap_asset": { - "denom": "...", - "amount": "100000" - } - } - ``` - - ```rust rewards_collector.rs focus=1:2,19:23 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - new_cfg: CreateOrUpdateConfig, - }, - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - WithdrawFromRedBank { - denom: String, - amount: Option, - }, - DistributeRewards { - denom: String, - amount: Option, - }, - SwapAsset { - denom: String, - amount: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom`](focus://json#3) | `String` | Denom of the asset | -| [`amount`](focus://json#4) | `Option` | Amount of assets to swap | - - - -## QueryMsg - -### `config` - -Queries config parameters. - - - - - ```json json - { - "config": {} - } - ``` - - ```rust rewards_collector.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(Vec>)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - } - ``` - - - - -### `route` - -Get routes for swapping an input denom into an output denom. - - -The response type of this query is chain-specific. - - - - - - ```json json - { - "route": { - "denom_in": "...", - "denom_out": "..." - } - } - ``` - - ```rust rewards_collector.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(Vec>)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`denom_in`](focus://json#3) | `String` | Denom of the asset going in | -| [`denom_out`](focus://json#4) | `String` | Denom of the asset going out | - - - -### `routes` - -Enumerate all swap routes. - - -The response type of this query is chain-specific. - - - - - - ```json json - { - "routes": { - - } - } - ``` - - ```rust rewards_collector.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(Config)] - Config {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(Vec>)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - } - ``` - - - -| **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`start_after`](focus://json#3) | `Option<(String, String)>` | Denom of the asset going in | -| [`limit`](focus://json#4) | `Option` | Denom of the asset going out | - - diff --git a/docs/develop/contracts/red-bank/rewards-collector/osmosis.mdx b/docs/develop/contracts/red-bank/rewards-collector/osmosis.mdx deleted file mode 100644 index 9e729e1..0000000 --- a/docs/develop/contracts/red-bank/rewards-collector/osmosis.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -sidebar_position: 2 ---- - -# osmosis - -The Osmosis Rewards Collector contract inherits logics from the base Rewards Collector contract, with the Osmosis custom msg, query, and swap route plugins. - -## Links - -- **Contract address:** `osmo1urvqe5mw00ws25yqdd4c4hlh8kdyf567mpcml7cdve9w08z0ydcqvsrgdy` -- **Testnet address:** `osmo14kzsqw5tatdvwlkj383lgkh6gcdetwn7kfqm7488uargyy2lpucqsyv53j` -- **Contract repo:** https://github.com/mars-protocol/outposts/tree/master/contracts/rewards-collector/osmosis -- **Audits:** https://github.com/mars-protocol/mars-audits/tree/main/red-bank - -## ExecuteMsg - -### `OsmosisRoute` - - - - - ```rust route.rs - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] - pub struct OsmosisRoute(pub Vec); - ``` - - - diff --git a/docs/develop/contracts/red-bank/rewards-collector/rewards-collector-intro.mdx b/docs/develop/contracts/red-bank/rewards-collector/rewards-collector-intro.mdx deleted file mode 100644 index 3b0cecc..0000000 --- a/docs/develop/contracts/red-bank/rewards-collector/rewards-collector-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# rewards-collector - -Receives protocol revenue in various coins from the Red Bank; swaps them into MARS or other specified assets through a DEX (for example Osmosis); forwards the assets to Mars Hub via IBC to be distributed as staking rewards or be deposited into the safety fund. - - \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/swapper/_category_.json b/docs/develop/contracts/red-bank/swapper/_category_.json deleted file mode 100644 index 52981be..0000000 --- a/docs/develop/contracts/red-bank/swapper/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Swapper", - "position": 7, - "link": { "type": "doc", "id": "swapper-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/red-bank/swapper/astroport.mdx b/docs/develop/contracts/red-bank/swapper/astroport.mdx deleted file mode 100644 index dff24b8..0000000 --- a/docs/develop/contracts/red-bank/swapper/astroport.mdx +++ /dev/null @@ -1,75 +0,0 @@ ---- -sidebar_position: 2 ---- - -# astroport - -## Links - -- **Deployments**: -- **Types**: - - **Rust**: - - **Typescript**: -- **Contract repo**: -- **Audits**: https://github.com/mars-protocol/mars-audits - -## `AstroportRoute` - - - - - ```json - { - "factory": "string", - "operations": SwapOperation[], - "oracle": "string", - "router": "string" - } - ``` - - - - -### `SwapOperation` - - - - - ```json - | { - "native_swap": { - "ask_denom": "string", - "offer_denom": "string" - } - } - | { - "astro_swap": { - "ask_asset_info": AssetInfo, - "offer_asset_info": AssetInfo - } - } - ``` - - - - -### `AssetInfo` - - - - - ```json - | { - "token": { - "contract_addr": "Addr" - } - } - | { - "native_token": { - "denom": "string" - } - } - ``` - - - diff --git a/docs/develop/contracts/red-bank/swapper/base.mdx b/docs/develop/contracts/red-bank/swapper/base.mdx deleted file mode 100644 index 7a4546d..0000000 --- a/docs/develop/contracts/red-bank/swapper/base.mdx +++ /dev/null @@ -1,209 +0,0 @@ ---- -sidebar_position: 1 ---- - -# base - -## Links - -- **Deployments**: -- **Types**: - - **Rust**: - - **Typescript**: -- **Contract repo**: -- **Audits**: https://github.com/mars-protocol/mars-audits - -## InstantiateMsg - - - - - ```json - { - "owner": "string" - } - ``` - - - - -## ExecuteMsg - -### `update_owner` - - - - - ```json - { - "update_owner": OwnerUpdate - } - ``` - - - - -#### `OwnerUpdate` - - - - - ```json - | { - "propose_new_owner": { - "proposed": "string" - } - } - | "clear_proposed" - | "accept_proposed" - | "abolish_owner_role" - | { - "set_emergency_owner": { - "emergency_owner": "string" - } - } - | "clear_emergency_owner" - ``` - - - - -### `set_route` - - - - - ```json - { - "set_route": { - "denom_in": "string", - "denom_out": "string", - "route": - } - } - ``` - - - - -### `swap_exact_in` - - - - - ```json - { - "swap_exact_in": { - "coin_in": Coin, - "denom_out": "string", - "slippage": "Decimal" - } - } - ``` - - - - -#### `Coin` - - - - - ```json - { - "amount": "Uint128", - "denom": "string" - } - ``` - - - - -### `transfer_result` - - - - - ```json - { - "transfer_result": { - "denom_in": "string", - "denom_out": "string", - "recipient": "Addr" - } - } - ``` - - - - -## QueryMsg - -### `owner` - - - - - ```json - { - "owner": {} - } - ``` - - - - -### `route` - - - - - ```json - { - "route": { - "denom_in": "string", - "denom_out": "string" - } - } - ``` - - - - -### `routes` - - - - - ```json - { - "routes": { - "limit"?: number | null, - "start_after"?: ["string", "string"] | null - } - } - ``` - - - - -### `estimate_exact_in_swap` - - - - - ```json - { - "estimate_exact_in_swap": { - "coin_in": Coin, - "denom_out": "string" - } - } - ``` - - - - -#### `Coin` - -See [above](#coin). diff --git a/docs/develop/contracts/red-bank/swapper/osmosis.mdx b/docs/develop/contracts/red-bank/swapper/osmosis.mdx deleted file mode 100644 index a9e14f7..0000000 --- a/docs/develop/contracts/red-bank/swapper/osmosis.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -sidebar_position: 3 ---- - -# osmosis - -## Links - -- **Deployments**: -- **Types**: - - **Rust**: - - **Typescript**: -- **Contract repo**: -- **Audits**: https://github.com/mars-protocol/mars-audits - -## `OsmosisRoute` - - - - - ```json - OsmosisRoute = SwapAmountInRoute[] - ``` - - - - -### `SwapAmountInRoute` - - - - - ```json - { - "pool_id": number, - "token_out_denom": "string" - } - ``` - - - diff --git a/docs/develop/contracts/red-bank/swapper/swapper-intro.mdx b/docs/develop/contracts/red-bank/swapper/swapper-intro.mdx deleted file mode 100644 index 7733d6d..0000000 --- a/docs/develop/contracts/red-bank/swapper/swapper-intro.mdx +++ /dev/null @@ -1,10 +0,0 @@ -import Admonition from '@theme/Admonition' - -# Swapper - -[`mars-swapper-base`](./base) contains chain-agnostic logics for the swapper contract. Each chain specific implementation should implement its own route struct that should implement the `mars_swapper_base::Route` trait and then use the `mars_swapper_base::SwapBase` to implement the entry point functions. See [`mars-swapper-osmosis`](./osmosis) for an example. Each chain specific swapper will thus implement the same API. - - -The swapper contracts should NEVER hold any funds and any funds sent to the contract except as part of executing the SwapExactIn message can be stolen by an attacker. See [Oak Audit 2023-08-01](https://github.com/oak-security/audit-reports/blob/master/Mars/2023-08-01%20Audit%20Report%20-%20Mars%20Red%20Bank%20Updates%20v1.0.pdf) issue 14. - - diff --git a/docs/develop/contracts/rover/_category_.json b/docs/develop/contracts/rover/_category_.json deleted file mode 100644 index 8e0e688..0000000 --- a/docs/develop/contracts/rover/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Rover", - "position": 2, - "link": { "type": "doc", "id": "rover-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/rover/account-nft.mdx b/docs/develop/contracts/rover/account-nft.mdx deleted file mode 100644 index c85e234..0000000 --- a/docs/develop/contracts/rover/account-nft.mdx +++ /dev/null @@ -1,2291 +0,0 @@ ---- -sidebar_position: 1 ---- - -# account-nft - -## Links - -- **Deployments**: https://github.com/mars-protocol/rover/tree/master/scripts/deploy/addresses -- **Types**: - - **Rust**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/packages/rover/src/adapters/account_nft/msg - - **Typescript**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/scripts/types/generated/mars-account-nft -- **Contract repo**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/contracts/account-nft -- **Audits**: https://github.com/mars-protocol/mars-audits/tree/main/rover - -## InstantiateMsg - - - - - ```ts types.ts - type Uint128 = string - - interface InstantiateMsg { - max_value_for_burn: Uint128 - minter: string - name: string - symbol: string - } - ``` - - {/* ```json json - { - "max_value_for_burn": "123", - "name": "...", - "symbol": "...", - "minter": "..." - } - ``` - - ```rust instantiate.rs - #[cw_serde] - pub struct InstantiateMsg { - pub max_value_for_burn: Uint128, - pub name: String, - pub symbol: String, - pub minter: String, - } - ``` */} - - - -{/* | **Params** | **Type** | **Description** | -| ----------- | ----------- | ----------- | -| [`max_value_for_burn`](focus://json#2) | `Uint128` | The maximum value of Debts + Collaterals (denominated in base token) for an account before burns are disallowed for the NFT. Meant to prevent accidental account deletions | -| [`name`](focus://json#3) | `String` | Name of the NFT contract | -| [`symbol`](focus://json#4) | `String` | Symbol of the NFT contract | -| [`minter`](focus://json#5) | `String` | The minter is the only one who can create new NFTs. Initially this likely will be the contract deployer. However, this role should be transferred through a config update to the Credit Manager. It is separate because some blockchains are permissioned and contracts go through governance and are instantiated separately. | */} - - - -## ExecuteMsg - -### `update_config` - -Update config in storage. Only minter can execute. - - - - - ```ts types.ts - type ExecuteMsg = - { - update_config: { - updates: NftConfigUpdates - } - } - ``` - - {/* ```json json - { - "update_config": { - "updates": { - "max_value_for_burn": "123", - "proposed_new_minter": "..." - } - } - } - ``` - - ```rust execute.rs focus=1:5,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -#### `NftConfigUpdates` - - - - - ```ts types.ts - interface NftConfigUpdates { - max_value_for_burn?: Uint128 | null - proposed_new_minter?: string | null - } - ``` - - {/* ```json json - { - "max_value_for_burn": "123", - "proposed_new_minter": "..." - } - ``` - - ```rust nft_config.rs - #[cw_serde] - pub struct NftConfigUpdates { - pub max_value_for_burn: Option, - pub proposed_new_minter: Option, - } - ``` */} - - - - -### `accept_minter_role` - -Accept the proposed minter role. Only the proposed new minter can execute. - - - - - ```ts types.ts - type ExecuteMsg = - { - accept_minter_role: {} - } - ``` - - {/* ```json json - { - "accept_minter_role": {} - } - ``` - - ```rust execute.rs focus=1:2,6,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -### `mint` - -Mint a new NFT to the specified user; can only be called by the contract minter. - - - - - ```ts types.ts - type ExecuteMsg = - { - mint: { - user: string - } - } - ``` - - {/* ```json json - { - "mint": { - "user": "..." - } - } - ``` - - ```rust execute.rs focus=1:2,7:9,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -### `burn` - -Burn an NFT the sender has access to. Will attempt to query the Credit Manager first to ensure the balance is below the config set threshold. - - - - - ```ts types.ts - type ExecuteMsg = - { - burn: { - token_id: string - } - } - ``` - - {/* ```json json - { - "burn": { - "token_id": "..." - } - } - ``` - - ```rust execute.rs focus=1:2,10:12,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -## ExecuteMsg (cw721) - -### `transfer_nft` - -Transfer is a base message to move a token to another account without triggering actions. - - - - - ```ts types.ts - type ExecuteMsg = - { - transfer_nft: { - recipient: string - token_id: string - } - } - ``` - - {/* ```json json - { - "transfer_nft": { - "recipient": "...", - "token_id": "..." - } - } - ``` - - ```rust execute.rs focus=1:2,13:16,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -### `send_nft` - -Send is a base message to transfer a token to a contract and trigger an action on the receiving contract. - - - - - ```ts types.ts - type Binary = string - - type ExecuteMsg = - { - send_nft: { - contract: string - msg: Binary - token_id: string - } - } - ``` - - {/* ```json json - { - "send_nft": { - "contract": "...", - "token": "...", - "msg": "" - } - } - ``` - - ```rust execute.rs focus=1:2,17:21,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -### `approve` - -Allows operator to transfer/send the token from the owner's account. If expiration is set, then this allowance has a time/height limit. - - - - - ```ts types.ts - type ExecuteMsg = - { - approve: { - expires?: Expiration | null - spender: string - token_id: string - } - } - ``` - - {/* ```json json - { - "approve": { - "spender": "...", - "token_id": "...", - "expires": { - "never": {} - } - } - } - ``` - - ```rust execute.rs focus=1:2,22:26,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -#### `Expiration` - - - - - ```ts types.ts - type Timestamp = Uint64 - - type Expiration = - | { - at_height: number - } - | { - at_time: Timestamp - } - | { - never: {} - } - ``` - - {/* ```rust cw_utils - pub enum Expiration { - AtHeight(u64), - AtTime(Timestamp), - Never {}, - } - ``` */} - - - - -### `revoke` - -Remove previously granted Approval. - - - - - ```ts types.ts - type ExecuteMsg = - { - revoke: { - spender: string - token_id: string - } - } - ``` - - {/* ```json json - { - "revoke": { - "spender": "...", - "token_id": "..." - } - } - ``` - - ```rust execute.rs focus=1:2,27:30,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -### `approve_all` - -Allows operator to transfer/send any token from the owner's account. If expiration is set, then this allowance has a time/height limit. - - - - - ```ts types.ts - type ExecuteMsg = - { - approve_all: { - expires?: Expiration | null - operator: string - } - } - ``` - - {/* ```json json - { - "approve_all": { - "operator": "...", - "expires": { - "never": {} - } - } - } - ``` - - ```rust execute.rs focus=1:2,31:34,38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -### `revoke_all` - -Remove previously granted ApproveAll permission. - - - - - ```ts types.ts - type ExecuteMsg = - { - revoke_all: { - operator: string - } - } - ``` - - {/* ```json json - { - "revoke_all": { - "operator": "..." - } - } - ``` - - ```rust execute.rs focus=1:2,35:38 - #[cw_serde] - pub enum ExecuteMsg { - UpdateConfig { - updates: NftConfigUpdates, - }, - AcceptMinterRole {}, - Mint { - user: String, - }, - Burn { - token_id: String, - }, - TransferNft { - recipient: String, - token_id: String, - }, - SendNft { - contract: String, - token_id: String, - msg: Binary, - }, - Approve { - spender: String, - token_id: String, - expires: Option, - }, - Revoke { - spender: String, - token_id: String, - }, - ApproveAll { - operator: String, - expires: Option, - }, - RevokeAll { - operator: String, - }, - } - ``` */} - - - - -## QueryMsg - -### `config` - -Queries the contracts configuration. - - - - - ```ts types.ts - type QueryMsg = - { - config: {} - } - ``` - - {/* ```json json - { - "config": {} - } - ``` - - ```rust query.rs focus=1:5,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `UncheckedNftConfig` (Response) - - - - - ```json json - { - "max_value_for_burn": "123", - "proposed_new_minter": "...", - } - ``` - - ```rust nft_config.rs - pub type UncheckedNftConfig = NftConfigBase; - - #[cw_serde] - pub struct NftConfigBase { - pub max_value_for_burn: Uint128, - pub proposed_new_minter: Option, - } - ``` - - - */} - -### `next_id` - -Queries the next token ID. - - - - - ```ts types.ts - type QueryMsg = - { - next_id: {} - } - ``` - - {/* ```json json - { - "next_id": {} - } - ``` - - ```rust query.rs focus=1:3,6:7,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* Returns `Uint128` */} - -## QueryMsg (cw721) - -### `owner_of` - -Queries the owner of the given token, error if token does not exist. - - - - - ```ts types.ts - type QueryMsg = - { - owner_of: { - include_expired?: boolean | null - token_id: string - } - } - ``` - - {/* ```json json - { - "owner_of": { - "token_id": "...", - "include_expired": false - } - } - ``` - - ```rust query.rs focus=1:3,8:12,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `OwnerOfResponse` - - - - - ```json json - { - "owner": "...", - "approvals": [ - { - "spender": "...", - "expires": { - "never": {} - } - }, - etc... - ] - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct OwnerOfResponse { - /// Owner of the token - pub owner: String, - /// If set this address is approved to transfer/send the token as well - pub approvals: Vec, - } - ``` - - - - -#### `Approval` - - - - - ```json json - { - "spender": "...", - "expires": { - "never": {} - } - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct Approval { - /// Account that can transfer/send the token - pub spender: String, - /// When the Approval expires (maybe Expiration::never) - pub expires: Expiration, - } - ``` - - - */} - -### `approval` - -Queries the operator that can access all of the owner's tokens. - - - - - ```ts types.ts - type QueryMsg = - { - approval: { - include_expired?: boolean | null - spender: string - token_id: string - } - } - ``` - - {/* ```json json - { - "approval": { - "token_id": "...", - "spender": "...", - "include_expired": false - } - } - ``` - - ```rust query.rs focus=1:3,13:18,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `ApprovalResponse` - - - - - ```json json - { - "approval": { - "spender": "...", - "expires": { - "never": {} - } - } - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct ApprovalResponse { - pub approval: Approval, - } - ``` - - - */} - -### `approvals` - -Queries approvals that a token has. - - - - - ```ts types.ts - type QueryMsg = - { - approvals: { - include_expired?: boolean | null - token_id: string - } - } - ``` - - {/* ```json json - { - "approvals": { - "token_id": "...", - "include_expired": "false" - } - } - ``` - - ```rust query.rs focus=1:3,19:23,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `ApprovalsResponse` - - - - - ```json json - { - "approvals": [ - { - "spender": "...", - "expires": { - "never": {} - } - }, - etc... - ] - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct ApprovalsResponse { - pub approvals: Vec, - } - ``` - - - */} - -### `all_operators` - -List all operators that can access all of the owner's tokens. - - - - - ```ts types.ts - type QueryMsg = - { - all_operators: { - include_expired?: boolean | null - limit?: number | null - owner: string - start_after?: string | null - } - } - ``` - - {/* ```json json - { - "all_operators": { - "owner": "...", - "include_expired": false, - "start_after": "...", - "limit": 123 - } - } - ``` - - ```rust query.rs focus=1:3,24:30,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `OperatorsResponse` - - - - - ```json json - { - "operators": [ - { - "spender": "...", - "expires": { - "never": {} - } - }, - etc... - ] - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct OperatorsResponse { - pub operators: Vec, - } - ``` - - - */} - -### `num_tokens` - -Total number of tokens issued. - - - - - ```ts types.ts - type QueryMsg = - { - num_tokens: {} - } - ``` - - {/* ```json json - { - "num_tokens": {} - } - ``` - - ```rust query.rs focus=1:3,31:32,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `NumTokensResponse` - - - - - ```json json - { - "count": "123" - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct NumTokensResponse { - pub count: u64, - } - ``` - - - */} - -### `contract_info` - -Queries top-level metadata about the contract. - - - - - ```ts types.ts - type QueryMsg = - { - contract_info: {} - } - ``` - - {/* ```json json - { - "contract_info": {} - } - ``` - - ```rust query.rs focus=1:3,33:34,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `ContractInfoResponse` - - - - - ```json json - { - "name": "...", - "symbol": "..." - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct ContractInfoResponse { - pub name: String, - pub symbol: String, - } - ``` - - - */} - -### `nft_info` - -Queries metadata about one particular token, based on ERC721 Metadata JSON Schema but directly from the contract. - - - - - ```ts types.ts - type QueryMsg = - { - nft_info: { - token_id: string - } - } - ``` - - {/* ```json json - { - "token_id": "..." - } - ``` - - ```rust query.rs focus=1:3,35:38,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `NftInfoResponse` - - - - - ```json json - { - "token_uri": "..." - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct NftInfoResponse { - /// Universal resource identifier for this NFT - /// Should point to a JSON file that conforms to the ERC721 - /// Metadata JSON Schema - pub token_uri: Option, - /// You can add any custom metadata here when you extend cw721-base - pub extension: Empty, - } - ``` - - - */} - -### `all_nft_info` - -Returns the result of both `NftInfo` and `OwnerOf` as one query as an optimization for clients. - - - - - ```ts types.ts - export type QueryMsg = - { - all_nft_info: { - include_expired?: boolean | null - token_id: string - } - } - ``` - - {/* ```json json - { - "all_nft_info": { - "token_id": "...", - "include_expired": false - } - } - ``` - - ```rust query.rs focus=1:3,39:43,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `AllNftInfoResponse` - - - - - ```json json - { - "access": { - "owner": "...", - "approvals": [ - { - "spender": "...", - "expires": { - "never": {} - } - }, - etc... - ] - }, - "info": { - "token_uri": "..." - } - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct AllNftInfoResponse { - /// Who can transfer the token - pub access: OwnerOfResponse, - /// Data on the token itself, - pub info: NftInfoResponse, - } - ``` - - - */} - -### `tokens` - -Queries all tokens owned by the given address, `[]` if unset. - - - - - ```ts types.ts - type QueryMsg = - { - tokens: { - limit?: number | null - owner: string - start_after?: string | null - } - } - ``` - - {/* ```json json - { - "tokens": { - "owner": "...", - "start_after": "...", - "limit": 10 - } - } - ``` - - ```rust query.rs focus=1:3,44:49,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `TokensResponse` - - - - - ```json json - { - "tokens": [ - { - "...", - "...", - etc... - } - ] - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct TokensResponse { - /// Contains all token_ids in lexicographical ordering - /// If there are more than `limit`, use `start_from` in future queries - /// to achieve pagination. - pub tokens: Vec, - } - ``` - - - */} - - -### `all_tokens` - -Lists all `token_ids` controlled by the contract. - - - - - ```ts types.ts - type QueryMsg = - { - all_tokens: { - limit?: number | null - start_after?: string | null - } - } - ``` - - {/* ```json json - { - "all_tokens": { - "start_after": "...", - "limit": 10 - } - } - ``` - - ```rust query.rs focus=1:3,50:54,57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* Returns [`TokensResponse`](#tokensresponse) */} - -### `minter` - -Queries the minter. - - - - - ```ts types.ts - type QueryMsg = - { - minter: {} - } - ``` - - {/* ```json json - { - "minter": {} - } - ``` - - ```rust query.rs focus=1:3,55:57 - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(crate::adapters::account_nft::UncheckedNftConfig)] - Config {}, - #[returns(u64)] - NextId {}, - #[returns(cw721::OwnerOfResponse)] - OwnerOf { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalResponse)] - Approval { - token_id: String, - spender: String, - include_expired: Option, - }, - #[returns(cw721::ApprovalsResponse)] - Approvals { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::OperatorsResponse)] - AllOperators { - owner: String, - include_expired: Option, - start_after: Option, - limit: Option, - }, - #[returns(cw721::NumTokensResponse)] - NumTokens {}, - #[returns(cw721::ContractInfoResponse)] - ContractInfo {}, - #[returns(cw721::NftInfoResponse)] - NftInfo { - token_id: String, - }, - #[returns(cw721::AllNftInfoResponse)] - AllNftInfo { - token_id: String, - include_expired: Option, - }, - #[returns(cw721::TokensResponse)] - Tokens { - owner: String, - start_after: Option, - limit: Option, - }, - #[returns(cw721::TokensResponse)] - AllTokens { - start_after: Option, - limit: Option, - }, - #[returns(cw721_base::MinterResponse)] - Minter {}, - } - ``` */} - - - - -{/* #### `MinterResponse` - - - - - ```json json - { - "minter": "..." - } - ``` - - ```rust cw721_base - pub struct MinterResponse { - pub minter: String, - } - ``` - - - */} \ No newline at end of file diff --git a/docs/develop/contracts/rover/credit-manager.mdx b/docs/develop/contracts/rover/credit-manager.mdx deleted file mode 100644 index 421306e..0000000 --- a/docs/develop/contracts/rover/credit-manager.mdx +++ /dev/null @@ -1,2871 +0,0 @@ ---- -sidebar_position: 2 ---- - -# credit-manager - -## Links - -- **Deployments**: https://github.com/mars-protocol/rover/tree/master/scripts/deploy/addresses -- **Types**: - - **Rust**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/packages/rover/src/msg - - **Typescript**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/scripts/types/generated/mars-credit-manager -- **Contract repo**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/contracts/credit-manager -- **Audits**: https://github.com/mars-protocol/mars-audits/tree/main/rover - -## InstantiateMsg - - - - - {/* ```json json - { - "owner": "...", - "allowed_coins": [ - "...", - "...", - etc... - ], - "vault_configs": [ - { - "vault": { - "address": "..." - }, - "config": { - "deposit_cap": { - "denom": "...", - "amount": "123" - }, - "max_ltv": "0.123", - "liquidation_threshold": "0.123", - "whitelisted": true, - } - }, - etc... - ], - "red_bank": "...", - "oracle": "...", - "max_close_factor": "0.123", - "max_unlocking_positions": "123", - "swapper": "...", - "zapper": "..." - } - ``` */} - - ```typescript types.ts - type Decimal = string - type Uint128 = string - type OracleBaseForString = string - type RedBankBaseForString = string - type SwapperBaseForString = string - type ZapperBaseForString = string - - interface InstantiateMsg { - allowed_coins: string[] - max_close_factor: Decimal - max_unlocking_positions: Uint128 - oracle: OracleBaseForString - owner: string - red_bank: RedBankBaseForString - swapper: SwapperBaseForString - vault_configs: VaultInstantiateConfig[] - zapper: ZapperBaseForString - } - ``` - - {/* ```rust instantiate.rs - #[cw_serde] - pub struct InstantiateMsg { - /// The address with privileged access to update config - pub owner: String, - /// Whitelisted coin denoms approved by governance - pub allowed_coins: Vec, - /// Vaults approved by governance that implement credit manager's vault interface - /// Includes a deposit cap that enforces a TLV limit for risk mitigation - pub vault_configs: Vec, - /// The Mars Protocol money market contract where we borrow assets from - pub red_bank: RedBankUnchecked, - /// The Mars Protocol oracle contract. We read prices of assets here. - pub oracle: OracleUnchecked, - /// The maximum percent a liquidator can decrease the debt amount of the liquidatee - pub max_close_factor: Decimal, - /// The maximum number of unlocking positions an account can have simultaneously - /// Note: As health checking requires looping through each, this number must not be too large. - /// If so, having too many could prevent the account from being liquidated due to gas constraints. - pub max_unlocking_positions: Uint128, - /// Helper contract for making swaps - pub swapper: SwapperUnchecked, - /// Helper contract for adding/removing liquidity - pub zapper: ZapperUnchecked, - } - ``` */} - - - - -#### `VaultInstantiateConfig` - - - - - ```ts types.ts - interface VaultInstantiateConfig { - config: VaultConfig - vault: VaultBaseForString - } - ``` - - {/* ```json json - { - "vault": { - "address": "..." - }, - "config": { - "deposit_cap": { - "denom": "...", - "amount": "123" - }, - "max_ltv": "0.123", - "liquidation_threshold": "0.123", - "whitelisted": true, - } - } - ``` - - ```rust instantiate.rs - #[cw_serde] - pub struct VaultInstantiateConfig { - pub vault: VaultUnchecked, - pub config: VaultConfig, - } - ``` */} - - - - -#### `VaultConfig` - - - - - ```ts types.ts - interface VaultConfig { - deposit_cap: Coin - liquidation_threshold: Decimal - max_ltv: Decimal - whitelisted: boolean - } - ``` - - {/* ```json json - { - "deposit_cap": { - "denom": "...", - "amount": "123" - }, - "max_ltv": "0.123", - "liquidation_threshold": "0.123", - "whitelisted": true, - } - ``` - - ```rust config.rs - #[cw_serde] - pub struct VaultConfig { - pub deposit_cap: Coin, - pub max_ltv: Decimal, - pub liquidation_threshold: Decimal, - pub whitelisted: bool, - } - ``` */} - - - - -#### `Coin` - - - - - ```ts types.ts - interface VaultConfig { - deposit_cap: Coin - liquidation_threshold: Decimal - max_ltv: Decimal - whitelisted: boolean - } - ``` - - - - - -#### `VaultBaseForString` - - - - - ```ts types.ts - interface VaultBaseForString { - address: string - } - ``` - - - - -## ExecuteMsg - -### `create_credit_account` - -Mints NFT representing a credit account for user. User can have many. - - - - - ```ts types.ts - type ExecuteMsg = - { - create_credit_account: {} - } - ``` - - {/* ```json json - { - "create_credit_account": {} - } - ``` - - ```rust execute.rs - #[cw_serde] - pub enum ExecuteMsg { - CreateCreditAccount {}, - UpdateCreditAccount { - account_id: String, - actions: Vec, - }, - UpdateConfig { - updates: ConfigUpdates, - }, - UpdateOwner(OwnerUpdate), - UpdateNftConfig { - updates: NftConfigUpdates, - }, - Callback(CallbackMsg), - } - ``` */} - - - - -### `update_credit_account` - -Update user's position on their credit account. - - - - - ```ts types.ts - type ExecuteMsg = - { - update_credit_account: { - account_id: string - actions: Action[] - } - } - ``` - - {/* ```json json - { - "update_credit_account": { - "account_id": "...", - "actions": [ - { - "enter_vault": { - "vault": { - "address": "..." - }, - "coin": { - "denom": "...", - "amount": { - "exact": "12345" - } - } - } - }, - etc... - ] - } - } - ``` - - ```rust execute.rs - #[cw_serde] - pub enum ExecuteMsg { - CreateCreditAccount {}, - UpdateCreditAccount { - account_id: String, - actions: Vec, - }, - UpdateConfig { - updates: ConfigUpdates, - }, - UpdateOwner(OwnerUpdate), - UpdateNftConfig { - updates: NftConfigUpdates, - }, - Callback(CallbackMsg), - } - ``` */} - - - - -#### `Action` - - - - - ```ts types.ts - type Action = - | { - deposit: Coin - } - | { - withdraw: Coin - } - | { - borrow: Coin - } - | { - repay: ActionCoin - } - | { - enter_vault: { - coin: ActionCoin - vault: VaultBaseForString - } - } - | { - exit_vault: { - amount: Uint128 - vault: VaultBaseForString - } - } - | { - request_vault_unlock: { - amount: Uint128 - vault: VaultBaseForString - } - } - | { - exit_vault_unlocked: { - id: number - vault: VaultBaseForString - } - } - | { - liquidate_coin: { - debt_coin: Coin - liquidatee_account_id: string - request_coin_denom: string - } - } - | { - liquidate_vault: { - debt_coin: Coin - liquidatee_account_id: string - position_type: VaultPositionType - request_vault: VaultBaseForString - } - } - | { - swap_exact_in: { - coin_in: ActionCoin - denom_out: string - slippage: Decimal - } - } - | { - provide_liquidity: { - coins_in: ActionCoin[] - lp_token_out: string - minimum_receive: Uint128 - } - } - | { - withdraw_liquidity: { - lp_token: ActionCoin - } - } - | { - refund_all_coin_balances: {} - } - ``` - -{/* - ```rust execute.rs - #[cw_serde] - pub enum Action { - /// Deposit coin of specified denom and amount. Verifies if the correct amount is sent with transaction. - Deposit(Coin), - /// Withdraw coin of specified denom and amount - Withdraw(Coin), - /// Borrow coin of specified amount from Red Bank - Borrow(Coin), - /// Repay coin of specified amount back to Red Bank. If `amount: AccountBalance` is passed, - /// the repaid amount will be the minimum between account balance for denom and total owed. - Repay(ActionCoin), - /// Deposit coins into vault strategy - /// If `coin.amount: AccountBalance`, Rover attempts to deposit the account's entire balance into the vault - EnterVault { - vault: VaultUnchecked, - coin: ActionCoin, - }, - /// Withdraw underlying coins from vault - ExitVault { - vault: VaultUnchecked, - amount: Uint128, - }, - /// Requests unlocking of shares for a vault with a required lock period - RequestVaultUnlock { - vault: VaultUnchecked, - amount: Uint128, - }, - /// Withdraws the assets for unlocking position id from vault. Required time must have elapsed. - ExitVaultUnlocked { - id: u64, - vault: VaultUnchecked, - }, - /// Pay back debt of a liquidatable rover account for a bonus. Requires specifying 1) the debt - /// denom/amount of what the liquidator wants to payoff and 2) the request coin denom which the - /// liquidatee should have a balance of. The amount returned to liquidator will be the request coin - /// of the amount that precisely matches the value of the debt + a liquidation bonus. - /// The debt amount will be adjusted down if: - /// - Exceeds liquidatee's total debt for denom - /// - Not enough liquidatee request coin balance to match - /// - The value of the debt repaid exceeds the maximum close factor % - LiquidateCoin { - /// The credit account id of the one with a liquidation threshold health factor 1 or below - liquidatee_account_id: String, - /// The coin debt that the liquidator wishes to pay back on behalf of the liquidatee. - /// The liquidator must already have these assets in their credit account. - debt_coin: Coin, - /// The coin they wish to acquire from the liquidatee (amount returned will include the bonus) - request_coin_denom: String, - }, - /// Pay back debt of a liquidatable rover account for a via liquidating a vault position. - /// Similar to LiquidateCoin {} msg and will make similar adjustments to the request. - /// The vault position will be withdrawn (and force withdrawn if a locked vault position) and - /// the underlying assets will transferred to the liquidator. - /// The `VaultPositionType` will determine which bucket to liquidate from. - LiquidateVault { - liquidatee_account_id: String, - debt_coin: Coin, - request_vault: VaultUnchecked, - position_type: VaultPositionType, - }, - /// Perform a swapper with an exact-in amount. Requires slippage allowance %. - /// If `coin_in.amount: AccountBalance`, the accounts entire balance of `coin_in.denom` will be used. - SwapExactIn { - coin_in: ActionCoin, - denom_out: String, - slippage: Decimal, - }, - /// Add Vec to liquidity pool in exchange for LP tokens - ProvideLiquidity { - coins_in: Vec, - lp_token_out: String, - minimum_receive: Uint128, - }, - /// Send LP token and withdraw corresponding reserve assets from pool. - /// If `lp_token.amount: AccountBalance`, the account balance of `lp_token.denom` will be used. - WithdrawLiquidity { - lp_token: ActionCoin, - }, - /// Refunds all coin balances back to user wallet - RefundAllCoinBalances {}, - } - ``` */} - - - - - -#### `ActionCoin` - - - - - ```ts types.ts - interface ActionCoin { - amount: ActionAmount - denom: string - } - ``` - - - - - -#### `ActionAmount` - - - - - ```ts types.ts - type ActionAmount = - | 'account_balance' - | { - exact: Uint128 - } - ``` - - - - -#### `VaultPositionType` - - - - - ```ts types.ts - type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g' - ``` - - - - -### `update_config` - -Update contract config constants. - - - - - ```ts types.ts - type ExecuteMsg = - { - update_config: { - updates: ConfigUpdates - } - } - ``` - -{/* - ```json json - { - "update_config": { - "updates": { - "account_nft": "...", - "allowed_coins": [ "...", "...", "..." ], - "pvault_configs": [ - { - "vault": { - "address": "..." - }, - "config": { - "deposit_cap": { - "denom": "...", - "amount": "123" - }, - "max_ltv": "0.123", - "liquidation_threshold": "0.123", - "whitelisted": true, - } - } - ] - "oracle": "...", - "max_close_factor": "0.123", - "max_unlocking_positions": "123", - "swapper": "...", - "zapper": "..." - } - } - } - ``` - - ```rust execute.rs - #[cw_serde] - pub enum ExecuteMsg { - CreateCreditAccount {}, - UpdateCreditAccount { - account_id: String, - actions: Vec, - }, - UpdateConfig { - updates: ConfigUpdates, - }, - UpdateOwner(OwnerUpdate), - UpdateNftConfig { - updates: NftConfigUpdates, - }, - Callback(CallbackMsg), - } - ``` */} - - - - - -#### `ConfigUpdates` - -Used when you want to update fields on Instantiate config. - - ```ts types.ts - interface ConfigUpdates { - account_nft?: string | null - allowed_coins?: string[] | null - max_close_factor?: Decimal | null - max_unlocking_positions?: Uint128 | null - oracle?: OracleBaseForString | null - swapper?: SwapperBaseForString | null - vault_configs?: VaultInstantiateConfig[] | null - zapper?: ZapperBaseForString | null - } - ``` - - {/* ```json json - { - "account_nft": "...", - "allowed_coins": [ "...", "...", "..." ], - "pvault_configs": [ - { - "vault": { - "address": "..." - }, - "config": { - "deposit_cap": { - "denom": "...", - "amount": "123" - }, - "max_ltv": "0.123", - "liquidation_threshold": "0.123", - "whitelisted": true, - } - } - ] - "oracle": "...", - "max_close_factor": "0.123", - "max_unlocking_positions": "123", - "swapper": "...", - "zapper": "..." - } - ``` - - ```rust instantiate.rs - #[cw_serde] - #[derive(Default)] - pub struct ConfigUpdates { - pub account_nft: Option, - pub allowed_coins: Option>, - pub vault_configs: Option>, - pub oracle: Option, - pub max_close_factor: Option, - pub max_unlocking_positions: Option, - pub swapper: Option, - pub zapper: Option, - } - ``` */} - -### `update_owner` - -Manages owner role state. - - - - - ```ts types.ts - type ExecuteMsg = - { - update_owner: OwnerUpdate - } - ``` - - - - // ```json json - // { - // "update_owner": { - // "propose_new_owner": { - // "proposed": "..." - // } - // } - // } - // ``` - - // ```rust execute.rs - // #[cw_serde] - // pub enum ExecuteMsg { - // CreateCreditAccount {}, - // UpdateCreditAccount { - // account_id: String, - // actions: Vec, - // }, - // UpdateConfig { - // updates: ConfigUpdates, - // }, - // UpdateOwner(OwnerUpdate), - // UpdateNftConfig { - // updates: NftConfigUpdates, - // }, - // Callback(CallbackMsg), - // } - // ``` - - - - -#### `OwnerUpdate` - - - - - ```ts types.ts - type OwnerUpdate = - | { - propose_new_owner: { - proposed: string - } - } - | 'clear_proposed' - | 'accept_proposed' - | 'abolish_owner_role' - ``` - - {/* ```rust mars_owner - pub enum OwnerUpdate { - ProposeNewOwner { - proposed: String, - }, - ClearProposed, - AcceptProposed, - AbolishOwnerRole, - } - ``` */} - - - - -### `update_nft_config` - -Update nft contract config. - - - - - ```ts types.ts - type ExecuteMsg = - { - update_nft_config: { - updates: NftConfigUpdates - } - } - ``` - - {/* ```json json - { - "update_nft_config": { - "updates": { - "max_value_for_burn": "12345", - "proposed_new_minter": "..." - } - } - } - ``` - - ```rust execute.rs - #[cw_serde] - pub enum ExecuteMsg { - CreateCreditAccount {}, - UpdateCreditAccount { - account_id: String, - actions: Vec, - }, - UpdateConfig { - updates: ConfigUpdates, - }, - UpdateOwner(OwnerUpdate), - UpdateNftConfig { - updates: NftConfigUpdates, - }, - Callback(CallbackMsg), - } - ``` */} - - - - -#### `NftConfigUpdates` - - - - - ```ts types.ts - interface NftConfigUpdates { - max_value_for_burn?: Uint128 | null - proposed_new_minter?: string | null - } - ``` - - {/* ```json json - { - "max_value_for_burn": "12345", - "proposed_new_minter": "..." - } - ``` - - ```rust nft_config.rs - #[cw_serde] - pub struct NftConfigUpdates { - pub max_value_for_burn: Option, - pub proposed_new_minter: Option, - } - ``` */} - - - - -### `callback` - -Internal actions only callable by the contract itself. - - - - - ```ts types.ts - type ExecuteMsg = - { - callback: CallbackMsg - } - ``` - - {/* ```json json - { - "callback": { - "enter_vault": { - "account_id": "...", - "vault": { - "address": "..." - }, - "coin": { - "denom": "...", - "amount": { - "exact": "..." - } - } - } - } - } - ``` - - ```rust execute.rs - #[cw_serde] - pub enum ExecuteMsg { - CreateCreditAccount {}, - UpdateCreditAccount { - account_id: String, - actions: Vec, - }, - UpdateConfig { - updates: ConfigUpdates, - }, - UpdateOwner(OwnerUpdate), - UpdateNftConfig { - updates: NftConfigUpdates, - }, - Callback(CallbackMsg), - } - ``` */} - - - - -#### `CallbackMsg` - -Internal actions made by the contract with pre-validated inputs. - - - - - ```ts types.ts - type Addr = string - - type CallbackMsg = - | { - withdraw: { - account_id: string - coin: Coin - recipient: Addr - } - } - | { - borrow: { - account_id: string - coin: Coin - } - } - | { - repay: { - account_id: string - coin: ActionCoin - } - } - | { - assert_max_ltv: { - account_id: string - prev_health: Health - } - } - | { - enter_vault: { - account_id: string - coin: ActionCoin - vault: VaultBaseForAddr - } - } - | { - exit_vault: { - account_id: string - amount: Uint128 - vault: VaultBaseForAddr - } - } - | { - update_vault_coin_balance: { - account_id: string - previous_total_balance: Uint128 - vault: VaultBaseForAddr - } - } - | { - request_vault_unlock: { - account_id: string - amount: Uint128 - vault: VaultBaseForAddr - } - } - | { - exit_vault_unlocked: { - account_id: string - position_id: number - vault: VaultBaseForAddr - } - } - | { - liquidate_coin: { - debt_coin: Coin - liquidatee_account_id: string - liquidator_account_id: string - request_coin_denom: string - } - } - | { - liquidate_vault: { - debt_coin: Coin - liquidatee_account_id: string - liquidator_account_id: string - position_type: VaultPositionType - request_vault: VaultBaseForAddr - } - } - | { - swap_exact_in: { - account_id: string - coin_in: ActionCoin - denom_out: string - slippage: Decimal - } - } - | { - update_coin_balance: { - account_id: string - previous_balance: Coin - } - } - | { - provide_liquidity: { - account_id: string - coins_in: ActionCoin[] - lp_token_out: string - minimum_receive: Uint128 - } - } - | { - withdraw_liquidity: { - account_id: string - lp_token: ActionCoin - } - } - | { - assert_one_vault_position_only: { - account_id: string - } - } - | { - refund_all_coin_balances: { - account_id: string - } - } - ``` - - {/* ```rust execute.rs - #[cw_serde] - pub enum CallbackMsg { - /// Withdraw specified amount of coin from credit account; - /// Decrement the token's asset amount; - Withdraw { - account_id: String, - coin: Coin, - recipient: Addr, - }, - /// Borrow specified amount of coin from Red Bank; - /// Increase the token's coin amount and debt shares; - Borrow { - account_id: String, - coin: Coin, - }, - /// Repay coin of specified amount back to Red Bank; - /// Decrement the token's coin amount and debt shares; - /// If `coin.amount: AccountBalance` is passed, the repaid amount will be the minimum - /// between account balance for denom and total owed; - Repay { - account_id: String, - coin: ActionCoin, - }, - /// Assert MaxLTV is either: - /// - Healthy, if prior to actions MaxLTV health factor >= 1 or None - /// - Not further weakened, if prior to actions MaxLTV health factor < 1 - /// Emits a `position_changed` event. - #[serde(rename = "assert_max_ltv")] - AssertMaxLTV { - prev_health: Health, - account_id: String, - }, - /// Adds coin to a vault strategy - EnterVault { - account_id: String, - vault: Vault, - coin: ActionCoin, - }, - /// Exchanges vault LP shares for assets - ExitVault { - account_id: String, - vault: Vault, - amount: Uint128, - }, - /// Used to update the account balance of vault coins after a vault action has taken place - UpdateVaultCoinBalance { - vault: Vault, - /// Account that needs vault coin balance adjustment - account_id: String, - /// Total vault coin balance in Rover - previous_total_balance: Uint128, - }, - /// Requests unlocking of shares for a vault with a lock period - RequestVaultUnlock { - account_id: String, - vault: Vault, - amount: Uint128, - }, - /// Withdraws assets from vault for a locked position having a lockup period that has been fulfilled - ExitVaultUnlocked { - account_id: String, - vault: Vault, - position_id: u64, - }, - /// Pay back debts of a liquidatable rover account for a bonus - LiquidateCoin { - liquidator_account_id: String, - liquidatee_account_id: String, - debt_coin: Coin, - request_coin_denom: String, - }, - LiquidateVault { - liquidator_account_id: String, - liquidatee_account_id: String, - debt_coin: Coin, - request_vault: Vault, - position_type: VaultPositionType, - }, - /// Perform a swapper with an exact-in amount. Requires slippage allowance %. - /// If `coin_in.amount: AccountBalance`, the accounts entire balance of `coin_in.denom` will be used. - SwapExactIn { - account_id: String, - coin_in: ActionCoin, - denom_out: String, - slippage: Decimal, - }, - /// Used to update the coin balance of account after an async action - UpdateCoinBalance { - /// Account that needs coin balance adjustment - account_id: String, - /// Total balance for coin in Rover prior to withdraw - previous_balance: Coin, - }, - /// Add Vec to liquidity pool in exchange for LP tokens - ProvideLiquidity { - account_id: String, - coins_in: Vec, - lp_token_out: String, - minimum_receive: Uint128, - }, - /// Send LP token and withdraw corresponding reserve assets from pool. - /// If `lp_token.amount: AccountBalance`, the account balance of `lp_token.denom` will be used. - WithdrawLiquidity { - account_id: String, - lp_token: ActionCoin, - }, - /// Checks to ensure only one vault position is taken per credit account - AssertOneVaultPositionOnly { - account_id: String, - }, - /// Refunds all coin balances back to user wallet - RefundAllCoinBalances { - account_id: String, - }, - } - ``` */} - - - - -#### `Health` - - - - - ```ts types.ts - interface Health { - liquidation_health_factor?: Decimal | null - liquidation_threshold_adjusted_collateral: Uint128 - max_ltv_adjusted_collateral: Uint128 - max_ltv_health_factor?: Decimal | null - total_collateral_value: Uint128 - total_debt_value: Uint128 - } - ``` - - - -## QueryMsg - -### `config` - -Rover contract-level config. - - - - - ```ts types.ts - type QueryMsg = - { - config: {} - } - ``` -{/* - ```json json - { - "config": {} - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* #### `ConfigResponse` - - - - - ```json json - { - "owner": "...", - "proposed_new_owner": "...", - "account_nft": "...", - "red_bank": "...", - "oracle": "...", - "max_close_factor": "0.123", - "max_unlocking_positions": "12345", - "swapper": "...", - "zapper": "..." - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct ConfigResponse { - pub owner: Option, - pub proposed_new_owner: Option, - pub account_nft: Option, - pub red_bank: String, - pub oracle: String, - pub max_close_factor: Decimal, - pub max_unlocking_positions: Uint128, - pub swapper: String, - pub zapper: String, - } - ``` - - - */} - -### `vaults_info` - -Configs & deposit caps on vaults. - - - - - ```ts types.ts - type QueryMsg = - { - vaults_info: { - limit?: number | null - start_after?: VaultBaseForString | null - } - } - ``` - - {/* ```json json - { - "vaults_info": { - "start_after": { - "address": "..." - }, - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type [`VaultInfoResponse`](#vaultinforesponse). */} - -{/* #### `VaultInfoResponse` - - - - - ```json json - { - "vault": { - "address": "..." - }, - "config": { - "deposit_cap": { - "denom": "...", - "amount": "123" - }, - "max_ltv": "0.123", - "liquidation_threshold": "0.123", - "whitelisted": true, - }, - "utilization": { - "denom": "...", - "amount": "12345" - } - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct VaultInfoResponse { - pub vault: VaultUnchecked, - pub config: VaultConfig, - /// The amount the vault has been utilized, - /// denominated in the same denom set in the vault config's deposit cap - pub utilization: Coin, - } - ``` - - - */} - -### `allowed_coins` - -Whitelisted coins. - - - - - ```ts types.ts - type QueryMsg = - { - allowed_coins: { - limit?: number | null - start_after?: string | null - } - } - ``` - - {/* ```json json - { - "allowed_coins": { - "start_after": "...", - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type `String`. */} - -### `positions` - -All positions represented by token with value. - - - - - ```ts types.ts - type QueryMsg = - { - positions: { - account_id: string - } - } - ``` - - {/* ```json json - { - "positions": { - "account_id": "..." - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* #### `Positions` (response) - - - - - ```json json - { - "account_id": "...", - "deposits": [ - { - "denom": "...", - "amount": "12345" - }, - etc... - ], - "debts": [ - { - "amount": "12345", - "denom": "...", - "shares": "12345" - }, - etc... - ], - "vaults": [ - { - "vault": { - "address": "..." - }, - "amount": { - "unlocked": "12345" - } - }, - etc... - ] - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct Positions { - pub account_id: String, - pub deposits: Vec, - pub debts: Vec, - pub vaults: Vec, - } - ``` - - - */} - -{/* #### `DebtAmount` - - - - - ```json json - { - "denom": "...", - "shares": "12345", - "amount": "12345" - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct DebtAmount { - pub denom: String, - /// number of shares in debt pool - pub shares: Uint128, - /// amount of coins - pub amount: Uint128, - } - ``` - - - */} - -{/* #### `VaultPosition` - - - - - ```json json - { - "vault": { - "address": "..." - }, - "amount": { - "unlocked": "12345" - } - } - ``` - - ```rust position.rs - #[cw_serde] - pub struct VaultPosition { - pub vault: Vault, - pub amount: VaultPositionAmount, - } - ``` - - - - -#### `VaultPositionAmount` - - - - - ```rust amount.rs - #[cw_serde] - pub enum VaultPositionAmount { - Unlocked(VaultAmount), - Locking(LockingVaultAmount), - } - ``` - - - */} - -### `health` - -The health of the account represented by token. - - - - - ```ts types.ts - type QueryMsg = - { - health: { - account_id: string - } - } - ``` - - {/* ```json json - { - "health": { - "account_id": "..." - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* #### `HealthResponse` - - - - - ```json json - { - "total_debt_value": "12345", - "total_collateral_value": "12345", - "max_ltv_adjusted_collateral": "12456", - "liquidation_threshold_adjusted_collateral": "12345", - "max_ltv_health_factor": "0.123", - "liquidation_health_factor": "0.123", - "liquidatable": true, - "above_max_ltv": true - } - ``` - - ```rust health.rs - #[cw_serde] - pub struct HealthResponse { - pub total_debt_value: Uint128, - pub total_collateral_value: Uint128, - pub max_ltv_adjusted_collateral: Uint128, - pub liquidation_threshold_adjusted_collateral: Uint128, - pub max_ltv_health_factor: Option, - pub liquidation_health_factor: Option, - pub liquidatable: bool, - pub above_max_ltv: bool, - } - ``` - - - */} - -### `all_coin_balances` - -Enumerate coin balances for all token positions; `start_after` accepts (`account_id`, `denom`). - - - - - ```ts types.ts - type QueryMsg = - { - all_coin_balances: { - limit?: number | null - start_after?: [string, string] | null - } - } - ``` - - {/* ```json json - { - "all_coin_balances": { - "start_after": [ "...", "..." ], - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type [`CoinBalanceResponseItem`](#coinbalanceresponseitem). */} - -{/* #### `CoinBalanceResponseItem` - - - - - ```json json - { - "account_id": "...", - "denom": "...", - "amount": "12345" - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct CoinBalanceResponseItem { - pub account_id: String, - pub denom: String, - pub amount: Uint128, - } - ``` - - - */} - -### `all_debt_shares` - -Enumerate debt shares for all token positions; `start_after` accepts (`account_id`, `denom`). - - - - - ```ts types.ts - type QueryMsg = - { - all_debt_shares: { - limit?: number | null - start_after?: [string, string] | null - } - } - ``` - - {/* ```json json - { - "all_debt_shares": { - "start_after": [ "...", "..." ], - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type [`SharesResponseItem`](#sharesresponseitem). */} - -{/* #### `SharesResponseItem` - - - - - ```json json - { - "account_id": "...", - "denom": "...", - "shares": "12345" - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct SharesResponseItem { - pub account_id: String, - pub denom: String, - pub shares: Uint128, - } - ``` - - - */} - - -### `total_debt_shares` - -Total debt shares issued for Coin. - - - - - ```ts types.ts - type QueryMsg = - { - total_debt_shares: string - } - ``` - - {/* ```json json - { - "total_debt_shares": "..." - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* #### `DebtShares` (response) - - - - - ```json json - { - "denom": "...", - "shares": "12345" - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct DebtShares { - pub denom: String, - pub shares: Uint128, - } - ``` - - - */} - -### `all_total_debt_shares` - -Enumerate total debt shares for all supported coins; start_after accepts denom string. - - - - - ```ts types.ts - type QueryMsg = - { - all_total_debt_shares: { - limit?: number | null - start_after?: string | null - } - } - ``` - - {/* ```json json - { - "all_total_debt_shares": { - "start_after": "...", - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type [`DebtShares`](#debtshares). */} - -### `all_vault_positions` - -Enumerate all vault positions; start_after accepts (account_id, addr). - - - - - ```ts types.ts - type QueryMsg = - { - all_vault_positions: { - limit?: number | null - start_after?: [string, string] | null - } - } - ``` - - {/* ```json json - { - "all_vault_positions": { - "start_after": [ "...", "..." ], - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type [`VaultPositionResponseItem`](#vaultpositionresponseitem). */} - -{/* #### `VaultPositionResponseItem` - - - - - ```json json - { - "account_id": "...", - "position": { - "vault": { - "address": "..." - }, - "amount": { - "unlocked": "12345" - } - } - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct VaultPositionResponseItem { - pub account_id: String, - pub position: VaultPosition, - } - ``` - - - */} - -### `total_vault_coin_balance` - -Get total vault coin balance in Rover for vault. - - - - - ```ts types.ts - type QueryMsg = - { - total_vault_coin_balance: { - vault: VaultBaseForString - } - } - ``` - - {/* ```json json - { - "total_vault_coin_balance": { - "vault": { - "address": "..." - } - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns `Uint128`. */} - -### `all_total_vault_coin_balances` - -Enumerate all total vault coin balances; start_after accepts vault addr. - - - - - ```ts types.ts - type QueryMsg = - { - all_total_vault_coin_balances: { - limit?: number | null - start_after?: VaultBaseForString | null - } - } - ``` - - {/* ```json json - { - "all_total_vault_coin_balances": { - "start_after": { - "address": "..." - }, - "limit": 5 - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type `VaultWithBalance`. - -#### `VaultWithBalance` - - - - - ```json json - { - "vault": { - "address": "..." - }, - "balance": "12345" - } - ``` - - ```rust query.rs - #[cw_serde] - pub struct VaultWithBalance { - pub vault: Vault, - pub balance: Uint128, - } - ``` - - - */} - -### `estimate_provide_liquidity` - -Estimate how many LP tokens received in exchange for coins provided for liquidity. - - - - - ```ts types.ts - type QueryMsg = - { - estimate_provide_liquidity: { - coins_in: Coin[] - lp_token_out: string - } - } - ``` - - {/* ```json json - { - "estimate_provide_liquidity": { - "lp_token_out": "...", - "coins_in": [ - { - "denom": "...", - "amount": "12345" - }, - etc... - ] - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns `Uint128`. */} - -### `estimate_withdraw_liquidity` - -Estimate coins withdrawn if exchanged for LP tokens. - - - - - ```ts types.ts - type QueryMsg = - { - estimate_withdraw_liquidity: { - lp_token: Coin - } - } - ``` - - {/* ```json json - { - "estimate_withdraw_liquidity": { - "lp_token": { - "denom": "...", - "amount": "12345" - } - } - } - ``` - - ```rust query.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(ConfigResponse)] - Config {}, - #[returns(Vec)] - VaultsInfo { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllowedCoins { - start_after: Option, - limit: Option, - }, - #[returns(Positions)] - Positions { - account_id: String, - }, - #[returns(mars_health::HealthResponse)] - Health { - account_id: String, - }, - #[returns(Vec)] - AllCoinBalances { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Vec)] - AllDebtShares { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(DebtShares)] - TotalDebtShares(String), - #[returns(Vec)] - AllTotalDebtShares { - start_after: Option, - limit: Option, - }, - #[returns(Vec)] - AllVaultPositions { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(Uint128)] - TotalVaultCoinBalance { - vault: VaultUnchecked, - }, - #[returns(Vec)] - AllTotalVaultCoinBalances { - start_after: Option, - limit: Option, - }, - #[returns(Uint128)] - EstimateProvideLiquidity { - lp_token_out: String, - coins_in: Vec, - }, - #[returns(Vec)] - EstimateWithdrawLiquidity { - lp_token: Coin, - }, - } - ``` */} - - - - -{/* Returns a vector containing objects of type [`Coin`](https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Coin.html). */} diff --git a/docs/develop/contracts/rover/health.mdx b/docs/develop/contracts/rover/health.mdx deleted file mode 100644 index bcdfb9a..0000000 --- a/docs/develop/contracts/rover/health.mdx +++ /dev/null @@ -1,176 +0,0 @@ ---- -sidebar_position: 3 ---- - -# health - -## Links - -- **Deployments**: https://github.com/mars-protocol/rover/tree/master/scripts/deploy/addresses -- **Types**: - - **Rust**: https://github.com/mars-protocol/rover/blob/master/packages/health-types/src/msg.rs - - **Typescript**: https://github.com/mars-protocol/rover/blob/master/scripts/types/generated/mars-rover-health/MarsRoverHealth.types.ts -- **Contract repo**: https://github.com/mars-protocol/rover/blob/master/contracts/health/src/contract.rs -- **Audits**: https://github.com/mars-protocol/mars-audits/tree/main/rover - -## InstantiateMsg - - - - - ```json - { - "credit_manager"?: "string" | null - "owner": "string" - } - ``` - - - - -## ExecuteMsg - -### `update_owner` - - - - - ```json - { - "update_owner": OwnerUpdate - } - ``` - - - - -#### `OwnerUpdate` - - - - - ```json - | { - "propose_new_owner": { - "proposed": "string" - } - } - | "clear_proposed" - | "accept_proposed" - | "abolish_owner_role" - | { - "set_emergency_owner": { - "emergency_owner": "string" - } - } - | "clear_emergency_owner" - ``` - - - - -### `update_config` - - - - - ```json - { - "update_config": { - "credit_manager": "string" - } - } - ``` - - - - -## QueryMsg - -### `health_values` - - - - - ```json - { - "health_values": { - "account_id": "string", - "action": ActionKind, - "kind": AccountKind - } - } - ``` - - - - -#### `ActionKind` - - - - - ```json - ActionKind = "default" | "liquidation" - ``` - - - - -#### `AccountKind` - - - - - ```json - AccountKind = "default" | "high_levered_strategy" - ``` - - - - - -### `health_state` - - - - - ```json - { - "health_state": { - "account_id": "string", - "action": ActionKind, - "kind": AccountKind - } - } - ``` - - - - -#### `ActionKind` - -See [above](#actionkind). - -#### `AccountKind` - -See [above](#accountkind). - -### config - - - - - ```json - { - "config": {} - } - ``` - - - - - - - - diff --git a/docs/develop/contracts/rover/rover-intro.mdx b/docs/develop/contracts/rover/rover-intro.mdx deleted file mode 100644 index ad04381..0000000 --- a/docs/develop/contracts/rover/rover-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Rover - -Discover the generalized credit protocol built on Mars' lending market. - - \ No newline at end of file diff --git a/docs/develop/contracts/rover/swapper.mdx b/docs/develop/contracts/rover/swapper.mdx deleted file mode 100644 index d86d859..0000000 --- a/docs/develop/contracts/rover/swapper.mdx +++ /dev/null @@ -1,626 +0,0 @@ ---- -sidebar_position: 4 ---- - -import Admonition from '@theme/Admonition' - -# swapper - -Base `swapper` contract. - -## Links - -- **Deployments**: https://github.com/mars-protocol/rover/tree/master/scripts/deploy/addresses -- **Types**: - - **Rust**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/packages/rover/src/adapters/swap - - **Typescript**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/scripts/types/generated/mars-swapper-base -- **Contract repo**: https://github.com/mars-protocol/v2-fields-of-mars/tree/master/contracts/swapper/base -- **Audits**: https://github.com/mars-protocol/mars-audits/tree/main/rover - -## InstantiateMsg - - - - - ```ts types.ts - interface InstantiateMsg { - owner: string - } - ``` - - {/* ```json json - { - "owner": "..." - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub struct InstantiateMsg { - /// The contract's owner, who can update config - pub owner: String, - } - ``` */} - - - -## ExecuteMsg - -### `update_owner` - -Manages owner role state. - - - - - ```ts types.ts - type ExecuteMsg = - { - update_owner: OwnerUpdate - } - ``` - - {/* ```json json - { - "update_owner": { - "propose_new_owner": { - "proposed": "..." - } - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - SwapExactIn { - coin_in: Coin, - denom_out: String, - slippage: Decimal, - }, - TransferResult { - recipient: Addr, - denom_in: String, - denom_out: String, - }, - } - ``` */} - - - - -#### `OwnerUpdate` - - - - - ```ts types.ts - export type OwnerUpdate = - | { - propose_new_owner: { - proposed: string - } - } - | 'clear_proposed' - | 'accept_proposed' - | 'abolish_owner_role' - ``` - - {/* ```rust mars_owner - pub enum OwnerUpdate { - ProposeNewOwner { - proposed: String, - }, - ClearProposed, - AcceptProposed, - AbolishOwnerRole, - } - ``` */} - - - - -### `set_route` - -Configure the route for swapping an asset. This is chain-specific, and can include parameters such as slippage tolerance and the routes for multi-step swaps. - - - - - ```ts types.ts - type ExecuteMsg = - { - set_route: { - denom_in: string - denom_out: string - route: Empty - } - } - ``` - - {/* ```json json - { - "denom_in": "...", - "denom_out": "...", - "route": { - // Route (chain-specific) - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - SwapExactIn { - coin_in: Coin, - denom_out: String, - slippage: Decimal, - }, - TransferResult { - recipient: Addr, - denom_in: String, - denom_out: String, - }, - } - ``` */} - - - - -#### `Empty` - - - - - ```ts types.ts - interface Empty { - [k: string]: unknown - } - ``` - - - - - -### `swap_exact_in` - -Perform a swapper with an exact-in amount. Requires slippage allowance %. - - - - - ```ts types.ts - type Decimal = string - - type ExecuteMsg = - { - swap_exact_in: { - coin_in: Coin - denom_out: string - slippage: Decimal - } - } - ``` - - {/* ```json json - { - "swap_exact_in": { - "coin_in": { - "denom": "...", - "amount": "12345" - }, - "denom_out": "...", - "slippage": "0.123" - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - SwapExactIn { - coin_in: Coin, - denom_out: String, - slippage: Decimal, - }, - TransferResult { - recipient: Addr, - denom_in: String, - denom_out: String, - }, - } - ``` */} - - - - -#### `Coin` - - - - - ```ts types.ts - interface Coin { - amount: Uint128 - denom: string - [k: string]: unknown - } - ``` - - - - -### `transfer_result` - -Send swapper results back to swapper. Also refunds extra if sent more than needed. Internal use only. - - - - - ```ts types.ts - type Addr = string - - type ExecuteMsg = - { - transfer_result: { - denom_in: string - denom_out: string - recipient: Addr - } - } - ``` - - {/* ```json json - { - "transfer_result": { - "recipient": "...", - "denom_in": "...", - "denom_out": "..." - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub enum ExecuteMsg { - UpdateOwner(OwnerUpdate), - SetRoute { - denom_in: String, - denom_out: String, - route: Route, - }, - SwapExactIn { - coin_in: Coin, - denom_out: String, - slippage: Decimal, - }, - TransferResult { - recipient: Addr, - denom_in: String, - denom_out: String, - }, - } - ``` */} - - - - -## QueryMsg - -### `owner` - -Query contract owner config. - - - - - ```ts types.ts - type QueryMsg = - { - owner: {} - } - ``` - - {/* ```json json - { - "owner": {} - } - ``` - - ```rust msgs.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(mars_owner::OwnerResponse)] - Owner {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(RoutesResponse)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(EstimateExactInSwapResponse)] - EstimateExactInSwap { - coin_in: Coin, - denom_out: String, - }, - } - ``` */} - - - - -{/* #### `OwnerResponse` - - - - - ```json json - { - "owner": "...", - "proposed": "...", - "initialized": true, - "abolished": true - } - ``` - - ```rust mars_owner - pub struct OwnerResponse { - pub owner: Option, - pub proposed: Option, - pub initialized: bool, - pub abolished: bool, - } - ``` - - - */} - -### `route` - -Get route for swapping an input denom into an output denom. - - - - - ```ts types.ts - type QueryMsg = - { - route: { - denom_in: string - denom_out: string - } - } - ``` - - {/* ```json json - { - "route": { - "denom_in": "...", - "denom_out": "..." - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(mars_owner::OwnerResponse)] - Owner {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(RoutesResponse)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(EstimateExactInSwapResponse)] - EstimateExactInSwap { - coin_in: Coin, - denom_out: String, - }, - } - ``` */} - - - - -{/* #### `RouteResponse` - - - - - ```json json - { - "denom_in": "...", - "denom_out": "...", - "route": { - // Route (chain-specific) - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub struct RouteResponse { - pub denom_in: String, - pub denom_out: String, - pub route: Route, - } - ``` - - - */} - -### `routes` - -Enumerate all swapper routes. - - - - - ```ts types.ts - type QueryMsg = - { - routes: { - limit?: number | null - start_after?: [string, string] | null - } - } - ``` - - {/* ```json json - { - "routes": { - "start_after": [ "...", "..." ], - "limit": 5 - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(mars_owner::OwnerResponse)] - Owner {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(RoutesResponse)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(EstimateExactInSwapResponse)] - EstimateExactInSwap { - coin_in: Coin, - denom_out: String, - }, - } - ``` */} - - - - -{/* #### `RoutesResponse` - -Returns a vector containing objects of type [`RouteResponse`](#routeresponse). - - - - - ```rust - pub type RoutesResponse = Vec>; - ``` - - - */} - -### `estimate_exact_in_swap` - -Return current spot price swapping In for Out - - -Do not use this as an oracle price feed. Use Mars-Oracle for pricing. - - - - - - ```ts types.ts - type QueryMsg = - { - estimate_exact_in_swap: { - coin_in: Coin - denom_out: string - } - } - ``` - - {/* ```json json - { - "estimate_exact_in_swap": { - "coin_in": { - "denom": "...", - "amount": "12345" - }, - "denom_out": "..." - } - } - ``` - - ```rust msgs.rs - #[cw_serde] - #[derive(QueryResponses)] - pub enum QueryMsg { - #[returns(mars_owner::OwnerResponse)] - Owner {}, - #[returns(RouteResponse)] - Route { - denom_in: String, - denom_out: String, - }, - #[returns(RoutesResponse)] - Routes { - start_after: Option<(String, String)>, - limit: Option, - }, - #[returns(EstimateExactInSwapResponse)] - EstimateExactInSwap { - coin_in: Coin, - denom_out: String, - }, - } - ``` */} - - - - -{/* #### `EstimateExactInSwapResponse` - - - - - ```json json - { - "amount": "12345" - } - ``` - - ```rust msgs.rs - #[cw_serde] - pub struct EstimateExactInSwapResponse { - pub amount: Uint128, - } - ``` - - */} \ No newline at end of file diff --git a/docs/develop/contracts/rover/v2-zapper/_category_.json b/docs/develop/contracts/rover/v2-zapper/_category_.json deleted file mode 100644 index 22085f3..0000000 --- a/docs/develop/contracts/rover/v2-zapper/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "v2-zapper", - "position": 5, - "link": { "type": "doc", "id": "v2-zapper-intro" } -} \ No newline at end of file diff --git a/docs/develop/contracts/rover/v2-zapper/base.mdx b/docs/develop/contracts/rover/v2-zapper/base.mdx deleted file mode 100644 index 6d71ddd..0000000 --- a/docs/develop/contracts/rover/v2-zapper/base.mdx +++ /dev/null @@ -1,158 +0,0 @@ ---- -sidebar_position: 1 ---- - -# base - -Base `zapper` contract. - -## Links - -- **Deployments**: https://github.com/mars-protocol/rover/tree/master/scripts/deploy/addresses -- **Types**: - - **Rust**: https://github.com/mars-protocol/rover/blob/master/packages/rover/src/adapters/zapper.rs - - **Typescript**: https://github.com/mars-protocol/rover/blob/master/scripts/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.types.ts -- **Contract repo**: https://github.com/mars-protocol/rover/blob/master/contracts/v2-zapper/base/src/contract.rs -- **Audits**: https://github.com/mars-protocol/mars-audits/tree/main/rover - -## InstantiateMsg - - - - - ```json - interface InstantiateMsg {} - ``` - - - - -## ExecuteMsg - -### `provide_liquidity` - - - - - ```json - { - "provide_liquidity": { - "lp_token_out": "string", - "minimum_receive": "Uint128", - "recipient"?: "string" | null - } - } - ``` - - - - -### `withdraw_liquidity` - - - - - ```json - { - "withdraw_liquidity": { - "minimum_receive": Coin[], - "recipient"?: "string" | null - } - } - ``` - - - - -#### `Coin` - - - - - ```json - { - "amount": "Uint128", - "denom": "string" - } - ``` - - - - -### `callback` - - - - - ```json - { - "callback": CallbackMsg - } - ``` - - - - -#### `CallbackMsg` - - - - - ```json - { - "return_coin": { - "balance_before": Coin, - "recipient": "Addr" - } - } - ``` - - - - -#### `Coin` - -See [above](#coin). - -## QueryMsg - -### `estimate_provide_liquidity` - - - - - ```json - { - "estimate_provide_liquidity": { - 'coins_in': Coin[], - "lp_token_out": "string" - } - } - ``` - - - - -#### `Coin` - -See [above](#coin). - -### `estimate_withdraw_liquidity` - - - - - ```json - { - "estimate_withdraw_liquidity": { - "coin_in": Coin - } - } - ``` - - - - -#### `Coin` - -See [above](#coin). \ No newline at end of file diff --git a/docs/develop/contracts/rover/v2-zapper/v2-zapper-intro.mdx b/docs/develop/contracts/rover/v2-zapper/v2-zapper-intro.mdx deleted file mode 100644 index 5507ae4..0000000 --- a/docs/develop/contracts/rover/v2-zapper/v2-zapper-intro.mdx +++ /dev/null @@ -1,2 +0,0 @@ -# v2-zapper - diff --git a/docs/develop/frontend/_category_.json b/docs/develop/frontend/_category_.json deleted file mode 100644 index 88d0614..0000000 --- a/docs/develop/frontend/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Frontend", - "position": 7, - "link": { "type": "doc", "id": "frontend-intro" } -} \ No newline at end of file diff --git a/docs/develop/frontend/frontend-intro.mdx b/docs/develop/frontend/frontend-intro.mdx deleted file mode 100644 index 3655a10..0000000 --- a/docs/develop/frontend/frontend-intro.mdx +++ /dev/null @@ -1,70 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Frontend - -Mission Control has published the [full Mars Protocol frontend repository on Github](https://github.com/mars-protocol/interface). That means anyone in the galaxy can download it to: - -- Run the frontend to uncover vulnerabilities -- Explore Mars’ architecture and learn how to build open Cosmos apps - -The release comes with a web application license agreement that grants anyone the right to use the code to interact with Martian Council-governed Outposts. The license imposes conditions on use including compliance with applicable law in the licensee’s jurisdiction. - -The description of the license herein is only a summary and may be incomplete or inaccurate–only the [full text of the license](https://github.com/mars-protocol/interface/blob/main/LICENSE) is legally binding. - -### GitHub Repo - -https://github.com/mars-protocol/interface - -### Web App - -This project is a [NextJS](https://nextjs.org/) React application. - -The project utilises [React hooks](https://reactjs.org/docs/hooks-intro.html), functional components, [Zustand](https://github.com/pmndrs/zustand) for state management, and [useQuery](https://github.com/TanStack/query) for general data fetching and management. - -Typescript is added and utilised (but optional if you want to create .jsx or .tsx files). - -SCSS with [CSS modules](https://create-react-app.dev/docs/adding-a-css-modules-stylesheet) (webpack allows importing css files into javascript, use the CSS module technique to avoid className clashes). - -### Deployment - -Start web server - -```bash -yarn && yarn dev -``` - -### Text and translations - -This repository makes use of a [translation repository](https://github.com/mars-protocol/translations). This repository containes all of the translation key values that are used within the UI. The rationale is to have no _hardcoded_ display string values in this repository. - -### Development practices - -#### Imports - -Local components are imported via index files, which can be automatically generated with `yarn index`. This command targets index.ts files with a specific pattern in order to automate component exports. This results in clean imports throughout the pages: - -``` -import { Button, Card, Title } from 'components/common' -``` - -or - -``` -import { Breakdown, RepayInput } from 'components/fields' -``` - -In order for this to work, components are place in a folder with UpperCamelCase with the respective Component.tsx file. The component cannot be exported at default, so rather export the `const` instead. - -#### Data orchestration - -Data is handled with a combination of container components, useQuery and Zustand. Container components are responsible for syncing the application state with the wallet-provider state. This fire of the required queries in useQuery, which are for many cases also stored in Zustand. - -We aim to have as much as possible available in Zustand, to have one source of truth. - -### Contributing - -We welcome and encourage contributions! Please create a pull request with as much information about the work you did and what your motivation/intention was. - -### License - -Contents of this repository are open source under the [Mars Protocol Web Application License Agreement](https://github.com/mars-protocol/interface/blob/main/LICENSE). \ No newline at end of file diff --git a/docs/develop/indexers/_category_.json b/docs/develop/indexers/_category_.json deleted file mode 100644 index 55f4c19..0000000 --- a/docs/develop/indexers/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Indexers", - "position": 7, - "link": { "type": "doc", "id": "indexers-intro" } -} \ No newline at end of file diff --git a/docs/develop/indexers/indexers-intro.mdx b/docs/develop/indexers/indexers-intro.mdx deleted file mode 100644 index ae6ac9e..0000000 --- a/docs/develop/indexers/indexers-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -# Overview - -Indexers, in a broad context, play a fundamental role in organising and optimising data retrieval within various systems. These tools act as navigational aids, allowing efficient access to specific information by creating structured indexes. In the realm of databases and information management, indexers enhance query performance by creating a roadmap to swiftly locate data entries. - -In the context of blockchain and dApps, indexers go beyond traditional databases, facilitating streamlined access to on-chain data. This includes transaction histories, smart contract states, and event logs. In the dynamic and decentralised world of blockchain, indexers contribute to the efficiency of data queries, supporting real-time updates and ensuring the seamless functionality of diverse applications and platforms. - -There are several indexer solutions available, each offering different levels of decentralisation, ease of development, and performance for you to consider. These solutions serve as intermediaries to assist in indexing the Mars protocol. \ No newline at end of file diff --git a/docs/develop/indexers/subquery.mdx b/docs/develop/indexers/subquery.mdx deleted file mode 100644 index 878f232..0000000 --- a/docs/develop/indexers/subquery.mdx +++ /dev/null @@ -1,25 +0,0 @@ ---- -sidebar_position: 2 ---- - -# SubQuery - -## Intro - -SubQuery is a leading blockchain data indexer that provides developers with fast, flexible, universal, open source and decentralised APIs for web3 projects. SubQuery SDK allows developers to get rich indexed data and build intuitive and immersive decentralised applications in a faster and more efficient way. SubQuery supports 100+ ecosystems including Mars, Cosmos, Ethereum, Polygon, Polkadot, Algorand, NEAR, and Avalanche. - -Another one of SubQuery's competitive advantages is the ability to aggregate data not only within a chain but across multiple blockchains all within a single project. This allows the creation of feature-rich dashboard analytics, multi-chain block scanners, or projects that index IBC transactions across zones. - -Other advantages include superior performance with multiple RPC endpoint configurations, multi-worker capabilities and a configurable caching architecture. To find out more, visit our [documentation](https://academy.subquery.network/). - -**Useful resources**: -- SubQuery Docs: [SubQuery Academy (Documentation)](https://academy.subquery.network/) -- Intro Quick Start Guide: [1. Create a New Project](https://academy.subquery.network/quickstart/quickstart.html) -- [Mars Starter Project](https://github.com/subquery/cosmos-subql-starter/tree/main/Mars/mars-starter) - -## Running and Hosting your Mars SubQuery APIs - -SubQuery is open-source, meaning you have the freedom to run it in the following three ways: -- Locally on your own computer (or a cloud provider of your choosing), [view the instructions on how to run SubQuery Locally](https://academy.subquery.network/run_publish/run.html). -- You can publish it to SubQuery's enterprise-level [Managed Service](https://managedservice.subquery.network/), where we'll host your SubQuery project in production ready services for mission critical data with zero-downtime blue/green deployments. There even is a generous free tier. [Find out how](https://academy.subquery.network/run_publish/publish.html). -- You can publish it to the decentralised [SubQuery Network](https://subquery.network/network), the most open, performant, reliable, and scalable data service for dApp developers. The SubQuery Network indexes and services data to the global community in an incentivised and verifiable way and supports Mars from launch. \ No newline at end of file diff --git a/docs/develop/liquidation-bots/_category_.json b/docs/develop/liquidation-bots/_category_.json deleted file mode 100644 index 028bf84..0000000 --- a/docs/develop/liquidation-bots/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Liquidation Bots", - "position": 6, - "link": { "type": "doc", "id": "liquidation-bots-intro" } -} \ No newline at end of file diff --git a/docs/develop/liquidation-bots/liquidation-bots-intro.mdx b/docs/develop/liquidation-bots/liquidation-bots-intro.mdx deleted file mode 100644 index 0cefea2..0000000 --- a/docs/develop/liquidation-bots/liquidation-bots-intro.mdx +++ /dev/null @@ -1,95 +0,0 @@ -# Liquidation Bots - -import Admonition from '@theme/Admonition' -import LiquidationBotsUrl from '@site/static/img/develop/liquidation-bots.png'; - -## Resources - -- https://github.com/mars-protocol/multichain-liquidator-bot - -## Summary - -The multichain liquidator bot is a scalable liquidation bot that ensures accounts are liquidated in a timely fashion. - -It is built to support both the Red Bank and Rover. - - - -For questions, issues or support, feel free to join the liquidators channel in the [Mars discord](https://discord.com/invite/marsprotocol/) - - - -The bot is composed of 4 distinct parts. As an overview of the architecture, please refer to this image. Each part is explained in more detail below. - - - -1. **Collector:** The Collector service is responsible for fetching all the user addresses that have debts in the Mars Red Bank and passes them on to the Health Checker. - -2. **Health Checker:** Health Checker is responsible for fetching the health status for positions, and flagging unhealthy positions for liquidation. - -3. **Liquidator:** The Liquidator service is responsible for handling liquidations of unhealthy positions. There are liquidation services (called executors) for both Redbank and rover (wip). - -4. **Manager:** The Manager service is responsible for ensuring all the data is processed within a timeframe. By default, the timeframe is a single block. It is also responsible for booting up new services (i.e health checker, executor) to meet demand. - -## Collector - -The Collector service fetching all the user addresses that have debts in the Mars Red Bank and passes them on to the Health Checker by querying the underlying contract storage of a cw-storage-plus `Map` for keys that contain a specific prefix. This allows for querying multiple pages in parallel using regular page numbers. Paging through a `Map` using an iterator requires you to know the last key of a page to query the next page - prohibiting parallel, non-overlapping, queries. - -The service uses [Redis lists](https://redis.io/docs/data-types/lists/) as a queue. - -## Health Checker - -The Health Checker fetches the health status for positions and flags unhealthy positions for liquidation by reading from a Redis Queue, called the `HealthCheckerQueue` which contains user positions to be checked. It then checks these positions in batches via a hive query, before filtering through the returned health status for unhealthy positions. These unhealthy positions are pushed into another redis queue called `LiquidationQueue`, which exposes them for liquidation by the executor module. - -## Liquidator - -Unhealthy positions are flagged by the health checker and placed into the Liqudidation queue redis list, which the liquidator pulls from to liquidate. - -### Red Bank - -Liquidations are then dispatched to the `liquidation-filterer` contract, which handles multiple liquidations per block and filters positions if they are no longer unhealthy to prevent failing transactions. - -After successfull liquidation, the liquidator service will read from the blockchain its balances, and dispatch a second collection of messages to swap won collateral back to a neutral asset, ready for another batch of liquidations - -### Rover - -Rover executor service differs from the redbank in a few ways. - -- It dispatches one liquidation at a time. To meet demand, when there is more than one liquidation per block to be processed, the manager process will spin up more executor services. -- It does not require its own capital to liquidate, but instead facilitates 'flash loan' style liquidations using a collection of actions via the rover contracts. - -Please note that this service is still in active development - -## Manager - -By default, the timeframe for the Manager service is a single block. If we are left with unprocessed data by the time a new block arrives, the manager would scale up by deploying more instances of the service that is currently lagging. Conversely, if we have too many instances of a service, it will be scaled down by removing deployments. - -This service also collects runtime performance data of all the parts of the system and will make the information available to other third-party tools so that performance dashboards can be constructed. - -## Usage - -Each service contains utilities to build and run the code in a uniform manner by way of Makefiles. Each Makefile contains a help that can be executed via `make help`. - -The top-level Makefile contains helpers to build and run all the services and contains the same `make help`. - -```bash -# Help -make help - -# Build all services -make - -# Build Docker images and start manager -make run - -# Build all Docker images -make docker_build -``` - -## Deploying - -### Docker - -The multichain-liquidation bot repo provides convenience Makefiles for each service to ease compiling and building Docker containers. To build all the Docker images, use the top-level Makefile by running make docker_build in the project root. This will compile the service and build the Docker images locally for each service. - -To learn more about deploying the bot using Docker, visit https://github.com/mars-protocol/multichain-liquidator-bot#docker \ No newline at end of file diff --git a/docs/develop/modules/_category_.json b/docs/develop/modules/_category_.json deleted file mode 100644 index 87df7c8..0000000 --- a/docs/develop/modules/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Modules", - "position": 4, - "link": { "type": "doc", "id": "modules-intro" } -} \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/_category_.json b/docs/develop/modules/cosmos-sdk-modules/_category_.json deleted file mode 100644 index 681f320..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Cosmos SDK Modules", - "position": 3, - "link": { "type": "doc", "id": "cosmos-sdk-modules-intro" } -} \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/auth.mdx b/docs/develop/modules/cosmos-sdk-modules/auth.mdx deleted file mode 100644 index 247ec4d..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/auth.mdx +++ /dev/null @@ -1,206 +0,0 @@ ---- -sidebar_position: 1 ---- - -# auth - -The `auth` module is responsible for the authentication of accounts and transactions and specifies the base transaction and account types. It contains the middlewares, where all basic transaction validity checks (signatures, nonces, auxiliary fields) are performed, and exposes the account keeper, which allows other modules to read, write, and modify accounts. - -For more information, visit https://docs.cosmos.network/main/modules/auth/ - -{/* ## Links - -- **Cosmos SDK Documentation:** https://docs.cosmos.network/main/modules/auth/ -- **Module address:** -- **Testnet address:** -- **Proto repo:** https://github.com/mars-protocol/hub/tree/main/third_party/proto/cosmos/auth/v1beta1 -- **query.proto:** https://github.com/mars-protocol/hub/blob/main/third_party/proto/cosmos/auth/v1beta1/query.proto */} - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - // Accounts returns all the existing accounts - // - // Since: cosmos-sdk 0.43 - rpc Accounts(QueryAccountsRequest) returns (QueryAccountsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/accounts"; - } - - // Account returns account details based on address. - rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; - } - - // Params queries all parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/params"; - } - - // ModuleAccounts returns all the existing module accounts. - rpc ModuleAccounts(QueryModuleAccountsRequest) returns (QueryModuleAccountsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts"; - } - - // Bech32 queries bech32Prefix - rpc Bech32Prefix(Bech32PrefixRequest) returns (Bech32PrefixResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/bech32"; - } - - // AddressBytesToString converts Account Address bytes to string - rpc AddressBytesToString(AddressBytesToStringRequest) returns (AddressBytesToStringResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_bytes}"; - } - - // AddressStringToBytes converts Address string to bytes - rpc AddressStringToBytes(AddressStringToBytesRequest) returns (AddressStringToBytesResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_string}"; - } -} -``` - -### `QueryAccountsRequest` - -`QueryAccountsRequest` is the request type for the `Query/Accounts` RPC method. - -Since: `cosmos-sdk 0.43` - -```go query.proto -message QueryAccountsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryAccountsResponse` -`QueryAccountsResponse` is the response type for the Query/Accounts RPC method. - -Since: `cosmos-sdk 0.43` - -```go query.proto -message QueryAccountsResponse { - // accounts are the existing accounts - repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryAccountRequest` -`QueryAccountRequest` is the request type for the `Query/Account` RPC method. - -```go query.proto -message QueryAccountRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address defines the address to query for. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryAccountResponse` -`QueryAccountResponse` is the response type for the `Query/Account` RPC method. - -```go query.proto -message QueryAccountResponse { - // account defines the account of the corresponding address. - google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is the response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryModuleAccountsRequest` - -`QueryModuleAccountsRequest` is the request type for the `Query/ModuleAccounts` RPC method. - -```go query.proto -message QueryModuleAccountsRequest {} -``` - -#### `QueryModuleAccountsResponse` -`QueryModuleAccountsResponse` is the response type for the `Query/ModuleAccounts` RPC method. - -```go query.proto -message QueryModuleAccountsResponse { - repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"]; -} -``` - -### `Bech32PrefixRequest` -`Bech32PrefixRequest` is the request type for `Bech32Prefix` rpc method. - -```go query.proto -message Bech32PrefixRequest {} -``` - -#### `Bech32PrefixResponse` - -`Bech32PrefixResponse` is the response type for `Bech32Prefix` rpc method. - -```go query.proto -message Bech32PrefixResponse { - string bech32_prefix = 1; -} -``` - -### `AddressBytesToStringRequest` -`AddressBytesToStringRequest` is the request type for `AddressString` rpc method. - -```go query.proto -message AddressBytesToStringRequest { - bytes address_bytes = 1; -} -``` - -#### `AddressBytesToStringResponse` -`AddressBytesToStringResponse` is the response type for `AddressString` rpc method. - -```go query.proto -message AddressBytesToStringResponse { - string address_string = 1; -} -``` - - -### `AddressStringToBytesRequest` - -`AddressStringToBytesRequest` is the request type for `AccountBytes` rpc method. - -```go query.proto -message AddressStringToBytesRequest { - string address_string = 1; -} -``` - -#### `AddressStringToBytesResponse` - -`AddressStringToBytesResponse` is the response type for `AddressBytes` rpc method. - -```go query.proto -message AddressStringToBytesResponse { - bytes address_bytes = 1; -} -``` - diff --git a/docs/develop/modules/cosmos-sdk-modules/authz.mdx b/docs/develop/modules/cosmos-sdk-modules/authz.mdx deleted file mode 100644 index bf46b60..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/authz.mdx +++ /dev/null @@ -1,210 +0,0 @@ ---- -sidebar_position: 2 ---- - -# authz - -The `authz` module is responsible for the authorization for accounts to perform actions on behalf of other accounts and enables a granter to grant authorizations to a grantee that allows the grantee to execute messages on behalf of the granter. Authorizations must be granted for a particular Msg service method one by one using an implementation of the Authorization interface. - -For more information, visit https://docs.cosmos.network/main/modules/authz/ - -## Message Types - -`Msg` defines the `authz` Msg service. - -```go tx.proto -service Msg { - // Grant grants the provided authorization to the grantee on the granter's - // account with the provided expiration time. If there is already a grant - // for the given (granter, grantee, Authorization) triple, then the grant - // will be overwritten. - rpc Grant(MsgGrant) returns (MsgGrantResponse); - - // Exec attempts to execute the provided messages using - // authorizations granted to the grantee. Each message should have only - // one signer corresponding to the granter of the authorization. - rpc Exec(MsgExec) returns (MsgExecResponse); - - // Revoke revokes any authorization corresponding to the provided method name on the - // granter's account that has been granted to the grantee. - rpc Revoke(MsgRevoke) returns (MsgRevokeResponse); -} -``` - -### `MsgGrant` - -`MsgGrant` is a request type for Grant method. It declares authorization to the grantee on behalf of the granter with the provided expiration time. - -```go tx.proto -message MsgGrant { - option (cosmos.msg.v1.signer) = "granter"; - - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgGrantResponse` - -`MsgGrantResponse` defines the `Msg/MsgGrant` response type. - -```go tx.proto -message MsgGrantResponse {} -``` - -### `MsgExec` - -`MsgExec` attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization. - -```go tx.proto -message MsgExec { - option (cosmos.msg.v1.signer) = "grantee"; - - string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Authorization Msg requests to execute. Each msg must implement Authorization interface - // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) - // triple and validate it. - repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "sdk.Msg, authz.Authorization"]; -} -``` - -#### `MsgExecResponse` - -`MsgExecResponse` defines the `Msg/MsgExecResponse` response type. - -```go tx.proto -message MsgExecResponse { - repeated bytes results = 1; -} -``` - -### `MsgRevoke` - -`MsgRevoke` revokes any authorization with the provided sdk.Msg type on the granter's account with that has been granted to the grantee. - -```go tx.proto -message MsgRevoke { - option (cosmos.msg.v1.signer) = "granter"; - - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string msg_type_url = 3; -} -``` - -#### `MsgRevokeResponse` - -`MsgRevokeResponse` defines the `Msg/MsgRevokeResponse` response type. - -```go tx.proto -message MsgRevokeResponse {} -``` - -## Queries - -Query defines the gRPC querier service. - -```go query.proto -service Query { - // Returns list of `Authorization`, granted to the grantee by the granter. - rpc Grants(QueryGrantsRequest) returns (QueryGrantsResponse) { - option (google.api.http).get = "/cosmos/authz/v1beta1/grants"; - } - - // GranterGrants returns list of `GrantAuthorization`, granted by granter. - // - // Since: cosmos-sdk 0.46 - rpc GranterGrants(QueryGranterGrantsRequest) returns (QueryGranterGrantsResponse) { - option (google.api.http).get = "/cosmos/authz/v1beta1/grants/granter/{granter}"; - } - - // GranteeGrants returns a list of `GrantAuthorization` by grantee. - // - // Since: cosmos-sdk 0.46 - rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) { - option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}"; - } -} -``` - -### `QueryGrantsRequest` - -`QueryGrantsRequest` is the request type for the `Query/Grants` RPC method. - -```go query.proto -message QueryGrantsRequest { - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Optional, msg_type_url, when set, will query only grants matching given msg type. - string msg_type_url = 3; - // pagination defines an pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 4; -} -``` - -#### `QueryGrantsResponse` - -`QueryGrantsResponse` is the response type for the `Query/Authorizations` RPC method. - -```go query.proto -message QueryGrantsResponse { - // authorizations is a list of grants granted for grantee by granter. - repeated Grant grants = 1; - // pagination defines an pagination for the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryGranterGrantsRequest` - -`QueryGranterGrantsRequest` is the request type for the `Query/GranterGrants` RPC method. - -```go query.proto -message QueryGranterGrantsRequest { - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGranterGrantsResponse` - -`QueryGranterGrantsResponse` is the response type for the `Query/GranterGrants` RPC method. - -```go query.proto -message QueryGranterGrantsResponse { - // grants is a list of grants granted by the granter. - repeated GrantAuthorization grants = 1; - // pagination defines an pagination for the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryGranteeGrantsRequest` - -`QueryGranteeGrantsRequest` is the request type for the `Query/IssuedGrants` RPC method. - -```go query.proto -message QueryGranteeGrantsRequest { - string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGranteeGrantsResponse` - -`QueryGranteeGrantsResponse` is the response type for the Query/GranteeGrants RPC method. - -```go query.proto -message QueryGranteeGrantsResponse { - // grants is a list of grants granted to the grantee. - repeated GrantAuthorization grants = 1; - // pagination defines an pagination for the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/bank.mdx b/docs/develop/modules/cosmos-sdk-modules/bank.mdx deleted file mode 100644 index b390136..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/bank.mdx +++ /dev/null @@ -1,368 +0,0 @@ ---- -sidebar_position: 3 ---- - -# bank - -The `bank` module is responsible for handling token transfer functionalities such as multi-asset coin transfers between accounts and tracking special-case pseudo-transfers which must work differently with particular kinds of accounts (notably delegating/undelegating for vesting accounts). It exposes several interfaces with varying capabilities for secure interaction with other modules which must alter user balances. - -In addition, the `bank` module tracks and provides query support for the total supply of all assets used in the application. - -For more information, visit https://docs.cosmos.network/main/modules/bank/ - -## Message Types - -`Msg` defines the bank Msg service. - -```go tx.proto -service Msg { - // Send defines a method for sending coins from one account to another account. - rpc Send(MsgSend) returns (MsgSendResponse); - - // MultiSend defines a method for sending coins from some accounts to other accounts. - rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse); -} -``` - -### `MsgSend` - -`MsgSend` represents a message to send coins from one account to another. - -```go tx.proto -message MsgSend { - option (cosmos.msg.v1.signer) = "from_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} -``` - -#### `MsgSendResponse` - -`MsgSendResponse` defines the `Msg/Send` response type. - -```go tx.proto -message MsgSendResponse {} -``` - -### `MsgMultiSend` - -`MsgMultiSend` represents an arbitrary multi-in, multi-out send message. - -```go tx.proto -message MsgMultiSend { - option (cosmos.msg.v1.signer) = "inputs"; - - option (gogoproto.equal) = false; - - repeated Input inputs = 1 [(gogoproto.nullable) = false]; - repeated Output outputs = 2 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgMultiSendResponse` - -`MsgMultiSendResponse` defines the `Msg/MultiSend` response type. - -```go tx.proto -message MsgMultiSendResponse {} -``` - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - // Balance queries the balance of a single coin for a single account. - rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/by_denom"; - } - - // AllBalances queries the balance of all coins for a single account. - rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; - } - - // SpendableBalances queries the spenable balance of all coins for a single - // account. - rpc SpendableBalances(QuerySpendableBalancesRequest) returns (QuerySpendableBalancesResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}"; - } - - // TotalSupply queries the total supply of all coins. - rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; - } - - // SupplyOf queries the supply of a single coin. - rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply/by_denom"; - } - - // Params queries the parameters of x/bank module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/params"; - } - - // DenomsMetadata queries the client metadata of a given coin denomination. - rpc DenomMetadata(QueryDenomMetadataRequest) returns (QueryDenomMetadataResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}"; - } - - // DenomsMetadata queries the client metadata for all registered coin - // denominations. - rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata"; - } - - // DenomOwners queries for all account addresses that own a particular token - // denomination. - rpc DenomOwners(QueryDenomOwnersRequest) returns (QueryDenomOwnersResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}"; - } -} -``` - -### `QueryBalanceRequest` - -`QueryBalanceRequest` is the request type for the `Query/Balance` RPC method. - -```go query.proto -message QueryBalanceRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query balances for. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // denom is the coin denom to query balances for. - string denom = 2; -} -``` - -#### `QueryBalanceResponse` - -`QueryBalanceResponse` is the response type for the `Query/Balance` RPC method. - -```go query.proto -message QueryBalanceResponse { - // balance is the balance of the coin. - cosmos.base.v1beta1.Coin balance = 1; -} -``` - -### `QueryAllBalanceRequest` - -`QueryAllBalanceRequest` is the request type for the `Query/AllBalances` RPC method. - -```go query.proto -message QueryAllBalancesRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query balances for. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryAllBalancesResponse` - -`QueryAllBalancesResponse` is the response type for the `Query/AllBalances` RPC method. - -```go query.proto -message QueryAllBalancesResponse { - // balances is the balances of all the coins. - repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QuerySpendableBalancesRequest` - -`QuerySpendableBalancesRequest` defines the gRPC request structure for querying an account's spendable balances. - -```go query.proto -message QuerySpendableBalancesRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query spendable balances for. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QuerySpendableBalancesResponse` - -`QuerySpendableBalancesResponse` defines the gRPC response structure for querying an account's spendable balances. - -```go query.proto -message QuerySpendableBalancesResponse { - // balances is the spendable balances of all the coins. - repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryTotalSupplyRequest` - -`QueryTotalSupplyRequest` is the request type for the `Query/TotalSupply` RPC method. - -```go query.proto -message QueryTotalSupplyRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // pagination defines an optional pagination for the request. - // - // Since: cosmos-sdk 0.43 - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryTotalSupplyResponse` - -`QueryTotalSupplyResponse` is the response type for the `Query/TotalSupply` RPC method. - -```go query.proto -message QueryTotalSupplyResponse { - // supply is the supply of the coins - repeated cosmos.base.v1beta1.Coin supply = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - - // pagination defines the pagination in the response. - // - // Since: cosmos-sdk 0.43 - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QuerySupplyOfRequest` - -`QuerySupplyOfRequest` is the request type for the `Query/SupplyOf` RPC method. - -```go query.proto -message QuerySupplyOfRequest { - // denom is the coin denom to query balances for. - string denom = 1; -} -``` - -#### `QuerySupplyOfResponse` - -`QuerySupplyOfResponse` is the response type for the `Query/SupplyOf` RPC method. - -```go query.proto -message QuerySupplyOfResponse { - // amount is the supply of the coin. - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` defines the request type for querying x/bank parameters. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` defines the response type for querying x/bank parameters. - -```go query.proto -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryDenomMetadataRequest` - -`QueryDenomMetadataRequest` is the request type for the `Query/DenomMetadata` RPC method. - -```go query.proto -message QueryDenomMetadataRequest { - // denom is the coin denom to query the metadata for. - string denom = 1; -} -``` - -#### `QueryDenomMetadataResponse` - -`QueryDenomMetadataResponse` is the response type for the `Query/DenomMetadata` RPC method. - -```go query.proto -message QueryDenomMetadataResponse { - // metadata describes and provides all the client information for the requested token. - Metadata metadata = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryDenomsMetadataRequest` - -`QueryDenomsMetadataRequest` is the request type for the `Query/DenomsMetadata` RPC method. - -```go query.proto -message QueryDenomsMetadataRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryDenomsMetadataResponse` -`QueryDenomsMetadataResponse` is the response type for the `Query/DenomsMetadata` RPC method. - -```go query.proto -message QueryDenomsMetadataResponse { - // metadata provides the client information for all the registered tokens. - repeated Metadata metadatas = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryDenomOwnersRequest` - -`QueryDenomOwnersRequest` defines the request type for the `DenomOwners` RPC query, which queries for a paginated set of all account holders of a particular denomination. - -```go query.proto -message QueryDenomOwnersRequest { - // denom defines the coin denomination to query all account holders for. - string denom = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryDenomOwnersResponse` - -`QueryDenomOwnersResponse` defines the RPC response of a `DenomOwners` RPC query. - -```go query.proto -message QueryDenomOwnersResponse { - repeated DenomOwner denom_owners = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/capability.mdx b/docs/develop/modules/cosmos-sdk-modules/capability.mdx deleted file mode 100644 index 21df016..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/capability.mdx +++ /dev/null @@ -1,9 +0,0 @@ ---- -sidebar_position: 4 ---- - -# capability - -The `capability` module is responsible for object capability implementation and allows for provisioning, tracking, and authenticating multi-owner capabilities at runtime. - -For more information, visit https://docs.cosmos.network/main/modules/capability/ diff --git a/docs/develop/modules/cosmos-sdk-modules/cosmos-sdk-modules-intro.mdx b/docs/develop/modules/cosmos-sdk-modules/cosmos-sdk-modules-intro.mdx deleted file mode 100644 index e23f0d3..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/cosmos-sdk-modules-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Cosmos SDK Modules - -Core Cosmos SDK modules. - - \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/crisis.mdx b/docs/develop/modules/cosmos-sdk-modules/crisis.mdx deleted file mode 100644 index efe81f9..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/crisis.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -sidebar_position: 5 ---- - -# crisis - -The `crisis` module is responsible for halting the blockchain under certain circumstances (e.g. if an invariant is broken). Invariants can be registered with the application during the application initialization process. - -For more information, visit https://docs.cosmos.network/main/modules/crisis/ - -## Message Types - -`Msg` defines the bank Msg service. - -```go tx.proto -service Msg { - // VerifyInvariant defines a method to verify a particular invariance. - rpc VerifyInvariant(MsgVerifyInvariant) returns (MsgVerifyInvariantResponse); -} -``` - -### `MsgVerifyInvariant` - -`MsgVerifyInvariant` represents a message to verify a particular invariance. - -```go tx.proto -message MsgVerifyInvariant { - option (cosmos.msg.v1.signer) = "sender"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string invariant_module_name = 2; - string invariant_route = 3; -} -``` - -#### `MsgVerifyInvariantResponse` - -`MsgVerifyInvariantResponse` defines the `Msg/VerifyInvariant` response type. - -```go tx.proto -message MsgVerifyInvariantResponse {} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/distribution.mdx b/docs/develop/modules/cosmos-sdk-modules/distribution.mdx deleted file mode 100644 index 7eb7624..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/distribution.mdx +++ /dev/null @@ -1,423 +0,0 @@ ---- -sidebar_position: 6 ---- - -# distribution - -The `distribution` module is responsible for fee distribution, and staking token provision distribution. This simple distribution mechanism describes a functional way to passively distribute rewards between validators and delegators. Note that this mechanism does not distribute funds as precisely as active reward distribution mechanisms and can be upgraded in the future. - -For more information, visit https://docs.cosmos.network/main/modules/distribution/ - -## Message Types - -`Msg` defines the distribution Msg service. - -```go tx.proto -service Msg { - // SetWithdrawAddress defines a method to change the withdraw address - // for a delegator (or validator self-delegation). - rpc SetWithdrawAddress(MsgSetWithdrawAddress) returns (MsgSetWithdrawAddressResponse); - - // WithdrawDelegatorReward defines a method to withdraw rewards of delegator - // from a single validator. - rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse); - - // WithdrawValidatorCommission defines a method to withdraw the - // full commission to the validator address. - rpc WithdrawValidatorCommission(MsgWithdrawValidatorCommission) returns (MsgWithdrawValidatorCommissionResponse); - - // FundCommunityPool defines a method to allow an account to directly - // fund the community pool. - rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse); -} -``` - -### `MsgSetWithdrawAddress` - -`MsgSetWithdrawAddress` sets the withdraw address for a delegator (or validator self-delegation). - -```go tx.proto -message MsgSetWithdrawAddress { - option (cosmos.msg.v1.signer) = "delegator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgSetWithdrawAddressResponse` - -`MsgSetWithdrawAddressResponse` defines the `Msg/SetWithdrawAddress` response type. - -```go tx.proto -message MsgSetWithdrawAddressResponse {} -``` - -### `MsgWithdrawDelegatorReward` - -`MsgWithdrawDelegatorReward` represents delegation withdrawal to a delegator from a single validator. - -```go tx.proto -message MsgWithdrawDelegatorReward { - option (cosmos.msg.v1.signer) = "delegator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgWithdrawDelegatorRewardResponse` - -`MsgWithdrawDelegatorRewardResponse` defines the `Msg/WithdrawDelegatorReward` response type. - -```go tx.proto -message MsgWithdrawDelegatorRewardResponse { - // Since: cosmos-sdk 0.46 - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} -``` - -### `MsgWithdrawValidatorCommission` - -`MsgWithdrawValidatorCommission` withdraws the full commission to the validator address. - -```go tx.proto -message MsgWithdrawValidatorCommission { - option (cosmos.msg.v1.signer) = "validator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgWithdrawValidatorCommissionResponse` -`MsgWithdrawValidatorCommissionResponse` defines the `Msg/WithdrawValidatorCommission` response type. - -```go tx.proto -message MsgWithdrawValidatorCommissionResponse { - // Since: cosmos-sdk 0.46 - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} -``` - -### `MsgFundCommunityPool` - -`MsgFundCommunityPool` allows an account to directly fund the community pool. - -```go tx.proto -message MsgFundCommunityPool { - option (cosmos.msg.v1.signer) = "depositor"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgFundCommunityPoolResponse` - -`MsgFundCommunityPoolResponse` defines the `Msg/FundCommunityPool` response type. - -```go tx.proto -message MsgFundCommunityPoolResponse {} -``` - -## Queries - -`Query` defines the gRPC querier service for distribution module. - -```go query.proto -service Query { - // Params queries params of the distribution module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/params"; - } - - // ValidatorOutstandingRewards queries rewards of a validator address. - rpc ValidatorOutstandingRewards(QueryValidatorOutstandingRewardsRequest) - returns (QueryValidatorOutstandingRewardsResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/" - "{validator_address}/outstanding_rewards"; - } - - // ValidatorCommission queries accumulated commission for a validator. - rpc ValidatorCommission(QueryValidatorCommissionRequest) returns (QueryValidatorCommissionResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/" - "{validator_address}/commission"; - } - - // ValidatorSlashes queries slash events of a validator. - rpc ValidatorSlashes(QueryValidatorSlashesRequest) returns (QueryValidatorSlashesResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/validators/{validator_address}/slashes"; - } - - // DelegationRewards queries the total rewards accrued by a delegation. - rpc DelegationRewards(QueryDelegationRewardsRequest) returns (QueryDelegationRewardsResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/" - "{validator_address}"; - } - - // DelegationTotalRewards queries the total rewards accrued by a each - // validator. - rpc DelegationTotalRewards(QueryDelegationTotalRewardsRequest) returns (QueryDelegationTotalRewardsResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards"; - } - - // DelegatorValidators queries the validators of a delegator. - rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/" - "{delegator_address}/validators"; - } - - // DelegatorWithdrawAddress queries withdraw address of a delegator. - rpc DelegatorWithdrawAddress(QueryDelegatorWithdrawAddressRequest) returns (QueryDelegatorWithdrawAddressResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/" - "{delegator_address}/withdraw_address"; - } - - // CommunityPool queries the community pool coins. - rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) { - option (google.api.http).get = "/cosmos/distribution/v1beta1/community_pool"; - } -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is the response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryValidatorOutstandingRewardsRequest` - -`QueryValidatorOutstandingRewardsRequest` is the request type for the `Query/ValidatorOutstandingRewards` RPC method. - -```go query.proto -message QueryValidatorOutstandingRewardsRequest { - // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryValidatorOutstandingRewardsResponse` - -`QueryValidatorOutstandingRewardsResponse` is the response type for the `Query/ValidatorOutstandingRewards` RPC method. - -```go query.proto -message QueryValidatorOutstandingRewardsResponse { - ValidatorOutstandingRewards rewards = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryValidatorCommissionRequest` - -`QueryValidatorCommissionRequest` is the request type for the `Query/ValidatorCommission` RPC method. - -```go query.proto -message QueryValidatorCommissionRequest { - // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryValidatorCommissionResponse` - -`QueryValidatorCommissionResponse` is the response type for the `Query/ValidatorCommission` RPC method. - -```go query.proto -message QueryValidatorCommissionResponse { - // commission defines the commision the validator received. - ValidatorAccumulatedCommission commission = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryValidatorSlashesRequest` - -`QueryValidatorSlashesRequest` is the request type for the `Query/ValidatorSlashes` RPC method. - -```go query.proto -message QueryValidatorSlashesRequest { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; - - // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // starting_height defines the optional starting height to query the slashes. - uint64 starting_height = 2; - // starting_height defines the optional ending height to query the slashes. - uint64 ending_height = 3; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 4; -} -``` - -#### `QueryValidatorSlashesResponse` - -`QueryValidatorSlashesResponse` is the response type for the `Query/ValidatorSlashes` RPC method. - -```go query.proto -message QueryValidatorSlashesResponse { - // slashes defines the slashes the validator received. - repeated ValidatorSlashEvent slashes = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryDelegationRewardsRequest` - -`QueryDelegationRewardsRequest` is the request type for the `Query/DelegationRewards` RPC method. - -```go query.proto -message QueryDelegationRewardsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_address defines the delegator address to query for. - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // validator_address defines the validator address to query for. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDelegationRewardsResponse` - -`QueryDelegationRewardsResponse` is the response type for the `Query/DelegationRewards` RPC method. - -```go query.proto -message QueryDelegationRewardsResponse { - // rewards defines the rewards accrued by a delegation. - repeated cosmos.base.v1beta1.DecCoin rewards = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; -} -``` - -### `QueryDelegationTotalRewardsRequest` - -`QueryDelegationTotalRewardsRequest` is the request type for the `Query/DelegationTotalRewards` RPC method. - -```go query.proto -message QueryDelegationTotalRewardsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - // delegator_address defines the delegator address to query for. - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDelegationTotalRewardsResponse` - -`QueryDelegationTotalRewardsResponse` is the response type for the `Query/DelegationTotalRewards` RPC method. - -```go query.proto -message QueryDelegationTotalRewardsResponse { - // rewards defines all the rewards accrued by a delegator. - repeated DelegationDelegatorReward rewards = 1 [(gogoproto.nullable) = false]; - // total defines the sum of all the rewards. - repeated cosmos.base.v1beta1.DecCoin total = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"]; -} -``` - -### `QueryDelegatorValidatorsRequest` - -`QueryDelegatorValidatorsRequest` is the request type for the `Query/DelegatorValidators` RPC method. - -```go query.proto -message QueryDelegatorValidatorsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_address defines the delegator address to query for. - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDelegatorValidatorsResponse` - -`QueryDelegatorValidatorsResponse` is the response type for the `Query/DelegatorValidators` RPC method. - -```go query.proto -message QueryDelegatorValidatorsResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // validators defines the validators a delegator is delegating for. - repeated string validators = 1; -} -``` - -### `QueryDelegatorWithdrawAddressRequest` - -`QueryDelegatorWithdrawAddressRequest` is the request type for the `Query/DelegatorWithdrawAddress` RPC method. - -```go query.proto -message QueryDelegatorWithdrawAddressRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_address defines the delegator address to query for. - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDelegatorWithdrawAddressResponse` - -`QueryDelegatorWithdrawAddressResponse` is the response type for the `Query/DelegatorWithdrawAddress` RPC method. - -```go query.proto -message QueryDelegatorWithdrawAddressResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // withdraw_address defines the delegator address to query for. - string withdraw_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -### `QueryCommunityPoolRequest` - -`QueryCommunityPoolRequest` is the request type for the `Query/CommunityPool` RPC method. - -```go query.proto -message QueryCommunityPoolRequest {} -``` - -#### `QueryCommunityPoolResponse` - -`QueryCommunityPoolResponse` is the response type for the `Query/CommunityPool` RPC method. - -```go query.proto -message QueryCommunityPoolResponse { - // pool defines community pool's coins. - repeated cosmos.base.v1beta1.DecCoin pool = 1 - [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; -} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/evidence.mdx b/docs/develop/modules/cosmos-sdk-modules/evidence.mdx deleted file mode 100644 index faacc6b..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/evidence.mdx +++ /dev/null @@ -1,113 +0,0 @@ ---- -sidebar_position: 7 ---- - -# evidence - -The `evidence` module is responsible for the submission and handling of arbitrary evidence of misbehavior such as equivocation and counterfactual signing. - -For more information, visit https://docs.cosmos.network/main/modules/evidence - -## Message Types - -`Msg` defines the evidence Msg service. - -```go tx.proto -service Msg { - // SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or - // counterfactual signing. - rpc SubmitEvidence(MsgSubmitEvidence) returns (MsgSubmitEvidenceResponse); -} -``` - -### `MsgSubmitEvidence` - -`MsgSubmitEvidence` represents a message that supports submitting arbitrary Evidence of misbehavior such as equivocation or counterfactual signing. - -```go tx.proto -message MsgSubmitEvidence { - option (cosmos.msg.v1.signer) = "submitter"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "Evidence"]; -} -``` - -#### `MsgSubmitEvidenceResponse` - -`MsgSubmitEvidenceResponse` defines the `Msg/SubmitEvidence` response type. - -```go tx.proto -message MsgSubmitEvidenceResponse { - // hash defines the hash of the evidence. - bytes hash = 4; -} -``` - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - // Evidence queries evidence based on evidence hash. - rpc Evidence(QueryEvidenceRequest) returns (QueryEvidenceResponse) { - option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence/{evidence_hash}"; - } - - // AllEvidence queries all evidence. - rpc AllEvidence(QueryAllEvidenceRequest) returns (QueryAllEvidenceResponse) { - option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence"; - } -} -``` - -### `QueryEvidenceRequest` - -`QueryEvidenceRequest` is the request type for the `Query/Evidence` RPC method. - -```go query.proto -message QueryEvidenceRequest { - // evidence_hash defines the hash of the requested evidence. - bytes evidence_hash = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; -} -``` - -#### `QueryEvidenceResponse` - -`QueryEvidenceResponse` is the response type for the `Query/Evidence` RPC method. - -```go query.proto -message QueryEvidenceResponse { - // evidence returns the requested evidence. - google.protobuf.Any evidence = 1; -} -``` - -### `QueryEvidenceRequest` - -`QueryEvidenceRequest` is the request type for the `Query/AllEvidence` RPC - -```go query.proto -message QueryAllEvidenceRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryAllEvidenceResponse` - -`QueryAllEvidenceResponse` is the response type for the `Query/AllEvidence` RPC method. - -```go query.proto -message QueryAllEvidenceResponse { - // evidence returns all evidences. - repeated google.protobuf.Any evidence = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/feegrant.mdx b/docs/develop/modules/cosmos-sdk-modules/feegrant.mdx deleted file mode 100644 index b26f807..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/feegrant.mdx +++ /dev/null @@ -1,180 +0,0 @@ ---- -sidebar_position: 8 ---- - -# feegrant - -The `feegrant` module is responsible for allowing accounts to grant fee allowances and to use fees from their accounts. Grantees can execute any transaction without the need to maintain sufficient fees. - -For more information, visit https://docs.cosmos.network/main/modules/feegrant/ - -## Message Types - -`Msg` defines the feegrant msg service. - -```go tx.proto -service Msg { - - // GrantAllowance grants fee allowance to the grantee on the granter's - // account with the provided expiration time. - rpc GrantAllowance(MsgGrantAllowance) returns (MsgGrantAllowanceResponse); - - // RevokeAllowance revokes any fee allowance of granter's account that - // has been granted to the grantee. - rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse); -} -``` - -### `MsgGrantAllowance` - -`MsgGrantAllowance` adds permission for Grantee to spend up to Allowance of fees from the account of Granter. - -```go tx.proto -message MsgGrantAllowance { - option (cosmos.msg.v1.signer) = "granter"; - - // granter is the address of the user granting an allowance of their funds. - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // grantee is the address of the user being granted an allowance of another user's funds. - string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // allowance can be any of basic, periodic, allowed fee allowance. - google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"]; -} -``` - -#### `MsgGrantAllowanceResponse` -`MsgGrantAllowanceResponse` defines the `Msg/GrantAllowanceResponse` response type. - -```go tx.proto -message MsgGrantAllowanceResponse {} -``` - -### `MsgRevokeAllowance` - -`MsgRevokeAllowance` removes any existing Allowance from Granter to Grantee. - -```go tx.proto -message MsgRevokeAllowance { - option (cosmos.msg.v1.signer) = "granter"; - - // granter is the address of the user granting an allowance of their funds. - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // grantee is the address of the user being granted an allowance of another user's funds. - string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgRevokeAllowanceResponse` - -`MsgRevokeAllowanceResponse` defines the `Msg/RevokeAllowanceResponse` response type. - -```go tx.proto -message MsgRevokeAllowanceResponse {} -``` - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - - // Allowance returns fee granted to the grantee by the granter. - rpc Allowance(QueryAllowanceRequest) returns (QueryAllowanceResponse) { - option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}"; - } - - // Allowances returns all the grants for address. - rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) { - option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}"; - } - - // AllowancesByGranter returns all the grants given by an address - // Since v0.46 - rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) { - option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}"; - } -} -``` - -### `QueryAllowanceRequest` - -`QueryAllowanceRequest` is the request type for the Query/Allowance RPC method. - -```go query.proto -message QueryAllowanceRequest { - // granter is the address of the user granting an allowance of their funds. - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // grantee is the address of the user being granted an allowance of another user's funds. - string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryAllowanceResponse` - -`QueryAllowanceResponse` is the response type for the `Query/Allowance` RPC method. - -```go query.proto -message QueryAllowanceResponse { - // allowance is a allowance granted for grantee by granter. - cosmos.feegrant.v1beta1.Grant allowance = 1; -} -``` - -### `QueryAllowancesRequest` - -`QueryAllowancesRequest` is the request type for the `Query/Allowances` RPC method. - -```go query.proto -message QueryAllowancesRequest { - string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryAllowancesResponse` - -`QueryAllowancesResponse` is the response type for the `Query/Allowances` RPC method. - -```go query.proto -message QueryAllowancesResponse { - // allowances are allowance's granted for grantee by granter. - repeated cosmos.feegrant.v1beta1.Grant allowances = 1; - - // pagination defines an pagination for the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryAllowancesByGranterRequest` - -`QueryAllowancesByGranterRequest` is the request type for the `Query/AllowancesByGranter` RPC method. - -```go query.proto -message QueryAllowancesByGranterRequest { - string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryAllowancesByGranterResponse` - -`QueryAllowancesByGranterResponse` is the response type for the `Query/AllowancesByGranter` RPC method. - -```go query.proto -message QueryAllowancesByGranterResponse { - // allowances that have been issued by the granter. - repeated cosmos.feegrant.v1beta1.Grant allowances = 1; - - // pagination defines an pagination for the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/group.mdx b/docs/develop/modules/cosmos-sdk-modules/group.mdx deleted file mode 100644 index 0c7eb7b..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/group.mdx +++ /dev/null @@ -1,912 +0,0 @@ ---- -sidebar_position: 9 ---- - -# group - -The `group` module is responsible for the creation and management of on-chain multisig accounts and enables voting for message execution based on configurable decision policies. - -For more information, visit https://docs.cosmos.network/main/modules/group/ - -## Message Types - -`Msg` is the cosmos.group.v1 Msg service. - -```go tx.proto -service Msg { - - // CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. - rpc CreateGroup(MsgCreateGroup) returns (MsgCreateGroupResponse); - - // UpdateGroupMembers updates the group members with given group id and admin address. - rpc UpdateGroupMembers(MsgUpdateGroupMembers) returns (MsgUpdateGroupMembersResponse); - - // UpdateGroupAdmin updates the group admin with given group id and previous admin address. - rpc UpdateGroupAdmin(MsgUpdateGroupAdmin) returns (MsgUpdateGroupAdminResponse); - - // UpdateGroupMetadata updates the group metadata with given group id and admin address. - rpc UpdateGroupMetadata(MsgUpdateGroupMetadata) returns (MsgUpdateGroupMetadataResponse); - - // CreateGroupPolicy creates a new group policy using given DecisionPolicy. - rpc CreateGroupPolicy(MsgCreateGroupPolicy) returns (MsgCreateGroupPolicyResponse); - - // CreateGroupWithPolicy creates a new group with policy. - rpc CreateGroupWithPolicy(MsgCreateGroupWithPolicy) returns (MsgCreateGroupWithPolicyResponse); - - // UpdateGroupPolicyAdmin updates a group policy admin. - rpc UpdateGroupPolicyAdmin(MsgUpdateGroupPolicyAdmin) returns (MsgUpdateGroupPolicyAdminResponse); - - // UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. - rpc UpdateGroupPolicyDecisionPolicy(MsgUpdateGroupPolicyDecisionPolicy) - returns (MsgUpdateGroupPolicyDecisionPolicyResponse); - - // UpdateGroupPolicyMetadata updates a group policy metadata. - rpc UpdateGroupPolicyMetadata(MsgUpdateGroupPolicyMetadata) returns (MsgUpdateGroupPolicyMetadataResponse); - - // SubmitProposal submits a new proposal. - rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); - - // WithdrawProposal aborts a proposal. - rpc WithdrawProposal(MsgWithdrawProposal) returns (MsgWithdrawProposalResponse); - - // Vote allows a voter to vote on a proposal. - rpc Vote(MsgVote) returns (MsgVoteResponse); - - // Exec executes a proposal. - rpc Exec(MsgExec) returns (MsgExecResponse); - - // LeaveGroup allows a group member to leave the group. - rpc LeaveGroup(MsgLeaveGroup) returns (MsgLeaveGroupResponse); -} -``` - -### `MsgCreateGroup` - -`MsgCreateGroup` is the `Msg/CreateGroup` request type. - -```go tx.proto -message MsgCreateGroup { - option (cosmos.msg.v1.signer) = "admin"; - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // members defines the group members. - repeated Member members = 2 [(gogoproto.nullable) = false]; - - // metadata is any arbitrary metadata to attached to the group. - string metadata = 3; -} -``` - -#### `MsgCreateGroupResponse` - -`MsgCreateGroupResponse` is the `Msg/CreateGroup` response type. - -```go tx.proto -message MsgCreateGroupResponse { - - // group_id is the unique ID of the newly created group. - uint64 group_id = 1; -} -``` - -### `MsgUpdateGroupMembers` - -`MsgUpdateGroupMembers` is the `Msg/UpdateGroupMembers` request type. - -```go tx.proto -message MsgUpdateGroupMembers { - option (cosmos.msg.v1.signer) = "admin"; - - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // group_id is the unique ID of the group. - uint64 group_id = 2; - - // member_updates is the list of members to update, - // set weight to 0 to remove a member. - repeated Member member_updates = 3 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgUpdateGroupMembersResponse` - -`MsgUpdateGroupMembersResponse` is the `Msg/UpdateGroupMembers` response type. - -```go tx.proto -message MsgUpdateGroupMembersResponse {} -``` - -### `MsgUpdateGroupAdmin` - -`MsgUpdateGroupAdmin` is the `Msg/UpdateGroupAdmin` request type. - -```go tx.proto -message MsgUpdateGroupAdmin { - option (cosmos.msg.v1.signer) = "admin"; - - // admin is the current account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // group_id is the unique ID of the group. - uint64 group_id = 2; - - // new_admin is the group new admin account address. - string new_admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgUpdateGroupAdminResponse` - -`MsgUpdateGroupAdminResponse` is the `Msg/UpdateGroupAdmin` response type. - -```go tx.proto -message MsgUpdateGroupAdminResponse {} -``` - -### `MsgUpdateGroupMetadata` - -`MsgUpdateGroupMetadata` is the `Msg/UpdateGroupMetadata` request type. - -```go tx.proto -message MsgUpdateGroupMetadata { - option (cosmos.msg.v1.signer) = "admin"; - - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // group_id is the unique ID of the group. - uint64 group_id = 2; - - // metadata is the updated group's metadata. - string metadata = 3; -} -``` - -#### `MsgUpdateGroupMetadataResponse` - -`MsgUpdateGroupMetadataResponse` is the `Msg/UpdateGroupMetadata` response type. - -```go tx.proto -message MsgUpdateGroupMetadataResponse {} -``` - -### `MsgCreateGroupPolicy` - -`MsgCreateGroupPolicy` is the `Msg/CreateGroupPolicy` request type. - -```go tx.proto -message MsgCreateGroupPolicy { - option (cosmos.msg.v1.signer) = "admin"; - - option (gogoproto.goproto_getters) = false; - - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // group_id is the unique ID of the group. - uint64 group_id = 2; - - // metadata is any arbitrary metadata attached to the group policy. - string metadata = 3; - - // decision_policy specifies the group policy's decision policy. - google.protobuf.Any decision_policy = 4 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; -} -``` - -#### `MsgCreateGroupPolicyResponse` - -`MsgCreateGroupPolicyResponse` is the `Msg/CreateGroupPolicy` response type. - -```go tx.proto -message MsgCreateGroupPolicyResponse { - - // address is the account address of the newly created group policy. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -### `MsgCreateGroupWithPolicy` - -`MsgCreateGroupWithPolicy` is the `Msg/CreateGroupWithPolicy` request type. - -```go tx.proto -message MsgCreateGroupWithPolicy { - option (gogoproto.goproto_getters) = false; - - // admin is the account address of the group and group policy admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // members defines the group members. - repeated Member members = 2 [(gogoproto.nullable) = false]; - - // group_metadata is any arbitrary metadata attached to the group. - string group_metadata = 3; - - // group_policy_metadata is any arbitrary metadata attached to the group policy. - string group_policy_metadata = 4; - - // group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group and group policy admin. - bool group_policy_as_admin = 5; - - // decision_policy specifies the group policy's decision policy. - google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; -} -``` - -#### `MsgCreateGroupWithPolicyResponse` - -`MsgCreateGroupWithPolicyResponse` is the `Msg/CreateGroupWithPolicy` response type. - -```go tx.proto -message MsgCreateGroupWithPolicyResponse { - - // group_id is the unique ID of the newly created group with policy. - uint64 group_id = 1; - - // group_policy_address is the account address of the newly created group policy. - string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -### `MsgUpdateGroupPolicyAdmin` - -`MsgUpdateGroupPolicyAdmin` is the `Msg/UpdateGroupPolicyAdmin` request type. - -```go tx.proto -message MsgUpdateGroupPolicyAdmin { - option (cosmos.msg.v1.signer) = "admin"; - - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // address is the account address of the group policy. - string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // new_admin is the new group policy admin. - string new_admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgUpdateGroupPolicyAdminResponse` - -`MsgUpdateGroupPolicyAdminResponse` is the `Msg/UpdateGroupPolicyAdmin` response type. - -```go tx.proto -message MsgUpdateGroupPolicyAdminResponse {} -``` - -### `MsgUpdateGroupPolicyDecisionPolicy` - -`MsgUpdateGroupPolicyDecisionPolicy` is the `Msg/UpdateGroupPolicyDecisionPolicy` request type. - -```go tx.proto -message MsgUpdateGroupPolicyDecisionPolicy { - option (cosmos.msg.v1.signer) = "admin"; - - option (gogoproto.goproto_getters) = false; - - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // address is the account address of group policy. - string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // decision_policy is the updated group policy's decision policy. - google.protobuf.Any decision_policy = 3 [(cosmos_proto.accepts_interface) = "DecisionPolicy"]; -} -``` - -#### `MsgUpdateGroupPolicyDecisionPolicyResponse` - -`MsgUpdateGroupPolicyDecisionPolicyResponse` is the `Msg/UpdateGroupPolicyDecisionPolicy` response type. - -```go tx.proto -message MsgUpdateGroupPolicyDecisionPolicyResponse {} -``` - -### `MsgUpdateGroupPolicyMetadata` - -`MsgUpdateGroupPolicyMetadata` is the `Msg/UpdateGroupPolicyMetadata` request type. - -```go tx.proto -message MsgUpdateGroupPolicyMetadata { - option (cosmos.msg.v1.signer) = "admin"; - - // admin is the account address of the group admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // address is the account address of group policy. - string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // metadata is the updated group policy metadata. - string metadata = 3; -} -``` - -#### `MsgUpdateGroupPolicyMetadataResponse` - -`MsgUpdateGroupPolicyMetadataResponse` is the `Msg/UpdateGroupPolicyMetadata` response type. - -```go tx.proto -message MsgUpdateGroupPolicyMetadataResponse {} -``` - -### `MsgSubmitProposal` - -`MsgSubmitProposal` is the `Msg/SubmitProposal` request type. - -```go tx.proto -message MsgSubmitProposal { - option (cosmos.msg.v1.signer) = "proposers"; - - option (gogoproto.goproto_getters) = false; - - // address is the account address of group policy. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // proposers are the account addresses of the proposers. - // Proposers signatures will be counted as yes votes. - repeated string proposers = 2; - - // metadata is any arbitrary metadata to attached to the proposal. - string metadata = 3; - - // messages is a list of `sdk.Msg`s that will be executed if the proposal passes. - repeated google.protobuf.Any messages = 4; - - // exec defines the mode of execution of the proposal, - // whether it should be executed immediately on creation or not. - // If so, proposers signatures are considered as Yes votes. - Exec exec = 5; -} -``` - -#### `MsgSubmitProposalResponse` - -`MsgSubmitProposalResponse` is the `Msg/SubmitProposal` response type. - -```go tx.proto -message MsgSubmitProposalResponse { - - // proposal is the unique ID of the proposal. - uint64 proposal_id = 1; -} -``` - -### `MsgWithdrawProposal` - -`MsgWithdrawProposal` is the `Msg/WithdrawProposal` request type. - -```go tx.proto -message MsgWithdrawProposal { - // proposal is the unique ID of the proposal. - uint64 proposal_id = 1; - - // address is the admin of the group policy or one of the proposer of the proposal. - string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgWithdrawProposalResponse` -`MsgWithdrawProposalResponse` is the `Msg/WithdrawProposal` response type. - -```go tx.proto -message MsgWithdrawProposalResponse {} -``` - -### `MsgVote` - -`MsgVote` is the `Msg/Vote` request type. - - -```go tx.proto -message MsgVote { - option (cosmos.msg.v1.signer) = "voter"; - - // proposal is the unique ID of the proposal. - uint64 proposal_id = 1; - // voter is the voter account address. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // option is the voter's choice on the proposal. - VoteOption option = 3; - - // metadata is any arbitrary metadata to attached to the vote. - string metadata = 4; - - // exec defines whether the proposal should be executed - // immediately after voting or not. - Exec exec = 5; -} -``` - -#### `MsgVoteResponse` - -`MsgVoteResponse` is the `Msg/Vote` response type. - -```go tx.proto -message MsgVoteResponse {} -``` - -### `MsgExec` - -`MsgExec` is the `Msg/Exec` request type. - -```go tx.proto -message MsgExec { - option (cosmos.msg.v1.signer) = "signer"; - - // proposal is the unique ID of the proposal. - uint64 proposal_id = 1; - - // signer is the account address used to execute the proposal. - string signer = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgExecResponse` - -`MsgExecResponse` is the `Msg/Exec` request type. - -```go tx.proto -message MsgExecResponse {} -``` - -### `MsgLeaveGroup` - -`MsgLeaveGroup` is the `Msg/LeaveGroup` request type. - -```go tx.proto -message MsgLeaveGroup { - option (cosmos.msg.v1.signer) = "address"; - - // address is the account address of the group member. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // group_id is the unique ID of the group. - uint64 group_id = 2; -} -``` - -#### `MsgLeaveGroupResponse` - -`MsgLeaveGroupResponse` is the `Msg/LeaveGroup` response type. - -```go tx.proto -message MsgLeaveGroupResponse {} -``` - -## Queries - -`Query` is the cosmos.group.v1 Query service. - -```go query.proto -service Query { - - // GroupInfo queries group info based on group id. - rpc GroupInfo(QueryGroupInfoRequest) returns (QueryGroupInfoResponse) { - option (google.api.http).get = "/cosmos/group/v1/group_info/{group_id}"; - }; - - // GroupPolicyInfo queries group policy info based on account address of group policy. - rpc GroupPolicyInfo(QueryGroupPolicyInfoRequest) returns (QueryGroupPolicyInfoResponse) { - option (google.api.http).get = "/cosmos/group/v1/group_policy_info/{address}"; - }; - - // GroupMembers queries members of a group - rpc GroupMembers(QueryGroupMembersRequest) returns (QueryGroupMembersResponse) { - option (google.api.http).get = "/cosmos/group/v1/group_members/{group_id}"; - }; - - // GroupsByAdmin queries groups by admin address. - rpc GroupsByAdmin(QueryGroupsByAdminRequest) returns (QueryGroupsByAdminResponse) { - option (google.api.http).get = "/cosmos/group/v1/groups_by_admin/{admin}"; - }; - - // GroupPoliciesByGroup queries group policies by group id. - rpc GroupPoliciesByGroup(QueryGroupPoliciesByGroupRequest) returns (QueryGroupPoliciesByGroupResponse) { - option (google.api.http).get = "/cosmos/group/v1/group_policies_by_group/{group_id}"; - }; - - // GroupsByAdmin queries group policies by admin address. - rpc GroupPoliciesByAdmin(QueryGroupPoliciesByAdminRequest) returns (QueryGroupPoliciesByAdminResponse) { - option (google.api.http).get = "/cosmos/group/v1/group_policies_by_admin/{admin}"; - }; - - // Proposal queries a proposal based on proposal id. - rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { - option (google.api.http).get = "/cosmos/group/v1/proposal/{proposal_id}"; - }; - - // ProposalsByGroupPolicy queries proposals based on account address of group policy. - rpc ProposalsByGroupPolicy(QueryProposalsByGroupPolicyRequest) returns (QueryProposalsByGroupPolicyResponse) { - option (google.api.http).get = "/cosmos/group/v1/proposals_by_group_policy/{address}"; - }; - - // VoteByProposalVoter queries a vote by proposal id and voter. - rpc VoteByProposalVoter(QueryVoteByProposalVoterRequest) returns (QueryVoteByProposalVoterResponse) { - option (google.api.http).get = "/cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}"; - }; - - // VotesByProposal queries a vote by proposal. - rpc VotesByProposal(QueryVotesByProposalRequest) returns (QueryVotesByProposalResponse) { - option (google.api.http).get = "/cosmos/group/v1/votes_by_proposal/{proposal_id}"; - }; - - // VotesByVoter queries a vote by voter. - rpc VotesByVoter(QueryVotesByVoterRequest) returns (QueryVotesByVoterResponse) { - option (google.api.http).get = "/cosmos/group/v1/votes_by_voter/{voter}"; - }; - - // GroupsByMember queries groups by member address. - rpc GroupsByMember(QueryGroupsByMemberRequest) returns (QueryGroupsByMemberResponse) { - option (google.api.http).get = "/cosmos/group/v1/groups_by_member/{address}"; - }; - - // TallyResult queries the tally of a proposal votes. - rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { - option (google.api.http).get = "/cosmos/group/v1/proposals/{proposal_id}/tally"; - }; -} -``` - -### `QueryGroupInfoRequest` - -`QueryGroupInfoRequest` is the `Query/GroupInfo` request type. - -```go query.proto -message QueryGroupInfoRequest { - - // group_id is the unique ID of the group. - uint64 group_id = 1; -} -``` - -#### `QueryGroupInfoResponse` - -`QueryGroupInfoResponse` is the `Query/GroupInfo` response type. - -```go query.proto -message QueryGroupInfoResponse { - - // info is the GroupInfo for the group. - GroupInfo info = 1; -} -``` - -### `QueryGroupPolicyInfoRequest` - -`QueryGroupPolicyInfoRequest` is the `Query/GroupPolicyInfo` request type. - -```go query.proto -message QueryGroupPolicyInfoRequest { - - // address is the account address of the group policy. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryGroupPolicyInfoResponse` - -`QueryGroupPolicyInfoResponse` is the `Query/GroupPolicyInfo` response type. - -```go query.proto -message QueryGroupPolicyInfoResponse { - - // info is the GroupPolicyInfo for the group policy. - GroupPolicyInfo info = 1; -} -``` - -### `QueryGroupMembersRequest` - -`QueryGroupMembersRequest` is the `Query/GroupMembers` request type. - -```go query.proto -message QueryGroupMembersRequest { - - // group_id is the unique ID of the group. - uint64 group_id = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGroupMembersResponse` - -`QueryGroupMembersResponse` is the `Query/GroupMembersResponse` response type. - -```go query.proto -message QueryGroupMembersResponse { - - // members are the members of the group with given group_id. - repeated GroupMember members = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryGroupsByAdminRequest` - -`QueryGroupsByAdminRequest` is the `Query/GroupsByAdmin` request type. - -```go query.proto -message QueryGroupsByAdminRequest { - - // admin is the account address of a group's admin. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGroupsByAdminResponse` - -`QueryGroupsByAdminResponse` is the `Query/GroupsByAdminResponse` response type. - -```go query.proto -message QueryGroupsByAdminResponse { - - // groups are the groups info with the provided admin. - repeated GroupInfo groups = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryGroupPoliciesByGroupRequest` - -`QueryGroupPoliciesByGroupRequest` is the `Query/GroupPoliciesByGroup` request type. - -```go query.proto -message QueryGroupPoliciesByGroupRequest { - - // group_id is the unique ID of the group policy's group. - uint64 group_id = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGroupPoliciesByGroupResponse` - -`QueryGroupPoliciesByGroupResponse` is the `Query/GroupPoliciesByGroup` response type. - -```go query.proto -message QueryGroupPoliciesByGroupResponse { - - // group_policies are the group policies info associated with the provided group. - repeated GroupPolicyInfo group_policies = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryGroupPoliciesByAdminRequest` - -`QueryGroupPoliciesByAdminRequest` is the `Query/GroupPoliciesByAdmin` request type. - -```go query.proto -message QueryGroupPoliciesByAdminRequest { - - // admin is the admin address of the group policy. - string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGroupPoliciesByAdminResponse` - -`QueryGroupPoliciesByAdminResponse` is the `Query/GroupPoliciesByAdmin` response type. - -```go query.proto -message QueryGroupPoliciesByAdminResponse { - - // group_policies are the group policies info with provided admin. - repeated GroupPolicyInfo group_policies = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryProposalRequest` - -`QueryProposalRequest` is the `Query/Proposal` request type. - -```go query.proto -message QueryProposalRequest { - - // proposal_id is the unique ID of a proposal. - uint64 proposal_id = 1; -} -``` - -#### `QueryProposalResponse` - -`QueryProposalResponse` is the `Query/Proposal` response type. - -```go query.proto -message QueryProposalResponse { - - // proposal is the proposal info. - Proposal proposal = 1; -} -``` - -### `QueryProposalsByGroupPolicyRequest` - -`QueryProposalsByGroupPolicyRequest` is the `Query/ProposalByGroupPolicy` request type. - -```go query.proto -message QueryProposalsByGroupPolicyRequest { - - // address is the account address of the group policy related to proposals. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryProposalsByGroupPolicyResponse` - -`QueryProposalsByGroupPolicyResponse` is the `Query/ProposalByGroupPolicy` response type. - -```go query.proto -message QueryProposalsByGroupPolicyResponse { - - // proposals are the proposals with given group policy. - repeated Proposal proposals = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryVoteByProposalVoterRequest` - -`QueryVoteByProposalVoterRequest` is the `Query/VoteByProposalVoter` request type. - -```go query.proto -message QueryVoteByProposalVoterRequest { - - // proposal_id is the unique ID of a proposal. - uint64 proposal_id = 1; - - // voter is a proposal voter account address. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryVoteByProposalVoterResponse` - -`QueryVoteByProposalVoterResponse` is the `Query/VoteByProposalVoter` response type. - -```go query.proto -message QueryVoteByProposalVoterResponse { - - // vote is the vote with given proposal_id and voter. - Vote vote = 1; -} -``` - -### `QueryVotesByProposalRequest` - -`QueryVotesByProposalRequest` is the `Query/VotesByProposal` request type. - -```go query.proto -message QueryVotesByProposalRequest { - - // proposal_id is the unique ID of a proposal. - uint64 proposal_id = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryVotesByProposalResponse` - -`QueryVotesByProposalResponse` is the `Query/VotesByProposal` response type. - -```go query.proto -message QueryVotesByProposalResponse { - - // votes are the list of votes for given proposal_id. - repeated Vote votes = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryVotesByVoterRequest` - -`QueryVotesByVoterRequest` is the `Query/VotesByVoter` request type. - -```go query.proto -message QueryVotesByVoterRequest { - // voter is a proposal voter account address. - string voter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryVotesByVoterResponse` - -`QueryVotesByVoterResponse` is the `Query/VotesByVoter` response type. - -```go query.proto -message QueryVotesByVoterResponse { - - // votes are the list of votes by given voter. - repeated Vote votes = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryGroupsByMemberRequest` - -`QueryGroupsByMemberRequest` is the `Query/GroupsByMember` request type. - -```go query.proto -message QueryGroupsByMemberRequest { - // address is the group member address. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryGroupsByMemberResponse` - -`QueryGroupsByMemberResponse` is the `Query/GroupsByMember` response type. - -```go query.proto -message QueryGroupsByMemberResponse { - // groups are the groups info with the provided group member. - repeated GroupInfo groups = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryTallyResultRequest` - -`QueryTallyResultRequest` is the `Query/TallyResult` request type. - -```go query.proto -message QueryTallyResultRequest { - // proposal_id is the unique id of a proposal. - uint64 proposal_id = 1; -} -``` - -#### `QueryTallyResultResponse` - -`QueryTallyResultResponse` is the `Query/TallyResult` response type. - -```go query.proto -message QueryTallyResultResponse { - // tally defines the requested tally. - TallyResult tally = 1 [(gogoproto.nullable) = false]; -} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/mint.mdx b/docs/develop/modules/cosmos-sdk-modules/mint.mdx deleted file mode 100644 index 9576049..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/mint.mdx +++ /dev/null @@ -1,93 +0,0 @@ ---- -sidebar_position: 10 ---- - -# mint - -The `mint` module is responsible for the creation of new units of MARS. The minting mechanism is designed to: - -- allow for a flexible inflation rate determined by market demand targeting a particular bonded-stake ratio. -- effect a balance between market liquidity and staked supply - -For more information, visit https://docs.cosmos.network/main/modules/mint - -## Queries - -`Query` provides defines the gRPC querier service. - -```go query.proto -service Query { - // Params returns the total set of minting parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/mint/v1beta1/params"; - } - - // Inflation returns the current minting inflation value. - rpc Inflation(QueryInflationRequest) returns (QueryInflationResponse) { - option (google.api.http).get = "/cosmos/mint/v1beta1/inflation"; - } - - // AnnualProvisions current minting annual provisions value. - rpc AnnualProvisions(QueryAnnualProvisionsRequest) returns (QueryAnnualProvisionsResponse) { - option (google.api.http).get = "/cosmos/mint/v1beta1/annual_provisions"; - } -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is the response type for the Query/Params RPC method. - -```go query.proto -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryInflationRequest` - -`QueryInflationRequest` is the request type for the `Query/Inflation` RPC method. - -```go query.proto -message QueryInflationRequest {} -``` - -#### `QueryInflationResponse` - -`QueryInflationResponse` is the response type for the `Query/Inflation` RPC method. - -```go query.proto -message QueryInflationResponse { - // inflation is the current minting inflation value. - bytes inflation = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; -} -``` - -### `QueryAnnualProvisionsRequest` - -`QueryAnnualProvisionsRequest` is the request type for the `Query/AnnualProvisions` RPC method. - -```go query.proto -message QueryAnnualProvisionsRequest {} -``` - -#### `QueryAnnualProvisionsResponse` - -`QueryAnnualProvisionsResponse` is the response type for the `Query/AnnualProvisions` RPC method. - -```go query.proto -message QueryAnnualProvisionsResponse { - // annual_provisions is the current minting annual provisions value. - bytes annual_provisions = 1 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/nft.mdx b/docs/develop/modules/cosmos-sdk-modules/nft.mdx deleted file mode 100644 index e354889..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/nft.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -sidebar_position: 11 ---- - -# nft - -The `nft` module is responsible for creating NFT classifications, creating NFTs, transferring NFTs, updating NFTs, and supporting various queries. It is fully compatible with the ERC721 specification. - -For more information, visit https://docs.cosmos.network/main/modules/nft/ - -## Message Types - -`Msg` defines the nft Msg service. - -```go tx.proto -service Msg { - // Send defines a method to send a nft from one account to another account. - rpc Send(MsgSend) returns (MsgSendResponse); -} -``` - -### `MsgSend` - -`MsgSend` represents a message to send a nft from one account to another account. - -```go tx.proto -message MsgSend { - option (cosmos.msg.v1.signer) = "sender"; - - // class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 - string class_id = 1; - - // id defines the unique identification of nft - string id = 2; - - // sender is the address of the owner of nft - string sender = 3; - - // receiver is the receiver address of nft - string receiver = 4; -} -``` - -#### `MsgSendResponse` - -`MsgSendResponse` defines the `Msg/Send` response type. - -```go tx.proto -message MsgSendResponse {} -``` - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - // Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721 - rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{owner}/{class_id}"; - } - - // Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721 - rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/owner/{class_id}/{id}"; - } - - // Supply queries the number of NFTs from the given class, same as totalSupply of ERC721. - rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}"; - } - - // NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in - // ERC721Enumerable - rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/nfts"; - } - - // NFT queries an NFT based on its class and id. - rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}/{id}"; - } - - // Class queries an NFT class based on its id - rpc Class(QueryClassRequest) returns (QueryClassResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}"; - } - - // Classes queries all NFT classes - rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) { - option (google.api.http).get = "/cosmos/nft/v1beta1/classes"; - } -} -``` - -### `QueryBalanceRequest` - -`QueryBalanceRequest` is the request type for the `Query/Balance` RPC method - -```go query.proto -message QueryBalanceRequest { - string class_id = 1; - string owner = 2; -} -``` - -#### `QueryBalanceResponse` - -`QueryBalanceResponse` is the response type for the `Query/Balance` RPC method - -```go query.proto -message QueryBalanceResponse { - uint64 amount = 1; -} -``` - -### `QueryOwnerRequest` - -`QueryOwnerRequest` is the request type for the `Query/Owner` RPC method - -```go query.proto -message QueryOwnerRequest { - string class_id = 1; - string id = 2; -} -``` - -#### `QueryOwnerResponse` - -`QueryOwnerResponse` is the response type for the `Query/Owner` RPC method - -```go query.proto -message QueryOwnerResponse { - string owner = 1; -} -``` - -### `QuerySupplyRequest` - -`QuerySupplyRequest` is the request type for the `Query/Supply` RPC method - -```go query.proto -message QuerySupplyRequest { - string class_id = 1; -} -``` - -#### `QuerySupplyResponse` - -`QuerySupplyResponse` is the response type for the `Query/Supply` RPC method - -```go query.proto -message QuerySupplyResponse { - uint64 amount = 1; -} -``` - -### `QueryNFTstRequest` - -`QueryNFTstRequest` is the request type for the `Query/NFTs` RPC method - -```go query.proto -message QueryNFTsRequest { - string class_id = 1; - string owner = 2; - cosmos.base.query.v1beta1.PageRequest pagination = 3; -} -``` - -#### `QueryNFTsResponse` - -`QueryNFTsResponse` is the response type for the `Query/NFTs` RPC methods - -```go query.proto -message QueryNFTsResponse { - repeated cosmos.nft.v1beta1.NFT nfts = 1; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryNFTRequest` - -`QueryNFTRequest` is the request type for the `Query/NFT` RPC method. - -```go query.proto -message QueryNFTRequest { - string class_id = 1; - string id = 2; -} -``` - -#### `QueryNFTResponse` - -`QueryNFTResponse` is the response type for the `Query/NFT` RPC method. - -```go query.proto -message QueryNFTResponse { - cosmos.nft.v1beta1.NFT nft = 1; -} -``` - -### `QueryClassRequest` - -`QueryClassRequest` is the request type for the `Query/Class` RPC method. - -```go query.proto -message QueryClassRequest { - string class_id = 1; -} -``` - -#### `QueryClassResponse` - -`QueryClassResponse` is the response type for the `Query/Class` RPC method. - -```go query.proto -message QueryClassResponse { - cosmos.nft.v1beta1.Class class = 1; -} -``` - -### `QueryClassesRequest` - -`QueryClassesRequest` is the request type for the `Query/Classes` RPC method. - -```go query.proto -message QueryClassesRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryClassesResponse` - -`QueryClassesResponse` is the response type for the `Query/Classes` RPC method. - -```go query.proto -message QueryClassesResponse { - repeated cosmos.nft.v1beta1.Class classes = 1; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/params.mdx b/docs/develop/modules/cosmos-sdk-modules/params.mdx deleted file mode 100644 index 72bbb0a..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/params.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -sidebar_position: 12 ---- - -# params - -The `params` module is responsible for providing a globally available parameter store. There are two main types, Keeper and Subspace. Subspace is an isolated namespace for a paramstore, where keys are prefixed by preconfigured spacename. Keeper has a permission to access all existing spaces. - -Subspace can be used by the individual keepers, which need a private parameter store that the other keepers cannot modify. The params Keeper can be used to add a route to x/gov router in order to modify any parameter in case a proposal passes. - -For more information, visit https://docs.cosmos.network/main/modules/params/ - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - // Params queries a specific parameter of a module, given its subspace and - // key. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/params/v1beta1/params"; - } - - // Subspaces queries for all registered subspaces and all keys for a subspace. - rpc Subspaces(QuerySubspacesRequest) returns (QuerySubspacesResponse) { - option (google.api.http).get = "/cosmos/params/v1beta1/subspaces"; - } -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest { - // subspace defines the module to query the parameter for. - string subspace = 1; - - // key defines the key of the parameter in the subspace. - string key = 2; -} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - // param defines the queried parameter. - ParamChange param = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QuerySubspacesRequest` - -`QuerySubspacesRequest` defines a request type for querying for all registered subspaces and all keys for a subspace. - -```go query.proto -message QuerySubspacesRequest {} -``` - -#### `QuerySubspacesResponse` - -`QuerySubspacesResponse` defines the response types for querying for all registered subspaces and all keys for a subspace. - -```go query.proto -message QuerySubspacesResponse { - repeated Subspace subspaces = 1; -} -``` diff --git a/docs/develop/modules/cosmos-sdk-modules/slashing.mdx b/docs/develop/modules/cosmos-sdk-modules/slashing.mdx deleted file mode 100644 index 13d94ad..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/slashing.mdx +++ /dev/null @@ -1,131 +0,0 @@ ---- -sidebar_position: 13 ---- - -# slashing - -The `slashing` module is responsible for validator punishment mechanisms, or disincentivizing any attributable action by a protocol-recognized actor with value at stake by penalizing them ("slashing"). Penalties may include, but are not limited to: - -- burning some amount of their stake -- removing their ability to vote on future blocks for a period of time - -For more information, visit https://docs.cosmos.network/main/modules/slashing/ - -## Message Types - -`Msg` defines the slashing Msg service. - -```go tx.proto -service Msg { - // Unjail defines a method for unjailing a jailed validator, thus returning - // them into the bonded validator set, so they can begin receiving provisions - // and rewards again. - rpc Unjail(MsgUnjail) returns (MsgUnjailResponse); -} -``` - -### `MsgUnjail` - -`MsgUnjail` defines the `Msg/Unjail` request type. - -```go tx.proto -message MsgUnjail { - option (cosmos.msg.v1.signer) = "validator_addr"; - - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; - - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.jsontag) = "address"]; -} -``` - -#### `MsgUnjailResponse` - -`MsgUnjailResponse` defines the `Msg/Unjail` response type. - -```go tx.proto -message MsgUnjailResponse {} -``` - -## Queries - -`Query` provides defines the gRPC querier service. - -```go query.proto -service Query { - // Params queries the parameters of slashing module - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/slashing/v1beta1/params"; - } - - // SigningInfo queries the signing info of given cons address - rpc SigningInfo(QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { - option (google.api.http).get = "/cosmos/slashing/v1beta1/signing_infos/{cons_address}"; - } - - // SigningInfos queries signing info of all validators - rpc SigningInfos(QuerySigningInfosRequest) returns (QuerySigningInfosResponse) { - option (google.api.http).get = "/cosmos/slashing/v1beta1/signing_infos"; - } -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` -`QueryParamsResponse` is the response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QuerySigningInfoRequest` - -`QuerySigningInfoRequest` is the request type for the `Query/SigningInfo` RPC method. - -```go query.proto -message QuerySigningInfoRequest { - // cons_address is the address to query signing info of - string cons_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QuerySigningInfoResponse` - -`QuerySigningInfoResponse` is the response type for the `Query/SigningInfo` RPC method. - -```go query.proto -message QuerySigningInfoResponse { - // val_signing_info is the signing info of requested val cons address - ValidatorSigningInfo val_signing_info = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QuerySigningInfosRequest` -`QuerySigningInfosRequest` is the request type for the `Query/SigningInfos` RPC method. - -```go query.proto -message QuerySigningInfosRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QuerySigningInfosResponse` - -`QuerySigningInfosResponse` is the response type for the `Query/SigningInfos` RPC method. - -```go query.proto -message QuerySigningInfosResponse { - // info is the signing info of all validators - repeated cosmos.slashing.v1beta1.ValidatorSigningInfo info = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/staking.mdx b/docs/develop/modules/cosmos-sdk-modules/staking.mdx deleted file mode 100644 index 4aac6f4..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/staking.mdx +++ /dev/null @@ -1,679 +0,0 @@ ---- -sidebar_position: 14 ---- - -# staking - -The `staking` module is responsible for supporting an advanced Proof-of-Stake (PoS) system. In this system, holders of the native staking token of the chain can become validators and can delegate tokens to validators, ultimately determining the effective validator set for the system. - -For more information, visit https://docs.cosmos.network/main/modules/staking/ - -## Message Types - -`Msg` defines the staking Msg service. - -```go tx.proto -service Msg { - // CreateValidator defines a method for creating a new validator. - rpc CreateValidator(MsgCreateValidator) returns (MsgCreateValidatorResponse); - - // EditValidator defines a method for editing an existing validator. - rpc EditValidator(MsgEditValidator) returns (MsgEditValidatorResponse); - - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - rpc Delegate(MsgDelegate) returns (MsgDelegateResponse); - - // BeginRedelegate defines a method for performing a redelegation - // of coins from a delegator and source validator to a destination validator. - rpc BeginRedelegate(MsgBeginRedelegate) returns (MsgBeginRedelegateResponse); - - // Undelegate defines a method for performing an undelegation from a - // delegate and a validator. - rpc Undelegate(MsgUndelegate) returns (MsgUndelegateResponse); - - // CancelUnbondingDelegation defines a method for performing canceling the unbonding delegation - // and delegate back to previous validator. - rpc CancelUnbondingDelegation(MsgCancelUnbondingDelegation) returns (MsgCancelUnbondingDelegationResponse); -} -``` - -### `MsgCreateValidator` - -`MsgCreateValidator` defines an SDK message for creating a new validator. - -```go tx.proto -message MsgCreateValidator { - // NOTE(fdymylja): this is a particular case in which - // if validator_address == delegator_address then only one - // is expected to sign, otherwise both are. - option (cosmos.msg.v1.signer) = "delegator_address"; - option (cosmos.msg.v1.signer) = "validator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - Description description = 1 [(gogoproto.nullable) = false]; - CommissionRates commission = 2 [(gogoproto.nullable) = false]; - string min_self_delegation = 3 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false - ]; - string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; - cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgCreateValidatorResponse` - -`MsgCreateValidatorResponse` defines the `Msg/CreateValidator` response type. - -```go tx.proto -message MsgCreateValidatorResponse {} -``` - -### `MsgEditValidator` - -`MsgEditValidator` defines an SDK message for editing an existing validator. - -```go tx.proto -message MsgEditValidator { - option (cosmos.msg.v1.signer) = "validator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - Description description = 1 [(gogoproto.nullable) = false]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // We pass a reference to the new commission rate and min self delegation as - // it's not mandatory to update. If not updated, the deserialized rate will be - // zero with no way to distinguish if an update was intended. - // REF: #2373 - string commission_rate = 3 - [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; - string min_self_delegation = 4 - [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; -} -``` - -#### `MsgEditValidatorResponse` - -`MsgEditValidatorResponse` defines the `Msg/EditValidator` response type. - -```go tx.proto -message MsgEditValidatorResponse {} -``` - -### `MsgDelegate` - -`MsgDelegate` defines an SDK message for performing a delegation of coins from a delegator to a validator. - -```go tx.proto -message MsgDelegate { - option (cosmos.msg.v1.signer) = "delegator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgDelegateResponse` - -`MsgDelegateResponse` defines the `Msg/Delegate` response type. - -```go tx.proto -message MsgDelegateResponse {} -``` - -### `MsgBeginRedelegate` - -`MsgBeginRedelegate` defines an SDK message for performing a redelegation of coins from a delegator and source validator to a destination validator. - -```go tx.proto -message MsgBeginRedelegate { - option (cosmos.msg.v1.signer) = "delegator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgBeginRedelegateResponse` - -`MsgBeginRedelegateResponse` defines the `Msg/BeginRedelegate` response type. - -```go tx.proto -message MsgBeginRedelegateResponse { - google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} -``` - -### `MsgUndelegate` - -`MsgUndelegate` defines a SDK message for performing an undelegation from a delegate and a validator. - -```go tx.proto -message MsgUndelegate { - option (cosmos.msg.v1.signer) = "delegator_address"; - - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgUndelegateResponse` - -`MsgUndelegateResponse` defines the `Msg/Undelegate` response type. - -```go tx.proto -message MsgUndelegateResponse { - google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} -``` - -### `MsgCancelUnbondingDelegation` - -`MsgCancelUnbondingDelegation` defines the SDK message for performing a cancel unbonding delegation for delegator. - -```go tx.proto -message MsgCancelUnbondingDelegation{ - option (cosmos.msg.v1.signer) = "delegator_address"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // amount is always less than or equal to unbonding delegation entry balance - cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; - // creation_height is the height which the unbonding took place. - int64 creation_height = 4; -} -``` - -#### `MsgCancelUnbondingDelegationResponse` - -`MsgCancelUnbondingDelegationResponse` defines the `Msg/CancelUnbondingDelegation` response type. - -```go tx.proto -message MsgCancelUnbondingDelegationResponse{} -``` - -## Queries - -`Query` defines the gRPC querier service. - -```go query.proto -service Query { - // Validators queries all validators that match the given status. - rpc Validators(QueryValidatorsRequest) returns (QueryValidatorsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators"; - } - - // Validator queries validator info for given validator address. - rpc Validator(QueryValidatorRequest) returns (QueryValidatorResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}"; - } - - // ValidatorDelegations queries delegate info for given validator. - rpc ValidatorDelegations(QueryValidatorDelegationsRequest) returns (QueryValidatorDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations"; - } - - // ValidatorUnbondingDelegations queries unbonding delegations of a validator. - rpc ValidatorUnbondingDelegations(QueryValidatorUnbondingDelegationsRequest) - returns (QueryValidatorUnbondingDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/" - "{validator_addr}/unbonding_delegations"; - } - - // Delegation queries delegate info for given validator delegator pair. - rpc Delegation(QueryDelegationRequest) returns (QueryDelegationResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" - "{delegator_addr}"; - } - - // UnbondingDelegation queries unbonding info for given validator delegator - // pair. - rpc UnbondingDelegation(QueryUnbondingDelegationRequest) returns (QueryUnbondingDelegationResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/" - "{delegator_addr}/unbonding_delegation"; - } - - // DelegatorDelegations queries all delegations of a given delegator address. - rpc DelegatorDelegations(QueryDelegatorDelegationsRequest) returns (QueryDelegatorDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegations/{delegator_addr}"; - } - - // DelegatorUnbondingDelegations queries all unbonding delegations of a given - // delegator address. - rpc DelegatorUnbondingDelegations(QueryDelegatorUnbondingDelegationsRequest) - returns (QueryDelegatorUnbondingDelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/" - "{delegator_addr}/unbonding_delegations"; - } - - // Redelegations queries redelegations of given address. - rpc Redelegations(QueryRedelegationsRequest) returns (QueryRedelegationsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations"; - } - - // DelegatorValidators queries all validators info for given delegator - // address. - rpc DelegatorValidators(QueryDelegatorValidatorsRequest) returns (QueryDelegatorValidatorsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators"; - } - - // DelegatorValidator queries validator info for given delegator validator - // pair. - rpc DelegatorValidator(QueryDelegatorValidatorRequest) returns (QueryDelegatorValidatorResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/" - "{validator_addr}"; - } - - // HistoricalInfo queries the historical info for given height. - rpc HistoricalInfo(QueryHistoricalInfoRequest) returns (QueryHistoricalInfoResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/historical_info/{height}"; - } - - // Pool queries the pool info. - rpc Pool(QueryPoolRequest) returns (QueryPoolResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/pool"; - } - - // Parameters queries the staking parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/staking/v1beta1/params"; - } -} -``` - -### `QueryValidatorsRequest` - -`QueryValidatorsRequest` is request type for `Query/Validators` RPC method. - -```go query.proto -message QueryValidatorsRequest { - // status enables to query for validators matching a given status. - string status = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryValidatorsResponse` - -`QueryValidatorsResponse` is response type for the `Query/Validators` RPC method. - -```go query.proto -message QueryValidatorsResponse { - // validators contains all the queried validators. - repeated Validator validators = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryValidatorRequest` - -`QueryValidatorRequest` is response type for the `Query/Validator` RPC method. - -```go query.proto -message QueryValidatorRequest { - // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryValidatorResponse` - -`QueryValidatorResponse` is response type for the `Query/Validator` RPC method. - -```go query.proto -message QueryValidatorResponse { - // validator defines the the validator info. - Validator validator = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryValidatorDelegationsRequest` - -`QueryValidatorDelegationsRequest` is request type for the `Query/ValidatorDelegations` RPC method. - -```go query.proto -message QueryValidatorDelegationsRequest { - // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryValidatorDelegationsResponse` - -`QueryValidatorDelegationsResponse` is response type for the `Query/ValidatorDelegations` RPC method. - -```go query.proto -message QueryValidatorDelegationsResponse { - repeated DelegationResponse delegation_responses = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "DelegationResponses"]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryValidatorUnbondingDelegationsRequest` - -`QueryValidatorUnbondingDelegationsRequest` is required type for the `Query/ValidatorUnbondingDelegations` RPC method. - -```go query.proto -message QueryValidatorUnbondingDelegationsRequest { - // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryValidatorUnbondingDelegationsResponse` - -`QueryValidatorUnbondingDelegationsResponse` is response type for the `Query/ValidatorUnbondingDelegations` RPC method. - -```go query.proto -message QueryValidatorUnbondingDelegationsResponse { - repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryDelegationRequest` - -`QueryDelegationRequest` is request type for the `Query/Delegation` RPC method. - -```go query.proto -message QueryDelegationRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDelegationResponse` -`QueryDelegationResponse` is response type for the `Query/Delegation` RPC method. - -```go query.proto -message QueryDelegationResponse { - // delegation_responses defines the delegation info of a delegation. - DelegationResponse delegation_response = 1; -} -``` - -### `QueryUnbondingDelegationRequest` - -`QueryUnbondingDelegationRequest` is request type for the `Query/UnbondingDelegation` RPC method. - -```go query.proto -message QueryUnbondingDelegationRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryUnbondingDelegationResponse` - -`QueryUnbondingDelegationResponse` is response type for the `Query/UnbondingDelegation` RPC method. - -```go query.proto -message QueryUnbondingDelegationResponse { - // unbond defines the unbonding information of a delegation. - UnbondingDelegation unbond = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryDelegatorDelegationsRequest` - -`QueryDelegatorDelegationsRequest` is request type for the `Query/DelegatorDelegations` RPC method. - -```go query.proto -message QueryDelegatorDelegationsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryDelegatorDelegationsResponse` - -`QueryDelegatorDelegationsResponse` is response type for the `Query/DelegatorDelegations` RPC method. - -```go query.proto -message QueryDelegatorDelegationsResponse { - // delegation_responses defines all the delegations' info of a delegator. - repeated DelegationResponse delegation_responses = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryDelegatorUnbondingDelegationsRequest` -`QueryDelegatorUnbondingDelegationsRequest` is request type for the `Query/DelegatorUnbondingDelegations` RPC method. - -```go query.proto -message QueryDelegatorUnbondingDelegationsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryDelegatorUnbondingDelegationsResponse` -`QueryDelegatorUnbondingDelegationsResponse` is response type for the `Query/DelegatorUnbondingDelegations` RPC method. - -```go query.proto -message QueryDelegatorUnbondingDelegationsResponse { - repeated UnbondingDelegation unbonding_responses = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryRedelegationsRequest` - -`QueryRedelegationsRequest` is request type for the `Query/Redelegations` RPC method. - -```go query.proto -message QueryRedelegationsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // src_validator_addr defines the validator address to redelegate from. - string src_validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // dst_validator_addr defines the validator address to redelegate to. - string dst_validator_addr = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 4; -} -``` - -#### `QueryRedelegationsResponse` - -`QueryRedelegationsResponse` is response type for the `Query/Redelegations` RPC method. - -```go query.proto -message QueryRedelegationsResponse { - repeated RedelegationResponse redelegation_responses = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryDelegatorValidatorsRequest` - -`QueryDelegatorValidatorsRequest` is request type for the `Query/DelegatorValidators` RPC method. - -```go query.proto -message QueryDelegatorValidatorsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryDelegatorValidatorsResponse` - -`QueryDelegatorValidatorsResponse` is response type for the `Query/DelegatorValidators` RPC method. - -```go query.proto -message QueryDelegatorValidatorsResponse { - // validators defines the the validators' info of a delegator. - repeated Validator validators = 1 [(gogoproto.nullable) = false]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryDelegatorValidatorRequest` - -`QueryDelegatorValidatorRequest` is request type for the `Query/DelegatorValidator` RPC method. - -```go query.proto -message QueryDelegatorValidatorRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_addr defines the delegator address to query for. - string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDelegatorValidatorResponse` - -`QueryDelegatorValidatorResponse` response type for the `Query/DelegatorValidator` RPC method. - -```go query.proto -message QueryDelegatorValidatorResponse { - // validator defines the the validator info. - Validator validator = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryHistoricalInfoRequest` - -`QueryHistoricalInfoRequest` is request type for the `Query/HistoricalInfo `RPC method. - -```go query.proto -message QueryHistoricalInfoRequest { - // height defines at which height to query the historical info. - int64 height = 1; -} -``` - -#### `QueryHistoricalInfoResponse` - -`QueryHistoricalInfoResponse` is response type for the `Query/HistoricalInfo` RPC method. - -```go query.proto -message QueryHistoricalInfoResponse { - // hist defines the historical info at the given height. - HistoricalInfo hist = 1; -} -``` - -### `QueryPoolRequest` - -`QueryPoolRequest` is request type for the `Query/Pool` RPC method. - -```go query.proto -message QueryPoolRequest {} -``` - -#### `QueryPoolResponse` - -`QueryPoolResponse` is response type for the `Query/Pool` RPC method. - -```go query.proto -message QueryPoolResponse { - // pool defines the pool info. - Pool pool = 1 [(gogoproto.nullable) = false]; -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/upgrade.mdx b/docs/develop/modules/cosmos-sdk-modules/upgrade.mdx deleted file mode 100644 index 2587d37..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/upgrade.mdx +++ /dev/null @@ -1,236 +0,0 @@ ---- -sidebar_position: 15 ---- - -# upgrade - -The `upgrade` module is responsible for handling and coordinating software upgrades. It accomplishes this by providing a BeginBlocker hook that prevents the blockchain state machine from proceeding once a pre-defined upgrade block height has been reached. - -For more information, visit https://docs.cosmos.network/main/modules/upgrade/ - -## Message Types - -`Msg` defines the upgrade Msg service. - -```go tx.proto -service Msg { - // SoftwareUpgrade is a governance operation for initiating a software upgrade. - // - // Since: cosmos-sdk 0.46 - rpc SoftwareUpgrade(MsgSoftwareUpgrade) returns (MsgSoftwareUpgradeResponse); - // CancelUpgrade is a governance operation for cancelling a previously - // approvid software upgrade. - // - // Since: cosmos-sdk 0.46 - rpc CancelUpgrade(MsgCancelUpgrade) returns (MsgCancelUpgradeResponse); -} -``` - -### `MsgSoftwareUpgrade` - -`MsgSoftwareUpgrade` is the `Msg/SoftwareUpgrade` request type. - -Since: cosmos-sdk 0.46 - -```go tx.proto -message MsgSoftwareUpgrade { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // plan is the upgrade plan. - Plan plan = 2 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgSoftwareUpgradeResponse` -`MsgSoftwareUpgradeResponse` is the `Msg/SoftwareUpgrade` response type. - -Since: cosmos-sdk 0.46 - -```go tx.proto -message MsgSoftwareUpgradeResponse {} -``` - -### `MsgCancelUpgrade` - -`MsgCancelUpgrade` is the `Msg/CancelUpgrade` request type. -Since: cosmos-sdk 0.46 - -```go tx.proto -message MsgCancelUpgrade { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `MsgCancelUpgradeResponse` -`MsgCancelUpgradeResponse` is the `Msg/CancelUpgrade` response type. - -Since: cosmos-sdk 0.46 - -```go tx.proto -message MsgCancelUpgradeResponse {} -``` - -## Queries - -`Query` defines the gRPC upgrade querier service. - -```go query.proto -service Query { - // CurrentPlan queries the current upgrade plan. - rpc CurrentPlan(QueryCurrentPlanRequest) returns (QueryCurrentPlanResponse) { - option (google.api.http).get = "/cosmos/upgrade/v1beta1/current_plan"; - } - - // AppliedPlan queries a previously applied upgrade plan by its name. - rpc AppliedPlan(QueryAppliedPlanRequest) returns (QueryAppliedPlanResponse) { - option (google.api.http).get = "/cosmos/upgrade/v1beta1/applied_plan/{name}"; - } - - // UpgradedConsensusState queries the consensus state that will serve - // as a trusted kernel for the next version of this chain. It will only be - // stored at the last height of this chain. - // UpgradedConsensusState RPC not supported with legacy querier - // This rpc is deprecated now that IBC has its own replacement - // (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54) - rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { - option deprecated = true; - option (google.api.http).get = "/cosmos/upgrade/v1beta1/upgraded_consensus_state/{last_height}"; - } - - // ModuleVersions queries the list of module versions from state. - // - // Since: cosmos-sdk 0.43 - rpc ModuleVersions(QueryModuleVersionsRequest) returns (QueryModuleVersionsResponse) { - option (google.api.http).get = "/cosmos/upgrade/v1beta1/module_versions"; - } - - // Returns the account with authority to conduct upgrades - rpc Authority(QueryAuthorityRequest) returns (QueryAuthorityResponse) { - option (google.api.http).get = "/cosmos/upgrade/v1beta1/authority"; - } -} -``` - -### `QueryCurrentPlanRequest` - -`QueryCurrentPlanRequest` is the request type for the `Query/CurrentPlan` RPC method. - -```go query.proto -message QueryCurrentPlanRequest {} -``` - -#### `QueryCurrentPlanResponse` -`QueryCurrentPlanResponse` is the response type for the `Query/CurrentPlan` RPC method. - -```go query.proto -message QueryCurrentPlanResponse { - // plan is the current upgrade plan. - Plan plan = 1; -} -``` - -### `QueryAppliedPlanRequest` - -`QueryAppliedPlanRequest` is the request type for the `Query/AppliedPlan` RPC method. - -```go query.proto -message QueryAppliedPlanRequest { - // name is the name of the applied plan to query for. - string name = 1; -} -``` - -#### `QueryAppliedPlanResponse` - -`QueryAppliedPlanResponse` is the response type for the `Query/AppliedPlan` RPC method. - -```go query.proto -message QueryAppliedPlanResponse { - // height is the block height at which the plan was applied. - int64 height = 1; -} -``` - -### `QueryUpgradedConsensusStateRequest` - -`QueryUpgradedConsensusStateRequest` is the request type for the `Query/UpgradedConsensusState` RPC method. - -```go query.proto -message QueryUpgradedConsensusStateRequest { - option deprecated = true; - - // last height of the current chain must be sent in request - // as this is the height under which next consensus state is stored - int64 last_height = 1; -} -``` - -#### `QueryUpgradedConsensusStateResponse` - -`QueryUpgradedConsensusStateResponse` is the response type for the `Query/UpgradedConsensusState` RPC method. - -```go query.proto -message QueryUpgradedConsensusStateResponse { - option deprecated = true; - reserved 1; - - // Since: cosmos-sdk 0.43 - bytes upgraded_consensus_state = 2; -} -``` - -### `QueryModuleVersionsRequest` - -`QueryModuleVersionsRequest` is the request type for the `Query/ModuleVersions` RPC method. - -Since: cosmos-sdk 0.43 - -```go query.proto -message QueryModuleVersionsRequest { - // module_name is a field to query a specific module - // consensus version from state. Leaving this empty will - // fetch the full list of module versions from state - string module_name = 1; -} -``` - -#### `QueryModuleVersionsResponse` - -`QueryModuleVersionsResponse` is the response type for the `Query/ModuleVersions` RPC method. - -Since: cosmos-sdk 0.43 - -```go query.proto -message QueryModuleVersionsResponse { - // module_versions is a list of module names with their consensus versions. - repeated ModuleVersion module_versions = 1; -} -``` - -### `QueryAuthorityRequest` - -`QueryAuthorityRequest` is the request type for `Query/Authority`. - -Since: cosmos-sdk 0.46 - -```go query.proto -message QueryAuthorityRequest {} -``` - -#### `QueryAuthorityResponse` - -`QueryAuthorityResponse` is the response type for `Query/Authority`. - -Since: cosmos-sdk 0.46 - -```go query.proto -message QueryAuthorityResponse { - string address = 1; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmos-sdk-modules/vesting.mdx b/docs/develop/modules/cosmos-sdk-modules/vesting.mdx deleted file mode 100644 index 3472864..0000000 --- a/docs/develop/modules/cosmos-sdk-modules/vesting.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -sidebar_position: 16 ---- - -# vesting - -The `vesting` module is responsible for handling the vesting account implementation used by Mars Hub. - -For more information, visit https://docs.cosmos.network/main/modules/vesting/ - -## Message Types - -`Msg` defines the bank Msg service. - -```go tx.proto -service Msg { - // CreateVestingAccount defines a method that enables creating a vesting - // account. - rpc CreateVestingAccount(MsgCreateVestingAccount) returns (MsgCreateVestingAccountResponse); - // CreatePermanentLockedAccount defines a method that enables creating a permanent - // locked account. - rpc CreatePermanentLockedAccount(MsgCreatePermanentLockedAccount) returns (MsgCreatePermanentLockedAccountResponse); - // CreatePeriodicVestingAccount defines a method that enables creating a - // periodic vesting account. - rpc CreatePeriodicVestingAccount(MsgCreatePeriodicVestingAccount) returns (MsgCreatePeriodicVestingAccountResponse); -} -``` - -### `MsgCreateVestingAccount` - -`MsgCreateVestingAccount` defines a message that enables creating a vesting account. - -```go tx.proto -message MsgCreateVestingAccount { - option (cosmos.msg.v1.signer) = "from_address"; - - option (gogoproto.equal) = true; - - string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; - - int64 end_time = 4; - bool delayed = 5; -} -``` - -#### `MsgCreateVestingAccountResponse` - -`MsgCreateVestingAccountResponse` defines the `Msg/CreateVestingAccount `response type. - -```go tx.proto -message MsgCreateVestingAccountResponse {} -``` - -### `MsgCreatePermanentLockedAccount` - -`MsgCreatePermanentLockedAccount` defines a message that enables creating a permanent locked account. - -```go tx.proto -message MsgCreatePermanentLockedAccount { - option (gogoproto.equal) = true; - - string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; - string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} -``` - -#### `MsgCreatePermanentLockedAccountResponse` - -`MsgCreatePermanentLockedAccountResponse` defines the `Msg/CreatePermanentLockedAccount` response type. - -```go tx.proto -message MsgCreatePermanentLockedAccountResponse {} -``` - -### `MsgCreateVestingAccount` - -`MsgCreateVestingAccount` defines a message that enables creating a vesting account. - -```go tx.proto -message MsgCreatePeriodicVestingAccount { - option (cosmos.msg.v1.signer) = "from_address"; - - option (gogoproto.equal) = false; - - string from_address = 1; - string to_address = 2; - int64 start_time = 3; - repeated Period vesting_periods = 4 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgCreateVestingAccountResponse` - -`MsgCreateVestingAccountResponse` defines the `Msg/CreatePeriodicVestingAccount` response type. - -```go tx.proto -message MsgCreatePeriodicVestingAccountResponse {} -``` \ No newline at end of file diff --git a/docs/develop/modules/cosmwasm-module/_category_.json b/docs/develop/modules/cosmwasm-module/_category_.json deleted file mode 100644 index a77533f..0000000 --- a/docs/develop/modules/cosmwasm-module/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "CosmWasm Module", - "position": 4, - "link": { "type": "doc", "id": "cosmwasm-module-intro" } -} \ No newline at end of file diff --git a/docs/develop/modules/cosmwasm-module/cosmwasm-module-intro.mdx b/docs/develop/modules/cosmwasm-module/cosmwasm-module-intro.mdx deleted file mode 100644 index 7468d27..0000000 --- a/docs/develop/modules/cosmwasm-module/cosmwasm-module-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# CosmWasm Module - -CosmWasm module which enables CosmWasm smart contracts. - - \ No newline at end of file diff --git a/docs/develop/modules/cosmwasm-module/wasm.mdx b/docs/develop/modules/cosmwasm-module/wasm.mdx deleted file mode 100644 index 2458f79..0000000 --- a/docs/develop/modules/cosmwasm-module/wasm.mdx +++ /dev/null @@ -1,680 +0,0 @@ ---- -sidebar_position: 1 ---- - -# wasm - -The wasm module is responsible for handling CosmWasm smart contract functionality on Mars Hub. The module is permission-gated (contracts can only be instantiated by whitelisted addresses or through governance). - -For more information, visit: https://github.com/CosmWasm/cosmwasm - -## Message Types - -`Msg` defines the wasm Msg service. - -```go tx.proto -service Msg { - // StoreCode to submit Wasm code to the system - rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); - // Instantiate creates a new smart contract instance for the given code id. - rpc InstantiateContract(MsgInstantiateContract) - returns (MsgInstantiateContractResponse); - // Execute submits the given message data to a smart contract - rpc ExecuteContract(MsgExecuteContract) returns (MsgExecuteContractResponse); - // Migrate runs a code upgrade/ downgrade for a smart contract - rpc MigrateContract(MsgMigrateContract) returns (MsgMigrateContractResponse); - // UpdateAdmin sets a new admin for a smart contract - rpc UpdateAdmin(MsgUpdateAdmin) returns (MsgUpdateAdminResponse); - // ClearAdmin removes any admin stored for a smart contract - rpc ClearAdmin(MsgClearAdmin) returns (MsgClearAdminResponse); -} -``` - -### `MsgStoreCode` - -`MsgStoreCode` submit Wasm code to the system. - -```go tx.proto -message MsgStoreCode { - // Sender is the that actor that signed the messages - string sender = 1; - // WASMByteCode can be raw or gzip compressed - bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ]; - // Used in v1beta1 - reserved 3, 4; - // InstantiatePermission access control to apply on contract creation, - // optional - AccessConfig instantiate_permission = 5; -} -``` - -#### `MsgStoreCodeResponse` - -`MsgStoreCodeResponse` returns store result data. - -```go tx.proto -message MsgStoreCodeResponse { - // CodeID is the reference to the stored WASM code - uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; -} -``` - -### `MsgInstantiateContract` - -`MsgInstantiateContract` create a new smart contract instance for the given code id. - -```go tx.proto -message MsgInstantiateContract { - // Sender is the that actor that signed the messages - string sender = 1; - // Admin is an optional address that can execute migrations - string admin = 2; - // CodeID is the reference to the stored WASM code - uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; - // Label is optional metadata to be stored with a contract instance. - string label = 4; - // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; - // Funds coins that are transferred to the contract on instantiation - repeated cosmos.base.v1beta1.Coin funds = 6 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` - -#### `MsgInstantiateContractResponse` - -`MsgInstantiateContractResponse` return instantiation result data. - -```go tx.proto -message MsgInstantiateContractResponse { - // Address is the bech32 address of the new contract instance. - string address = 1; - // Data contains base64-encoded bytes to returned from the contract - bytes data = 2; -} -``` - -### `MsgExecuteContract` - -`MsgExecuteContract` submits the given message data to a smart contract. - -```go tx.proto -message MsgExecuteContract { - // Sender is the that actor that signed the messages - string sender = 1; - // Contract is the address of the smart contract - string contract = 2; - // Msg json encoded message to be passed to the contract - bytes msg = 3 [ (gogoproto.casttype) = "RawContractMessage" ]; - // Funds coins that are transferred to the contract on execution - repeated cosmos.base.v1beta1.Coin funds = 5 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` - -#### `MsgExecuteContractResponse` -`MsgExecuteContractResponse` returns execution result data. - -```go tx.proto -message MsgExecuteContractResponse { - // Data contains base64-encoded bytes to returned from the contract - bytes data = 1; -} -``` - -### `MsgMigrateContract` - -`MsgMigrateContract` runs a code upgrade/downgrade for a smart contract. - -```go tx.proto -message MsgMigrateContract { - // Sender is the that actor that signed the messages - string sender = 1; - // Contract is the address of the smart contract - string contract = 2; - // CodeID references the new WASM code - uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ]; - // Msg json encoded message to be passed to the contract on migration - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; -} -``` - -#### `MsgMigrateContractResponse` - -`MsgMigrateContractResponse` returns contract migration result data. - -```go tx.proto -message MsgMigrateContractResponse { - // Data contains same raw bytes returned as data from the wasm contract. - // (May be empty) - bytes data = 1; -} -``` - -### `MsgUpdateAdmin` - -`MsgUpdateAdmin` sets a new admin for a smart contract. - -```go tx.proto -message MsgUpdateAdmin { - // Sender is the that actor that signed the messages - string sender = 1; - // NewAdmin address to be set - string new_admin = 2; - // Contract is the address of the smart contract - string contract = 3; -} -``` - -#### `MsgUpdateAdminResponse` - -`MsgUpdateAdminResponse` returns empty data. - -```go tx.proto -message MsgUpdateAdminResponse {} -``` - -### `MsgClearAdmin` - -`MsgClearAdmin` removes any admin stored for a smart contract. - -```go tx.proto -message MsgClearAdmin { - // Sender is the that actor that signed the messages - string sender = 1; - // Contract is the address of the smart contract - string contract = 3; -} -``` - -#### `MsgClearAdminResponse` - -`MsgClearAdminResponse` returns empty data. - -```go tx.proto -message MsgClearAdminResponse {} -``` - -## Proposal Types - -### `StoreCodeProposal` - -`StoreCodeProposal` gov proposal content type to submit WASM code to the system. - -```go proposal.proto -message StoreCodeProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; - // WASMByteCode can be raw or gzip compressed - bytes wasm_byte_code = 4 [ (gogoproto.customname) = "WASMByteCode" ]; - // Used in v1beta1 - reserved 5, 6; - // InstantiatePermission to apply on contract creation, optional - AccessConfig instantiate_permission = 7; -} -``` - -### `InstantiateContractProposal` - -`InstantiateContractProposal` gov proposal content type to instantiate a contract. - -```go proposal.proto -message InstantiateContractProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; - // Admin is an optional address that can execute migrations - string admin = 4; - // CodeID is the reference to the stored WASM code - uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; - // Label is optional metadata to be stored with a constract instance. - string label = 6; - // Msg json encoded message to be passed to the contract on instantiation - bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ]; - // Funds coins that are transferred to the contract on instantiation - repeated cosmos.base.v1beta1.Coin funds = 8 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` - -### `MigrateContractProposal` - -`MigrateContractProposal` gov proposal content type to migrate a contract. - -```go proposal.proto -message MigrateContractProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // Note: skipping 3 as this was previously used for unneeded run_as - - // Contract is the address of the smart contract - string contract = 4; - // CodeID references the new WASM code - uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ]; - // Msg json encoded message to be passed to the contract on migration - bytes msg = 6 [ (gogoproto.casttype) = "RawContractMessage" ]; -} -``` - -### `SudoContractProposal` - -`SudoContractProposal` gov proposal content type to call sudo on a contract. - -```go proposal.proto -message SudoContractProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // Contract is the address of the smart contract - string contract = 3; - // Msg json encoded message to be passed to the contract as sudo - bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ]; -} -``` - -### `ExecuteContractProposal` - -`ExecuteContractProposal` gov proposal content type to call execute on a contract. - -```go proposal.proto -message ExecuteContractProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // RunAs is the address that is passed to the contract's environment as sender - string run_as = 3; - // Contract is the address of the smart contract - string contract = 4; - // Msg json encoded message to be passed to the contract as execute - bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ]; - // Funds coins that are transferred to the contract on instantiation - repeated cosmos.base.v1beta1.Coin funds = 6 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` - -### `UpdateAdminProposal` - -`UpdateAdminProposal` gov proposal content type to set an admin for a contract. - -```go proposal.proto -message UpdateAdminProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // NewAdmin address to be set - string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; - // Contract is the address of the smart contract - string contract = 4; -} -``` - -### `ClearAdminProposal` - -`ClearAdminProposal` gov proposal content type to clear the admin of a contract. - -```go proposal.proto -message ClearAdminProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - // Contract is the address of the smart contract - string contract = 3; -} -``` - -### `PinCodesProposal` - -`PinCodesProposal` gov proposal content type to pin a set of code ids in the wasmvm cache. - -```go proposal.proto -message PinCodesProposal { - // Title is a short summary - string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; - // Description is a human readable text - string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; - // CodeIDs references the new WASM codes - repeated uint64 code_ids = 3 [ - (gogoproto.customname) = "CodeIDs", - (gogoproto.moretags) = "yaml:\"code_ids\"" - ]; -} -``` - -### `UnpinCodesProposal` - -`UnpinCodesProposal` gov proposal content type to unpin a set of code ids in the wasmvm cache. - -```go proposal.proto -message UnpinCodesProposal { - // Title is a short summary - string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; - // Description is a human readable text - string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; - // CodeIDs references the WASM codes - repeated uint64 code_ids = 3 [ - (gogoproto.customname) = "CodeIDs", - (gogoproto.moretags) = "yaml:\"code_ids\"" - ]; -} -``` - -### `AccessConfigUpdate` - -`AccessConfigUpdate` contains the code id and the access config to be applied. - -```go proposal.proto -message AccessConfigUpdate { - // CodeID is the reference to the stored WASM code to be updated - uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ]; - // InstantiatePermission to apply to the set of code ids - AccessConfig instantiate_permission = 2 [ (gogoproto.nullable) = false ]; -} -``` - -### `UpdateInstantiateConfigProposal` - -`UpdateInstantiateConfigProposal` gov proposal content type to update instantiate config to a set of code ids. - -```go proposal.proto -message UpdateInstantiateConfigProposal { - // Title is a short summary - string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ]; - // Description is a human readable text - string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ]; - // AccessConfigUpdate contains the list of code ids and the access config - // to be applied. - repeated AccessConfigUpdate access_config_updates = 3 - [ (gogoproto.nullable) = false ]; -} -``` - -## Queries - -`Query` provides defines the gRPC querier service. - -```go query.proto -service Query { - // ContractInfo gets the contract meta data - rpc ContractInfo(QueryContractInfoRequest) - returns (QueryContractInfoResponse) { - option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}"; - } - // ContractHistory gets the contract code history - rpc ContractHistory(QueryContractHistoryRequest) - returns (QueryContractHistoryResponse) { - option (google.api.http).get = - "/cosmwasm/wasm/v1/contract/{address}/history"; - } - // ContractsByCode lists all smart contracts for a code id - rpc ContractsByCode(QueryContractsByCodeRequest) - returns (QueryContractsByCodeResponse) { - option (google.api.http).get = "/cosmwasm/wasm/v1/code/{code_id}/contracts"; - } - // AllContractState gets all raw store data for a single contract - rpc AllContractState(QueryAllContractStateRequest) - returns (QueryAllContractStateResponse) { - option (google.api.http).get = "/cosmwasm/wasm/v1/contract/{address}/state"; - } - // RawContractState gets single key from the raw store data of a contract - rpc RawContractState(QueryRawContractStateRequest) - returns (QueryRawContractStateResponse) { - option (google.api.http).get = - "/cosmwasm/wasm/v1/contract/{address}/raw/{query_data}"; - } - // SmartContractState get smart query result from the contract - rpc SmartContractState(QuerySmartContractStateRequest) - returns (QuerySmartContractStateResponse) { - option (google.api.http).get = - "/cosmwasm/wasm/v1/contract/{address}/smart/{query_data}"; - } - // Code gets the binary code and metadata for a singe wasm code - rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { - option (google.api.http).get = "/cosmwasm/wasm/v1/code/{code_id}"; - } - // Codes gets the metadata for all stored wasm codes - rpc Codes(QueryCodesRequest) returns (QueryCodesResponse) { - option (google.api.http).get = "/cosmwasm/wasm/v1/code"; - } - - // PinnedCodes gets the pinned code ids - rpc PinnedCodes(QueryPinnedCodesRequest) returns (QueryPinnedCodesResponse) { - option (google.api.http).get = "/cosmwasm/wasm/v1/codes/pinned"; - } -} -``` - -### `QueryContractInfoRequest` -`QueryContractInfoRequest` is the request type for the `Query/ContractInfo` RPC method. - -```go query.proto -message QueryContractInfoRequest { - // address is the address of the contract to query - string address = 1; -} -``` - -#### `QueryContractInfoResponse` -`QueryContractInfoResponse` is the response type for the `Query/ContractInfo` RPC method. - -```go query.proto -message QueryContractInfoResponse { - option (gogoproto.equal) = true; - - // address is the address of the contract - string address = 1; - ContractInfo contract_info = 2 [ - (gogoproto.embed) = true, - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "" - ]; -} -``` - -### `QueryContractHistoryRequest` -`QueryContractHistoryRequest` is the request type for the `Query/ContractHistory` RPC method. - -```go query.proto -message QueryContractHistoryRequest { - // address is the address of the contract to query - string address = 1; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryContractHistoryResponse` -`QueryContractHistoryResponse` is the response type for the `Query/ContractHistory` RPC method. - -```go query.proto -message QueryContractHistoryResponse { - repeated ContractCodeHistoryEntry entries = 1 - [ (gogoproto.nullable) = false ]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryContractsByCodeRequest` -`QueryContractsByCodeRequest` is the request type for the `Query/ContractsByCode` RPC method. - -```go query.proto -message QueryContractsByCodeRequest { - uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryContractsByCodeResponse` - -`QueryContractsByCodeResponse` is the response type for the `Query/ContractsByCode` RPC method. - -```go query.proto -message QueryContractsByCodeResponse { - // contracts are a set of contract addresses - repeated string contracts = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryAllContractStateRequest` - -`QueryAllContractStateRequest` is the request type for the `Query/AllContractState` RPC method. - -```go query.proto -message QueryAllContractStateRequest { - // address is the address of the contract - string address = 1; - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryAllContractStateResponse` -`QueryAllContractStateResponse` is the response type for the `Query/AllContractState` RPC method. - -```go query.proto -message QueryAllContractStateResponse { - repeated Model models = 1 [ (gogoproto.nullable) = false ]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryRawContractStateRequest` - -`QueryRawContractStateRequest` is the request type for the `Query/RawContractState` RPC method. - -```go query.proto -message QueryRawContractStateRequest { - // address is the address of the contract - string address = 1; - bytes query_data = 2; -} -``` - -#### `QueryRawContractStateResponse` - -`QueryRawContractStateResponse` is the response type for the `Query/RawContractState` RPC method. - -```go query.proto -message QueryRawContractStateResponse { - // Data contains the raw store data - bytes data = 1; -} -``` - -### `QuerySmartContractStateRequest` -`QuerySmartContractStateRequest` is the request type for the `Query/SmartContractState` RPC method. - -```go query.proto -message QuerySmartContractStateRequest { - // address is the address of the contract - string address = 1; - // QueryData contains the query data passed to the contract - bytes query_data = 2 [ (gogoproto.casttype) = "RawContractMessage" ]; -} -``` - -#### `QuerySmartContractStateResponse` - -`QuerySmartContractStateResponse` is the response type for the `Query/SmartContractState` RPC method. - -```go query.proto -message QuerySmartContractStateResponse { - // Data contains the json data returned from the smart contract - bytes data = 1 [ (gogoproto.casttype) = "RawContractMessage" ]; -} -``` - -### `QueryCodeRequest` -`QueryCodeRequest` is the request type for the `Query/Code` RPC method. - -```go query.proto -message QueryCodeRequest { - uint64 code_id = 1; // grpc-gateway_out does not support Go style CodID -} -``` - -#### `QueryCodeResponse` -`QueryCodeResponse` is the response type for the `Query/Code` RPC method. - -```go query.proto -message QueryCodeResponse { - option (gogoproto.equal) = true; - CodeInfoResponse code_info = 1 - [ (gogoproto.embed) = true, (gogoproto.jsontag) = "" ]; - bytes data = 2 [ (gogoproto.jsontag) = "data" ]; -} -``` - -### `QueryCodesRequest` - -`QueryCodesRequest` is the request type for the `Query/Codes` RPC method. - -```go query.proto -message QueryCodesRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryCodesResponse` - -`QueryCodesResponse` is the response type for the `Query/Codes` RPC method. - -```go query.proto -message QueryCodesResponse { - repeated CodeInfoResponse code_infos = 1 [ (gogoproto.nullable) = false ]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryPinnedCodesRequest` - -`QueryPinnedCodesRequest` is the request type for the `Query/PinnedCodes` RPC method. - -```go query.proto -message QueryPinnedCodesRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryPinnedCodesResponse` - -`QueryPinnedCodesResponse` is the response type for the Query/PinnedCodes RPC method. - -```go query.proto -message QueryPinnedCodesResponse { - repeated uint64 code_ids = 1 - [ (gogoproto.nullable) = false, (gogoproto.customname) = "CodeIDs" ]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/custom-modules/_category_.json b/docs/develop/modules/custom-modules/_category_.json deleted file mode 100644 index f1a2d1e..0000000 --- a/docs/develop/modules/custom-modules/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Custom Modules", - "position": 2, - "link": { "type": "doc", "id": "custom-modules-intro" } -} \ No newline at end of file diff --git a/docs/develop/modules/custom-modules/custom-modules-intro.mdx b/docs/develop/modules/custom-modules/custom-modules-intro.mdx deleted file mode 100644 index 9a1c2cf..0000000 --- a/docs/develop/modules/custom-modules/custom-modules-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Custom Modules - -Custom modules built for Mars Hub. - - \ No newline at end of file diff --git a/docs/develop/modules/custom-modules/gov.mdx b/docs/develop/modules/custom-modules/gov.mdx deleted file mode 100644 index 51e9b19..0000000 --- a/docs/develop/modules/custom-modules/gov.mdx +++ /dev/null @@ -1,412 +0,0 @@ ---- -sidebar_position: 1 ---- - -# gov - -The `gov` module is a wrapper module around the [vanilla governance](https://docs.cosmos.network/main/modules/gov/) module that comes as standard within the Cosmos SDK. This wrapper inherits most of the standard governance module but implements alternative vote tallying logic. That is, tokens locked in a vesting contract contribute towards that token-holders’ voting power. This module has been built to account for the builders’ token allocation and to facilitate their participation in governance. - -## Links - -- **Module address:** -- **Testnet address:** -- **Module repo:** https://github.com/mars-protocol/hub/tree/main/x/gov -- **Proto repo:** https://github.com/mars-protocol/hub/tree/main/third_party/proto/cosmos/gov/v1 -- **tx.proto:** https://github.com/mars-protocol/hub/blob/main/third_party/proto/cosmos/gov/v1/tx.proto -- **query.proto:** https://github.com/mars-protocol/hub/blob/main/third_party/proto/cosmos/gov/v1/query.proto -- **Video walkthrough:** https://youtu.be/M9i7s04fYgw -- **Article breakdown:** https://blog.marsprotocol.io/blog/mars-protocol-code-review-breakdown-session-3-4-safety-fund-and-governance-modules -- **Audit:** - -## Message Types - -`Msg` defines the gov `Msg` service. - -```go tx.proto -service Msg { - // SubmitProposal defines a method to create new proposal given a content. - rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); - - // ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal - // to execute a legacy content-based proposal. - rpc ExecLegacyContent(MsgExecLegacyContent) returns (MsgExecLegacyContentResponse); - - // Vote defines a method to add a vote on a specific proposal. - rpc Vote(MsgVote) returns (MsgVoteResponse); - - // VoteWeighted defines a method to add a weighted vote on a specific proposal. - rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); - - // Deposit defines a method to add deposit on a specific proposal. - rpc Deposit(MsgDeposit) returns (MsgDepositResponse); -} -``` - -### `MsgSubmitProposal` - -`MsgSubmitProposal` defines an `sdk.Msg` type that supports submitting arbitrary proposal Content. - -```go tx.proto -message MsgSubmitProposal { - option (cosmos.msg.v1.signer) = "proposer"; - - repeated google.protobuf.Any messages = 1; - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false]; - string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // metadata is any arbitrary metadata attached to the proposal. - string metadata = 4; -} -``` - -#### `MsgSubmitProposalResponse` - -`MsgSubmitProposalResponse` defines the `Msg/SubmitProposal` response type. - -```go tx.proto -message MsgSubmitProposalResponse { - uint64 proposal_id = 1; -} -``` - -### `MsgExecLegacyContent` - -`MsgExecLegacyContent` is used to wrap the legacy content field into a message. This ensures backwards compatibility with v1beta1.`MsgSubmitProposal`. - -```go tx.proto -message MsgExecLegacyContent { - option (cosmos.msg.v1.signer) = "authority"; - - // content is the proposal's content. - google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; - // authority must be the gov module address. - string authority = 2; -} -``` - -#### `MsgExecLegacyContentResponse` - -`MsgExecLegacyContentResponse` defines the `Msg/ExecLegacyContent` response type. - -```go tx.proto -message MsgExecLegacyContentResponse {} -``` - -### `MsgVote` - -`MsgVote` defines a message to cast a vote. - -```go tx.proto -message MsgVote { - option (cosmos.msg.v1.signer) = "voter"; - - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - VoteOption option = 3; - string metadata = 4; -} -``` - -#### `MsgVoteResponse` - -`MsgVoteResponse` defines the `Msg/Vote` response type. - -```go tx.proto -message MsgVoteResponse {} -``` - -### `MsgVoteWeighted` - -`MsgVoteWeighted` defines a message to cast a vote. - -```go tx.proto -message MsgVoteWeighted { - option (cosmos.msg.v1.signer) = "voter"; - - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated WeightedVoteOption options = 3; - string metadata = 4; -} -``` - -#### `MsgVoteWeightedResponse` - -`MsgVoteWeightedResponse` defines the `Msg/VoteWeighted` response type. - -```go tx.proto -message MsgVoteWeightedResponse {} -``` - -### `MsgDeposit` - -`MsgDeposit` defines a message to submit a deposit to an existing proposal. - -```go tx.proto -message MsgDeposit { - option (cosmos.msg.v1.signer) = "depositor"; - - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; -} -``` - -#### `MsgDepositResponse` - -`MsgDepositResponse` defines the `Msg/Deposit` response type. - -```go tx.proto -message MsgDepositResponse {} -``` - -## Queries - -`Query` defines the gRPC querier service for gov module. - -```go query.proto -service Query { - // Proposal queries proposal details based on ProposalID. - rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}"; - } - - // Proposals queries all proposals based on given status. - rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals"; - } - - // Vote queries voted information based on proposalID, voterAddr. - rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}"; - } - - // Votes queries votes of a given proposal. - rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/votes"; - } - - // Params queries all parameters of the gov module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/gov/v1/params/{params_type}"; - } - - // Deposit queries single deposit information based proposalID, depositAddr. - rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}"; - } - - // Deposits queries all deposits of a single proposal. - rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits"; - } - - // TallyResult queries the tally of a proposal vote. - rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/tally"; - } -} -``` - -### `QueryProposalRequest` - -`QueryProposalRequest` is the request type for the `Query/Proposal RPC` method. - -```go query.proto -message QueryProposalRequest { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; -} -``` - -#### `QueryProposalResponse` - -`QueryProposalResponse` is the response type for the `Query/Proposal` RPC method. - -```go query.proto -message QueryProposalResponse { - Proposal proposal = 1; -} -``` - -### `QueryProposalsRequest` - -`QueryProposalsRequest` is the request type for the `Query/Proposals` RPC method. - -```go query.proto -message QueryProposalsRequest { - // proposal_status defines the status of the proposals. - ProposalStatus proposal_status = 1; - - // voter defines the voter address for the proposals. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // depositor defines the deposit addresses from the proposals. - string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 4; -} -``` - -#### `QueryProposalsResponse` - -`QueryProposalsResponse` is the response type for the `Query/Proposals` RPC method. - -```go query.proto -message QueryProposalsResponse { - repeated Proposal proposals = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryVoteRequest` - -`QueryVoteRequest` is the request type for the `Query/Vote` RPC method. - -```go query.proto -message QueryVoteRequest { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - - // voter defines the oter address for the proposals. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryVoteResponse` - -`QueryVoteResponse` is the response type for the Query/Vote RPC method. - -```go query.proto -message QueryVoteResponse { - // vote defined the queried vote. - Vote vote = 1; -} -``` - -### `QueryVotesRequest` - -`QueryVotesRequest` is the request type for the `Query/Votes` RPC method. - -```go query.proto -message QueryVotesRequest { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryVotesResponse` - -`QueryVotesResponse` is the response type for the `Query/Votes` RPC method. - -```go query.proto -message QueryVotesResponse { - // votes defined the queried votes. - repeated Vote votes = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest { - // params_type defines which parameters to query for, can be one of "voting", - // "tallying" or "deposit". - string params_type = 1; -} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is the response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - // voting_params defines the parameters related to voting. - VotingParams voting_params = 1; - // deposit_params defines the parameters related to deposit. - DepositParams deposit_params = 2; - // tally_params defines the parameters related to tally. - TallyParams tally_params = 3; -} -``` - -### `QueryDepositRequest` -`QueryDepositRequest` is the request type for the `Query/Deposit` RPC method. - -```go query.proto -message QueryDepositRequest { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - - // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} -``` - -#### `QueryDepositResponse` -`QueryDepositResponse` is the response type for the `Query/Deposit` RPC method. - -```go query.proto -message QueryDepositResponse { - // deposit defines the requested deposit. - Deposit deposit = 1; -} -``` - -### `QueryDepositsRequest` -`QueryDepositsRequest` is the request type for the `Query/Deposits` RPC method. - -```go query.proto -message QueryDepositsRequest { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} -``` - -#### `QueryDepositsResponse` - -`QueryDepositsResponse` is the response type for the `Query/Deposits` RPC method. - -```go query.proto -message QueryDepositsResponse { - repeated Deposit deposits = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryTallyResultRequest` -`QueryTallyResultRequest` is the request type for the `Query/Tally` RPC method. - -```go query.proto -message QueryTallyResultRequest { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; -} -``` - -#### `QueryTallyResultResponse` - -`QueryTallyResultResponse` is the response type for the `Query/Tally` RPC method. - -```go query.proto -message QueryTallyResultResponse { - // tally defines the requested tally. - TallyResult tally = 1; -} -``` diff --git a/docs/develop/modules/custom-modules/incentives.mdx b/docs/develop/modules/custom-modules/incentives.mdx deleted file mode 100644 index 12dad54..0000000 --- a/docs/develop/modules/custom-modules/incentives.mdx +++ /dev/null @@ -1,153 +0,0 @@ ---- -sidebar_position: 2 ---- - -# incentives - -The `incentives` module facilitates the incentivisation of staking on Mars Hub. Incentivisation is defined via linear unlocking schedules. Tokens associated with a schedule are sourced from the community pool and therefore incentives can only be launched after a successful governance action. It should be noted that a schedule can consist of multiple tokens, not only MARS. - -# Links - -- **Module address:** -- **Testnet address:** -- **Module repo:** https://github.com/mars-protocol/hub/tree/main/x/incentives -- **Proto repo:** https://github.com/mars-protocol/hub/tree/main/proto/mars/incentives/v1beta1 -- **proposals.proto:** https://github.com/mars-protocol/hub/blob/main/proto/mars/incentives/v1beta1/proposals.proto -- **query.proto:** https://github.com/mars-protocol/hub/blob/main/proto/mars/incentives/v1beta1/query.proto -- **Video walkthrough:** https://www.youtube.com/watch?v=XIdH3kGqtLw -- **Article breakdown:** https://blog.marsprotocol.io/blog/mars-protocol-code-review-breakdown-session-5-staking-incentives-module -- **Audit:** - -## Proposal Types - -### `CreateIncentivesScheduleProposal` - -`CreateIncentivesScheduleProposal` defines a governance proposal for starting a new incentives schedule. - -```go proposals.proto -message CreateIncentivesScheduleProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - // Title is the title of the proposal - string title = 1; - - // Description is the description of the proposal - string description = 2; - - // StartTime is the UNIX timestamp of which this incentives schedule shall begin - google.protobuf.Timestamp start_time = 3 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"start_time\"" - ]; - - // EndTime is the UNIX timestamp of which this incentives schedule shall finish - google.protobuf.Timestamp end_time = 4 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"end_time\"" - ]; - - // Amount is the total amount of coins that shall be released to stakers throughout the span of this incentives schedule - repeated cosmos.base.v1beta1.Coin amount = 5 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` - -### `TerminateIncentivesSchedulesProposal` - -`TerminateIncentivesSchedulesProposal` defines a governance proposal for pre-mature ending of one or more incentives schedules. - -```go proposals.proto -message TerminateIncentivesSchedulesProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - // Title is the title of the proposal - string title = 1; - - // Description is the description of the proposal - string description = 2; - - // Ids is the array of identifiers of the incentives schedules which are to be terminated - repeated uint64 ids = 3; -} -``` - -## Queries - -`Query` defines the gRPC querier service for the incentives module. - -```go query.proto -service Query { - // Schedule queries an incentives schedule by identifier - rpc Schedule(QueryScheduleRequest) returns (QueryScheduleResponse) { - option (google.api.http).get = "/mars/incentives/v1beta1/schedule/{id}"; - } - - // Schedules queries all incentives schedules - rpc Schedules(QuerySchedulesRequest) returns (QuerySchedulesResponse) { - option (google.api.http).get = "/mars/incentives/v1beta1/schedules"; - } -} -``` - -### `QueryScheduleRequest` - -`QueryScheduleRequest` is the request type for the `Query/Schedule` RPC method. - -```go query.proto -message QueryScheduleRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // ID is the identifier of the incentives schedule to be queried - uint64 id = 1; -} -``` - -#### `QueryScheduleResponse` - -`QueryScheduleResponse` is the response type for the `Query/Schedule` RPC method. - -```go query.proto -message QueryScheduleResponse { - // Schedule is the parameters of the incentives schedule - Schedule schedule = 1 [(gogoproto.nullable) = false]; -} -``` - - -### `QuerySchedulesRequest` - -`QuerySchedulesRequest` is the request type for the `Query/Schedules` RPC method. - -```go query.proto -message QuerySchedulesRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // Pagination defines an optional pagination for the request - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QuerySchedulesResponse` - -`QuerySchedulesResponse` is the response type for the `Query/Schedules` RPC method. - -```go query.proto -message QuerySchedulesResponse { - // Schedule is the parameters of the incentives schedule - repeated Schedule schedules = 1 [(gogoproto.nullable) = false]; - - // Pagination defines the pagination in the response - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - diff --git a/docs/develop/modules/custom-modules/safety.mdx b/docs/develop/modules/custom-modules/safety.mdx deleted file mode 100644 index a4ceddf..0000000 --- a/docs/develop/modules/custom-modules/safety.mdx +++ /dev/null @@ -1,87 +0,0 @@ ---- -sidebar_position: 3 ---- - -import Admonition from '@theme/Admonition' - -# safety - -The `safety` module is tasked solely with receiving a fraction of an outpost’s revenues denominated in stablecoins. Spending funds in the safetyfund can only be done via a successful governance proposal. - -# Links - -- **Module address:** -- **Testnet address:** -- **Module repo:** https://github.com/mars-protocol/hub/tree/main/x/safety -- **Proto repo:** https://github.com/mars-protocol/hub/tree/main/proto -- **proposals.proto:** https://github.com/mars-protocol/hub/blob/main/proto/mars/safety/v1beta1/proposals.proto -- **query.proto:** https://github.com/mars-protocol/hub/blob/main/proto/mars/safety/v1beta1/query.proto -- **Video walkthrough:** https://www.youtube.com/watch?v=2UjSXEcbyuY -- **Article breakdown:** https://blog.marsprotocol.io/blog/mars-protocol-code-review-breakdown-session-3-4-safety-fund-and-governance-modules -- **Audit:** - -## Proposal Types - -### `SafetyFundSpendProposal` - -`SafetyFundSpendProposal` details a proposal for the use of safety funds, together with how many coins are proposed to be spent, and to which recipient account. - - - For now, this is just a copy of the CommunityPoolSpendProposal in the distribution module. in the long term, the goal is for the module to be able to automatically detect bad debts incurred in outposts and automatically distribute the appropriate amount of funds, without having to go through the governance process. - - -```go proposals.proto -message SafetyFundSpendProposal { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - // Title is the proposal's title - string title = 1; - - // Description is the proposal's description - string description = 2; - - // Recipient is a string representing the account address to which the funds shall be sent to - string recipient = 3; - - // Amount represents the coins that shall be sent to the recipient - repeated cosmos.base.v1beta1.Coin amount = 4 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` - -## Queries - -`Query` defines the gRPC querier service for the safety fund module. - -```go query.proto -service Query { - // Balances queries coins available in the safety fund - rpc Balances(QueryBalancesRequest) returns (QueryBalancesResponse) { - option (google.api.http).get = "/mars/safety/v1beta1/balances"; - } -} -``` - -### `QueryBalancesRequest` -`QueBalancesRequest` is the request type of the `QuerBalancesRPC` method. - -```go query.proto -message QueryBalancesRequest {} -``` - -#### `QueryBalancesResponse` -`QueBalancesResponse` is the response type of the `QuerBalancesRPC` method. - -```go query.proto -message QueryBalancesResponse { - // Balances is the coins available in the safety fund - repeated cosmos.base.v1beta1.Coin balances = 1 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} -``` diff --git a/docs/develop/modules/ibc-modules/_category_.json b/docs/develop/modules/ibc-modules/_category_.json deleted file mode 100644 index 04fb55f..0000000 --- a/docs/develop/modules/ibc-modules/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "IBC Modules", - "position": 5, - "link": { "type": "doc", "id": "ibc-modules-intro" } -} \ No newline at end of file diff --git a/docs/develop/modules/ibc-modules/ibc-modules-intro.mdx b/docs/develop/modules/ibc-modules/ibc-modules-intro.mdx deleted file mode 100644 index d73392d..0000000 --- a/docs/develop/modules/ibc-modules/ibc-modules-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# IBC Modules - -IBC modules which enable IBC transactions between Cosmos blockchains. - - \ No newline at end of file diff --git a/docs/develop/modules/ibc-modules/interchain-accounts.mdx b/docs/develop/modules/ibc-modules/interchain-accounts.mdx deleted file mode 100644 index 2103294..0000000 --- a/docs/develop/modules/ibc-modules/interchain-accounts.mdx +++ /dev/null @@ -1,52 +0,0 @@ ---- -sidebar_position: 1 ---- - -# interchain_accounts - -The `interchain_accounts` module is responsible for the implementation of the ICS-27 protocol, which enables cross-chain account management built upon IBC. Chains using the Interchain Accounts module can programmatically create accounts on other chains and control these accounts via IBC transactions. - -For more info, visit https://ibc.cosmos.network/main/apps/interchain-accounts/overview.html - -## Queries - -`Query` (controller) defines the gRPC querier service of the ICA controller submodule. - -```go query.proto -service Query { - // Params queries all parameters of the ICA controller submodule. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ibc/apps/interchain_accounts/controller/v1/params"; - } -} -``` - -`Query` (host) defines the gRPC querier service of the ICA host submodule. - -```go query.proto -service Query { - // Params queries all parameters of the ICA host submodule. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ibc/apps/interchain_accounts/host/v1/params"; - } -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the Query/Params RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is the response type for the Query/Params RPC method. - -```go query.proto -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/ibc-modules/transfer.mdx b/docs/develop/modules/ibc-modules/transfer.mdx deleted file mode 100644 index ba5f2b5..0000000 --- a/docs/develop/modules/ibc-modules/transfer.mdx +++ /dev/null @@ -1,173 +0,0 @@ ---- -sidebar_position: 2 ---- - -# transfer - -The `transfer` module is responsible for the implementation of the ICS-20 protocol, which enables cross-chain fungible token transfers. - -For more information, visit: https://ibc.cosmos.network/main/apps/transfer/overview.html - -## Message Types - -`Msg` defines the ibc/transfer Msg service. - -```go tx.proto -service Msg { - // Transfer defines a rpc handler method for MsgTransfer. - rpc Transfer(MsgTransfer) returns (MsgTransferResponse); -} -``` - -### `MsgTransfer` - -`MsgTransfer` defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains. - -See ICS Spec here: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures - -```go tx.proto -message MsgTransfer { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // the port on which the packet will be sent - string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; - // the channel by which the packet will be sent - string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; - // the tokens to be transferred - cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false]; - // the sender address - string sender = 4; - // the recipient address on the destination chain - string receiver = 5; - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - ibc.core.client.v1.Height timeout_height = 6 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; - // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - uint64 timeout_timestamp = 7 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; -} -``` - -#### `MsgTransferResponse` -`MsgTransferResponse` defines the `Msg/Transfer` response type. - -```go tx.proto -message MsgTransferResponse {} -``` - -## Queries - -`Query` provides defines the gRPC querier service. - -```go query.proto -service Query { - // DenomTrace queries a denomination trace information. - rpc DenomTrace(QueryDenomTraceRequest) returns (QueryDenomTraceResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces/{hash}"; - } - - // DenomTraces queries all denomination traces. - rpc DenomTraces(QueryDenomTracesRequest) returns (QueryDenomTracesResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces"; - } - - // Params queries all parameters of the ibc-transfer module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/params"; - } - - // DenomHash queries a denomination hash information. - rpc DenomHash(QueryDenomHashRequest) returns (QueryDenomHashResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace}"; - } -} -``` - -### `QueryDenomTraceRequest` - -`QueryDenomTraceRequest` is the request type for the `Query/DenomTrace` RPC method. - -```go query.proto -message QueryDenomTraceRequest { - // hash (in hex format) of the denomination trace information. - string hash = 1; -} -``` - -#### `QueryDenomTraceResponse` - -`QueryDenomTraceResponse` is the response type for the `Query/DenomTrace` RPC method. - -```go query.proto -message QueryDenomTraceResponse { - // denom_trace returns the requested denomination trace information. - DenomTrace denom_trace = 1; -} -``` - -### `QueryDenomTracesRequest` - -`QueryDenomTracesRequest` is the request type for the `Query/DenomTraces` RPC method. - -```go query.proto -message QueryDenomTracesRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} -``` - -#### `QueryDenomTracesResponse` - -`QueryDenomTracesResponse` is the response type for the `Query/DenomTraces` RPC method. - -```go query.proto -message QueryDenomTracesResponse { - // denom_traces returns all denominations trace information. - repeated DenomTrace denom_traces = 1 [(gogoproto.castrepeated) = "Traces", (gogoproto.nullable) = false]; - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} -``` - -### `QueryParamsRequest` - -`QueryParamsRequest` is the request type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsRequest {} -``` - -#### `QueryParamsResponse` - -`QueryParamsResponse` is the response type for the `Query/Params` RPC method. - -```go query.proto -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1; -} -``` - -### `QueryDenomHashRequest` - -`QueryDenomHashRequest` is the request type for the `Query/DenomHash` RPC method. - -```go query.proto -message QueryDenomHashRequest { - // The denomination trace ([port_id]/[channel_id])+/[denom] - string trace = 1; -} -``` - -#### `QueryDenomHashResponse` - -`QueryDenomHashResponse` is the response type for the `Query/DenomHash` RPC method. - -```go query.proto -message QueryDenomHashResponse { - // hash (in hex format) of the denomination trace information. - string hash = 1; -} -``` \ No newline at end of file diff --git a/docs/develop/modules/module-accounts.mdx b/docs/develop/modules/module-accounts.mdx deleted file mode 100644 index 6884a38..0000000 --- a/docs/develop/modules/module-accounts.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Module Accounts - -| Module | Address | Type | Permissions | Description | -|---|---|---|---|---| -| `auth` | - | `cosmos-sdk` | | Authentication of accounts and transactions. | -| `authz` | - | `cosmos-sdk` | | Authorization for accounts to perform actions on behalf of other accounts. | -| `bank` | - | `cosmos-sdk` | | Token transfer functionalities. | -| `capability` | - | `cosmos-sdk` | | Object capability implementation. | -| `crisis` | - | `cosmos-sdk` | | Halting the blockchain. | -| `distribution` | - | `cosmos-sdk` | | Fee and staking token provision distribution. | -| `evidence` | - | `cosmos-sdk` | | Evidence handling for misbehavior. | -| `feegrant` | - | `cosmos-sdk` | | Fee allowances. | -| `gov` | - | `custom` | | On-chain governance. | -| `group` | - | `cosmos-sdk` | | On-chain multisig accounts. | -| `incentives` | - | `custom` | | Incentivisation of staking on Mars Hub. | -| `interchain_accounts` | - | `ibc` | | Cross-chain account management. | -| `mint` | - | `cosmos-sdk` | | Creation of new units of MARS. | -| `nft` | - | `cosmos-sdk` | | NFT support. | -| `params` | - | `cosmos-sdk` | | Globally available parameter store. | -| `safety` | - | `custom` | | Receives a fraction of an outpost’s revenues. | -| `slashing` | - | `cosmos-sdk` | | Validator punishment mechanisms. | -| `staking` | - | `cosmos-sdk` | | Proof-of-Stake (PoS) system. | -| `transfer` | - | `ibc` | | Cross-chain fungible token transfers. | -| `upgrade` | - | `cosmos-sdk` | | Software upgrades. | -| `vesting` | - | `cosmos-sdk` | | Vesting account implementation. | -| `wasm` | - | `cw` | | CosmWasm smart contracts. | - - diff --git a/docs/develop/modules/modules-intro.mdx b/docs/develop/modules/modules-intro.mdx deleted file mode 100644 index be8bb70..0000000 --- a/docs/develop/modules/modules-intro.mdx +++ /dev/null @@ -1,7 +0,0 @@ -import Cards from '@site/src/components/Cards'; - -# Modules - -Core and custom modules that make up Mars Hub. - - \ No newline at end of file diff --git a/docs/develop/overview.mdx b/docs/develop/overview.mdx deleted file mode 100644 index 2e37bb7..0000000 --- a/docs/develop/overview.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -sidebar_position: 1 ---- - -import Cards from '@site/src/components/Cards'; - -# Develop - -Expand your developer skills and explore the exciting realm of Mars Protocol's code base with detailed tutorials. - - \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index 23b43b2..ec0b1c7 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -152,22 +152,6 @@ const config = { editUrl: 'https://github.com/mars-protocol/docs/blob/master', }, ], - [ - '@docusaurus/plugin-content-docs', - { - beforeDefaultRemarkPlugins: [ - [remarkCodeHike, { - showCopyButton: true, - lineNumbers: true, - theme }], - ], - id: 'develop', - path: 'docs/develop', - routeBasePath: 'docs/develop', - sidebarPath: require.resolve('./sidebars.js'), - editUrl: 'https://github.com/mars-protocol/docs/blob/master', - }, - ], [ '@docusaurus/plugin-content-docs', @@ -267,14 +251,6 @@ const config = { activeBaseRegex: `/learn/`, }, - { - // to: '/docs/develop/smart-contracts/astroport-contract-addresses', - to: '/docs/develop/overview', - label: 'Develop', - position: 'left', - activeBaseRegex: `/develop/`, - }, - // {to: '/blog', label: 'Blog', position: 'left'}, {