MsgPrivilegedExecuteContract
MsgPrivilegedExecuteContract defines a method for executing a Cosmwasm contract from the exchange module with privileged capabilities.
Fields description
Sender
describes the creator of this msg.Funds
defines the user's bank coins used to fund the execution (e.g. 100inj).ContractAddress
defines the contract address to execute.Data
defines the call data used when executing the contract, see further details below.
Contract Interface
If you want to enable privileged actions on your contract, you must implement the following execute method:
The
origin
field is the address of the user who sent the privileged action. You don't have to set this field yourself, it will be set by the exchange module.The
name
field is the name of the privileged action. You can define these to be whatever you want.The
args
field is the arguments of the privileged action. You can define these to be whatever you want.
A complete definition of the Data string in Golang is:
A user can then call the privileged action by sending a MsgPrivilegedExecuteContract
with the following data:
Supported Privileged Actions
There are currently two supported privileged actions:
These privileged actions must be set inside the Cosmwasm response data field, e.g.:
PositionTransfer
The position transfer allows a contract to transfer a derivative position from its own subaccount to a user's subaccount. The position may not be liquidable. Solely the receiver pays a taker trading fee deducted from his balances.
Currently only transfers from the contract's subaccount to a user's subaccount are supported.
SyntheticTrade
The synthetic trade allows a contract to execute a synthetic trade on behalf of a user for derivative markets. This is not touching the orderbook and is purely a synthetic trade. Taker trading fees still apply. The subaccount ids must be set to the contract's subaccount id and the user's subaccount id.
Last updated