Reset bep3 swaps for zero height in migration (#1135)

* reinstate and expand export test

* format testdata json

* sort bep3 testdata json for easier diffing

* add more bep3 swap examples to test data

* reset swaps for zero height

* update top level migration testdata
This commit is contained in:
Ruaridh 2022-01-15 03:17:49 +00:00 committed by GitHub
parent 779f8081e7
commit e9a28cefd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 684 additions and 298 deletions

View File

@ -1,10 +1,17 @@
package app
import (
"encoding/json"
"os"
"sort"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/types"
db "github.com/tendermint/tm-db"
)
@ -20,43 +27,52 @@ func TestNewApp(t *testing.T) {
)
}
// func TestExport(t *testing.T) {
// db := db.NewMemDB()
// app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, AppOptions{})
// setGenesis(app)
func TestExport(t *testing.T) {
db := db.NewMemDB()
app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, DefaultNodeHome, nil, MakeEncodingConfig(), Options{})
// // Making a new app object with the db, so that initchain hasn't been called
// newApp := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, AppOptions{})
// _, _, err := newApp.ExportAppStateAndValidators(false, []string{})
// require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
// }
stateBytes, err := json.Marshal(NewDefaultGenesisState())
require.NoError(t, err)
// // ensure that black listed addresses are properly set in bank keeper
// func TestBlackListedAddrs(t *testing.T) {
// db := db.NewMemDB()
// app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, AppOptions{})
initRequest := abci.RequestInitChain{
Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC),
ChainId: "kava-test",
InitialHeight: 1,
ConsensusParams: tmtypes.TM2PB.ConsensusParams(tmtypes.DefaultConsensusParams()),
Validators: nil,
AppStateBytes: stateBytes,
}
app.InitChain(initRequest)
app.Commit()
// for acc := range mAccPerms {
// require.Equal(t, !allowedReceivingModAcc[acc], app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc)))
// }
// }
exportedApp, err := app.ExportAppStateAndValidators(false, []string{})
require.NoError(t, err)
// func setGenesis(app *App) error {
// genesisState := NewDefaultGenesisState()
// Assume each module is exported correctly, so only check modules in genesis are present in export
initialModules, err := unmarshalJSONKeys(initRequest.AppStateBytes)
require.NoError(t, err)
exportedModules, err := unmarshalJSONKeys(exportedApp.AppState)
require.NoError(t, err)
assert.ElementsMatch(t, initialModules, exportedModules)
// stateBytes, err := codec.MarshalJSONIndent(app.cdc, genesisState)
// if err != nil {
// return err
// }
assert.Equal(t, initRequest.InitialHeight+1, exportedApp.Height) // app.Commit() increments height
assert.Equal(t, initRequest.ConsensusParams, exportedApp.ConsensusParams)
assert.Equal(t, []tmtypes.GenesisValidator(nil), exportedApp.Validators) // no validators set in default genesis
}
// // Initialize the chain
// app.InitChain(
// abci.RequestInitChain{
// Validators: []abci.ValidatorUpdate{},
// AppStateBytes: stateBytes,
// },
// )
// app.Commit()
// unmarshalJSONKeys extracts keys from the top level of a json blob.
func unmarshalJSONKeys(jsonBytes []byte) ([]string, error) {
var jsonMap map[string]json.RawMessage
err := json.Unmarshal(jsonBytes, &jsonMap)
if err != nil {
return nil, err
}
// return nil
// }
keys := make([]string, 0, len(jsonMap))
for k, _ := range jsonMap {
keys = append(keys, k)
}
sort.Strings(keys)
return keys, nil
}

View File

