Skip to content

Commit

Permalink
opbot [goreleaser]
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Jun 22, 2024
1 parent b3faae2 commit 4e3a1b6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 44 deletions.
71 changes: 36 additions & 35 deletions ethergo/chaindata/chaindata.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,166 +7,167 @@ import "strings"

// ChainMetadata represents the chain metadata.
type ChainMetadata struct {
// ChainId is the chain id.
ChainId int64
// ChainID is the chain id.
ChainID int64
// ChainName is the chain name.
ChainName string
// Explorer is the chain explorer.
Explorer string
}

// ChainMetadataList is the list of chain metadata.
var ChainMetadataList = []ChainMetadata{
{
ChainId: 1,
ChainID: 1,
ChainName: "ethereum",
Explorer: "https://etherscan.io",
},
{
ChainId: 56,
ChainID: 56,
ChainName: "bsc",
Explorer: "https://bscscan.com",
},
{
ChainId: 137,
ChainID: 137,
ChainName: "polygon",
Explorer: "https://polygonscan.com",
},
{
ChainId: 80001,
ChainID: 80001,
ChainName: "mumbai",
Explorer: "https://mumbai.polygonscan.com",
},
{
ChainId: 250,
ChainID: 250,
ChainName: "fantom",
Explorer: "https://ftmscan.com",
},
{
ChainId: 43114,
ChainID: 43114,
ChainName: "avalanche",
Explorer: "https://snowtrace.io/",
},
{
ChainId: 42161,
ChainID: 42161,
ChainName: "arbitrum",
Explorer: "https://arbiscan.io",
},
{
ChainId: 1337,
ChainID: 1337,
ChainName: "local",
Explorer: "http://localhost:1337",
},
{
ChainId: 42220,
ChainID: 42220,
ChainName: "celo",
Explorer: "https://explorer.celo.org",
},
{
ChainId: 128,
ChainID: 128,
ChainName: "heco",
Explorer: "https://hecoinfo.com",
},
{
ChainId: 66,
ChainID: 66,
ChainName: "okexchain",
Explorer: "https://www.oklink.com/okexchain",
},
{
ChainId: 100,
ChainID: 100,
ChainName: "xdai",
Explorer: "https://blockscout.com/poa/xdai",
},
{
ChainId: 10,
ChainID: 10,
ChainName: "optimism",
Explorer: "https://optimistic.etherscan.io",
},
{
ChainId: 25,
ChainID: 25,
ChainName: "cronos",
Explorer: "https://cronoscan.com",
},
{
ChainId: 1285,
ChainID: 1285,
ChainName: "moonriver",
Explorer: "https://moonriver.moonscan.io",
},
{
ChainId: 1284,
ChainID: 1284,
ChainName: "moonbeam",
Explorer: "https://moonbeam.moonscan.io",
},
{
ChainId: 66,
ChainID: 66,
ChainName: "okc",
Explorer: "https://www.oklink.com/en/okc",
},
{
ChainId: 9001,
ChainID: 9001,
ChainName: "evmos",
Explorer: "https://evm.evmos.org",
},
{
ChainId: 7700,
ChainID: 7700,
ChainName: "canto",
Explorer: "https://tuber.build/",
},
{
ChainId: 53935,
ChainID: 53935,
ChainName: "dfk chain",
Explorer: "https://subnets.avax.network/defi-kingdoms",
},
{
ChainId: 8217,
ChainID: 8217,
ChainName: "klaytn",
Explorer: "https://scope.klaytn.com",
},
{
ChainId: 288,
ChainID: 288,
ChainName: "boba",
Explorer: "https://bobascan.com",
},
{
ChainId: 1088,
ChainID: 1088,
ChainName: "metis",
Explorer: "https://andromeda-explorer.metis.io",
},
{
ChainId: 1313161554,
ChainID: 1313161554,
ChainName: "aurora",
Explorer: "https://explorer.mainnet.aurora.dev",
},
{
ChainId: 1666600000,
ChainID: 1666600000,
ChainName: "harmony",
Explorer: "https://explorer.harmony.one",
},
{
ChainId: 2000,
ChainID: 2000,
ChainName: "dogechain",
Explorer: "https://explorer.dogechain.dog",
},
{
ChainId: 8453,
ChainID: 8453,
ChainName: "base",
Explorer: "https://basescan.org",
},
{
ChainId: 81457,
ChainID: 81457,
ChainName: "blast",
Explorer: "https://blastscan.io",
},
{
ChainId: 534352,
ChainID: 534352,
ChainName: "scroll",
Explorer: "https://scrollscan.com",
},
}

