Skip to content

Commit

Permalink
feat: add ink
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jan 29, 2025
1 parent 2577fd0 commit d7feee4
Show file tree
Hide file tree
Showing 43 changed files with 51,248 additions and 33,419 deletions.
62 changes: 62 additions & 0 deletions generators/buildTokenList.inkypump.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package main

import (
"strconv"

"github.com/migratooor/tokenLists/generators/common/chains"
"github.com/migratooor/tokenLists/generators/common/helpers"
"github.com/migratooor/tokenLists/generators/common/models"
"github.com/migratooor/tokenLists/generators/common/utils"
)

func handleInkypumpTokenList(
chainID uint64,
tokenAddresses []string,
tokenIcons map[string]string,
) []models.TokenListToken {
tokenList := helpers.GetTokensFromAddressesWithIcons(chainID, tokenAddresses, tokenIcons)
tokenList = append(tokenList, chains.CHAINS[chainID].Coin)
return tokenList
}

func fetchInkypumpTokenList() []models.TokenListToken {
type TInkypumpAPIResponse struct {
Tokens []struct {
Address string `json:"address"`
IconURI string `json:"image_url"`
Name string `json:"name"`
Symbol string `json:"ticker"`
FundingProgress float64 `json:"funding_progress"`
} `json:"tokens"`
TotalPages int `json:"totalPages"`
TotalCount int `json:"totalCount"`
}

baseAPIEndpoint := `https://inkypump.com/api/tokens`
tokenAddresses := []string{}
tokenIcons := make(map[string]string)
for i := 0; i < 40; i++ {
nextPageURI := `?page=` + strconv.Itoa(i) + `&sortBy=mcap-high`
response := helpers.FetchJSON[TInkypumpAPIResponse](baseAPIEndpoint + nextPageURI)
for _, token := range response.Tokens {
if token.FundingProgress >= 1.0 {
tokenAddresses = append(tokenAddresses, token.Address)
tokenIcons[utils.ToAddress(token.Address)] = token.IconURI
}
}
if i >= response.TotalPages {
break
}
}
return handleInkypumpTokenList(57073, tokenAddresses, tokenIcons)
}

func buildInkypumpTokenList() {
tokenList := helpers.LoadTokenListFromJsonFile(`inkypump.json`)
tokenList.Name = `Inkypump`
tokenList.LogoURI = `https://assets.smold.app/api/chain/57073/logo-128.png`
tokenList.Keywords = []string{`inkypump`, `launcher`}
tokens := []models.TokenListToken{}
tokens = append(tokens, fetchInkypumpTokenList()...)
helpers.SaveTokenListInJsonFile(tokenList, tokens, `inkypump.json`, helpers.SavingMethodStandard)
}
32 changes: 32 additions & 0 deletions generators/common/chains/57073.ink.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package chains

import (
"math"

"github.com/migratooor/tokenLists/generators/common/models"
)

var INK = TChain{
ID: 57073,
Name: `Ink`,
Type: `EVM`,
LogoURI: `https://assets.smold.app/chains/57073/logo-128.png`,
IsTestNet: false,
RpcURI: `https://rpc-gel.inkonchain.com`,
MaxBlockRange: 100_000_000,
MaxBatchSize: math.MaxInt64,
WeightRatio: 0.0,
MulticallContract: TContractData{
Address: `0xca11bde05977b3631167028862be2a173976ca11`,
Block: 0,
},
Coin: models.TokenListToken{
Address: `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`,
Name: `Ethereum`,
Symbol: `ETH`,
LogoURI: `https://assets.smold.app/api/token/57073/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE/logo-128.png`,
ChainID: 57073,
Decimals: 18,
},
IgnoredTokens: []string{},
}
1 change: 1 addition & 0 deletions generators/common/chains/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var CHAINS = map[uint64]TChain{
7777777: ZORA,
1380012617: RARI,
1151111081099710: SOLANA,
57073: INK,
}

var SUPPORTED_CHAIN_IDS = []uint64{}
Expand Down
7 changes: 7 additions & 0 deletions generators/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,11 @@ var GENERATORS = map[string]TGenerators{
GenerationMethod: GenerationAPI,
GeneratorType: GeneratorToken,
},
`inkypump`: {
Exec: buildInkypumpTokenList,
Name: `Inkypump`,
Description: `A list of tokens available on inkypump.com.`,
GenerationMethod: GenerationAPI,
GeneratorType: GeneratorToken,
},
}
4 changes: 2 additions & 2 deletions lists/1/popular.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Popular tokens",
"description": "A curated list of popular tokens from all the token lists on tokenlistooor.",
"timestamp": "2025-01-26T01:11:37Z",
"timestamp": "2025-01-29T11:18:45+01:00",
"version": {
"major": 57,
"minor": 0,
"minor": 1,
"patch": 0
},
"logoURI": "https://raw.githubusercontent.com/smoldapp/tokenLists/main/.github/tokenlistooor.svg",
Expand Down
Loading

0 comments on commit d7feee4

Please sign in to comment.