@ -1393,6 +1393,44 @@
"status": "Completed",
"timestamp": "1636034914"
},
{
"amount": [
{
"amount": "19000000000",
"denom": "bnb"
}
],
"closed_block": "1712118",
"cross_chain": true,
"direction": "Outgoing",
"expire_height": "1736797",
"random_number_hash": "280EB832A37F2265CC82F3957CE603AAD57BAD7038B876A1F28953AFA29FA1C3",
"recipient": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6",
"recipient_other_chain": "bnb18nsgj50zvc4uq93w4j0ltz5gaxhwv7aq4qnq0p",
"sender": "kava1zw6gg4ztvly7zf25pa33mclav3spvj3ympxxna",
"sender_other_chain": "bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn",
"status": "Completed",
"timestamp": "1641976566"
},
{
"amount": [
{
"amount": "999595462080",
"denom": "busd"
}
],
"closed_block": "787122",
"cross_chain": true,
"direction": "Incoming",
"expire_height": "811799",
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"recipient": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"recipient_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"sender": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"sender_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"status": "Expired",
"timestamp": "1635694492"
},
{
"amount": [
{
@ -1411,6 +1449,44 @@
"sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"status": "Expired",
"timestamp": "1635694492"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "Outgoing",
"expire_height": "1730589",
"random_number_hash": "A74EA1AB58D312FDF1E872D18583CACCF294E639DDA4F303939E9ADCEC081D93",
"recipient": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"recipient_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"sender": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"sender_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"status": "Open",
"timestamp": "1641934114"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "Incoming",
"expire_height": "1740000",
"random_number_hash": "39E9ADCEC081D93A74EA1A83CACCF294E639DDA4F3039B58D312FDF1E872D185",
"recipient": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"sender_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"status": "Open",
"timestamp": "1641934114"
}
],
"previous_block_time": "1970-01-01T00:00:00Z",

View File

@ -1139,32 +1139,118 @@
},
"atomic_swaps": [
{
"amount": [{ "denom": "btcb", "amount": "1999955998" }],
"random_number_hash": "6F1CF8F2E13A0C0F0A359F54E47E4E265D766B8E006D2F00BDF994ABDEF1E9E4",
"expire_height": "838627",
"timestamp": "1636034914",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"recipient": "kava1fl2hs6y9vz986g5v52pdan9ga923n9mn5cxxkw",
"sender_other_chain": "bnb19k9wuv2j7c7ck8tmc7kav0r0cnt3esmkrpf25x",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"closed_block": "838115",
"status": "SWAP_STATUS_COMPLETED",
"amount": [
{
"amount": "1999955998",
"denom": "btcb"
}
],
"closed_block": "1",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING"
"direction": "SWAP_DIRECTION_INCOMING",
"expire_height": "838627",
"random_number_hash": "6F1CF8F2E13A0C0F0A359F54E47E4E265D766B8E006D2F00BDF994ABDEF1E9E4",
"recipient": "kava1fl2hs6y9vz986g5v52pdan9ga923n9mn5cxxkw",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"sender_other_chain": "bnb19k9wuv2j7c7ck8tmc7kav0r0cnt3esmkrpf25x",
"status": "SWAP_STATUS_COMPLETED",
"timestamp": "1636034914"
},
{
"amount": [{ "denom": "busd", "amount": "999595462080" }],
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"expire_height": "811799",
"timestamp": "1635694492",
"sender": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"recipient": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"recipient_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"closed_block": "787122",
"status": "SWAP_STATUS_EXPIRED",
"amount": [
{
"amount": "19000000000",
"denom": "bnb"
}
],
"closed_block": "1",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING"
"direction": "SWAP_DIRECTION_OUTGOING",
"expire_height": "1736797",
"random_number_hash": "280EB832A37F2265CC82F3957CE603AAD57BAD7038B876A1F28953AFA29FA1C3",
"recipient": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6",
"recipient_other_chain": "bnb18nsgj50zvc4uq93w4j0ltz5gaxhwv7aq4qnq0p",
"sender": "kava1zw6gg4ztvly7zf25pa33mclav3spvj3ympxxna",
"sender_other_chain": "bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn",
"status": "SWAP_STATUS_COMPLETED",
"timestamp": "1641976566"
},
{
"amount": [
{
"amount": "999595462080",
"denom": "busd"
}
],
"closed_block": "787122",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING",
"expire_height": "1",
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"recipient": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"recipient_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"sender": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"sender_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"status": "SWAP_STATUS_EXPIRED",
"timestamp": "1635694492"
},
{
"amount": [
{
"amount": "999595462080",
"denom": "busd"
}
],
"closed_block": "787122",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING",
"expire_height": "1",
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"recipient": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"recipient_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"sender": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"status": "SWAP_STATUS_EXPIRED",
"timestamp": "1635694492"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING",
"expire_height": "24687",
"random_number_hash": "A74EA1AB58D312FDF1E872D18583CACCF294E639DDA4F303939E9ADCEC081D93",
"recipient": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"recipient_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"sender": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"sender_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"status": "SWAP_STATUS_OPEN",
"timestamp": "1641934114"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING",
"expire_height": "1",
"random_number_hash": "39E9ADCEC081D93A74EA1A83CACCF294E639DDA4F3039B58D312FDF1E872D185",
"recipient": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"sender_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"status": "SWAP_STATUS_EXPIRED",
"timestamp": "1641934114"
}
],
"supplies": [

View File

@ -80,11 +80,44 @@ func migrateAtomicSwaps(oldSwaps v015bep3.AtomicSwaps) v016bep3.AtomicSwaps {
CrossChain: oldSwap.CrossChain,
Direction: migrateSwapDirection(oldSwap.Direction),
}
swap = resetSwapForZeroHeight(swap)
newSwaps[i] = swap
}
return newSwaps
}
// resetSwapForZeroHeight updates swap expiry/close heights to work when the chain height is reset to zero.
func resetSwapForZeroHeight(swap v016bep3.AtomicSwap) v016bep3.AtomicSwap {
switch status := swap.Status; status {
case v016bep3.SWAP_STATUS_COMPLETED:
// Reset closed block to one so completed swaps are not held in long term storage too long.
swap.ClosedBlock = 1
case v016bep3.SWAP_STATUS_OPEN:
switch dir := swap.Direction; dir {
case v016bep3.SWAP_DIRECTION_INCOMING:
// Open incoming swaps can be expired safely. They haven't been claimed yet, so the outgoing swap on bnb will just timeout.
// The chain downtime cannot be accurately predicted, so it's easier to expire than to recalculate a correct expire height.
swap.ExpireHeight = 1
swap.Status = v016bep3.SWAP_STATUS_EXPIRED
case v016bep3.SWAP_DIRECTION_OUTGOING:
// Open outgoing swaps should be extended to allow enough time to claim after the chain launches.
// They cannot be expired as there could be an open/claimed bnb swap.
swap.ExpireHeight = 1 + 24686 // default timeout used when sending swaps from kava
case v016bep3.SWAP_DIRECTION_UNSPECIFIED:
default:
panic(fmt.Sprintf("unknown bep3 swap direction '%s'", dir))
}
case v016bep3.SWAP_STATUS_EXPIRED:
// Once a swap is marked expired the expire height is ignored. However reset to 1 to be sure.
swap.ExpireHeight = 1
case v016bep3.SWAP_STATUS_UNSPECIFIED:
default:
panic(fmt.Sprintf("unknown bep3 swap status '%s'", status))
}
return swap
}
func migrateSupplies(oldSupplies v015bep3.AssetSupplies) v016bep3.AssetSupplies {
newSupplies := make(v016bep3.AssetSupplies, len(oldSupplies))
for i, supply := range oldSupplies {

View File

@ -62,31 +62,97 @@ func (s *migrateTestSuite) TestMigrate_JSON() {
s.Require().JSONEq(string(expected), string(actual))
}
func (s *migrateTestSuite) TestMigrate_Swaps_Status() {
func (s *migrateTestSuite) TestMigrate_Swaps() {
type oldSwap struct {
ExpireHeight uint64
CloseBlock int64
Status v015bep3.SwapStatus
Direction v015bep3.SwapDirection
}
type newSwap struct {
ExpireHeight uint64
CloseBlock int64
Status v016bep3.SwapStatus
Direction v016bep3.SwapDirection
}
testcases := []struct {
name string
oldStatus v015bep3.SwapStatus
newStatus v016bep3.SwapStatus
name string
oldSwap oldSwap
newSwap newSwap
}{
{
name: "null swap status",
oldStatus: v015bep3.NULL,
newStatus: v016bep3.SWAP_STATUS_UNSPECIFIED,
name: "invalid swap direction",
oldSwap: oldSwap{
Direction: v015bep3.INVALID,
},
newSwap: newSwap{
Direction: v016bep3.SWAP_DIRECTION_UNSPECIFIED,
},
},
{
name: "open swap status",
oldStatus: v015bep3.Open,
newStatus: v016bep3.SWAP_STATUS_OPEN,
name: "invalid swap status",
oldSwap: oldSwap{
Status: v015bep3.NULL,
},
newSwap: newSwap{
Status: v016bep3.SWAP_STATUS_UNSPECIFIED,
},
},
{
name: "completed swap status",
oldStatus: v015bep3.Completed,
newStatus: v016bep3.SWAP_STATUS_COMPLETED,
name: "incoming open swap",
oldSwap: oldSwap{
// expire and close not set in open swaps
Status: v015bep3.Open,
Direction: v015bep3.Incoming,
},
newSwap: newSwap{
ExpireHeight: 1,
Status: v016bep3.SWAP_STATUS_EXPIRED,
Direction: v016bep3.SWAP_DIRECTION_INCOMING,
},
},
{
name: "expired swap status",
oldStatus: v015bep3.Expired,
newStatus: v016bep3.SWAP_STATUS_EXPIRED,
name: "outgoing open swap",
oldSwap: oldSwap{
// expire and close not set in open swaps
Status: v015bep3.Open,
Direction: v015bep3.Outgoing,
},
newSwap: newSwap{
ExpireHeight: 24687,
Status: v016bep3.SWAP_STATUS_OPEN,
Direction: v016bep3.SWAP_DIRECTION_OUTGOING,
},
},
{
name: "completed swap",
oldSwap: oldSwap{
ExpireHeight: 1000,
CloseBlock: 900,
Status: v015bep3.Completed,
Direction: v015bep3.Incoming,
},
newSwap: newSwap{
ExpireHeight: 1000,
CloseBlock: 1,
Status: v016bep3.SWAP_STATUS_COMPLETED,
Direction: v016bep3.SWAP_DIRECTION_INCOMING,
},
},
{
name: "expired swap",
oldSwap: oldSwap{
ExpireHeight: 1000,
CloseBlock: 900,
Status: v015bep3.Expired,
Direction: v015bep3.Incoming,
},
newSwap: newSwap{
ExpireHeight: 1,
CloseBlock: 900,
Status: v016bep3.SWAP_STATUS_EXPIRED,
Direction: v016bep3.SWAP_DIRECTION_INCOMING,
},
},
}
@ -96,97 +162,32 @@ func (s *migrateTestSuite) TestMigrate_Swaps_Status() {
{
Amount: sdk.NewCoins(sdk.NewCoin("bnb", sdk.NewInt(12))),
RandomNumberHash: bytes.HexBytes{},
ExpireHeight: 360,
ExpireHeight: tc.oldSwap.ExpireHeight,
Timestamp: 1110,
Sender: s.addresses[0],
Recipient: s.addresses[1],
RecipientOtherChain: s.addresses[0].String(),
SenderOtherChain: s.addresses[1].String(),
ClosedBlock: 1,
Status: tc.oldStatus,
ClosedBlock: tc.oldSwap.CloseBlock,
Status: tc.oldSwap.Status,
CrossChain: true,
Direction: v015bep3.Incoming,
Direction: tc.oldSwap.Direction,
},
}
expectedSwaps := v016bep3.AtomicSwaps{
{
Amount: sdk.NewCoins(sdk.NewCoin("bnb", sdk.NewInt(12))),
RandomNumberHash: bytes.HexBytes{},
ExpireHeight: 360,
ExpireHeight: tc.newSwap.ExpireHeight,
Timestamp: 1110,
Sender: s.addresses[0],
Recipient: s.addresses[1],
RecipientOtherChain: s.addresses[0].String(),
SenderOtherChain: s.addresses[1].String(),
ClosedBlock: 1,
Status: tc.newStatus,
ClosedBlock: tc.newSwap.CloseBlock,
Status: tc.newSwap.Status,
CrossChain: true,
Direction: v016bep3.SWAP_DIRECTION_INCOMING,
},
}
s.v15genstate.AtomicSwaps = oldSwaps
genState := Migrate(s.v15genstate)
s.Require().Len(genState.AtomicSwaps, 1)
s.Equal(expectedSwaps, genState.AtomicSwaps)
})
}
}
func (s *migrateTestSuite) TestMigrate_Swaps_Direction() {
testcases := []struct {
name string
oldDirection v015bep3.SwapDirection
newDirection v016bep3.SwapDirection
}{
{
name: "invalid swap direction",
oldDirection: v015bep3.INVALID,
newDirection: v016bep3.SWAP_DIRECTION_UNSPECIFIED,
},
{
name: "income swap direction",
oldDirection: v015bep3.Incoming,
newDirection: v016bep3.SWAP_DIRECTION_INCOMING,
},
{
name: "outgoing swap direction",
oldDirection: v015bep3.Outgoing,
newDirection: v016bep3.SWAP_DIRECTION_OUTGOING,
},
}
for _, tc := range testcases {
s.Run(tc.name, func() {
oldSwaps := v015bep3.AtomicSwaps{
{
Amount: sdk.NewCoins(sdk.NewCoin("bnb", sdk.NewInt(12))),
RandomNumberHash: bytes.HexBytes{},
ExpireHeight: 360,
Timestamp: 1110,
Sender: s.addresses[0],
Recipient: s.addresses[1],
RecipientOtherChain: s.addresses[0].String(),
SenderOtherChain: s.addresses[1].String(),
ClosedBlock: 1,
Status: v015bep3.Open,
CrossChain: true,
Direction: tc.oldDirection,
},
}
expectedSwaps := v016bep3.AtomicSwaps{
{
Amount: sdk.NewCoins(sdk.NewCoin("bnb", sdk.NewInt(12))),
RandomNumberHash: bytes.HexBytes{},
ExpireHeight: 360,
Timestamp: 1110,
Sender: s.addresses[0],
Recipient: s.addresses[1],
RecipientOtherChain: s.addresses[0].String(),
SenderOtherChain: s.addresses[1].String(),
ClosedBlock: 1,
Status: v016bep3.SWAP_STATUS_OPEN,
CrossChain: true,
Direction: tc.newDirection,
Direction: tc.newSwap.Direction,
},
}
s.v15genstate.AtomicSwaps = oldSwaps

View File

@ -1,25 +1,4 @@
{
"supplies": [
{
"current_supply": {
"amount": "30467559434006",
"denom": "bnb"
},
"incoming_supply": {
"amount": "0",
"denom": "bnb"
},
"outgoing_supply": {
"amount": "0",
"denom": "bnb"
},
"time_elapsed": "0",
"time_limited_current_supply": {
"amount": "0",
"denom": "bnb"
}
}
],
"atomic_swaps": [
{
"amount": [
@ -40,6 +19,44 @@
"status": "Completed",
"timestamp": "1636034914"
},
{
"amount": [
{
"amount": "19000000000",
"denom": "bnb"
}
],
"closed_block": "1712118",
"cross_chain": true,
"direction": "Outgoing",
"expire_height": "1736797",
"random_number_hash": "280EB832A37F2265CC82F3957CE603AAD57BAD7038B876A1F28953AFA29FA1C3",
"recipient": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6",
"recipient_other_chain": "bnb18nsgj50zvc4uq93w4j0ltz5gaxhwv7aq4qnq0p",
"sender": "kava1zw6gg4ztvly7zf25pa33mclav3spvj3ympxxna",
"sender_other_chain": "bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn",
"status": "Completed",
"timestamp": "1641976566"
},
{
"amount": [
{
"amount": "999595462080",
"denom": "busd"
}
],
"closed_block": "787122",
"cross_chain": true,
"direction": "Incoming",
"expire_height": "811799",
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"recipient": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"recipient_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"sender": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"sender_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"status": "Expired",
"timestamp": "1635694492"
},
{
"amount": [
{
@ -58,79 +75,138 @@
"sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"status": "Expired",
"timestamp": "1635694492"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "Outgoing",
"expire_height": "1730589",
"random_number_hash": "A74EA1AB58D312FDF1E872D18583CACCF294E639DDA4F303939E9ADCEC081D93",
"recipient": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"recipient_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"sender": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"sender_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"status": "Open",
"timestamp": "1641934114"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "Incoming",
"expire_height": "1740000",
"random_number_hash": "39E9ADCEC081D93A74EA1A83CACCF294E639DDA4F3039B58D312FDF1E872D185",
"recipient": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"sender_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"status": "Open",
"timestamp": "1641934114"
}
],
"previous_block_time": "1970-01-01T00:00:00Z",
"params": {
"asset_params": [
{
"denom": "btcb",
"coin_id": "0",
"supply_limit": {
"limit": "100000000000",
"time_limited": false,
"time_period": "0",
"time_based_limit": "0"
},
"active": true,
"coin_id": "0",
"denom": "btcb",
"deputy_address": "kava1kla4wl0ccv7u85cemvs3y987hqk0afcv7vue84",
"fixed_fee": "2",
"min_swap_amount": "3",
"max_block_lock": "86400",
"max_swap_amount": "2000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
"min_swap_amount": "3",
"supply_limit": {
"limit": "100000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0"
}
},
{
"denom": "xrpb",
"coin_id": "144",
"supply_limit": {
"limit": "2000000000000000",
"time_limited": false,
"time_period": "0",
"time_based_limit": "0"
},
"active": true,
"coin_id": "144",
"denom": "xrpb",
"deputy_address": "kava14q5sawxdxtpap5x5sgzj7v4sp3ucncjlpuk3hs",
"fixed_fee": "100000",
"min_swap_amount": "100001",
"max_block_lock": "86400",
"max_swap_amount": "250000000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
},
{
"denom": "bnb",
"coin_id": "714",
"supply_limit": {
"limit": "100000000000000",
"time_limited": false,
"time_period": "0",
"time_based_limit": "0"
},
"active": true,
"deputy_address": "kava1agcvt07tcw0tglu0hmwdecsnuxp2yd45f3avgm",
"fixed_fee": "1000",
"min_swap_amount": "1001",
"max_swap_amount": "500000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
},
{
"denom": "busd",
"coin_id": "727",
"min_swap_amount": "100001",
"supply_limit": {
"limit": "2000000000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0",
"time_based_limit": "0"
},
"time_period": "0"
}
},
{
"active": true,
"coin_id": "714",
"denom": "bnb",
"deputy_address": "kava1agcvt07tcw0tglu0hmwdecsnuxp2yd45f3avgm",
"fixed_fee": "1000",
"max_block_lock": "86400",
"max_swap_amount": "500000000000",
"min_block_lock": "24686",
"min_swap_amount": "1001",
"supply_limit": {
"limit": "100000000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0"
}
},
{
"active": true,
"coin_id": "727",
"denom": "busd",
"deputy_address": "kava1j9je7f6s0v6k7dmgv6u5k5ru202f5ffsc7af04",
"fixed_fee": "20000",
"min_swap_amount": "20001",
"max_block_lock": "86400",
"max_swap_amount": "100000000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
"min_swap_amount": "20001",
"supply_limit": {
"limit": "2000000000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0"
}
}
]
}
}
},
"previous_block_time": "1970-01-01T00:00:00Z",
"supplies": [
{
"current_supply": {
"amount": "30467559434006",
"denom": "bnb"
},
"incoming_supply": {
"amount": "0",
"denom": "bnb"
},
"outgoing_supply": {
"amount": "0",
"denom": "bnb"
},
"time_elapsed": "0",
"time_limited_current_supply": {
"amount": "0",
"denom": "bnb"
}
}
]
}

View File

@ -1,114 +1,212 @@
{
"atomic_swaps": [
{
"amount": [
{
"amount": "1999955998",
"denom": "btcb"
}
],
"closed_block": "1",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING",
"expire_height": "838627",
"random_number_hash": "6F1CF8F2E13A0C0F0A359F54E47E4E265D766B8E006D2F00BDF994ABDEF1E9E4",
"recipient": "kava1fl2hs6y9vz986g5v52pdan9ga923n9mn5cxxkw",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"sender_other_chain": "bnb19k9wuv2j7c7ck8tmc7kav0r0cnt3esmkrpf25x",
"status": "SWAP_STATUS_COMPLETED",
"timestamp": "1636034914"
},
{
"amount": [
{
"amount": "19000000000",
"denom": "bnb"
}
],
"closed_block": "1",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING",
"expire_height": "1736797",
"random_number_hash": "280EB832A37F2265CC82F3957CE603AAD57BAD7038B876A1F28953AFA29FA1C3",
"recipient": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6",
"recipient_other_chain": "bnb18nsgj50zvc4uq93w4j0ltz5gaxhwv7aq4qnq0p",
"sender": "kava1zw6gg4ztvly7zf25pa33mclav3spvj3ympxxna",
"sender_other_chain": "bnb1jh7uv2rm6339yue8k4mj9406k3509kr4wt5nxn",
"status": "SWAP_STATUS_COMPLETED",
"timestamp": "1641976566"
},
{
"amount": [
{
"amount": "999595462080",
"denom": "busd"
}
],
"closed_block": "787122",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING",
"expire_height": "1",
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"recipient": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"recipient_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"sender": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"sender_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"status": "SWAP_STATUS_EXPIRED",
"timestamp": "1635694492"
},
{
"amount": [
{
"amount": "999595462080",
"denom": "busd"
}
],
"closed_block": "787122",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING",
"expire_height": "1",
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"recipient": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"recipient_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"sender": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"status": "SWAP_STATUS_EXPIRED",
"timestamp": "1635694492"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING",
"expire_height": "24687",
"random_number_hash": "A74EA1AB58D312FDF1E872D18583CACCF294E639DDA4F303939E9ADCEC081D93",
"recipient": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"recipient_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"sender": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"sender_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"status": "SWAP_STATUS_OPEN",
"timestamp": "1641934114"
},
{
"amount": [
{
"amount": "1000000",
"denom": "btcb"
}
],
"closed_block": "0",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING",
"expire_height": "1",
"random_number_hash": "39E9ADCEC081D93A74EA1A83CACCF294E639DDA4F3039B58D312FDF1E872D185",
"recipient": "kava1d2u28azje7rhqyjtxc2ex8q0cxxpw7dfm7ltq5",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"sender_other_chain": "bnb1lhk5ndlgf5wz55t8k35cqj6h9l3m4l5ek2w7q6",
"status": "SWAP_STATUS_EXPIRED",
"timestamp": "1641934114"
}
],
"params": {
"asset_params": [
{
"denom": "btcb",
"coin_id": "0",
"supply_limit": {
"limit": "100000000000",
"time_limited": false,
"time_period": "0s",
"time_based_limit": "0"
},
"active": true,
"coin_id": "0",
"denom": "btcb",
"deputy_address": "kava1kla4wl0ccv7u85cemvs3y987hqk0afcv7vue84",
"fixed_fee": "2",
"min_swap_amount": "3",
"max_block_lock": "86400",
"max_swap_amount": "2000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
"min_swap_amount": "3",
"supply_limit": {
"limit": "100000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0s"
}
},
{
"denom": "xrpb",
"coin_id": "144",
"supply_limit": {
"limit": "2000000000000000",
"time_limited": false,
"time_period": "0s",
"time_based_limit": "0"
},
"active": true,
"coin_id": "144",
"denom": "xrpb",
"deputy_address": "kava14q5sawxdxtpap5x5sgzj7v4sp3ucncjlpuk3hs",
"fixed_fee": "100000",
"min_swap_amount": "100001",
"max_block_lock": "86400",
"max_swap_amount": "250000000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
},
{
"denom": "bnb",
"coin_id": "714",
"supply_limit": {
"limit": "100000000000000",
"time_limited": false,
"time_period": "0s",
"time_based_limit": "0"
},
"active": true,
"deputy_address": "kava1agcvt07tcw0tglu0hmwdecsnuxp2yd45f3avgm",
"fixed_fee": "1000",
"min_swap_amount": "1001",
"max_swap_amount": "500000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
},
{
"denom": "busd",
"coin_id": "727",
"min_swap_amount": "100001",
"supply_limit": {
"limit": "2000000000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0s",
"time_based_limit": "0"
},
"time_period": "0s"
}
},
{
"active": true,
"coin_id": "714",
"denom": "bnb",
"deputy_address": "kava1agcvt07tcw0tglu0hmwdecsnuxp2yd45f3avgm",
"fixed_fee": "1000",
"max_block_lock": "86400",
"max_swap_amount": "500000000000",
"min_block_lock": "24686",
"min_swap_amount": "1001",
"supply_limit": {
"limit": "100000000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0s"
}
},
{
"active": true,
"coin_id": "727",
"denom": "busd",
"deputy_address": "kava1j9je7f6s0v6k7dmgv6u5k5ru202f5ffsc7af04",
"fixed_fee": "20000",
"min_swap_amount": "20001",
"max_block_lock": "86400",
"max_swap_amount": "100000000000000",
"min_block_lock": "24686",
"max_block_lock": "86400"
"min_swap_amount": "20001",
"supply_limit": {
"limit": "2000000000000000",
"time_based_limit": "0",
"time_limited": false,
"time_period": "0s"
}
}
]
},
"atomic_swaps": [
{
"amount": [{ "denom": "btcb", "amount": "1999955998" }],
"random_number_hash": "6F1CF8F2E13A0C0F0A359F54E47E4E265D766B8E006D2F00BDF994ABDEF1E9E4",
"expire_height": "838627",
"timestamp": "1636034914",
"sender": "kava14qsmvzprqvhwmgql9fr0u3zv9n2qla8zhnm5pc",
"recipient": "kava1fl2hs6y9vz986g5v52pdan9ga923n9mn5cxxkw",
"sender_other_chain": "bnb19k9wuv2j7c7ck8tmc7kav0r0cnt3esmkrpf25x",
"recipient_other_chain": "bnb1xz3xqf4p2ygrw9lhp5g5df4ep4nd20vsywnmpr",
"closed_block": "838115",
"status": "SWAP_STATUS_COMPLETED",
"cross_chain": true,
"direction": "SWAP_DIRECTION_INCOMING"
},
{
"amount": [{ "denom": "busd", "amount": "999595462080" }],
"random_number_hash": "BFB7CC82DA0E0C8556AC37843F5AB136B9A7A066054368F5948944282B414D83",
"expire_height": "811799",
"timestamp": "1635694492",
"sender": "kava1eufgf0w9d7hf5mgtek4zr2upkxag9stmzx6unl",
"recipient": "kava1hh4x3a4suu5zyaeauvmv7ypf7w9llwlfufjmuu",
"sender_other_chain": "bnb10zq89008gmedc6rrwzdfukjk94swynd7dl97w8",
"recipient_other_chain": "bnb1vl3wn4x8kqajg2j9wxa5y5amgzdxchutkxr6at",
"closed_block": "787122",
"status": "SWAP_STATUS_EXPIRED",
"cross_chain": true,
"direction": "SWAP_DIRECTION_OUTGOING"
}
],
"previous_block_time": "1970-01-01T00:00:00Z",
"supplies": [
{
"incoming_supply": { "denom": "bnb", "amount": "0" },
"outgoing_supply": { "denom": "bnb", "amount": "0" },
"current_supply": { "denom": "bnb", "amount": "30467559434006" },
"time_limited_current_supply": { "denom": "bnb", "amount": "0" },
"time_elapsed": "0s"
"current_supply": {
"amount": "30467559434006",
"denom": "bnb"
},
"incoming_supply": {
"amount": "0",
"denom": "bnb"
},
"outgoing_supply": {
"amount": "0",
"denom": "bnb"
},
"time_elapsed": "0s",
"time_limited_current_supply": {
"amount": "0",
"denom": "bnb"
}
}
],
"previous_block_time": "1970-01-01T00:00:00Z"
}
]
}