0g-chain/x/bep3/spec/03_messages.md
Denali Marsh 6c68e41758
[R4R] bep3 module audit revisions (#505)
* most audit revisions

* remove expected income

* update begin block spec

* filter queryAtomicSwaps, add queryAssetSupplies

* update old address

* update test

* Remove legacy method

* remove legacy comment

* address PR comments

* IsValid for SwapDirection, SwapStatus

* fix rng logging

* query asset supplies

* return [64]byte from rng

* remove cross chain field from MsgCreateAtomicSwap

* move swap filtering to querier

* rename Limit field to SupplyLimit
2020-05-12 13:15:38 -07:00

46 lines
1.5 KiB
Markdown

# Messages
## Create swap
Swaps are created using the `MsgCreateAtomicSwap` message type.
```go
// MsgCreateAtomicSwap contains an AtomicSwap struct
type MsgCreateAtomicSwap struct {
From sdk.AccAddress `json:"from" yaml:"from"`
To sdk.AccAddress `json:"to" yaml:"to"`
RecipientOtherChain string `json:"recipient_other_chain" yaml:"recipient_other_chain"`
SenderOtherChain string `json:"sender_other_chain" yaml:"sender_other_chain"`
RandomNumberHash tmbytes.HexBytes `json:"random_number_hash" yaml:"random_number_hash"`
Timestamp int64 `json:"timestamp" yaml:"timestamp"`
Amount sdk.Coins `json:"amount" yaml:"amount"`
HeightSpan int64 `json:"height_span" yaml:"height_span"`
}
```
## Claim swap
Active swaps are claimed using the `MsgClaimAtomicSwap` message type.
```go
// MsgClaimAtomicSwap defines a AtomicSwap claim
type MsgClaimAtomicSwap struct {
From sdk.AccAddress `json:"from" yaml:"from"`
SwapID tmbytes.HexBytes `json:"swap_id" yaml:"swap_id"`
RandomNumber tmbytes.HexBytes `json:"random_number" yaml:"random_number"`
}
```
## Refund swap
Expired swaps are refunded using the `MsgRefundAtomicSwap` message type.
```go
// MsgRefundAtomicSwap defines a refund msg
type MsgRefundAtomicSwap struct {
From sdk.AccAddress `json:"from" yaml:"from"`
SwapID tmbytes.HexBytes `json:"swap_id" yaml:"swap_id"`
}
```