Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
07f56e14
Unverified
Commit
07f56e14
authored
Jun 11, 2021
by
Ralph Pichler
Committed by
GitHub
Jun 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add xdai addresses (#2065)
parent
1742618a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
11 deletions
+39
-11
listener.go
pkg/postage/listener/listener.go
+10
-3
factory.go
pkg/settlement/swap/chequebook/factory.go
+17
-4
priceoracle.go
pkg/settlement/swap/priceoracle/priceoracle.go
+12
-4
No files found.
pkg/postage/listener/listener.go
View file @
07f56e14
...
@@ -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
)
{
...
...
pkg/settlement/swap/chequebook/factory.go
View file @
07f56e14
...
@@ -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
}
}
pkg/settlement/swap/priceoracle/priceoracle.go
View file @
07f56e14
...
@@ -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
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment