Skip to content

Commit

Permalink
feat: init zora chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Feb 23, 2024
1 parent fcadab8 commit 913cce2
Show file tree
Hide file tree
Showing 46 changed files with 29,408 additions and 100,731 deletions.
21 changes: 13 additions & 8 deletions generators/buildTokenList.blockscout.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ var BLOCKSCOUTV5_URI = map[uint64]string{
}

var BLOCKSCOUTV6_URI = map[uint64]string{
1: `https://eth.blockscout.com`,
5: `https://eth-goerli.blockscout.com`,
10: `https://optimism.blockscout.com`,
100: `https://gnosis.blockscout.com`,
137: `https://polygon.blockscout.com`,
1101: `https://zkevm.blockscout.com`,
8453: `https://base.blockscout.com`,
1: `https://eth.blockscout.com`,
5: `https://eth-goerli.blockscout.com`,
10: `https://optimism.blockscout.com`,
100: `https://gnosis.blockscout.com`,
137: `https://polygon.blockscout.com`,
1101: `https://zkevm.blockscout.com`,
8453: `https://base.blockscout.com`,
7777777: `https://explorer.zora.energy/`,
}

func handleBlockScoutTokenList(chainID uint64, tokenAddresses []common.Address) []models.TokenListToken {
Expand Down Expand Up @@ -62,6 +63,7 @@ func fetchBlockScoutV6TokenList(chainID uint64) []models.TokenListToken {
Items []struct {
Address string `json:"address"`
IconURI string `json:"icon_url"`
Type string `json:"type"`
} `json:"items"`
NextPage struct {
ContractAddressHash string `json:"contract_address_hash"`
Expand All @@ -78,9 +80,12 @@ func fetchBlockScoutV6TokenList(chainID uint64) []models.TokenListToken {
nextPageURI := `/api/v2/tokens`
tokens := []common.Address{}

for i := 0; i < 20; i++ {
for i := 0; i < 40; i++ {
response := helpers.FetchJSON[TBlockScoutAPIResponse](explorerBaseURI + nextPageURI)
for _, token := range response.Items {
if token.Type == `ERC-721` || token.Type == `ERC-1155` {
continue
}
tokens = append(tokens, common.HexToAddress(token.Address))
}
nextPageURI = `/api/v2/tokens?contract_address_hash=` + response.NextPage.ContractAddressHash + `&fiat_value=` + response.NextPage.FiatValue + `&holder_count=` + strconv.Itoa(response.NextPage.HolderCount) + `&is_name_null=` + strconv.FormatBool(response.NextPage.IsNameNull) + `&items_count=` + strconv.Itoa(response.NextPage.ItemsCount) + `&market_cap=` + response.NextPage.MarketCap + `&name=` + response.NextPage.Name
Expand Down
7 changes: 7 additions & 0 deletions generators/buildTokenList.uniswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ var UniswapContractsPerChainID = map[uint64][]TUniContracts{
Type: 3,
},
},
7777777: {
{
ContractAddress: common.HexToAddress(`0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb`),
BlockNumber: big.NewInt(10320368),
Type: 3,
},
},
}

func buildUniswapTokenList() {
Expand Down
28 changes: 28 additions & 0 deletions generators/common/chains/7777777.zora.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package chains

import (
"math"

"github.com/ethereum/go-ethereum/common"
"github.com/migratooor/tokenLists/generators/common/models"
)

var ZORA = TChain{
ID: 7777777,
RpcURI: `https://rpc.zora.energy`,
MaxBlockRange: 100_000_000,
MaxBatchSize: math.MaxInt64,
MulticallContract: TContractData{
Address: common.HexToAddress(`0xca11bde05977b3631167028862be2a173976ca11`),
Block: 0,
},
Coin: models.TokenListToken{
Address: `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`,
Name: `Ethereum`,
Symbol: `ETH`,
LogoURI: `https://assets.smold.app/api/token/7777777/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE/logo-128.png`,
ChainID: 7777777,
Decimals: 18,
},
IgnoredTokens: []common.Address{},
}
35 changes: 18 additions & 17 deletions generators/common/chains/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,24 @@ var DEFAULT_COIN_ADDRESS = common.HexToAddress(`0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEe

// CHAINS is the list of supported chains
var CHAINS = map[uint64]TChain{
1: ETHEREUM,
5: GOERLI,
10: OPTIMISM,
56: BINANCE_SMART_CHAIN,
100: GNOSIS,
137: POLYGON,
250: FANTOM,
324: ZKSYNC,
1088: METIS,
1101: POLYGON_ZKEVM,
5000: MANTLE,
8453: BASE,
42161: ARBITRUM,
42220: CELO,
43114: AVALANCHE,
59144: LINEA,
534352: SCROLL,
1: ETHEREUM,
5: GOERLI,
10: OPTIMISM,
56: BINANCE_SMART_CHAIN,
100: GNOSIS,
137: POLYGON,
250: FANTOM,
324: ZKSYNC,
1088: METIS,
1101: POLYGON_ZKEVM,
5000: MANTLE,
8453: BASE,
42161: ARBITRUM,
42220: CELO,
43114: AVALANCHE,
59144: LINEA,
534352: SCROLL,
7777777: ZORA,
}

var SUPPORTED_CHAIN_IDS = []uint64{}
Expand Down
Loading

0 comments on commit 913cce2

Please sign in to comment.