24 lines
667 B
Go
24 lines
667 B
Go
package snt
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
)
|
|
|
|
var errorNotAvailableOnChainID = errors.New("not available for chainID")
|
|
|
|
var contractAddressByChainID = map[uint64]common.Address{
|
|
1: common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"), // mainnet
|
|
3: common.HexToAddress("0xc55cf4b03948d7ebc8b9e8bad92643703811d162"), // ropsten
|
|
5: common.HexToAddress("0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"), // goerli
|
|
}
|
|
|
|
func ContractAddress(chainID uint64) (common.Address, error) {
|
|
addr, exists := contractAddressByChainID[chainID]
|
|
if !exists {
|
|
return *new(common.Address), errorNotAvailableOnChainID
|
|
}
|
|
return addr, nil
|
|
}
|