Commit 87032ceb authored by Ralph Pichler's avatar Ralph Pichler Committed by GitHub

replace sw3-bindings with go-sw3-abi (#1486)

parent 79592c11
......@@ -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
......
......@@ -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=
......
......@@ -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(simpleswapfactory.ERC20SimpleSwapABI)
chequebookABI = transaction.ParseABIUnchecked(sw3abi.ERC20SimpleSwapABIv0_3_1)
chequeCashedEventType = chequebookABI.Events["ChequeCashed"]
chequeBouncedEventType = chequebookABI.Events["ChequeBounced"]
)
......
......@@ -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(simpleswapfactory.ERC20SimpleSwapABI)
chequebookABI = transaction.ParseABIUnchecked(sw3abi.ERC20SimpleSwapABIv0_3_1)
chequeCashedEventType = chequebookABI.Events["ChequeCashed"]
chequeBouncedEventType = chequebookABI.Events["ChequeBounced"]
)
......
......@@ -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(simpleswapfactory.SimpleSwapFactoryABI)
factoryABI = transaction.ParseABIUnchecked(sw3abi.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(simpleswapfactory.SimpleSwapFactoryDeployedCode)
referenceCode := common.FromHex(sw3abi.SimpleSwapFactoryDeployedBinv0_3_1)
if !bytes.Equal(code, referenceCode) {
return ErrInvalidFactory
}
......
......@@ -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(simpleswapfactory.SimpleSwapFactoryABI)
factoryABI = transaction.ParseABIUnchecked(sw3abi.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(simpleswapfactory.SimpleSwapFactoryDeployedCode), nil
return common.FromHex(sw3abi.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(),
......
......@@ -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(simpleswapfactory.ERC20ABI)
erc20ABI = transaction.ParseABIUnchecked(sw3abi.ERC20ABIv0_3_1)
errDecodeABI = errors.New("could not decode abi data")
)
......
......@@ -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(simpleswapfactory.ERC20ABI)
erc20ABI = transaction.ParseABIUnchecked(sw3abi.ERC20ABIv0_3_1)
)
func TestBalanceOf(t *testing.T) {
......
......@@ -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(simpleswapfactory.ERC20ABI)
erc20ABI = transaction.ParseABIUnchecked(sw3abi.ERC20ABIv0_3_1)
)
type transferEvent struct {
......
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