From 069138a403c54d103f6399d713b5e06259d4773b Mon Sep 17 00:00:00 2001 From: MarkCherepovskyi Date: Fri, 1 Nov 2024 17:07:54 +0200 Subject: [PATCH] nft module --- database/bridge.go | 80 ++++++++++--------- database/schema/14-bridge.sql | 60 ++++++++------ .../bdjuno/tables/public_bridge_chains.yaml | 14 ++++ ...nfo.yaml => public_bridge_token_info.yaml} | 2 +- ...yaml => public_bridge_token_metadata.yaml} | 2 +- ..._tokens.yaml => public_bridge_tokens.yaml} | 6 +- ...on.yaml => public_bridge_transaction.yaml} | 2 +- .../databases/bdjuno/tables/tables.yaml | 9 ++- modules/bridge/handle_genesis.go | 52 ++++++++++++ modules/bridge/handle_msg_token.go | 8 +- modules/bridge/handle_transaction.go | 1 - modules/bridge/module.go | 7 +- modules/nft/handle_msg.go | 2 +- modules/registrar.go | 2 + types/bridge.go | 25 ++++++ 15 files changed, 187 insertions(+), 85 deletions(-) create mode 100644 hasura/metadata/databases/bdjuno/tables/public_bridge_chains.yaml rename hasura/metadata/databases/bdjuno/tables/{public_token_info.yaml => public_bridge_token_info.yaml} (89%) rename hasura/metadata/databases/bdjuno/tables/{public_token_metadata.yaml => public_bridge_token_metadata.yaml} (86%) rename hasura/metadata/databases/bdjuno/tables/{public_tokens.yaml => public_bridge_tokens.yaml} (78%) rename hasura/metadata/databases/bdjuno/tables/{public_transaction.yaml => public_bridge_transaction.yaml} (93%) create mode 100644 modules/bridge/handle_genesis.go create mode 100644 types/bridge.go diff --git a/database/bridge.go b/database/bridge.go index 508b2482..ffe84ade 100644 --- a/database/bridge.go +++ b/database/bridge.go @@ -8,13 +8,12 @@ import ( // SaveChain allows to save new Chain func (db *Db) SaveBridgeChain(id string, chainType int32, bridgeAddress string, operator string) error { query := ` - INSERT INTO chains(id, chain_type, bridge_address, operator) - VALUES ($1, $2, $3, $4) RETURNING id + INSERT INTO bridge_chains(id, chain_type, bridge_address, operator) + VALUES ($1, $2, $3, $4) ON CONFLICT (id) DO UPDATE - SET chain_type = excluded.chain_type, - bridge_address = excluded.bridge_address, - operator = excluded.operator - WHERE chains.id <= excluded.id + SET chain_type = excluded.chain_type, + bridge_address = excluded.bridge_address, + operator = excluded.operator ` _, err := db.SQL.Exec(query, id, chainType, bridgeAddress, operator) if err != nil { @@ -27,7 +26,7 @@ func (db *Db) SaveBridgeChain(id string, chainType int32, bridgeAddress string, // RemoveChain allows to remove the Chain func (db *Db) RemoveBridgeChain(id string) error { query := ` - DELETE FROM chains WHERE id = $1 + DELETE FROM bridge_chains WHERE id = $1 ` _, err := db.SQL.Exec(query, id) if err != nil { @@ -40,29 +39,30 @@ func (db *Db) RemoveBridgeChain(id string) error { // ------------------------------------------------------------------------------------------------------------------- // SaveTokenInfo allows to save new TokenInfo -func (db *Db) SaveBridgeTokenInfo(address string, decimals uint64, chaiID string, tokenID uint64, isWrapped bool) (int64, error) { +func (db *Db) SaveBridgeTokenInfo(address string, decimals uint64, chainID string, tokenID uint64, isWrapped bool) (int64, error) { query := ` - INSERT INTO tokens_info( address, decimals, chaiId, tokenId, isWrapped) - VALUES ($1, $2, $3, $4, $5, $6) RETURNING id + INSERT INTO bridge_tokens_info(address, decimals, chain_id, token_id, is_wrapped) + VALUES ($1, $2, $3, $4, $5) ON CONFLICT (address) DO UPDATE - SET chaiId = excluded.chaiId, - tokenId = excluded.tokenId, - WHERE tokens_info.address <= excluded.address + SET chain_id = excluded.chain_id, + token_id = excluded.token_id, + is_wrapped = excluded.is_wrapped + RETURNING id ` var id int64 - err := db.SQL.QueryRow(query, address, decimals, chaiID, tokenID, isWrapped) + err := db.SQL.QueryRow(query, address, decimals, chainID, tokenID, isWrapped).Scan(&id) if err != nil { - return emptyIndex, fmt.Errorf("error while storing token info: %s", err) + return 0, fmt.Errorf("error while storing token info: %s", err) } return id, nil } // RemoveTokenInfo allows to remove the TokenInfo -func (db *Db) RemoveBridgeTokenInfo(id string) error { +func (db *Db) RemoveBridgeTokenInfo(id int64) error { query := ` - DELETE FROM tokens_info WHERE id = $1 + DELETE FROM bridge_tokens_info WHERE id = $1 ` _, err := db.SQL.Exec(query, id) if err != nil { @@ -75,28 +75,28 @@ func (db *Db) RemoveBridgeTokenInfo(id string) error { // ------------------------------------------------------------------------------------------------------------------- // SaveTokenMetadata allows to save new TokenMetadata -func (db *Db) SaveBridgeTokenMetadata(tokenID uint64, name, symbol, uri string) (int64, error) { +func (db *Db) SaveBridgeTokenMetadata(tokenID uint64, name, symbol, uri string) error { query := ` - INSERT INTO token_metadata(tokenID, name, symbol, uri) + INSERT INTO bridge_token_metadata(token_id, name, symbol, uri) VALUES ($1, $2, $3, $4) - ON CONFLICT (name) DO UPDATE - SET uri = excluded.uri - WHERE tokens_info.name <= excluded.name + ON CONFLICT (token_id) DO UPDATE + SET name = excluded.name, + symbol = excluded.symbol, + uri = excluded.uri ` - var id int64 - err := db.SQL.QueryRow(query, tokenID, name, symbol, uri).Scan(&id) + _, err := db.SQL.Exec(query, tokenID, name, symbol, uri) if err != nil { - return emptyIndex, fmt.Errorf("error while storing token metadata: %s", err) + return fmt.Errorf("error while storing token metadata: %s", err) } - return id, nil + return nil } // RemoveTokenMetadata allows to remove the TokenMetadata -func (db *Db) RemoveBridgeTokenMetadata(id string) error { +func (db *Db) RemoveBridgeTokenMetadata(id int64) error { query := ` - DELETE FROM token_metadata WHERE id = $1 + DELETE FROM bridge_token_metadata WHERE id = $1 ` _, err := db.SQL.Exec(query, id) if err != nil { @@ -108,24 +108,28 @@ func (db *Db) RemoveBridgeTokenMetadata(id string) error { // ------------------------------------------------------------------------------------------------------------------- -func (db *Db) SaveBridgeTokens(tokensInfoID, tokenMetadataID int64) error { +// SaveBridgeTokens allows to save new Tokens +func (db *Db) SaveBridgeToken(tokensInfoID int64, tokenMetadataID uint64) error { query := ` - INSERT INTO tokens(tokens_info_id, token_metadata_id) - VALUES ($1, $2) RETURNING id + INSERT INTO bridge_tokens(tokens_info_id, metadata_id) + VALUES ($1, $2) + ON CONFLICT (tokens_info_id, metadata_id) DO NOTHING + ` _, err := db.SQL.Exec(query, tokensInfoID, tokenMetadataID) if err != nil { - return fmt.Errorf("error while removing token: %s", err) + return fmt.Errorf("error while storing token: %s", err) } - return err + return nil } -func (db *Db) RemoveBridgeTokens(tokenID uint64) error { +// RemoveBridgeTokens allows to remove the Tokens +func (db *Db) RemoveBridgeToken(tokenID uint64) error { query := ` - DELETE FROM tokens WHERE metadata_id = $1; - DELETE FORM tokens_info WHERE id = $1; - DELETE FORM token_metadata WHERE token_id = $1; + DELETE FROM bridge_tokens WHERE metadata_id = $1; + DELETE FROM bridge_tokens_info WHERE id = $1; + DELETE FROM bridge_token_metadata WHERE token_id = $1; ` _, err := db.SQL.Exec(query, tokenID) if err != nil { @@ -141,7 +145,7 @@ func (db *Db) SaveBridgeTransaction( tx types.Transaction, ) error { query := ` - INSERT INTO transactions( + INSERT INTO bridge_transactions( deposit_chain_id, deposit_tx_hash, deposit_tx_index, diff --git a/database/schema/14-bridge.sql b/database/schema/14-bridge.sql index f9cd5147..e122d7a2 100644 --- a/database/schema/14-bridge.sql +++ b/database/schema/14-bridge.sql @@ -1,31 +1,39 @@ -- +migrate Up - -CREATE TABLE tokens_info +CREATE TABLE bridge_tokens_info ( id SERIAL PRIMARY KEY, - address TEXT, - decimals INTEGER, - chain_id TEXT, - token_id INT, - is_wrapped BOOLEAN + address VARCHAR(255) NOT NULL UNIQUE , + decimals INTEGER NOT NULL, + chain_id VARCHAR(255) NOT NULL, + token_id INTEGER NOT NULL, + is_wrapped BOOLEAN NOT NULL ); -CREATE TABLE token_metadata ( - token_id TEXT UNIQUE PRIMARY KEY, - name TEXT, - symbol TEXT, - uri TEXT +CREATE INDEX idx_bridge_tokens_info_address ON bridge_tokens_info(address); +CREATE INDEX idx_bridge_tokens_info_chain_id ON bridge_tokens_info(chain_id); + +CREATE TABLE bridge_token_metadata ( + token_id VARCHAR(255) UNIQUE PRIMARY KEY, + name VARCHAR(255) NOT NULL, + symbol VARCHAR(50) NOT NULL, + uri TEXT ); -CREATE TABLE tokens ( - metadata_id TEXT NOT NULL, - tokens_info_id BIGINT NOT NULL, - FOREIGN KEY (metadata_id) REFERENCES token_metadata(token_id) ON DELETE CASCADE, - FOREIGN KEY (tokens_info_id) REFERENCES tokens_info(id) ON DELETE CASCADE, - PRIMARY KEY (metadata_id, tokens_info_id) +CREATE INDEX idx_bridge_token_metadata_name ON bridge_token_metadata(name); +CREATE INDEX idx_bridge_token_metadata_symbol ON bridge_token_metadata(symbol); + +CREATE TABLE bridge_tokens ( + metadata_id VARCHAR(255) NOT NULL, + tokens_info_id BIGINT NOT NULL, + FOREIGN KEY (metadata_id) REFERENCES bridge_token_metadata(token_id) ON DELETE CASCADE, + FOREIGN KEY (tokens_info_id) REFERENCES bridge_tokens_info(id) ON DELETE CASCADE, + PRIMARY KEY (metadata_id, tokens_info_id) ); -CREATE TABLE transactions +CREATE INDEX idx_bridge_tokens_metadata_id ON bridge_tokens(metadata_id); +CREATE INDEX idx_bridge_tokens_tokens_info_id ON bridge_tokens(tokens_info_id); + +CREATE TABLE bridge_transactions ( id SERIAL PRIMARY KEY, deposit_chain_id TEXT NOT NULL, @@ -43,18 +51,18 @@ CREATE TABLE transactions is_wrapped BOOLEAN NOT NULL ); -CREATE TABLE chains +CREATE TABLE bridge_chains ( - id TEXT, + id TEXT UNIQUE PRIMARY KEY , chain_type SMALLINT, bridge_address TEXT, operator TEXT ); -- +migrate Down -DROP TABLE tokens; -DROP TABLE tokens_info; -DROP TABLE chains; -DROP TABLE transactions; -DROP TABLE token_metadata; +DROP TABLE bridge_tokens; +DROP TABLE bridge_tokens_info; +DROP TABLE bridge_chains; +DROP TABLE bridge_transactions; +DROP TABLE bridge_token_metadata; diff --git a/hasura/metadata/databases/bdjuno/tables/public_bridge_chains.yaml b/hasura/metadata/databases/bdjuno/tables/public_bridge_chains.yaml new file mode 100644 index 00000000..2047d317 --- /dev/null +++ b/hasura/metadata/databases/bdjuno/tables/public_bridge_chains.yaml @@ -0,0 +1,14 @@ +table: + name: bridge_chains + schema: public +select_permissions: +- permission: + allow_aggregations: false + columns: + - id + - chain_type + - bridge_address + - operator + filter: {} + limit: 100 + role: anonymous diff --git a/hasura/metadata/databases/bdjuno/tables/public_token_info.yaml b/hasura/metadata/databases/bdjuno/tables/public_bridge_token_info.yaml similarity index 89% rename from hasura/metadata/databases/bdjuno/tables/public_token_info.yaml rename to hasura/metadata/databases/bdjuno/tables/public_bridge_token_info.yaml index fb1013f3..dc17bb14 100644 --- a/hasura/metadata/databases/bdjuno/tables/public_token_info.yaml +++ b/hasura/metadata/databases/bdjuno/tables/public_bridge_token_info.yaml @@ -1,5 +1,5 @@ table: - name: tokens_info + name: bridge_tokens_info schema: public select_permissions: - permission: diff --git a/hasura/metadata/databases/bdjuno/tables/public_token_metadata.yaml b/hasura/metadata/databases/bdjuno/tables/public_bridge_token_metadata.yaml similarity index 86% rename from hasura/metadata/databases/bdjuno/tables/public_token_metadata.yaml rename to hasura/metadata/databases/bdjuno/tables/public_bridge_token_metadata.yaml index 81db2eb0..33763cda 100644 --- a/hasura/metadata/databases/bdjuno/tables/public_token_metadata.yaml +++ b/hasura/metadata/databases/bdjuno/tables/public_bridge_token_metadata.yaml @@ -1,5 +1,5 @@ table: - name: token_metadata + name: bridge_token_metadata schema: public select_permissions: - permission: diff --git a/hasura/metadata/databases/bdjuno/tables/public_tokens.yaml b/hasura/metadata/databases/bdjuno/tables/public_bridge_tokens.yaml similarity index 78% rename from hasura/metadata/databases/bdjuno/tables/public_tokens.yaml rename to hasura/metadata/databases/bdjuno/tables/public_bridge_tokens.yaml index 03740985..4e05f1df 100644 --- a/hasura/metadata/databases/bdjuno/tables/public_tokens.yaml +++ b/hasura/metadata/databases/bdjuno/tables/public_bridge_tokens.yaml @@ -1,11 +1,11 @@ table: - name: tokens + name: bridge_tokens schema: public object_relationships: - - name: tokens_info + - name: bridge_tokens_info using: foreign_key_constraint_on: id - - name: token_metadata + - name: bridge_token_metadata using: foreign_key_constraint_on: id select_permissions: diff --git a/hasura/metadata/databases/bdjuno/tables/public_transaction.yaml b/hasura/metadata/databases/bdjuno/tables/public_bridge_transaction.yaml similarity index 93% rename from hasura/metadata/databases/bdjuno/tables/public_transaction.yaml rename to hasura/metadata/databases/bdjuno/tables/public_bridge_transaction.yaml index df1e20fe..9798b1dc 100644 --- a/hasura/metadata/databases/bdjuno/tables/public_transaction.yaml +++ b/hasura/metadata/databases/bdjuno/tables/public_bridge_transaction.yaml @@ -1,5 +1,5 @@ table: - name: transaction + name: bridge_transaction schema: public object_relationships: - name: block diff --git a/hasura/metadata/databases/bdjuno/tables/tables.yaml b/hasura/metadata/databases/bdjuno/tables/tables.yaml index d2317d47..2bcbf4d4 100644 --- a/hasura/metadata/databases/bdjuno/tables/tables.yaml +++ b/hasura/metadata/databases/bdjuno/tables/tables.yaml @@ -31,7 +31,7 @@ - "!include public_token_price.yaml" - "!include public_token_price_history.yaml" - "!include public_token_unit.yaml" -- "!include public_transaction.yaml" +- "!include public_bridge_transaction.yaml" - "!include public_validator.yaml" - "!include public_validator_commission.yaml" - "!include public_validator_description.yaml" @@ -43,9 +43,10 @@ - "!include public_vesting_period.yaml" - "!include public_nft_events.yaml" - "!include public_nfts.yaml" -- "!include public_tokens.yaml" -- "!include public_token_metadata.yaml" -- "!include public_token_info.yaml" +- "!include public_bridge_tokens.yaml" +- "!include public_bridge_token_metadata.yaml" +- "!include public_bridge_token_info.yaml" - "!include public_admins_vesting.yaml" - "!include public_accumulator_params.yaml" +- "!include public_bridge_chains.yaml" diff --git a/modules/bridge/handle_genesis.go b/modules/bridge/handle_genesis.go new file mode 100644 index 00000000..40bcffa6 --- /dev/null +++ b/modules/bridge/handle_genesis.go @@ -0,0 +1,52 @@ +package bridge + +import ( + "encoding/json" + bridgetypes "github.com/hyle-team/bridgeless-core/v12/x/bridge/types" + "github.com/pkg/errors" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/rs/zerolog/log" +) + +// HandleGenesis implements modules.Module +func (m *Module) HandleGenesis(doc *tmtypes.GenesisDoc, appState map[string]json.RawMessage) error { + log.Debug().Str("module", "bridge").Msg("parsing genesis") + + // Read the genesis state + var genState bridgetypes.GenesisState + err := m.cdc.UnmarshalJSON(appState[bridgetypes.ModuleName], &genState) + if err != nil { + return errors.Wrap(err, "error while reading bridge genesis data") + } + + // Save tokens + for _, token := range genState.Tokens { + err = m.db.SaveBridgeTokenMetadata(token.Id, token.Metadata.Name, token.Metadata.Symbol, token.Metadata.Uri) + if err != nil { + return errors.Wrap(err, "error while storing genesis token metadata") + } + for _, tokenInfo := range token.Info { + tokenInfoId, err := m.db.SaveBridgeTokenInfo(tokenInfo.Address, tokenInfo.Decimals, tokenInfo.ChainId, tokenInfo.TokenId, tokenInfo.IsWrapped) + if err != nil { + return errors.Wrap(err, "error while storing genesis token info") + } + if err = m.db.SaveBridgeToken(tokenInfoId, token.Id); err != nil { + return errors.Wrap(err, "error while storing genesis token") + } + } + } + + for _, chain := range genState.Chains { + if err = m.db.SaveBridgeChain(chain.Id, int32(chain.Type), chain.BridgeAddress, chain.Operator); err != nil { + return errors.Wrap(err, "error while storing genesis chain") + } + } + + for _, tx := range genState.Transactions { + if err = m.db.SaveBridgeTransaction(tx); err != nil { + return errors.Wrap(err, "error while storing genesis transaction") + } + } + return nil +} diff --git a/modules/bridge/handle_msg_token.go b/modules/bridge/handle_msg_token.go index fe097d89..8e5c3448 100644 --- a/modules/bridge/handle_msg_token.go +++ b/modules/bridge/handle_msg_token.go @@ -7,7 +7,7 @@ import ( // handleMsgInsertToken allows to properly handle a MsgInsertToken func (m *Module) handleMsgInsertToken(_ *juno.Tx, msg *bridge.MsgInsertToken) error { - metadataId, err := m.db.SaveBridgeTokenMetadata(msg.Token.Id, msg.Token.Metadata.Name, msg.Token.Metadata.Symbol, msg.Token.Metadata.Uri) + err := m.db.SaveBridgeTokenMetadata(msg.Token.Id, msg.Token.Metadata.Name, msg.Token.Metadata.Symbol, msg.Token.Metadata.Uri) if err != nil { return err } @@ -18,7 +18,7 @@ func (m *Module) handleMsgInsertToken(_ *juno.Tx, msg *bridge.MsgInsertToken) er return err } - if err = m.db.SaveBridgeTokens(tokenInfoId, metadataId); err != nil { + if err = m.db.SaveBridgeToken(tokenInfoId, msg.Token.Id); err != nil { return err } } @@ -28,12 +28,12 @@ func (m *Module) handleMsgInsertToken(_ *juno.Tx, msg *bridge.MsgInsertToken) er // handleMsgDeleteToken allows to properly handle a MsgDeleteToken func (m *Module) handleMsgDeleteToken(_ *juno.Tx, msg *bridge.MsgDeleteToken) error { - return m.db.RemoveBridgeTokens(msg.TokenId) + return m.db.RemoveBridgeToken(msg.TokenId) } // handleMsgUpdateToken allows to properly handle a MsgUpdateToken func (m *Module) handleMsgUpdateToken(_ *juno.Tx, msg *bridge.MsgUpdateToken) error { - if _, err := m.db.SaveBridgeTokenMetadata(msg.TokenId, msg.Metadata.Name, msg.Metadata.Symbol, msg.Metadata.Uri); err != nil { + if err := m.db.SaveBridgeTokenMetadata(msg.TokenId, msg.Metadata.Name, msg.Metadata.Symbol, msg.Metadata.Uri); err != nil { return err } diff --git a/modules/bridge/handle_transaction.go b/modules/bridge/handle_transaction.go index 523e76f4..0432dd2b 100644 --- a/modules/bridge/handle_transaction.go +++ b/modules/bridge/handle_transaction.go @@ -7,7 +7,6 @@ import ( // handleMsgSubmitTransactions allows to properly handle a MsgSubmitTransactions func (m *Module) handleMsgSubmitTransactions(_ *juno.Tx, msg *bridge.MsgSubmitTransactions) error { - for _, tx := range msg.Transactions { if err := m.db.SaveBridgeTransaction(tx); err != nil { return err diff --git a/modules/bridge/module.go b/modules/bridge/module.go index e88c8c8f..0a5ac25c 100644 --- a/modules/bridge/module.go +++ b/modules/bridge/module.go @@ -4,8 +4,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/forbole/bdjuno/v4/database" - "github.com/forbole/bdjuno/v4/modules/nft/source" - junomessages "github.com/forbole/juno/v4/modules/messages" "github.com/forbole/juno/v4/modules" @@ -14,6 +12,7 @@ import ( var ( _ modules.Module = &Module{} _ modules.MessageModule = &Module{} + _ modules.GenesisModule = &Module{} ) // Module represents the x/bridge module @@ -22,18 +21,16 @@ type Module struct { db *database.Db messageParser junomessages.MessageAddressesParser - keeper source.Source } // NewModule returns a new Module instance func NewModule( - messageParser junomessages.MessageAddressesParser, keeper source.Source, cdc codec.Codec, db *database.Db, + messageParser junomessages.MessageAddressesParser, cdc codec.Codec, db *database.Db, ) *Module { return &Module{ cdc: cdc, db: db, messageParser: messageParser, - keeper: keeper, } } diff --git a/modules/nft/handle_msg.go b/modules/nft/handle_msg.go index 4d553512..ecf0d8c7 100644 --- a/modules/nft/handle_msg.go +++ b/modules/nft/handle_msg.go @@ -28,7 +28,7 @@ func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error { case *nft.MsgSend: return m.handleMsgSend(tx, cosmosMsg) case *nft.MsgWithdrawal: - return m.handleMsgWithdrawal(cosmosMsg) + return m.handleMsgWithdrawal(tx, cosmosMsg) default: break } diff --git a/modules/registrar.go b/modules/registrar.go index 95f66e51..0822a616 100644 --- a/modules/registrar.go +++ b/modules/registrar.go @@ -3,6 +3,7 @@ package modules import ( "github.com/forbole/bdjuno/v4/modules/accumulator" "github.com/forbole/bdjuno/v4/modules/actions" + "github.com/forbole/bdjuno/v4/modules/bridge" "github.com/forbole/bdjuno/v4/modules/nft" "github.com/forbole/bdjuno/v4/modules/types" @@ -111,5 +112,6 @@ func (r *Registrar) BuildModules(ctx registrar.Context) jmodules.Modules { upgradeModule, nft.NewModule(r.parser, sources.NFTSource, stakingModule, cdc, db), accumulator.NewModule(r.parser, sources.AccumulatorSource, cdc, db), + bridge.NewModule(r.parser, cdc, db), } } diff --git a/types/bridge.go b/types/bridge.go new file mode 100644 index 00000000..25fb528b --- /dev/null +++ b/types/bridge.go @@ -0,0 +1,25 @@ +package types + +import ( + bridgetypes "github.com/hyle-team/bridgeless-core/v12/x/bridge/types" +) + +// BridgeStore represents the x/bridge store +type BridgeStore struct { + Params bridgetypes.Params + Chains []bridgetypes.Chain + Tokens []bridgetypes.Token + Transactions []bridgetypes.Transaction + Height int64 +} + +// NewAccumulatorParams allows to build a new MintParams instance +func NewBridgeStore(params bridgetypes.Params, chains []bridgetypes.Chain, tokens []bridgetypes.Token, transactions []bridgetypes.Transaction, height int64) *BridgeStore { + return &BridgeStore{ + Params: params, + Chains: chains, + Tokens: tokens, + Transactions: transactions, + Height: height, + } +}