The x/forwarding module maintains state related to forwarding accounts, which are specialized accounts used to automatically route tokens from Noble through predefined channels. The state contains account details, channel information, and statistics related to forwarding operations.
The ForwardingAccount structure stores the data needed for forwarding. This includes routing information, account creation details, and a fallback address.
{
"BaseAccount": {
"address": "noble1...",
"pub_key": null,
"account_number": "0",
"sequence": "0"
},
"channel": "channel-0",
"recipient": "cosmos1...",
"created_at": "1620000000",
"fallback": "noble1..."
}- BaseAccount: inherits from
cosmos.auth.v1beta1.BaseAccount - channel: specifies the IBC channel through which tokens are forwarded
- recipient: the address that receives the forwarded tokens
- created_at: block height at creation
- fallback: a fallback address to be used if forwarding to the primary recipient fails
The state is updated by the following messages:
MsgRegisterAccount: updates theForwardingAccountstate by creating a new accountMsgClearAccount: updates theForwardingAccountstate by clearing an account
The genesis state of the x/forwarding module sets up the initial configuration, including which denominations are allowed for forwarding and the initial statistics related to registered accounts and forwarding actions.
{
"allowed_denoms": [
"ausdy",
"uusdc"
],
"num_of_accounts": {
"channel-0": "1",
"channel-1": "1"
},
"num_of_forwards": {
"channel-0": "1",
"channel-1": "1"
},
"total_forwarded": {
"channel-0": "1000000ausdy",
"channel-1": "500000uusdc"
}
}- allowed_denoms: a list of denominations that are allowed to be forwarded
- num_of_accounts: a map linking channel IDs to the number of registered forwarding accounts
- num_of_forwards: a map linking channel IDs to the number of forwarding actions
- total_forwarded: a map linking channel IDs to the total amount (per denom) forwarded through the channel
The state is updated by the following messages:
MsgSetAllowedDenoms: updates theallowed_denomsfield, changing which denominations are permitted for forwarding