// ChainIDToChainName converts the chain id to the chain name.
func ChainIDToChainName(chainId int64, isUpper bool) string {
func ChainIDToChainName(chainID int64, isUpper bool) string {
for _, chainMetadata := range ChainMetadataList {
if chainMetadata.ChainId == chainId {
if chainMetadata.ChainID == chainID {
// upper the first letter
if isUpper {
return strings.ToUpper(chainMetadata.ChainName)
Expand All @@ -178,9 +179,9 @@ func ChainIDToChainName(chainId int64, isUpper bool) string {
}

// ChainIDToExplorer converts the chain id to the chain explorer.
func ChainIDToExplorer(chainId int64) string {
func ChainIDToExplorer(chainID int64) string {
for _, chainMetadata := range ChainMetadataList {
if chainMetadata.ChainId == chainId {
if chainMetadata.ChainID == chainID {
return chainMetadata.Explorer
}

Check warning on line 186 in ethergo/chaindata/chaindata.go

View check run for this annotation

Codecov / codecov/patch

ethergo/chaindata/chaindata.go#L182-L186

Added lines #L182 - L186 were not covered by tests
}
Expand Down
20 changes: 12 additions & 8 deletions services/rfq/relayer/relapi/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ func (c *RelayerServerSuite) TestGetQuoteRequestByTxHash() {
err = json.NewDecoder(resp.Body).Decode(&result)
c.Require().NoError(err)
expectedResult := relapi.GetQuoteRequestStatusResponse{
Status: quoteRequest.Status.String(),
TxID: hexutil.Encode(quoteRequest.TransactionID[:]),
OriginTxHash: quoteRequest.OriginTxHash.String(),
DestTxHash: quoteRequest.DestTxHash.String(),
Status: quoteRequest.Status.String(),
TxID: hexutil.Encode(quoteRequest.TransactionID[:]),
OriginTxHash: quoteRequest.OriginTxHash.String(),
OriginChainID: quoteRequest.Transaction.OriginChainId,
DestChainID: quoteRequest.Transaction.DestChainId,
DestTxHash: quoteRequest.DestTxHash.String(),
}
c.Equal(expectedResult, result)
c.GetTestContext().Done()
Expand Down Expand Up @@ -94,10 +96,12 @@ func (c *RelayerServerSuite) TestGetQuoteRequestByTxID() {
err = json.NewDecoder(resp.Body).Decode(&result)
c.Require().NoError(err)
expectedResult := relapi.GetQuoteRequestStatusResponse{
Status: quoteRequest.Status.String(),
TxID: hexutil.Encode(quoteRequest.TransactionID[:]),
OriginTxHash: quoteRequest.OriginTxHash.String(),
DestTxHash: quoteRequest.DestTxHash.String(),
Status: quoteRequest.Status.String(),
TxID: hexutil.Encode(quoteRequest.TransactionID[:]),
OriginTxHash: quoteRequest.OriginTxHash.String(),
OriginChainID: quoteRequest.Transaction.OriginChainId,
DestChainID: quoteRequest.Transaction.DestChainId,
DestTxHash: quoteRequest.DestTxHash.String(),
}
c.Equal(expectedResult, result)
c.GetTestContext().Done()
Expand Down
2 changes: 1 addition & 1 deletion services/scribe/db/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (t *DBSuite) TestStoreAndRetrieveEthTx() {
err = testDB.StoreEthTx(t.GetTestContext(), signedTx, uint32(testTx.ChainId().Uint64()), common.BigToHash(big.NewInt(gofakeit.Int64())), gofakeit.Uint64(), gofakeit.Uint64())
Nil(t.T(), err)

// err = testDB.StoreEthTxAtHead(t.GetTestContext(), signedTx, uint32(testTx.ChainId().Uint64()), common.BigToHash(big.NewInt(gofakeit.Int64())), gofakeit.Uint64(), gofakeit.Uint64())
// err = testDB.StoreEthTxAtHead(t.GetTestContext(), signedTx, uint32(testTx.ChainID().Uint64()), common.BigToHash(big.NewInt(gofakeit.Int64())), gofakeit.Uint64(), gofakeit.Uint64())
// Nil(t.T(), err)

ethTxFilter := db.EthTxFilter{
Expand Down

0 comments on commit 4e3a1b6

Please sign in to comment.