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 {
}
var (
GoerliChainID = int64(5)
GoerliPostageStampContractAddress = common.HexToAddress("0x621e455C4a139f5C4e4A8122Ce55Dc21630769E4")
GoerliStartBlock = uint64(4933174)
XDaiChainID = int64(100)
XDaiPostageStampContractAddress = common.HexToAddress("0x6a1a21eca3ab28be85c7ba22b2d6eae5907c900e")
XDaiStartBlock = uint64(16515648)
)
// DiscoverAddresses returns the canonical contracts for this chainID
func DiscoverAddresses(chainID int64) (postageStamp common.Address, startBlock uint64, found bool) {
if chainID == 5 {
// goerli
switch chainID {
case GoerliChainID:
return GoerliPostageStampContractAddress, GoerliStartBlock, true
}
case XDaiChainID:
return XDaiPostageStampContractAddress, XDaiStartBlock, true
default:
return common.Address{}, 0, false
}
}
func totalTimeMetric(metric prometheus.Counter, start time.Time) {
......
......@@ -227,13 +227,26 @@ func (c *factory) ERC20Address(ctx context.Context) (common.Address, error) {
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
func DiscoverFactoryAddress(chainID int64) (currentFactory common.Address, legacyFactories []common.Address, found bool) {
if chainID == 5 {
switch chainID {
case GoerliChainID:
// goerli
return common.HexToAddress("0x73c412512E1cA0be3b89b77aB3466dA6A1B9d273"), []common.Address{
common.HexToAddress("0xf0277caffea72734853b834afc9892461ea18474"),
return GoerliFactoryAddress, []common.Address{
GoerliLegacyFactoryAddress,
}, true
}
case XDaiChainID:
// xdai
return XDaiFactoryAddress, []common.Address{}, true
default:
return common.Address{}, nil, false
}
}
......@@ -20,7 +20,6 @@ import (
var (
errDecodeABI = errors.New("could not decode abi data")
goerliContractAddress = common.HexToAddress("0x0c9de531dcb38b758fe8a2c163444a5e54ee0db2")
)
type service struct {
......@@ -147,11 +146,20 @@ func (s *service) Close() error {
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
func DiscoverPriceOracleAddress(chainID int64) (priceOracleAddress common.Address, found bool) {
if chainID == 5 {
// goerli
switch chainID {
case goerliChainID:
return goerliContractAddress, true
case xdaiChainID:
return xdaiContractAddress, true
}
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