Authorization Systems
Supported Data Types and Operator
Supported data types are listed below (more information in here)
const (
Coin Type = "coin"
ArrayCoin Type = "array.coin"
String Type = "string"
ArrayString Type = "array.string"
)
Supported operator are listed below (more information in here)
const (
Equal Operator = "equal"
LTE Operator = "lte"
Sum Operator = "sum"
DailySum Operator = "daily.sum"
)
Current supported combo can be seen here. Below are the visualization for more clarity.
coin
├── equal
├── lte
├── sum
└── daily.sum
array.coin
├── equal
├── lte
├── sum
└── daily.sum
string
└── equal
array.string
└── equal
Flowchart
Create Authorization
Send IBC packet data from chain A to chain B with these message parameters:
- granter: owner account that initiate this action
- authorization JSON: authorization instruction in JSON format.
Execute message with authorization
By using internal chain loop (such as BeginBlock or EndBlock) or x/epoch module (cron like approach for cosmos SDK), programmer can add their own timing, we provide the trigger/hook function called MsgExec. The function needs packet_data_id.
Send IBC packet data from chain A to chain B with these message parameters:
- grant_id: unique packet data id
- granter: owner account that initiate this action
- array of sdk.Msg: array of sdk.Msg that will be executed on the receiving chain
Validate the sdk.Msg parameters, if match then execute, if not return error authorization.
Revoke authorization
We do not allow edit on authorization. We can only revoke it.
Owner can revoke by using MsgRevoke. Owner provide grant_id.
Send IBC packet data from chain A to chain B with these message parameters:
- grant_id: unique packet data id
- granter: owner account that initiate this action
Delete stored data in chain A and chain B.