Economics Engine
The Economics ADO allows users to deposit funds to be used to pay fees implemented on ADO actions by the ADODB. Deposited funds can be either native funds such as "uandr" or CW20 tokens where the contract address is used. The fees are automatically called by the ADO that implements them.
Fees are charged in the following order:
A fee can be paid by a combination of the below. For example if a 1000 uandr fee is required and the balance of the ADO is 800 uandr, then 800 will be deducted from the 1000, and the remainder is paid by App contract. If the App does not have sufficient funds to cover the rest, then the funds are deducted from the payee next.
ADO: First, the ADO requesting the fees is checked for funds and if available will use these funds to pay the fee.
App: The App contract of the ADO requesting the fees.
Payee: The address that sent the message to the ADO that is requesting the fees.
Ado_type: economics
InstantiateMsg
Name | Type | Description |
---|---|---|
| String | The address of the kernel contract on chain. This can be found in our deployed contracts section. |
| Option<String> | Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified. |
ExecuteMsg
Deposit
Deposit funds to be used by the Andromeda economics module to pay for ADO fees.
Name | Type | Description |
---|---|---|
| Option<AndrAddr> | If specified, then your deposit would be on the behalf of the AndrAddr. If not specified, then the deposit will be for the sender. |
Receive
Handles receiving CW20 tokens to be deposited as funds to pay fees with. Called by sending CW20 tokens from the CW20 ADO using the Send execute message.
This is not called directly by the user, but called when the user sends CW20 tokens to this ADO.
The msg field of the Send execute should be a base64 encoded Cw20HookMsg.
Cw20ReceiveMsg
The msg
field needs to be a Cw20HookMsg
of type Deposit
. The message is attached as a bsae64 encoded binary of the JSON representation of the Deposit message.
Cw20HookMsg
Deposits CW20 tokens to be used as funds to pay fees.
Name | Type | Description |
---|---|---|
| Option<AndrAddr> | If specified, then your deposit would be on the behalf of the AndrAddr. If not specified, then the deposit will be for the sender. |
PayFee
Pay a fee for the given action. The sender must be a valid ADO contract.
This message is never called by the user directly, but by an ADO when the user calls a message that requires fees to be payed.
Name | Type | Description |
---|---|---|
| Addr | The address that will pay in case the ADO and App did not have enough funds to cover the fee. |
| String | The action we are paying a fee for. |
Withdraw
Withdraw native funds from the Andromeda economics module. If no amount is provided, all funds are withdrawn for the given asset.
Name | Type | Description |
---|---|---|
| Option<AndrAddr> | The amount of the specified asset to withdraw. If not specified then the total amount is withdrawn. |
| String | The native asset to withdraw. |
WithdrawCW20
Withdraw CW20 funds from the Andromeda economics module. If no amount is provided all funds are withdrawn for the given asset.
Name | Type | Description |
---|---|---|
| Option<Uint128> | The amount of the specified asset to withdraw. If not specified then the total amount is withdrawn. |
| String | The contract address of the CW20 token to withdraw. |
Ownership
The set of ownerhsip messages. These messages are the same as the ones found in the ADO base section.
QueryMsg
Balance
Queries the amount of the specified asset
for the specified address
.
Name | Type | Description |
---|---|---|
| String | The asset to get the balance for. Can be either a native token or a CW20 contract address. |
| The address to get the balance for. |
Returns a Uint128
representing the current balance.
Version
Queries the version of the ADO.
VersionResponse
Name | Type | Descripton |
---|---|---|
| String | The version of the ADO. |
Owner
Queries the owner of the contract.
ContractOwnerResponse
Type
Queries the ADO type.
TypeResponse
Name | Type | Description |
---|---|---|
| String | The type of the ado. |
KernelAddress
Queries the kernel address of the chain the ADO is deployed on.
Returns a String containing the contract address of the Kernel.