tokenswap

Abstract

This module is for coinswap from HDAC chain to RIZON Blockchain.

State

Tokenswap

Tokenswap defines the tokenswap state
1
type Tokenswap struct {
2
// tx_hash is the tx hash of burn tx from legacy chain
3
// tx_hash is used for store key
4
TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
5
// receiver is the target of tokenswap
6
Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"`
7
// signer is who confirms the swap process
8
Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"`
9
// amount is the amount of swap process
10
Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
11
}
Copied!

Params

Params defines the parameters for the tokenswap module
1
type Params struct {
2
// swappable indicates whether tokenswap module is enabled or not
3
Swappable bool `protobuf:"varint,1,opt,name=swappable,proto3" json:"swappable,omitempty" yaml:"swappable"`
4
// signer is someone who can request tokenswap
5
Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty" yaml:"signer"`
6
}
Copied!

Message

MsgCreateTokenswapRequest

MsgCreateTokenswapRequest defines a SDK message for creating a new tokenswap

structure

1
type MsgCreateTokenswapRequest struct {
2
// tx_hash is the tx hash of burn tx from legacy chain
3
// tx_hash is used for store key
4
TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"`
5
// receiver is the target of tokenswap
6
Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty" yaml:"receiver"`
7
// signer is who confirms the swap process
8
Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty" yaml:"signer"`
9
// amount is the amount of swap process
10
Amount *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount,omitempty"`
11
}
Copied!

request sample

1
{
2
"body": {
3
"messages": [
4
{
5
"@type": "/rizonworld.rizon.tokenswap.MsgCreateTokenswapRequest",
6
"amount": "3.000000000000000000",
7
"receiver": "rizon1rkxs2xeq93qlwhvcp2wp8zpstrp8vver3ap4y5",
8
"signer": "rizon136fzkc73rm5def5fngs386qdlxcuvxvrte8lk7",
9
"tx_hash": "a4aa35ffe32f5d2d0fbb5a3b2273695c44576c11e529760f0fbf7ed16d90e99f"
10
}
11
],
12
},
13
}
Copied!

Event

msg_server

CreateTokenswap

Type
AttributeKey
AttributeValue
create_tokenswap
tx_hash
{msg.TxHash}
create_tokenswap
receiver
{msg.Receiver}
create_tokenswap
amount
{msg.Amount}
message
module
tokenswap
message
sender
{msg.Signer}

Parameter

Key
Type
Example
Swappable
bool
true
Signer
string
"rizon136fzkc73rm5def5fngs386qdlxcuvxvrte8lk7"