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
87032ceb
Unverified
Commit
87032ceb
authored
Apr 07, 2021
by
Ralph Pichler
Committed by
GitHub
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace sw3-bindings with go-sw3-abi (#1486)
parent
79592c11
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
23 deletions
+20
-23
go.mod
go.mod
+1
-2
go.sum
go.sum
+2
-4
cashout_test.go
pkg/settlement/swap/chequebook/cashout_test.go
+2
-2
chequebook.go
pkg/settlement/swap/chequebook/chequebook.go
+2
-2
factory.go
pkg/settlement/swap/chequebook/factory.go
+3
-3
factory_test.go
pkg/settlement/swap/chequebook/factory_test.go
+4
-4
erc20.go
pkg/settlement/swap/erc20/erc20.go
+2
-2
erc20_test.go
pkg/settlement/swap/erc20/erc20_test.go
+2
-2
event_test.go
pkg/settlement/swap/transaction/event_test.go
+2
-2
No files found.
go.mod
View file @
87032ceb
...
...
@@ -8,9 +8,8 @@ require (
github.com/coreos/go-semver v0.3.0
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/ethereum/go-ethereum v1.9.23
github.com/ethersphere/
bmt v0.1.4
github.com/ethersphere/
go-sw3-abi v0.3.2
github.com/ethersphere/langos v1.0.0
github.com/ethersphere/sw3-bindings/v3 v3.0.3
github.com/foxcpp/go-mockdns v0.0.0-20201212160233-ede2f9158d15
github.com/gogo/protobuf v1.3.1
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
...
...
go.sum
View file @
87032ceb
...
...
@@ -165,12 +165,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.9.23 h1:SIKhg/z4Q7AbvqcxuPYvMxf36che/Rq/Pp0IdYEkbtw=
github.com/ethereum/go-ethereum v1.9.23/go.mod h1:JIfVb6esrqALTExdz9hRYvrP0xBDf6wCncIu1hNwHpM=
github.com/ethersphere/
bmt v0.1.4 h1:+rkWYNtMgDx6bkNqGdWu+U9DgGI1rRZplpSW3YhBr1Q
=
github.com/ethersphere/
bmt v0.1.4/go.mod h1:Yd8ft1U69WDuHevZc/rwPxUv1rzPSMpMnS6xbU53aY8
=
github.com/ethersphere/
go-sw3-abi v0.3.2 h1:BVTuSZ9Ph/JJBglU9pCRSch3gDq4g5QEto6KzMYP/08
=
github.com/ethersphere/
go-sw3-abi v0.3.2/go.mod h1:BmpsvJ8idQZdYEtWnvxA8POYQ8Rl/NhyCdF0zLMOOJU
=
github.com/ethersphere/langos v1.0.0 h1:NBtNKzXTTRSue95uOlzPN4py7Aofs0xWPzyj4AI1Vcc=
github.com/ethersphere/langos v1.0.0/go.mod h1:dlcN2j4O8sQ+BlCaxeBu43bgr4RQ+inJ+pHwLeZg5Tw=
github.com/ethersphere/sw3-bindings/v3 v3.0.3 h1:iENjwaFFqu9hM9LrL8H0yRgToq9xFwLAr9XXvOt9LFM=
github.com/ethersphere/sw3-bindings/v3 v3.0.3/go.mod h1:EEn7sxejLPj6p1oDT/YGrjDfNV8z6PWcd4DviE0hOIk=
github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
...
...
pkg/settlement/swap/chequebook/cashout_test.go
View file @
87032ceb
...
...
@@ -17,11 +17,11 @@ import (
"github.com/ethersphere/bee/pkg/settlement/swap/transaction/backendmock"
transactionmock
"github.com/ethersphere/bee/pkg/settlement/swap/transaction/mock"
storemock
"github.com/ethersphere/bee/pkg/statestore/mock"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
)
var
(
chequebookABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
ERC20SimpleSwapABI
)
chequebookABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
ERC20SimpleSwapABIv0_3_1
)
chequeCashedEventType
=
chequebookABI
.
Events
[
"ChequeCashed"
]
chequeBouncedEventType
=
chequebookABI
.
Events
[
"ChequeBounced"
]
)
...
...
pkg/settlement/swap/chequebook/chequebook.go
View file @
87032ceb
...
...
@@ -16,7 +16,7 @@ import (
"github.com/ethersphere/bee/pkg/settlement/swap/erc20"
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
"github.com/ethersphere/bee/pkg/storage"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
)
// SendChequeFunc is a function to send cheques.
...
...
@@ -33,7 +33,7 @@ var (
// ErrInsufficientFunds is the error when the chequebook has not enough free funds for a user action
ErrInsufficientFunds
=
errors
.
New
(
"insufficient token balance"
)
chequebookABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
ERC20SimpleSwapABI
)
chequebookABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
ERC20SimpleSwapABIv0_3_1
)
chequeCashedEventType
=
chequebookABI
.
Events
[
"ChequeCashed"
]
chequeBouncedEventType
=
chequebookABI
.
Events
[
"ChequeBounced"
]
)
...
...
pkg/settlement/swap/chequebook/factory.go
View file @
87032ceb
...
...
@@ -13,7 +13,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
"golang.org/x/net/context"
)
...
...
@@ -22,7 +22,7 @@ var (
ErrNotDeployedByFactory
=
errors
.
New
(
"chequebook not deployed by factory"
)
errDecodeABI
=
errors
.
New
(
"could not decode abi data"
)
factoryABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
SimpleSwapFactoryABI
)
factoryABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
SimpleSwapFactoryABIv0_3_1
)
simpleSwapDeployedEventType
=
factoryABI
.
Events
[
"SimpleSwapDeployed"
]
)
...
...
@@ -105,7 +105,7 @@ func (c *factory) VerifyBytecode(ctx context.Context) (err error) {
return
err
}
referenceCode
:=
common
.
FromHex
(
s
impleswapfactory
.
SimpleSwapFactoryDeployedCode
)
referenceCode
:=
common
.
FromHex
(
s
w3abi
.
SimpleSwapFactoryDeployedBinv0_3_1
)
if
!
bytes
.
Equal
(
code
,
referenceCode
)
{
return
ErrInvalidFactory
}
...
...
pkg/settlement/swap/chequebook/factory_test.go
View file @
87032ceb
...
...
@@ -16,11 +16,11 @@ import (
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
"github.com/ethersphere/bee/pkg/settlement/swap/transaction/backendmock"
transactionmock
"github.com/ethersphere/bee/pkg/settlement/swap/transaction/mock"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
)
var
(
factoryABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
SimpleSwapFactoryABI
)
factoryABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
SimpleSwapFactoryABIv0_3_1
)
simpleSwapDeployedEvent
=
factoryABI
.
Events
[
"SimpleSwapDeployed"
]
)
...
...
@@ -60,7 +60,7 @@ func TestFactoryVerifySelf(t *testing.T) {
if
blockNumber
!=
nil
{
t
.
Fatal
(
"not called for latest block"
)
}
return
common
.
FromHex
(
s
impleswapfactory
.
SimpleSwapFactoryDeployedCode
),
nil
return
common
.
FromHex
(
s
w3abi
.
SimpleSwapFactoryDeployedBinv0_3_1
),
nil
}),
),
transactionmock
.
New
(),
...
...
@@ -84,7 +84,7 @@ func TestFactoryVerifySelfInvalidCode(t *testing.T) {
if
blockNumber
!=
nil
{
t
.
Fatal
(
"not called for latest block"
)
}
return
common
.
FromHex
(
simpleswapfactory
.
AddressBin
),
nil
return
common
.
FromHex
(
"abcd"
),
nil
}),
),
transactionmock
.
New
(),
...
...
pkg/settlement/swap/erc20/erc20.go
View file @
87032ceb
...
...
@@ -12,11 +12,11 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
)
var
(
erc20ABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
ERC20ABI
)
erc20ABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
ERC20ABIv0_3_1
)
errDecodeABI
=
errors
.
New
(
"could not decode abi data"
)
)
...
...
pkg/settlement/swap/erc20/erc20_test.go
View file @
87032ceb
...
...
@@ -14,11 +14,11 @@ import (
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
backendmock
"github.com/ethersphere/bee/pkg/settlement/swap/transaction/backendmock"
transactionmock
"github.com/ethersphere/bee/pkg/settlement/swap/transaction/mock"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
)
var
(
erc20ABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
ERC20ABI
)
erc20ABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
ERC20ABIv0_3_1
)
)
func
TestBalanceOf
(
t
*
testing
.
T
)
{
...
...
pkg/settlement/swap/transaction/event_test.go
View file @
87032ceb
...
...
@@ -12,11 +12,11 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethersphere/bee/pkg/settlement/swap/transaction"
"github.com/ethersphere/
sw3-bindings/v3/simpleswapfactory
"
"github.com/ethersphere/
go-sw3-abi/sw3abi
"
)
var
(
erc20ABI
=
transaction
.
ParseABIUnchecked
(
s
impleswapfactory
.
ERC20ABI
)
erc20ABI
=
transaction
.
ParseABIUnchecked
(
s
w3abi
.
ERC20ABIv0_3_1
)
)
type
transferEvent
struct
{
...
...
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