Commit 07f56e14 authored by Ralph Pichler's avatar Ralph Pichler Committed by GitHub

feat: add xdai addresses (#2065)

parent 1742618a
...@@ -324,17 +324,24 @@ type priceUpdateEvent struct { ...@@ -324,17 +324,24 @@ type priceUpdateEvent struct {
} }
var ( var (
GoerliChainID = int64(5)
GoerliPostageStampContractAddress = common.HexToAddress("0x621e455C4a139f5C4e4A8122Ce55Dc21630769E4") GoerliPostageStampContractAddress = common.HexToAddress("0x621e455C4a139f5C4e4A8122Ce55Dc21630769E4")
GoerliStartBlock = uint64(4933174) GoerliStartBlock = uint64(4933174)
XDaiChainID = int64(100)
XDaiPostageStampContractAddress = common.HexToAddress("0x6a1a21eca3ab28be85c7ba22b2d6eae5907c900e")
XDaiStartBlock = uint64(16515648)
) )
// DiscoverAddresses returns the canonical contracts for this chainID // DiscoverAddresses returns the canonical contracts for this chainID
func DiscoverAddresses(chainID int64) (postageStamp common.Address, startBlock uint64, found bool) { func DiscoverAddresses(chainID int64) (postageStamp common.Address, startBlock uint64, found bool) {
if chainID == 5 { switch chainID {
// goerli case GoerliChainID:
return GoerliPostageStampContractAddress, GoerliStartBlock, true return GoerliPostageStampContractAddress, GoerliStartBlock, true
case XDaiChainID:
return XDaiPostageStampContractAddress, XDaiStartBlock, true
default:
return common.Address{}, 0, false
} }
return common.Address{}, 0, false
} }
func totalTimeMetric(metric prometheus.Counter, start time.Time) { func totalTimeMetric(metric prometheus.Counter, start time.Time) {
......
...@@ -227,13 +227,26 @@ func (c *factory) ERC20Address(ctx context.Context) (common.Address, error) { ...@@ -227,13 +227,26 @@ func (c *factory) ERC20Address(ctx context.Context) (common.Address, error) {
return *erc20Address, nil return *erc20Address, nil
} }
var (
GoerliChainID = int64(5)
GoerliFactoryAddress = common.HexToAddress("0x73c412512E1cA0be3b89b77aB3466dA6A1B9d273")
GoerliLegacyFactoryAddress = common.HexToAddress("0xf0277caffea72734853b834afc9892461ea18474")
XDaiChainID = int64(100)
XDaiFactoryAddress = common.HexToAddress("0xc2d5a532cf69aa9a1378737d8ccdef884b6e7420")
)
// DiscoverFactoryAddress returns the canonical factory for this chainID // DiscoverFactoryAddress returns the canonical factory for this chainID
func DiscoverFactoryAddress(chainID int64) (currentFactory common.Address, legacyFactories []common.Address, found bool) { func DiscoverFactoryAddress(chainID int64) (currentFactory common.Address, legacyFactories []common.Address, found bool) {
if chainID == 5 { switch chainID {
case GoerliChainID:
// goerli // goerli
return common.HexToAddress("0x73c412512E1cA0be3b89b77aB3466dA6A1B9d273"), []common.Address{ return GoerliFactoryAddress, []common.Address{
common.HexToAddress("0xf0277caffea72734853b834afc9892461ea18474"), GoerliLegacyFactoryAddress,
}, true }, true
case XDaiChainID:
// xdai
return XDaiFactoryAddress, []common.Address{}, true
default:
return common.Address{}, nil, false
} }
return common.Address{}, nil, false
} }
...@@ -19,8 +19,7 @@ import ( ...@@ -19,8 +19,7 @@ import (
) )
var ( var (
errDecodeABI = errors.New("could not decode abi data") errDecodeABI = errors.New("could not decode abi data")
goerliContractAddress = common.HexToAddress("0x0c9de531dcb38b758fe8a2c163444a5e54ee0db2")
) )
type service struct { type service struct {
...@@ -147,11 +146,20 @@ func (s *service) Close() error { ...@@ -147,11 +146,20 @@ func (s *service) Close() error {
return nil return nil
} }
var (
goerliChainID = int64(5)
goerliContractAddress = common.HexToAddress("0x0c9de531dcb38b758fe8a2c163444a5e54ee0db2")
xdaiChainID = int64(100)
xdaiContractAddress = common.HexToAddress("0x0FDc5429C50e2a39066D8A94F3e2D2476fcc3b85")
)
// DiscoverPriceOracleAddress returns the canonical price oracle for this chainID // DiscoverPriceOracleAddress returns the canonical price oracle for this chainID
func DiscoverPriceOracleAddress(chainID int64) (priceOracleAddress common.Address, found bool) { func DiscoverPriceOracleAddress(chainID int64) (priceOracleAddress common.Address, found bool) {
if chainID == 5 { switch chainID {
// goerli case goerliChainID:
return goerliContractAddress, true return goerliContractAddress, true
case xdaiChainID:
return xdaiContractAddress, true
} }
return common.Address{}, false return common.Address{}, false
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment