Brian Sztamfater 27ad41ba8f
feat_: integrate base chain (#6228)
* feat_: integrate base chain

Signed-off-by: Brian Sztamfater <brian@status.im>
Co-authored-by: Dario Gabriel Lipicar <dario@status.im>
2025-01-20 12:12:11 -03:00

43 lines
1.6 KiB
Go

package ethscan
import (
"errors"
"github.com/ethereum/go-ethereum/common"
)
var errorNotAvailableOnChainID = errors.New("not available for chainID")
type ContractData struct {
Address common.Address
CreatedAtBlock uint
}
var contractDataByChainID = map[uint64]ContractData{
1: {common.HexToAddress("0x08A8fDBddc160A7d5b957256b903dCAb1aE512C5"), 12_194_222}, // mainnet
10: {common.HexToAddress("0x9e5076df494fc949abc4461f4e57592b81517d81"), 34_421_097}, // optimism
42161: {common.HexToAddress("0xbb85398092b83a016935a17fc857507b7851a071"), 70_031_945}, // arbitrum
8453: {common.HexToAddress("0xc68c1e011cfE059EB94C8915c291502288704D89"), 24_567_587}, // base
777333: {common.HexToAddress("0x0000000000000000000000000000000000777333"), 50}, // unit tests
11155111: {common.HexToAddress("0xec21ebe1918e8975fc0cd0c7747d318c00c0acd5"), 4_366_506}, // sepolia
421614: {common.HexToAddress("0xec21Ebe1918E8975FC0CD0c7747D318C00C0aCd5"), 553_947}, // sepolia arbitrum
11155420: {common.HexToAddress("0xec21ebe1918e8975fc0cd0c7747d318c00c0acd5"), 7_362_011}, // sepolia optimism
84532: {common.HexToAddress("0xc68c1e011cfE059EB94C8915c291502288704D89"), 20_078_235}, // sepolia base
}
func ContractAddress(chainID uint64) (common.Address, error) {
contract, exists := contractDataByChainID[chainID]
if !exists {
return *new(common.Address), errorNotAvailableOnChainID
}
return contract.Address, nil
}
func ContractCreatedAt(chainID uint64) (uint, error) {
contract, exists := contractDataByChainID[chainID]
if !exists {
return 0, errorNotAvailableOnChainID
}
return contract.CreatedAtBlock, nil
}