diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..8f43f1f6 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +@noot \ No newline at end of file diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 00000000..0b9a992b --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,28 @@ +on: [pull_request] +name: checks + +jobs: + linter-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Run go fmt + run: diff -u <(echo -n) <(gofmt -d -s .) + + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: 'latest' + args: -v + + vet-check: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.15.x' + - uses: actions/checkout@v2 + + - name: Run go vet + run: go vet ./... \ No newline at end of file diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 00000000..baaccdb2 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,42 @@ +on: [pull_request] +name: unit-tests + +jobs: + unit-tests: + strategy: + matrix: + go-version: [1.17.x] + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + steps: + - id: go-cache-paths + run: | + echo "::set-output name=go-build::$(go env GOCACHE)" + echo "::set-output name=go-mod::$(go env GOMODCACHE)" + + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v2 + + # cache go build cache + - name: Cache go modules + uses: actions/cache@v2 + with: + path: ${{ steps.go-cache-paths.outputs.go-build }} + key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go-build + + # cache go mod cache + - name: Cache go modules + uses: actions/cache@v2 + with: + path: ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go-mod + + - name: Run build + run: make build + + - name: Run unit tests + run: go test -short ./... -timeout=30m diff --git a/alice/protocol.go b/alice/protocol.go index f3386978..42c8a1cf 100644 --- a/alice/protocol.go +++ b/alice/protocol.go @@ -20,12 +20,13 @@ import ( logging "github.com/ipfs/go-log" ) -var _ Alice = &alice{} - -var log = logging.Logger("alice") - const ( - keyAlice = "4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d" + keyAlice = "4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d" //nolint +) + +var ( + _ Alice = &alice{} + log = logging.Logger("alice") ) func reverse(s []byte) []byte { @@ -72,7 +73,7 @@ type Alice interface { type alice struct { ctx context.Context - t0, t1 time.Time + t0, t1 time.Time //nolint privkeys *monero.PrivateKeyPair pubkeys *monero.PublicKeyPair diff --git a/bob/protocol.go b/bob/protocol.go index 7f652a97..edb55062 100644 --- a/bob/protocol.go +++ b/bob/protocol.go @@ -20,18 +20,12 @@ import ( logging "github.com/ipfs/go-log" ) -var log = logging.Logger("bob") - const defaultDaemonEndpoint = "http://127.0.0.1:18081/json_rpc" -func reverse(s []byte) []byte { - for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { - s[i], s[j] = s[j], s[i] - } - return s -} - -var _ Bob = &bob{} +var ( + _ Bob = &bob{} + log = logging.Logger("bob") +) // Bob contains the functions that will be called by a user who owns XMR // and wishes to swap for ETH. @@ -73,7 +67,7 @@ type Bob interface { type bob struct { ctx context.Context - t0, t1 time.Time + t0, t1 time.Time //nolint privkeys *monero.PrivateKeyPair pubkeys *monero.PublicKeyPair diff --git a/cmd/alice.go b/cmd/alice.go index f25a490f..4ed55f5d 100644 --- a/cmd/alice.go +++ b/cmd/alice.go @@ -15,7 +15,9 @@ func (n *node) doProtocolAlice() error { if err := n.host.Start(); err != nil { return err } - defer n.host.Stop() + defer func() { + _ = n.host.Stop() + }() outCh := make(chan *net.MessageInfo) n.host.SetOutgoingCh(outCh) @@ -26,6 +28,7 @@ func (n *node) doProtocolAlice() error { // can move on to just watching the contract setupDone := make(chan struct{}) + var done bool for { select { case <-n.done: @@ -35,6 +38,10 @@ func (n *node) doProtocolAlice() error { log.Error("failed to handle message: error=", err) } case <-setupDone: + done = true + } + + if done { break } } diff --git a/cmd/bob.go b/cmd/bob.go index fdbc94da..33aab87e 100644 --- a/cmd/bob.go +++ b/cmd/bob.go @@ -16,7 +16,9 @@ func (n *node) doProtocolBob() error { if err := n.host.Start(); err != nil { return err } - defer n.host.Stop() + defer func() { + _ = n.host.Stop() + }() outCh := make(chan *net.MessageInfo) n.host.SetOutgoingCh(outCh) @@ -27,6 +29,7 @@ func (n *node) doProtocolBob() error { // can move on to just watching the contract setupDone := make(chan struct{}) + var done bool for { select { case <-n.done: @@ -36,6 +39,10 @@ func (n *node) doProtocolBob() error { log.Info("failed to handle message: error=%s\n", err) } case <-setupDone: + done = true + } + + if done { break } } diff --git a/ethereum/contracts/SwapOnChain.console.sol b/ethereum/contracts/Swap.console.sol similarity index 100% rename from ethereum/contracts/SwapOnChain.console.sol rename to ethereum/contracts/Swap.console.sol diff --git a/ethereum/contracts/SwapOnChain.sol b/ethereum/contracts/Swap.sol similarity index 100% rename from ethereum/contracts/SwapOnChain.sol rename to ethereum/contracts/Swap.sol diff --git a/makefile b/makefile new file mode 100644 index 00000000..624dd660 --- /dev/null +++ b/makefile @@ -0,0 +1,15 @@ +.PHONY: lint test install build +all: install + +lint: + ./scripts/install_lint.sh + ${GOPATH}/bin/golangci-lint run + +test: + go test ./... + +install: + cd cmd/ && go install && cd .. + +build: + ./scripts/build.sh \ No newline at end of file diff --git a/monero/client_test.go b/monero/client_test.go index e649e39f..ffaf118d 100644 --- a/monero/client_test.go +++ b/monero/client_test.go @@ -59,7 +59,8 @@ func TestClient_Transfer(t *testing.T) { // transfer to account A+B err = cA.Transfer(kpABPub.Address(), 0, amount) require.NoError(t, err) - daemon.callGenerateBlocks(aliceAddress.Address, 1) + err = daemon.callGenerateBlocks(aliceAddress.Address, 1) + require.NoError(t, err) for { t.Log("checking balance...") @@ -72,11 +73,13 @@ func TestClient_Transfer(t *testing.T) { break } - daemon.callGenerateBlocks(aliceAddress.Address, 1) + err = daemon.callGenerateBlocks(aliceAddress.Address, 1) + require.NoError(t, err) time.Sleep(time.Second) } - daemon.callGenerateBlocks(aliceAddress.Address, 16) + err = daemon.callGenerateBlocks(aliceAddress.Address, 16) + require.NoError(t, err) // generate spend account for A+B skAKPriv := SumPrivateSpendKeys(kpA.sk, kpB.sk) diff --git a/monero/crypto_test.go b/monero/crypto_test.go index d55b0dd4..f1671eba 100644 --- a/monero/crypto_test.go +++ b/monero/crypto_test.go @@ -7,13 +7,6 @@ import ( "github.com/stretchr/testify/require" ) -func reverse(s []byte) []byte { - for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { - s[i], s[j] = s[j], s[i] - } - return s -} - func TestPrivateKeyPairToAddress(t *testing.T) { skBytes := "a6e51afb9662bf2173d807ceaf88938d09a82d1ab2cea3eeb1706eeeb8b6ba03" pskBytes := "57edf916a28c2a0a172565468564ab1c5c217d33ea63436f7604a96aa28ec471" diff --git a/monero/rpc.go b/monero/rpc.go index 7e2a61c7..55576c61 100644 --- a/monero/rpc.go +++ b/monero/rpc.go @@ -24,7 +24,7 @@ type generateFromKeysRequest struct { type generateFromKeysResponse struct { Address string `json:"address"` - Info string `json:"info` + Info string `json:"info"` } func (c *client) callGenerateFromKeys(sk *PrivateSpendKey, vk *PrivateViewKey, address Address, filename, password string) error { diff --git a/net/host.go b/net/host.go index 1d9e624e..e5dd2a08 100644 --- a/net/host.go +++ b/net/host.go @@ -64,8 +64,6 @@ type host struct { } func NewHost(port uint64, want, keyfile string, bootnodes []string) (*host, error) { - ctx, cancel := context.WithCancel(context.Background()) - key, err := loadKey(keyfile) if err != nil { fmt.Println("failed to load libp2p key, generating key...", keyfile) @@ -95,22 +93,21 @@ func NewHost(port uint64, want, keyfile string, bootnodes []string) (*host, erro } // create libp2p host instance - h, err := libp2p.New(ctx, opts...) + h, err := libp2p.New(context.Background(), opts...) if err != nil { return nil, err } inCh := make(chan *MessageInfo) + ctx, cancel := context.WithCancel(context.Background()) return &host{ ctx: ctx, cancel: cancel, h: h, wantMessage: &WantMessage{Want: want}, - //mdns: newMDNS(h), - //discovery: discovery, - bootnodes: bns, - inCh: inCh, + bootnodes: bns, + inCh: inCh, }, nil } diff --git a/scripts/generate-bindings.sh b/scripts/generate-bindings.sh index 0caca5fe..1e78efe3 100755 --- a/scripts/generate-bindings.sh +++ b/scripts/generate-bindings.sh @@ -1,10 +1,11 @@ #!/bin/bash -$SOLC_BIN --abi ethereum/contracts/SwapOnChain.sol -o ethereum/abi/ --overwrite -$SOLC_BIN --bin ethereum/contracts/SwapOnChain.sol -o ethereum/bin/ --overwrite -abigen --abi ethereum/abi/SwapOnChain.abi --pkg swapOnChain --type SwapOnChain --out swapOnChain.go --bin ethereum/bin/SwapOnChain.bin -mv swapOnChain.go ./swapOnChain-contract +$SOLC_BIN --abi ethereum/contracts/Swap.sol -o ethereum/abi/ --overwrite +$SOLC_BIN --bin ethereum/contracts/Swap.sol -o ethereum/bin/ --overwrite +abigen --abi ethereum/abi/Swap.abi --pkg swap --type Swap --out swap.go --bin ethereum/bin/Swap.bin +mv swap.go ./swap-contract + $SOLC_BIN --abi ethereum/contracts/SwapDLEQ.sol -o ethereum/abi/ --overwrite $SOLC_BIN --bin ethereum/contracts/SwapDLEQ.sol -o ethereum/bin/ --overwrite -abigen --abi ethereum/abi/SwapDLEQ.abi --pkg swapDLEQ --type SwapDLEQ --out swapDLEQ.go --bin ethereum/bin/SwapDLEQ.bin -mv swapDLEQ.go ./swapDLEQ-contract +abigen --abi ethereum/abi/SwapDLEQ.abi --pkg swapdleq --type SwapDLEQ --out swap_dleq.go --bin ethereum/bin/SwapDLEQ.bin +mv swap_dleq.go ./swap-dleq-contract diff --git a/scripts/install_lint.sh b/scripts/install_lint.sh new file mode 100755 index 00000000..30b7c6ba --- /dev/null +++ b/scripts/install_lint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [[ -z "${GOPATH}" ]]; then + export GOPATH=~/go +fi + +if ! command -v golangci-lint &> /dev/null +then + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.0 +fi + +export PATH=$PATH:$(go env GOPATH)/bin \ No newline at end of file diff --git a/swap-contract/swap.go b/swap-contract/swap.go new file mode 100644 index 00000000..6ccf2bcb --- /dev/null +++ b/swap-contract/swap.go @@ -0,0 +1,925 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package swap + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// SwapMetaData contains all meta data concerning the Swap contract. +var SwapMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_pubKeyClaim\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_pubKeyRefund\",\"type\":\"bytes32\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p\",\"type\":\"bytes32\"}],\"name\":\"Constructed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"b\",\"type\":\"bool\"}],\"name\":\"IsReady\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"Refunded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_s\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyClaim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyRefund\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_s\",\"type\":\"uint256\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"set_ready\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeout_0\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeout_1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x6101206040526000600160006101000a81548160ff02191690831515021790555060405162001c4638038062001c46833981810160405281019062000045919062000190565b3373ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250508160c081815250508060e0818152505062015180426200009a919062000210565b6101008181525050604051620000b09062000142565b604051809103906000f080158015620000cd573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250507f1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb816040516200013291906200027e565b60405180910390a150506200029b565b610df78062000e4f83390190565b600080fd5b6000819050919050565b6200016a8162000155565b81146200017657600080fd5b50565b6000815190506200018a816200015f565b92915050565b60008060408385031215620001aa57620001a962000150565b5b6000620001ba8582860162000179565b9250506020620001cd8582860162000179565b9150509250929050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006200021d82620001d7565b91506200022a83620001d7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115620002625762000261620001e1565b5b828201905092915050565b620002788162000155565b82525050565b60006020820190506200029560008301846200026d565b92915050565b60805160a05160c05160e05161010051610b4c62000303600039600081816101c80152818161032a015281816103e4015261049b01526000818161013e015261022f0152600061040801526000818161028c0152610444015260006105340152610b4c6000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806345bb8e091161005b57806345bb8e09146100d85780634ded8d52146100f6578063736290f81461011457806374d7c138146101325761007d565b806303f7e24614610082578063278ecde1146100a0578063379607f5146100bc575b600080fd5b61008a61013c565b604051610097919061065a565b60405180910390f35b6100ba60048036038101906100b591906106b0565b610160565b005b6100d660048036038101906100d191906106b0565b6102c3565b005b6100e06103dc565b6040516100ed91906106ec565b60405180910390f35b6100fe6103e2565b60405161010b91906106ec565b60405180910390f35b61011c610406565b604051610129919061065a565b60405180910390f35b61013a61042a565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b60011515600160009054906101000a900460ff16151514156101c6576000544210156101c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101b89061078a565b60405180910390fd5b610229565b7f00000000000000000000000000000000000000000000000000000000000000004210610228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021f906107f6565b60405180910390fd5b5b610253817f000000000000000000000000000000000000000000000000000000000000000061052f565b7f3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c8160405161028291906106ec565b60405180910390a17f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16ff5b60011515600160009054906101000a900460ff1615151415610328576000544210610323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161031a90610862565b60405180910390fd5b61038c565b7f000000000000000000000000000000000000000000000000000000000000000042101561038b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610382906108f4565b60405180910390fd5b5b7f7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8816040516103bb91906106ec565b60405180910390a13373ffffffffffffffffffffffffffffffffffffffff16ff5b60005481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900460ff1615801561049257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80156104bd57507f000000000000000000000000000000000000000000000000000000000000000042105b6104c657600080fd5b60018060006101000a81548160ff02191690831515021790555062015180426104ef9190610943565b6000819055507f2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4600160405161052591906109b4565b60405180910390a1565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c4f4912b856040518263ffffffff1660e01b815260040161058b91906106ec565b604080518083038186803b1580156105a257600080fd5b505afa1580156105b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105da91906109e4565b91509150600060ff6002846105ef9190610a53565b901b82179050838160001b1461063a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063190610af6565b60405180910390fd5b5050505050565b6000819050919050565b61065481610641565b82525050565b600060208201905061066f600083018461064b565b92915050565b600080fd5b6000819050919050565b61068d8161067a565b811461069857600080fd5b50565b6000813590506106aa81610684565b92915050565b6000602082840312156106c6576106c5610675565b5b60006106d48482850161069b565b91505092915050565b6106e68161067a565b82525050565b600060208201905061070160008301846106dd565b92915050565b600082825260208201905092915050565b7f4974277320426f622773207475726e206e6f772c20706c65617365207761697460008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b6000610774602183610707565b915061077f82610718565b604082019050919050565b600060208201905081810360008301526107a381610767565b9050919050565b7f4d697373656420796f7572206368616e63652100000000000000000000000000600082015250565b60006107e0601383610707565b91506107eb826107aa565b602082019050919050565b6000602082019050818103600083015261080f816107d3565b9050919050565b7f546f6f206c61746520746f20636c61696d210000000000000000000000000000600082015250565b600061084c601283610707565b915061085782610816565b602082019050919050565b6000602082019050818103600083015261087b8161083f565b9050919050565b7f2769735265616479203d3d2066616c7365272063616e6e6f7420636c61696d2060008201527f7965742100000000000000000000000000000000000000000000000000000000602082015250565b60006108de602483610707565b91506108e982610882565b604082019050919050565b6000602082019050818103600083015261090d816108d1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061094e8261067a565b91506109598361067a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561098e5761098d610914565b5b828201905092915050565b60008115159050919050565b6109ae81610999565b82525050565b60006020820190506109c960008301846109a5565b92915050565b6000815190506109de81610684565b92915050565b600080604083850312156109fb576109fa610675565b5b6000610a09858286016109cf565b9250506020610a1a858286016109cf565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000610a5e8261067a565b9150610a698361067a565b925082610a7957610a78610a24565b5b828206905092915050565b7f70726f76696465642073656372657420646f6573206e6f74206d61746368207460008201527f6865206578706563746564207075624b65790000000000000000000000000000602082015250565b6000610ae0603283610707565b9150610aeb82610a84565b604082019050919050565b60006020820190508181036000830152610b0f81610ad3565b905091905056fea2646970667358221220deb05d88ade0df4b92724ecbc0c32da19406555cbf453d4d1413dd5be62f963c64736f6c63430008090033608060405234801561001057600080fd5b50610dd7806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c4f4912b14610030575b600080fd5b61004a60048036038101906100459190610caa565b610061565b604051610058929190610ce6565b60405180910390f35b60008061006c610c09565b610074610c09565b7f216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a8260000181815250507f666666666666666666666666666666666666666666666666666666666666665882602001818152505060018260400181815250506000816000018181525050600181602001818152505060018160400181815250505b600085111561012d57600180861614156101165761011381836101d2565b90505b600185901c945061012682610701565b91506100f5565b600061013c8260400151610b6b565b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061016d5761016c610d0f565b5b818360000151098260000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806101ac576101ab610d0f565b5b818360200151098260200181815250508160000151826020015194509450505050915091565b6101da610c09565b6101e2610c2a565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061021157610210610d0f565b5b83604001518560400151098160000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061025457610253610d0f565b5b81600001518260000151098160200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061029757610296610d0f565b5b83600001518560000151098160400181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806102da576102d9610d0f565b5b83602001518560200151098160600181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061031d5761031c610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061034c5761034b610d0f565b5b82606001518360400151097f52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3098160800181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806103b1576103b0610d0f565b5b81608001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed6103e19190610d6d565b8260200151088160a00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061041f5761041e610d0f565b5b81608001518260200151088160c00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061046257610461610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061049157610490610d0f565b5b82606001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed6104c19190610d6d565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806104f0576104ef610d0f565b5b84604001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed6105209190610d6d565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061054f5761054e610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061057e5761057d610d0f565b5b89602001518a60000151087f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806105b8576105b7610d0f565b5b8b602001518c60000151080908087f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806105f5576105f4610d0f565b5b8360a00151846000015109098260000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061063957610638610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061066857610667610d0f565b5b82604001518360600151087f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806106a2576106a1610d0f565b5b8360c00151846000015109098260200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806106e6576106e5610d0f565b5b8160c001518260a00151098260400181815250505092915050565b610709610c09565b610711610c2a565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806107405761073f610d0f565b5b83602001518460000151088160000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061078357610782610d0f565b5b81600001518260000151098160200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806107c6576107c5610d0f565b5b83600001518460000151098160400181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061080957610808610d0f565b5b836020015184602001510981606001818152505080604001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed61084d9190610d6d565b8160800181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061088557610884610d0f565b5b81606001518260800151088160a00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806108c8576108c7610d0f565b5b83604001518460400151098160e00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061090b5761090a610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061093a57610939610d0f565b5b8260e001516002097f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed61096d9190610d6d565b8260a00151088160c00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806109ab576109aa610d0f565b5b8160c001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806109df576109de610d0f565b5b83606001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610a0f9190610d6d565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610a3e57610a3d610d0f565b5b85604001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610a6e9190610d6d565b86602001510808098260000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610aae57610aad610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610add57610adc610d0f565b5b82606001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610b0d9190610d6d565b8360800151088260a00151098260200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610b5157610b50610d0f565b5b8160c001518260a001510982604001818152505050919050565b60008060027f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610b9b9190610d6d565b905060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed905060405160208152602080820152602060408201528460608201528260808201528160a082015260208160c0836005600019fa610bfd57600080fd5b80519350505050919050565b60405180606001604052806000815260200160008152602001600081525090565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600080fd5b6000819050919050565b610c8781610c74565b8114610c9257600080fd5b50565b600081359050610ca481610c7e565b92915050565b600060208284031215610cc057610cbf610c6f565b5b6000610cce84828501610c95565b91505092915050565b610ce081610c74565b82525050565b6000604082019050610cfb6000830185610cd7565b610d086020830184610cd7565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610d7882610c74565b9150610d8383610c74565b925082821015610d9657610d95610d3e565b5b82820390509291505056fea264697066735822122026763aba14e28dd6f9cbc211a6db8bcee0af925f8e7aef10e72e4164c3feaf8c64736f6c63430008090033", +} + +// SwapABI is the input ABI used to generate the binding from. +// Deprecated: Use SwapMetaData.ABI instead. +var SwapABI = SwapMetaData.ABI + +// SwapBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use SwapMetaData.Bin instead. +var SwapBin = SwapMetaData.Bin + +// DeploySwap deploys a new Ethereum contract, binding an instance of Swap to it. +func DeploySwap(auth *bind.TransactOpts, backend bind.ContractBackend, _pubKeyClaim [32]byte, _pubKeyRefund [32]byte) (common.Address, *types.Transaction, *Swap, error) { + parsed, err := SwapMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SwapBin), backend, _pubKeyClaim, _pubKeyRefund) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Swap{SwapCaller: SwapCaller{contract: contract}, SwapTransactor: SwapTransactor{contract: contract}, SwapFilterer: SwapFilterer{contract: contract}}, nil +} + +// Swap is an auto generated Go binding around an Ethereum contract. +type Swap struct { + SwapCaller // Read-only binding to the contract + SwapTransactor // Write-only binding to the contract + SwapFilterer // Log filterer for contract events +} + +// SwapCaller is an auto generated read-only Go binding around an Ethereum contract. +type SwapCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SwapTransactor is an auto generated write-only Go binding around an Ethereum contract. +type SwapTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SwapFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type SwapFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// SwapSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type SwapSession struct { + Contract *Swap // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SwapCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type SwapCallerSession struct { + Contract *SwapCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// SwapTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type SwapTransactorSession struct { + Contract *SwapTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// SwapRaw is an auto generated low-level Go binding around an Ethereum contract. +type SwapRaw struct { + Contract *Swap // Generic contract binding to access the raw methods on +} + +// SwapCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type SwapCallerRaw struct { + Contract *SwapCaller // Generic read-only contract binding to access the raw methods on +} + +// SwapTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type SwapTransactorRaw struct { + Contract *SwapTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewSwap creates a new instance of Swap, bound to a specific deployed contract. +func NewSwap(address common.Address, backend bind.ContractBackend) (*Swap, error) { + contract, err := bindSwap(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Swap{SwapCaller: SwapCaller{contract: contract}, SwapTransactor: SwapTransactor{contract: contract}, SwapFilterer: SwapFilterer{contract: contract}}, nil +} + +// NewSwapCaller creates a new read-only instance of Swap, bound to a specific deployed contract. +func NewSwapCaller(address common.Address, caller bind.ContractCaller) (*SwapCaller, error) { + contract, err := bindSwap(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &SwapCaller{contract: contract}, nil +} + +// NewSwapTransactor creates a new write-only instance of Swap, bound to a specific deployed contract. +func NewSwapTransactor(address common.Address, transactor bind.ContractTransactor) (*SwapTransactor, error) { + contract, err := bindSwap(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &SwapTransactor{contract: contract}, nil +} + +// NewSwapFilterer creates a new log filterer instance of Swap, bound to a specific deployed contract. +func NewSwapFilterer(address common.Address, filterer bind.ContractFilterer) (*SwapFilterer, error) { + contract, err := bindSwap(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &SwapFilterer{contract: contract}, nil +} + +// bindSwap binds a generic wrapper to an already deployed contract. +func bindSwap(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(SwapABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Swap *SwapRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Swap.Contract.SwapCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Swap *SwapRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Swap.Contract.SwapTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Swap *SwapRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Swap.Contract.SwapTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Swap *SwapCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Swap.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Swap *SwapTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Swap.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Swap *SwapTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Swap.Contract.contract.Transact(opts, method, params...) +} + +// PubKeyClaim is a free data retrieval call binding the contract method 0x736290f8. +// +// Solidity: function pubKeyClaim() view returns(bytes32) +func (_Swap *SwapCaller) PubKeyClaim(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "pubKeyClaim") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PubKeyClaim is a free data retrieval call binding the contract method 0x736290f8. +// +// Solidity: function pubKeyClaim() view returns(bytes32) +func (_Swap *SwapSession) PubKeyClaim() ([32]byte, error) { + return _Swap.Contract.PubKeyClaim(&_Swap.CallOpts) +} + +// PubKeyClaim is a free data retrieval call binding the contract method 0x736290f8. +// +// Solidity: function pubKeyClaim() view returns(bytes32) +func (_Swap *SwapCallerSession) PubKeyClaim() ([32]byte, error) { + return _Swap.Contract.PubKeyClaim(&_Swap.CallOpts) +} + +// PubKeyRefund is a free data retrieval call binding the contract method 0x03f7e246. +// +// Solidity: function pubKeyRefund() view returns(bytes32) +func (_Swap *SwapCaller) PubKeyRefund(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "pubKeyRefund") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PubKeyRefund is a free data retrieval call binding the contract method 0x03f7e246. +// +// Solidity: function pubKeyRefund() view returns(bytes32) +func (_Swap *SwapSession) PubKeyRefund() ([32]byte, error) { + return _Swap.Contract.PubKeyRefund(&_Swap.CallOpts) +} + +// PubKeyRefund is a free data retrieval call binding the contract method 0x03f7e246. +// +// Solidity: function pubKeyRefund() view returns(bytes32) +func (_Swap *SwapCallerSession) PubKeyRefund() ([32]byte, error) { + return _Swap.Contract.PubKeyRefund(&_Swap.CallOpts) +} + +// Timeout0 is a free data retrieval call binding the contract method 0x4ded8d52. +// +// Solidity: function timeout_0() view returns(uint256) +func (_Swap *SwapCaller) Timeout0(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "timeout_0") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Timeout0 is a free data retrieval call binding the contract method 0x4ded8d52. +// +// Solidity: function timeout_0() view returns(uint256) +func (_Swap *SwapSession) Timeout0() (*big.Int, error) { + return _Swap.Contract.Timeout0(&_Swap.CallOpts) +} + +// Timeout0 is a free data retrieval call binding the contract method 0x4ded8d52. +// +// Solidity: function timeout_0() view returns(uint256) +func (_Swap *SwapCallerSession) Timeout0() (*big.Int, error) { + return _Swap.Contract.Timeout0(&_Swap.CallOpts) +} + +// Timeout1 is a free data retrieval call binding the contract method 0x45bb8e09. +// +// Solidity: function timeout_1() view returns(uint256) +func (_Swap *SwapCaller) Timeout1(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Swap.contract.Call(opts, &out, "timeout_1") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Timeout1 is a free data retrieval call binding the contract method 0x45bb8e09. +// +// Solidity: function timeout_1() view returns(uint256) +func (_Swap *SwapSession) Timeout1() (*big.Int, error) { + return _Swap.Contract.Timeout1(&_Swap.CallOpts) +} + +// Timeout1 is a free data retrieval call binding the contract method 0x45bb8e09. +// +// Solidity: function timeout_1() view returns(uint256) +func (_Swap *SwapCallerSession) Timeout1() (*big.Int, error) { + return _Swap.Contract.Timeout1(&_Swap.CallOpts) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 _s) returns() +func (_Swap *SwapTransactor) Claim(opts *bind.TransactOpts, _s *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "claim", _s) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 _s) returns() +func (_Swap *SwapSession) Claim(_s *big.Int) (*types.Transaction, error) { + return _Swap.Contract.Claim(&_Swap.TransactOpts, _s) +} + +// Claim is a paid mutator transaction binding the contract method 0x379607f5. +// +// Solidity: function claim(uint256 _s) returns() +func (_Swap *SwapTransactorSession) Claim(_s *big.Int) (*types.Transaction, error) { + return _Swap.Contract.Claim(&_Swap.TransactOpts, _s) +} + +// Refund is a paid mutator transaction binding the contract method 0x278ecde1. +// +// Solidity: function refund(uint256 _s) returns() +func (_Swap *SwapTransactor) Refund(opts *bind.TransactOpts, _s *big.Int) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "refund", _s) +} + +// Refund is a paid mutator transaction binding the contract method 0x278ecde1. +// +// Solidity: function refund(uint256 _s) returns() +func (_Swap *SwapSession) Refund(_s *big.Int) (*types.Transaction, error) { + return _Swap.Contract.Refund(&_Swap.TransactOpts, _s) +} + +// Refund is a paid mutator transaction binding the contract method 0x278ecde1. +// +// Solidity: function refund(uint256 _s) returns() +func (_Swap *SwapTransactorSession) Refund(_s *big.Int) (*types.Transaction, error) { + return _Swap.Contract.Refund(&_Swap.TransactOpts, _s) +} + +// SetReady is a paid mutator transaction binding the contract method 0x74d7c138. +// +// Solidity: function set_ready() returns() +func (_Swap *SwapTransactor) SetReady(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Swap.contract.Transact(opts, "set_ready") +} + +// SetReady is a paid mutator transaction binding the contract method 0x74d7c138. +// +// Solidity: function set_ready() returns() +func (_Swap *SwapSession) SetReady() (*types.Transaction, error) { + return _Swap.Contract.SetReady(&_Swap.TransactOpts) +} + +// SetReady is a paid mutator transaction binding the contract method 0x74d7c138. +// +// Solidity: function set_ready() returns() +func (_Swap *SwapTransactorSession) SetReady() (*types.Transaction, error) { + return _Swap.Contract.SetReady(&_Swap.TransactOpts) +} + +// SwapClaimedIterator is returned from FilterClaimed and is used to iterate over the raw logs and unpacked data for Claimed events raised by the Swap contract. +type SwapClaimedIterator struct { + Event *SwapClaimed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SwapClaimedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SwapClaimed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SwapClaimed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SwapClaimedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SwapClaimedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SwapClaimed represents a Claimed event raised by the Swap contract. +type SwapClaimed struct { + S *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterClaimed is a free log retrieval operation binding the contract event 0x7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8. +// +// Solidity: event Claimed(uint256 s) +func (_Swap *SwapFilterer) FilterClaimed(opts *bind.FilterOpts) (*SwapClaimedIterator, error) { + + logs, sub, err := _Swap.contract.FilterLogs(opts, "Claimed") + if err != nil { + return nil, err + } + return &SwapClaimedIterator{contract: _Swap.contract, event: "Claimed", logs: logs, sub: sub}, nil +} + +// WatchClaimed is a free log subscription operation binding the contract event 0x7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8. +// +// Solidity: event Claimed(uint256 s) +func (_Swap *SwapFilterer) WatchClaimed(opts *bind.WatchOpts, sink chan<- *SwapClaimed) (event.Subscription, error) { + + logs, sub, err := _Swap.contract.WatchLogs(opts, "Claimed") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SwapClaimed) + if err := _Swap.contract.UnpackLog(event, "Claimed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseClaimed is a log parse operation binding the contract event 0x7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8. +// +// Solidity: event Claimed(uint256 s) +func (_Swap *SwapFilterer) ParseClaimed(log types.Log) (*SwapClaimed, error) { + event := new(SwapClaimed) + if err := _Swap.contract.UnpackLog(event, "Claimed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SwapConstructedIterator is returned from FilterConstructed and is used to iterate over the raw logs and unpacked data for Constructed events raised by the Swap contract. +type SwapConstructedIterator struct { + Event *SwapConstructed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SwapConstructedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SwapConstructed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SwapConstructed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SwapConstructedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SwapConstructedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SwapConstructed represents a Constructed event raised by the Swap contract. +type SwapConstructed struct { + P [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterConstructed is a free log retrieval operation binding the contract event 0x1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb. +// +// Solidity: event Constructed(bytes32 p) +func (_Swap *SwapFilterer) FilterConstructed(opts *bind.FilterOpts) (*SwapConstructedIterator, error) { + + logs, sub, err := _Swap.contract.FilterLogs(opts, "Constructed") + if err != nil { + return nil, err + } + return &SwapConstructedIterator{contract: _Swap.contract, event: "Constructed", logs: logs, sub: sub}, nil +} + +// WatchConstructed is a free log subscription operation binding the contract event 0x1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb. +// +// Solidity: event Constructed(bytes32 p) +func (_Swap *SwapFilterer) WatchConstructed(opts *bind.WatchOpts, sink chan<- *SwapConstructed) (event.Subscription, error) { + + logs, sub, err := _Swap.contract.WatchLogs(opts, "Constructed") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SwapConstructed) + if err := _Swap.contract.UnpackLog(event, "Constructed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseConstructed is a log parse operation binding the contract event 0x1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb. +// +// Solidity: event Constructed(bytes32 p) +func (_Swap *SwapFilterer) ParseConstructed(log types.Log) (*SwapConstructed, error) { + event := new(SwapConstructed) + if err := _Swap.contract.UnpackLog(event, "Constructed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SwapIsReadyIterator is returned from FilterIsReady and is used to iterate over the raw logs and unpacked data for IsReady events raised by the Swap contract. +type SwapIsReadyIterator struct { + Event *SwapIsReady // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SwapIsReadyIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SwapIsReady) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SwapIsReady) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SwapIsReadyIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SwapIsReadyIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SwapIsReady represents a IsReady event raised by the Swap contract. +type SwapIsReady struct { + B bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterIsReady is a free log retrieval operation binding the contract event 0x2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4. +// +// Solidity: event IsReady(bool b) +func (_Swap *SwapFilterer) FilterIsReady(opts *bind.FilterOpts) (*SwapIsReadyIterator, error) { + + logs, sub, err := _Swap.contract.FilterLogs(opts, "IsReady") + if err != nil { + return nil, err + } + return &SwapIsReadyIterator{contract: _Swap.contract, event: "IsReady", logs: logs, sub: sub}, nil +} + +// WatchIsReady is a free log subscription operation binding the contract event 0x2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4. +// +// Solidity: event IsReady(bool b) +func (_Swap *SwapFilterer) WatchIsReady(opts *bind.WatchOpts, sink chan<- *SwapIsReady) (event.Subscription, error) { + + logs, sub, err := _Swap.contract.WatchLogs(opts, "IsReady") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SwapIsReady) + if err := _Swap.contract.UnpackLog(event, "IsReady", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseIsReady is a log parse operation binding the contract event 0x2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4. +// +// Solidity: event IsReady(bool b) +func (_Swap *SwapFilterer) ParseIsReady(log types.Log) (*SwapIsReady, error) { + event := new(SwapIsReady) + if err := _Swap.contract.UnpackLog(event, "IsReady", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// SwapRefundedIterator is returned from FilterRefunded and is used to iterate over the raw logs and unpacked data for Refunded events raised by the Swap contract. +type SwapRefundedIterator struct { + Event *SwapRefunded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *SwapRefundedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(SwapRefunded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(SwapRefunded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *SwapRefundedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *SwapRefundedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// SwapRefunded represents a Refunded event raised by the Swap contract. +type SwapRefunded struct { + S *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRefunded is a free log retrieval operation binding the contract event 0x3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c. +// +// Solidity: event Refunded(uint256 s) +func (_Swap *SwapFilterer) FilterRefunded(opts *bind.FilterOpts) (*SwapRefundedIterator, error) { + + logs, sub, err := _Swap.contract.FilterLogs(opts, "Refunded") + if err != nil { + return nil, err + } + return &SwapRefundedIterator{contract: _Swap.contract, event: "Refunded", logs: logs, sub: sub}, nil +} + +// WatchRefunded is a free log subscription operation binding the contract event 0x3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c. +// +// Solidity: event Refunded(uint256 s) +func (_Swap *SwapFilterer) WatchRefunded(opts *bind.WatchOpts, sink chan<- *SwapRefunded) (event.Subscription, error) { + + logs, sub, err := _Swap.contract.WatchLogs(opts, "Refunded") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(SwapRefunded) + if err := _Swap.contract.UnpackLog(event, "Refunded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRefunded is a log parse operation binding the contract event 0x3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c. +// +// Solidity: event Refunded(uint256 s) +func (_Swap *SwapFilterer) ParseRefunded(log types.Log) (*SwapRefunded, error) { + event := new(SwapRefunded) + if err := _Swap.contract.UnpackLog(event, "Refunded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/swapOnChain-contract/swapOnChain_test.go b/swap-contract/swap_test.go similarity index 92% rename from swapOnChain-contract/swapOnChain_test.go rename to swap-contract/swap_test.go index b7a9983c..958d46f2 100644 --- a/swapOnChain-contract/swapOnChain_test.go +++ b/swap-contract/swap_test.go @@ -1,4 +1,4 @@ -package swapOnChain +package swap import ( "context" @@ -28,12 +28,12 @@ func reverse(s []byte) []byte { return s } -func setBigIntLE(s []byte) *big.Int { +func setBigIntLE(s []byte) *big.Int { //nolint s = reverse(s) return big.NewInt(0).SetBytes(s) } -func TestDeploySwapOnChain(t *testing.T) { +func TestDeploySwap(t *testing.T) { conn, err := ethclient.Dial("http://127.0.0.1:8545") require.NoError(t, err) @@ -43,7 +43,7 @@ func TestDeploySwapOnChain(t *testing.T) { authAlice, err := bind.NewKeyedTransactorWithChainID(pk_a, big.NewInt(1337)) // ganache chainID require.NoError(t, err) - address, tx, swapContract, err := DeploySwapOnChain(authAlice, conn, [32]byte{}, [32]byte{}) + address, tx, swapContract, err := DeploySwap(authAlice, conn, [32]byte{}, [32]byte{}) require.NoError(t, err) t.Log(address) @@ -71,6 +71,7 @@ func TestSwap_Claim(t *testing.T) { pk_a, err := crypto.HexToECDSA(keyAlice) require.NoError(t, err) pk_b, err := crypto.HexToECDSA(keyBob) + require.NoError(t, err) authAlice, err := bind.NewKeyedTransactorWithChainID(pk_a, big.NewInt(1337)) // ganache chainID authAlice.Value = big.NewInt(10) @@ -79,23 +80,29 @@ func TestSwap_Claim(t *testing.T) { require.NoError(t, err) aliceBalanceBefore, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceBefore: ", aliceBalanceBefore) + // check whether Bob had nothing before the Tx bobBalanceBefore, err := conn.BalanceAt(context.Background(), authBob.From, nil) - fmt.Println("BobBalanceBefore: ", bobBalanceBefore) require.NoError(t, err) + fmt.Println("BobBalanceBefore: ", bobBalanceBefore) var pkAliceFixed [32]byte copy(pkAliceFixed[:], reverse(pubKeyAlice)) var pkBobFixed [32]byte copy(pkBobFixed[:], reverse(pubKeyBob)) - contractAddress, deployTx, swap, err := DeploySwapOnChain(authAlice, conn, pkBobFixed, pkAliceFixed) - fmt.Println("Deploy Tx Gas Cost:", deployTx.Gas()) - aliceBalanceAfter, err := conn.BalanceAt(context.Background(), authAlice.From, nil) - fmt.Println("AliceBalanceAfter: ", aliceBalanceAfter) - contractBalance, err := conn.BalanceAt(context.Background(), contractAddress, nil) - require.Equal(t, contractBalance, big.NewInt(10)) + contractAddress, deployTx, swap, err := DeploySwap(authAlice, conn, pkBobFixed, pkAliceFixed) require.NoError(t, err) + fmt.Println("Deploy Tx Gas Cost:", deployTx.Gas()) + + aliceBalanceAfter, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) + fmt.Println("AliceBalanceAfter: ", aliceBalanceAfter) + + contractBalance, err := conn.BalanceAt(context.Background(), contractAddress, nil) + require.NoError(t, err) + require.Equal(t, contractBalance, big.NewInt(10)) txOpts := &bind.TransactOpts{ From: authAlice.From, @@ -161,17 +168,19 @@ func TestSwap_Refund_Within_T0(t *testing.T) { require.NoError(t, err) authAlice, err := bind.NewKeyedTransactorWithChainID(pk_a, big.NewInt(1337)) // ganache chainID - authAlice.Value = big.NewInt(10) require.NoError(t, err) + authAlice.Value = big.NewInt(10) aliceBalanceBefore, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceBefore: ", aliceBalanceBefore) var pkAliceFixed [32]byte copy(pkAliceFixed[:], reverse(pubKeyAlice)) var pkBobFixed [32]byte copy(pkBobFixed[:], reverse(pubKeyBob)) - contractAddress, _, swap, err := DeploySwapOnChain(authAlice, conn, pkBobFixed, pkAliceFixed) + contractAddress, _, swap, err := DeploySwap(authAlice, conn, pkBobFixed, pkAliceFixed) + require.NoError(t, err) txOpts := &bind.TransactOpts{ From: authAlice.From, @@ -219,13 +228,15 @@ func TestSwap_Refund_After_T1(t *testing.T) { require.NoError(t, err) aliceBalanceBefore, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceBefore: ", aliceBalanceBefore) var pkAliceFixed [32]byte copy(pkAliceFixed[:], reverse(pubKeyAlice)) var pkBobFixed [32]byte copy(pkBobFixed[:], reverse(pubKeyBob)) - contractAddress, _, swap, err := DeploySwapOnChain(authAlice, conn, pkBobFixed, pkAliceFixed) + contractAddress, _, swap, err := DeploySwap(authAlice, conn, pkBobFixed, pkAliceFixed) + require.NoError(t, err) txOpts := &bind.TransactOpts{ From: authAlice.From, @@ -244,6 +255,7 @@ func TestSwap_Refund_After_T1(t *testing.T) { // wait some, then try again var result int64 rpcClient, err := rpc.Dial("http://127.0.0.1:8545") + require.NoError(t, err) ret := rpcClient.Call(&result, "evm_increaseTime", 3600*25) require.NoError(t, ret) diff --git a/swapDLEQ-contract/swapDLEQ_test.go b/swap-dleq-contract/swap_dlep_test.go similarity index 98% rename from swapDLEQ-contract/swapDLEQ_test.go rename to swap-dleq-contract/swap_dlep_test.go index f4e8185a..e4d8f48f 100644 --- a/swapDLEQ-contract/swapDLEQ_test.go +++ b/swap-dleq-contract/swap_dlep_test.go @@ -1,4 +1,4 @@ -package swapDLEQ +package swapdleq import ( "context" @@ -130,6 +130,7 @@ func TestSwap_Claim(t *testing.T) { pk_a, err := crypto.HexToECDSA(keyAlice) require.NoError(t, err) pk_b, err := crypto.HexToECDSA(keyBob) + require.NoError(t, err) authAlice, err := bind.NewKeyedTransactorWithChainID(pk_a, big.NewInt(1337)) // ganache chainID authAlice.Value = big.NewInt(10) @@ -138,11 +139,13 @@ func TestSwap_Claim(t *testing.T) { require.NoError(t, err) aliceBalanceBefore, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceBefore: ", aliceBalanceBefore) + // check whether Bob had nothing before the Tx bobBalanceBefore, err := conn.BalanceAt(context.Background(), authBob.From, nil) - fmt.Println("BobBalanceBefore: ", bobBalanceBefore) require.NoError(t, err) + fmt.Println("BobBalanceBefore: ", bobBalanceBefore) var pkAliceFixedX [32]byte // copy(pkAliceFixedX[:], reverse(pubKeyAliceX.Bytes())) @@ -156,13 +159,18 @@ func TestSwap_Claim(t *testing.T) { var pkBobFixedY [32]byte // copy(pkBobFixedY[:], reverse(pubKeyBobY.Bytes())) copy(pkBobFixedY[:], reverse(secp256k1BobY)) + contractAddress, deployTx, swap, err := DeploySwapDLEQ(authAlice, conn, setBigIntLE(pkBobFixedX[:]), setBigIntLE(pkBobFixedY[:]), setBigIntLE(pkAliceFixedX[:]), setBigIntLE(pkAliceFixedY[:])) - fmt.Println("Deploy Tx Gas Cost:", deployTx.Gas()) - aliceBalanceAfter, err := conn.BalanceAt(context.Background(), authAlice.From, nil) - fmt.Println("AliceBalanceAfter: ", aliceBalanceAfter) - contractBalance, err := conn.BalanceAt(context.Background(), contractAddress, nil) - require.Equal(t, contractBalance, big.NewInt(10)) require.NoError(t, err) + fmt.Println("Deploy Tx Gas Cost:", deployTx.Gas()) + + aliceBalanceAfter, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) + fmt.Println("AliceBalanceAfter: ", aliceBalanceAfter) + + contractBalance, err := conn.BalanceAt(context.Background(), contractAddress, nil) + require.NoError(t, err) + require.Equal(t, contractBalance, big.NewInt(10)) txOpts := &bind.TransactOpts{ From: authAlice.From, @@ -275,7 +283,6 @@ func TestSwap_Refund_Within_T0(t *testing.T) { require.NoError(t, err) fmt.Println("AliceParsed: ", secp256k1AliceX, secp256k1AliceY) - // setup conn, err := ethclient.Dial("ws://127.0.0.1:8545") require.NoError(t, err) @@ -284,10 +291,11 @@ func TestSwap_Refund_Within_T0(t *testing.T) { require.NoError(t, err) authAlice, err := bind.NewKeyedTransactorWithChainID(pk_a, big.NewInt(1337)) // ganache chainID - authAlice.Value = big.NewInt(10) require.NoError(t, err) + authAlice.Value = big.NewInt(10) aliceBalanceBefore, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceBefore: ", aliceBalanceBefore) var pkAliceFixedX [32]byte @@ -303,8 +311,11 @@ func TestSwap_Refund_Within_T0(t *testing.T) { // copy(pkBobFixedY[:], reverse(pubKeyBobY.Bytes())) copy(pkBobFixedY[:], reverse(secp256k1BobY)) contractAddress, deployTx, swap, err := DeploySwapDLEQ(authAlice, conn, setBigIntLE(pkBobFixedX[:]), setBigIntLE(pkBobFixedY[:]), setBigIntLE(pkAliceFixedX[:]), setBigIntLE(pkAliceFixedY[:])) + require.NoError(t, err) fmt.Println("Deploy Tx Gas Cost:", deployTx.Gas()) + aliceBalanceAfter, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceAfter: ", aliceBalanceAfter) txOpts := &bind.TransactOpts{ @@ -405,10 +416,11 @@ func TestSwap_Refund_After_T1(t *testing.T) { require.NoError(t, err) authAlice, err := bind.NewKeyedTransactorWithChainID(pk_a, big.NewInt(1337)) // ganache chainID - authAlice.Value = big.NewInt(10) require.NoError(t, err) + authAlice.Value = big.NewInt(10) aliceBalanceBefore, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceBefore: ", aliceBalanceBefore) var pkAliceFixedX [32]byte @@ -424,8 +436,11 @@ func TestSwap_Refund_After_T1(t *testing.T) { // copy(pkBobFixedY[:], reverse(pubKeyBobY.Bytes())) copy(pkBobFixedY[:], reverse(secp256k1BobY)) contractAddress, deployTx, swap, err := DeploySwapDLEQ(authAlice, conn, setBigIntLE(pkBobFixedX[:]), setBigIntLE(pkBobFixedY[:]), setBigIntLE(pkAliceFixedX[:]), setBigIntLE(pkAliceFixedY[:])) + require.NoError(t, err) fmt.Println("Deploy Tx Gas Cost:", deployTx.Gas()) + aliceBalanceAfter, err := conn.BalanceAt(context.Background(), authAlice.From, nil) + require.NoError(t, err) fmt.Println("AliceBalanceAfter: ", aliceBalanceAfter) txOpts := &bind.TransactOpts{ From: authAlice.From, @@ -444,6 +459,7 @@ func TestSwap_Refund_After_T1(t *testing.T) { // wait some, then try again var result int64 rpcClient, err := rpc.Dial("http://127.0.0.1:8545") + require.NoError(t, err) ret := rpcClient.Call(&result, "evm_increaseTime", 3600*25) require.NoError(t, ret) diff --git a/swapDLEQ-contract/swapDLEQ.go b/swap-dleq-contract/swap_dleq.go similarity index 99% rename from swapDLEQ-contract/swapDLEQ.go rename to swap-dleq-contract/swap_dleq.go index 59455204..100e5bf7 100644 --- a/swapDLEQ-contract/swapDLEQ.go +++ b/swap-dleq-contract/swap_dleq.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package swapDLEQ +package swapdleq import ( "errors" @@ -31,7 +31,7 @@ var ( // SwapDLEQMetaData contains all meta data concerning the SwapDLEQ contract. var SwapDLEQMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pubKeyClaimX\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pubKeyClaimY\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pubKeyRefundX\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_pubKeyRefundY\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"name\":\"Constructed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"b\",\"type\":\"bool\"}],\"name\":\"IsReady\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"Refunded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_s\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyClaimX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyClaimY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyRefundX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyRefundY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_s\",\"type\":\"uint256\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"set_ready\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeout_0\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeout_1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x6101606040526000600160006101000a81548160ff02191690831515021790555060405162002542380380620025428339818101604052810190620000459190620001a6565b3373ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250508360c081815250508260e081815250508161010081815250508061012081815250506201518042620000ac919062000247565b6101408181525050604051620000c29062000158565b604051809103906000f080158015620000df573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250507fbc91786c56ba12548733c92d8dc8bc6e725d7ac2eb0c3039fddbcfbf19a852a9828260405162000146929190620002b5565b60405180910390a150505050620002e2565b61151d806200102583390190565b600080fd5b6000819050919050565b62000180816200016b565b81146200018c57600080fd5b50565b600081519050620001a08162000175565b92915050565b60008060008060808587031215620001c357620001c262000166565b5b6000620001d3878288016200018f565b9450506020620001e6878288016200018f565b9350506040620001f9878288016200018f565b92505060606200020c878288016200018f565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000254826200016b565b915062000261836200016b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111562000299576200029862000218565b5b828201905092915050565b620002af816200016b565b82525050565b6000604082019050620002cc6000830185620002a4565b620002db6020830184620002a4565b9392505050565b60805160a05160c05160e051610100516101205161014051610ca96200037c6000396000818161021a0152818161047e01528181610664015261071b0152600081816102db01526106880152600081816102ba01526107b101526000818161054001526107d5015260008181610190015261051f0152600081816103e001526106c401526000818161027d01526104e20152610ca96000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80634ded8d52116100665780634ded8d521461010c5780636edc1dcc1461012a57806374d7c13814610148578063bab8458d14610152578063dd5620b51461017057610093565b806313d9822314610098578063278ecde1146100b6578063379607f5146100d257806345bb8e09146100ee575b600080fd5b6100a061018e565b6040516100ad9190610810565b60405180910390f35b6100d060048036038101906100cb919061085c565b6101b2565b005b6100ec60048036038101906100e7919061085c565b610417565b005b6100f661065c565b6040516101039190610810565b60405180910390f35b610114610662565b6040516101219190610810565b60405180910390f35b610132610686565b60405161013f9190610810565b60405180910390f35b6101506106aa565b005b61015a6107af565b6040516101679190610810565b60405180910390f35b6101786107d3565b6040516101859190610810565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60011515600160009054906101000a900460ff161515141561021857600054421015610213576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020a9061090c565b60405180910390fd5b61027b565b7f0000000000000000000000000000000000000000000000000000000000000000421061027a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027190610978565b60405180910390fd5b5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166366ce10b7827f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040518463ffffffff1660e01b815260040161031893929190610998565b60206040518083038186803b15801561033057600080fd5b505afa158015610344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103689190610a07565b6103a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039e90610aa6565b60405180910390fd5b7f3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c816040516103d69190610810565b60405180910390a17f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16ff5b60011515600160009054906101000a900460ff161515141561047c576000544210610477576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161046e90610b12565b60405180910390fd5b6104e0565b7f00000000000000000000000000000000000000000000000000000000000000004210156104df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d690610ba4565b60405180910390fd5b5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166366ce10b7827f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040518463ffffffff1660e01b815260040161057d93929190610998565b60206040518083038186803b15801561059557600080fd5b505afa1580156105a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cd9190610a07565b61060c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060390610aa6565b60405180910390fd5b7f7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb88160405161063b9190610810565b60405180910390a13373ffffffffffffffffffffffffffffffffffffffff16ff5b60005481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900460ff1615801561071257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b801561073d57507f000000000000000000000000000000000000000000000000000000000000000042105b61074657600080fd5b60018060006101000a81548160ff021916908315150217905550620151804261076f9190610bf3565b6000819055507f2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd460016040516107a59190610c58565b60405180910390a1565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000819050919050565b61080a816107f7565b82525050565b60006020820190506108256000830184610801565b92915050565b600080fd5b610839816107f7565b811461084457600080fd5b50565b60008135905061085681610830565b92915050565b6000602082840312156108725761087161082b565b5b600061088084828501610847565b91505092915050565b600082825260208201905092915050565b7f4974277320426f622773207475726e206e6f772c20706c65617365207761697460008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b60006108f6602183610889565b91506109018261089a565b604082019050919050565b60006020820190508181036000830152610925816108e9565b9050919050565b7f4d697373656420796f7572206368616e63652100000000000000000000000000600082015250565b6000610962601383610889565b915061096d8261092c565b602082019050919050565b6000602082019050818103600083015261099181610955565b9050919050565b60006060820190506109ad6000830186610801565b6109ba6020830185610801565b6109c76040830184610801565b949350505050565b60008115159050919050565b6109e4816109cf565b81146109ef57600080fd5b50565b600081519050610a01816109db565b92915050565b600060208284031215610a1d57610a1c61082b565b5b6000610a2b848285016109f2565b91505092915050565b7f70726f76696465642073656372657420646f6573206e6f74206d61746368207460008201527f6865206578706563746564207075624b65790000000000000000000000000000602082015250565b6000610a90603283610889565b9150610a9b82610a34565b604082019050919050565b60006020820190508181036000830152610abf81610a83565b9050919050565b7f546f6f206c61746520746f20636c61696d210000000000000000000000000000600082015250565b6000610afc601283610889565b9150610b0782610ac6565b602082019050919050565b60006020820190508181036000830152610b2b81610aef565b9050919050565b7f2769735265616479203d3d2066616c7365272063616e6e6f7420636c61696d2060008201527f7965742100000000000000000000000000000000000000000000000000000000602082015250565b6000610b8e602483610889565b9150610b9982610b32565b604082019050919050565b60006020820190508181036000830152610bbd81610b81565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610bfe826107f7565b9150610c09836107f7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610c3e57610c3d610bc4565b5b828201905092915050565b610c52816109cf565b82525050565b6000602082019050610c6d6000830184610c49565b9291505056fea2646970667358221220b30b28b3a6902af0d29ef6a25fb28651b161620b549bb20da1ca2f62ad868e0d64736f6c63430008090033608060405234801561001057600080fd5b506114fd806100206000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80635f972df8116100ad578063913f424c11610071578063913f424c14610372578063bb8c256a146103a4578063db318833146103d5578063e241c1d914610407578063f47289e11461043857610121565b80635f972df81461027f57806366ce10b7146102b05780638081a1e7146102e05780638940aebe146103115780638cecf66e1461034257610121565b80631ecfe64d116100f45780631ecfe64d146101c35780632d58c9a2146101f45780632e52d606146102125780634df7e3d0146102305780635b7648111461024e57610121565b80630138e31b14610126578063022079d91461015757806306c91ce3146101875780630dbe671f146101a5575b600080fd5b610140600480360381019061013b9190610fbb565b61046a565b60405161014e929190611031565b60405180910390f35b610171600480360381019061016c919061105a565b610544565b60405161017e91906110f0565b60405180910390f35b61018f61065f565b60405161019c919061110b565b60405180910390f35b6101ad610683565b6040516101ba919061110b565b60405180910390f35b6101dd60048036038101906101d89190610fbb565b610688565b6040516101eb929190611031565b60405180910390f35b6101fc61078d565b604051610209919061110b565b60405180910390f35b61021a6107b1565b604051610227919061110b565b60405180910390f35b6102386107d5565b604051610245919061110b565b60405180910390f35b61026860048036038101906102639190610fbb565b6107da565b604051610276929190611031565b60405180910390f35b61029960048036038101906102949190610fbb565b610852565b6040516102a7929190611031565b60405180910390f35b6102ca60048036038101906102c59190611126565b6108ca565b6040516102d791906110f0565b60405180910390f35b6102fa60048036038101906102f59190611126565b610922565b604051610308929190611031565b60405180910390f35b61032b60048036038101906103269190611179565b6109bc565b604051610339929190611031565b60405180910390f35b61035c60048036038101906103579190611179565b610a13565b604051610369919061110b565b60405180910390f35b61038c60048036038101906103879190610fbb565b610b2c565b60405161039b939291906111a6565b60405180910390f35b6103be60048036038101906103b99190610fbb565b610be8565b6040516103cc929190611031565b60405180910390f35b6103ef60048036038101906103ea91906111dd565b610c86565b6040516103fe939291906111a6565b60405180910390f35b610421600480360381019061041c9190611126565b610ebe565b60405161042f929190611031565b60405180910390f35b610452600480360381019061044d9190611126565b610f58565b604051610461939291906111a6565b60405180910390f35b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061049c5761049b61126a565b5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806104cb576104ca61126a565b5b8686097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806104fd576104fc61126a565b5b888609087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806105305761052f61126a565b5b848709809250819350505094509492505050565b6000807ffffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036414190506000600160008060028a61057e9190611299565b141561058b57601b61058e565b601c5b8a60001b85806105a1576105a061126a565b5b8c8b0960001b604051600081526020016040526040516105c49493929190611347565b6020604051602081039080840390855afa1580156105e6573d6000803e3d6000fd5b505050602060405103519050600085856040516020016106079291906113ad565b6040516020818303038152906040528051906020012060001c90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614935050505095945050505050565b7f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179881565b600081565b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806106ba576106b961126a565b5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806106e9576106e861126a565b5b86867ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6107169190611408565b097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806107465761074561126a565b5b888609087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806107795761077861126a565b5b848709809250819350505094509492505050565b7f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b881565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f81565b600781565b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061080c5761080b61126a565b5b8487097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061083e5761083d61126a565b5b848709809250819350505094509492505050565b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806108845761088361126a565b5b8387097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806108b6576108b561126a565b5b858709809250819350505094509492505050565b60006109197f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8868686610544565b90509392505050565b60008060006109348487876001610b2c565b80935081945082955050505061094981610a13565b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061097a5761097961126a565b5b81840992507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806109ae576109ad61126a565b5b818309915050935093915050565b600080610a0a7f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b885610922565b91509150915091565b6000806000905060006001905060007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f9050600085905060005b60008214610b1f578183610a61919061143c565b9050837ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610a9357610a9261126a565b5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610ac257610ac161126a565b5b8684097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f610af09190611408565b87088095508196505050818282610b07919061146d565b84610b129190611408565b8093508194505050610a4d565b8495505050505050919050565b60008060008087905060008790506000879050600087905060008060006001905060008e1415610b6d57600080600199509950995050505050505050610bde565b5b60008714610bc75760006001881614610b9c57610b8f838383898989610c86565b8093508194508295505050505b600287610ba9919061143c565b9650610bb6868686610f58565b809650819750829850505050610b6e565b828282809a50819b50829c50505050505050505050505b9450945094915050565b6000806000610bfd8787600188886001610c86565b809350819450829550505050610c1281610a13565b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610c4357610c4261126a565b5b81840992507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610c7757610c7661126a565b5b81830991505094509492505050565b6000806000806000806000808d148015610ca0575060008c145b15610cb75789898996509650965050505050610eb2565b60008a148015610cc75750600089145b15610cde578c8c8c96509650965050505050610eb2565b898d148015610cec5750888c145b15610d4c57610cfd8d8c8f8e6107da565b8094508195505050610d138484600360016107da565b8094508195505050610d2984846000600161046a565b8094508195505050610d3f8c8c600260016107da565b8092508193505050610d75565b610d5889898e8e610688565b8094508195505050610d6c8a898f8e610688565b80925081935050505b610d8184848484610852565b8094508195505050610d95848486866107da565b8093508198505050610da987838f8e610688565b8093508198505050610dbd87838c8b610688565b8093508198505050610dd18d8c8985610688565b8092508197505050610de5868286866107da565b8092508197505050610df986828e8e610688565b8092508197505050808214610ea9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610e3757610e3661126a565b5b81880996507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610e6b57610e6a61126a565b5b82870995507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610e9f57610e9e61126a565b5b8183099450610ead565b8194505b505050505b96509650969350505050565b6000806000610ed08686866001610b2c565b809350819450829550505050610ee581610a13565b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610f1657610f1561126a565b5b81840992507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610f4a57610f4961126a565b5b818309915050935093915050565b6000806000610f6b868686898989610c86565b80935081945082955050505093509350939050565b600080fd5b6000819050919050565b610f9881610f85565b8114610fa357600080fd5b50565b600081359050610fb581610f8f565b92915050565b60008060008060808587031215610fd557610fd4610f80565b5b6000610fe387828801610fa6565b9450506020610ff487828801610fa6565b935050604061100587828801610fa6565b925050606061101687828801610fa6565b91505092959194509250565b61102b81610f85565b82525050565b60006040820190506110466000830185611022565b6110536020830184611022565b9392505050565b600080600080600060a0868803121561107657611075610f80565b5b600061108488828901610fa6565b955050602061109588828901610fa6565b94505060406110a688828901610fa6565b93505060606110b788828901610fa6565b92505060806110c888828901610fa6565b9150509295509295909350565b60008115159050919050565b6110ea816110d5565b82525050565b600060208201905061110560008301846110e1565b92915050565b60006020820190506111206000830184611022565b92915050565b60008060006060848603121561113f5761113e610f80565b5b600061114d86828701610fa6565b935050602061115e86828701610fa6565b925050604061116f86828701610fa6565b9150509250925092565b60006020828403121561118f5761118e610f80565b5b600061119d84828501610fa6565b91505092915050565b60006060820190506111bb6000830186611022565b6111c86020830185611022565b6111d56040830184611022565b949350505050565b60008060008060008060c087890312156111fa576111f9610f80565b5b600061120889828a01610fa6565b965050602061121989828a01610fa6565b955050604061122a89828a01610fa6565b945050606061123b89828a01610fa6565b935050608061124c89828a01610fa6565b92505060a061125d89828a01610fa6565b9150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006112a482610f85565b91506112af83610f85565b9250826112bf576112be61126a565b5b828206905092915050565b6000819050919050565b6000819050919050565b60008160001b9050919050565b60006113066113016112fc846112ca565b6112de565b6112d4565b9050919050565b611316816112eb565b82525050565b600060ff82169050919050565b6113328161131c565b82525050565b611341816112d4565b82525050565b600060808201905061135c600083018761130d565b6113696020830186611329565b6113766040830185611338565b6113836060830184611338565b95945050505050565b6000819050919050565b6113a76113a282610f85565b61138c565b82525050565b60006113b98285611396565b6020820191506113c98284611396565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061141382610f85565b915061141e83610f85565b925082821015611431576114306113d9565b5b828203905092915050565b600061144782610f85565b915061145283610f85565b9250826114625761146161126a565b5b828204905092915050565b600061147882610f85565b915061148383610f85565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156114bc576114bb6113d9565b5b82820290509291505056fea2646970667358221220f81983bfaa15e20a9df1c51d692c116ecca46d245b1ea48b7b50dbbfe30a0b4464736f6c63430008090033", + Bin: "0x6101606040526000600160006101000a81548160ff02191690831515021790555060405162002542380380620025428339818101604052810190620000459190620001a6565b3373ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250508360c081815250508260e081815250508161010081815250508061012081815250506201518042620000ac919062000247565b6101408181525050604051620000c29062000158565b604051809103906000f080158015620000df573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250507fbc91786c56ba12548733c92d8dc8bc6e725d7ac2eb0c3039fddbcfbf19a852a9828260405162000146929190620002b5565b60405180910390a150505050620002e2565b61151d806200102583390190565b600080fd5b6000819050919050565b62000180816200016b565b81146200018c57600080fd5b50565b600081519050620001a08162000175565b92915050565b60008060008060808587031215620001c357620001c262000166565b5b6000620001d3878288016200018f565b9450506020620001e6878288016200018f565b9350506040620001f9878288016200018f565b92505060606200020c878288016200018f565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600062000254826200016b565b915062000261836200016b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111562000299576200029862000218565b5b828201905092915050565b620002af816200016b565b82525050565b6000604082019050620002cc6000830185620002a4565b620002db6020830184620002a4565b9392505050565b60805160a05160c05160e051610100516101205161014051610ca96200037c6000396000818161021a0152818161047e01528181610664015261071b0152600081816102db01526106880152600081816102ba01526107b101526000818161054001526107d5015260008181610190015261051f0152600081816103e001526106c401526000818161027d01526104e20152610ca96000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80634ded8d52116100665780634ded8d521461010c5780636edc1dcc1461012a57806374d7c13814610148578063bab8458d14610152578063dd5620b51461017057610093565b806313d9822314610098578063278ecde1146100b6578063379607f5146100d257806345bb8e09146100ee575b600080fd5b6100a061018e565b6040516100ad9190610810565b60405180910390f35b6100d060048036038101906100cb919061085c565b6101b2565b005b6100ec60048036038101906100e7919061085c565b610417565b005b6100f661065c565b6040516101039190610810565b60405180910390f35b610114610662565b6040516101219190610810565b60405180910390f35b610132610686565b60405161013f9190610810565b60405180910390f35b6101506106aa565b005b61015a6107af565b6040516101679190610810565b60405180910390f35b6101786107d3565b6040516101859190610810565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b60011515600160009054906101000a900460ff161515141561021857600054421015610213576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020a9061090c565b60405180910390fd5b61027b565b7f0000000000000000000000000000000000000000000000000000000000000000421061027a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027190610978565b60405180910390fd5b5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166366ce10b7827f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040518463ffffffff1660e01b815260040161031893929190610998565b60206040518083038186803b15801561033057600080fd5b505afa158015610344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103689190610a07565b6103a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039e90610aa6565b60405180910390fd5b7f3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c816040516103d69190610810565b60405180910390a17f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16ff5b60011515600160009054906101000a900460ff161515141561047c576000544210610477576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161046e90610b12565b60405180910390fd5b6104e0565b7f00000000000000000000000000000000000000000000000000000000000000004210156104df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d690610ba4565b60405180910390fd5b5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166366ce10b7827f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006040518463ffffffff1660e01b815260040161057d93929190610998565b60206040518083038186803b15801561059557600080fd5b505afa1580156105a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cd9190610a07565b61060c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060390610aa6565b60405180910390fd5b7f7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb88160405161063b9190610810565b60405180910390a13373ffffffffffffffffffffffffffffffffffffffff16ff5b60005481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900460ff1615801561071257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b801561073d57507f000000000000000000000000000000000000000000000000000000000000000042105b61074657600080fd5b60018060006101000a81548160ff021916908315150217905550620151804261076f9190610bf3565b6000819055507f2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd460016040516107a59190610c58565b60405180910390a1565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000819050919050565b61080a816107f7565b82525050565b60006020820190506108256000830184610801565b92915050565b600080fd5b610839816107f7565b811461084457600080fd5b50565b60008135905061085681610830565b92915050565b6000602082840312156108725761087161082b565b5b600061088084828501610847565b91505092915050565b600082825260208201905092915050565b7f4974277320426f622773207475726e206e6f772c20706c65617365207761697460008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b60006108f6602183610889565b91506109018261089a565b604082019050919050565b60006020820190508181036000830152610925816108e9565b9050919050565b7f4d697373656420796f7572206368616e63652100000000000000000000000000600082015250565b6000610962601383610889565b915061096d8261092c565b602082019050919050565b6000602082019050818103600083015261099181610955565b9050919050565b60006060820190506109ad6000830186610801565b6109ba6020830185610801565b6109c76040830184610801565b949350505050565b60008115159050919050565b6109e4816109cf565b81146109ef57600080fd5b50565b600081519050610a01816109db565b92915050565b600060208284031215610a1d57610a1c61082b565b5b6000610a2b848285016109f2565b91505092915050565b7f70726f76696465642073656372657420646f6573206e6f74206d61746368207460008201527f6865206578706563746564207075624b65790000000000000000000000000000602082015250565b6000610a90603283610889565b9150610a9b82610a34565b604082019050919050565b60006020820190508181036000830152610abf81610a83565b9050919050565b7f546f6f206c61746520746f20636c61696d210000000000000000000000000000600082015250565b6000610afc601283610889565b9150610b0782610ac6565b602082019050919050565b60006020820190508181036000830152610b2b81610aef565b9050919050565b7f2769735265616479203d3d2066616c7365272063616e6e6f7420636c61696d2060008201527f7965742100000000000000000000000000000000000000000000000000000000602082015250565b6000610b8e602483610889565b9150610b9982610b32565b604082019050919050565b60006020820190508181036000830152610bbd81610b81565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610bfe826107f7565b9150610c09836107f7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610c3e57610c3d610bc4565b5b828201905092915050565b610c52816109cf565b82525050565b6000602082019050610c6d6000830184610c49565b9291505056fea26469706673582212208ff70bc20f908bb331f6d2e132e93f184c29ce60e475c43508e0f6bed63ee03064736f6c63430008090033608060405234801561001057600080fd5b506114fd806100206000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80635f972df8116100ad578063913f424c11610071578063913f424c14610372578063bb8c256a146103a4578063db318833146103d5578063e241c1d914610407578063f47289e11461043857610121565b80635f972df81461027f57806366ce10b7146102b05780638081a1e7146102e05780638940aebe146103115780638cecf66e1461034257610121565b80631ecfe64d116100f45780631ecfe64d146101c35780632d58c9a2146101f45780632e52d606146102125780634df7e3d0146102305780635b7648111461024e57610121565b80630138e31b14610126578063022079d91461015757806306c91ce3146101875780630dbe671f146101a5575b600080fd5b610140600480360381019061013b9190610fbb565b61046a565b60405161014e929190611031565b60405180910390f35b610171600480360381019061016c919061105a565b610544565b60405161017e91906110f0565b60405180910390f35b61018f61065f565b60405161019c919061110b565b60405180910390f35b6101ad610683565b6040516101ba919061110b565b60405180910390f35b6101dd60048036038101906101d89190610fbb565b610688565b6040516101eb929190611031565b60405180910390f35b6101fc61078d565b604051610209919061110b565b60405180910390f35b61021a6107b1565b604051610227919061110b565b60405180910390f35b6102386107d5565b604051610245919061110b565b60405180910390f35b61026860048036038101906102639190610fbb565b6107da565b604051610276929190611031565b60405180910390f35b61029960048036038101906102949190610fbb565b610852565b6040516102a7929190611031565b60405180910390f35b6102ca60048036038101906102c59190611126565b6108ca565b6040516102d791906110f0565b60405180910390f35b6102fa60048036038101906102f59190611126565b610922565b604051610308929190611031565b60405180910390f35b61032b60048036038101906103269190611179565b6109bc565b604051610339929190611031565b60405180910390f35b61035c60048036038101906103579190611179565b610a13565b604051610369919061110b565b60405180910390f35b61038c60048036038101906103879190610fbb565b610b2c565b60405161039b939291906111a6565b60405180910390f35b6103be60048036038101906103b99190610fbb565b610be8565b6040516103cc929190611031565b60405180910390f35b6103ef60048036038101906103ea91906111dd565b610c86565b6040516103fe939291906111a6565b60405180910390f35b610421600480360381019061041c9190611126565b610ebe565b60405161042f929190611031565b60405180910390f35b610452600480360381019061044d9190611126565b610f58565b604051610461939291906111a6565b60405180910390f35b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061049c5761049b61126a565b5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806104cb576104ca61126a565b5b8686097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806104fd576104fc61126a565b5b888609087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806105305761052f61126a565b5b848709809250819350505094509492505050565b6000807ffffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036414190506000600160008060028a61057e9190611299565b141561058b57601b61058e565b601c5b8a60001b85806105a1576105a061126a565b5b8c8b0960001b604051600081526020016040526040516105c49493929190611347565b6020604051602081039080840390855afa1580156105e6573d6000803e3d6000fd5b505050602060405103519050600085856040516020016106079291906113ad565b6040516020818303038152906040528051906020012060001c90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614935050505095945050505050565b7f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179881565b600081565b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806106ba576106b961126a565b5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806106e9576106e861126a565b5b86867ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6107169190611408565b097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806107465761074561126a565b5b888609087ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806107795761077861126a565b5b848709809250819350505094509492505050565b7f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b881565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f81565b600781565b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061080c5761080b61126a565b5b8487097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061083e5761083d61126a565b5b848709809250819350505094509492505050565b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806108845761088361126a565b5b8387097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806108b6576108b561126a565b5b858709809250819350505094509492505050565b60006109197f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8868686610544565b90509392505050565b60008060006109348487876001610b2c565b80935081945082955050505061094981610a13565b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f8061097a5761097961126a565b5b81840992507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f806109ae576109ad61126a565b5b818309915050935093915050565b600080610a0a7f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b885610922565b91509150915091565b6000806000905060006001905060007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f9050600085905060005b60008214610b1f578183610a61919061143c565b9050837ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610a9357610a9261126a565b5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610ac257610ac161126a565b5b8684097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f610af09190611408565b87088095508196505050818282610b07919061146d565b84610b129190611408565b8093508194505050610a4d565b8495505050505050919050565b60008060008087905060008790506000879050600087905060008060006001905060008e1415610b6d57600080600199509950995050505050505050610bde565b5b60008714610bc75760006001881614610b9c57610b8f838383898989610c86565b8093508194508295505050505b600287610ba9919061143c565b9650610bb6868686610f58565b809650819750829850505050610b6e565b828282809a50819b50829c50505050505050505050505b9450945094915050565b6000806000610bfd8787600188886001610c86565b809350819450829550505050610c1281610a13565b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610c4357610c4261126a565b5b81840992507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610c7757610c7661126a565b5b81830991505094509492505050565b6000806000806000806000808d148015610ca0575060008c145b15610cb75789898996509650965050505050610eb2565b60008a148015610cc75750600089145b15610cde578c8c8c96509650965050505050610eb2565b898d148015610cec5750888c145b15610d4c57610cfd8d8c8f8e6107da565b8094508195505050610d138484600360016107da565b8094508195505050610d2984846000600161046a565b8094508195505050610d3f8c8c600260016107da565b8092508193505050610d75565b610d5889898e8e610688565b8094508195505050610d6c8a898f8e610688565b80925081935050505b610d8184848484610852565b8094508195505050610d95848486866107da565b8093508198505050610da987838f8e610688565b8093508198505050610dbd87838c8b610688565b8093508198505050610dd18d8c8985610688565b8092508197505050610de5868286866107da565b8092508197505050610df986828e8e610688565b8092508197505050808214610ea9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610e3757610e3661126a565b5b81880996507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610e6b57610e6a61126a565b5b82870995507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610e9f57610e9e61126a565b5b8183099450610ead565b8194505b505050505b96509650969350505050565b6000806000610ed08686866001610b2c565b809350819450829550505050610ee581610a13565b90507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610f1657610f1561126a565b5b81840992507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f80610f4a57610f4961126a565b5b818309915050935093915050565b6000806000610f6b868686898989610c86565b80935081945082955050505093509350939050565b600080fd5b6000819050919050565b610f9881610f85565b8114610fa357600080fd5b50565b600081359050610fb581610f8f565b92915050565b60008060008060808587031215610fd557610fd4610f80565b5b6000610fe387828801610fa6565b9450506020610ff487828801610fa6565b935050604061100587828801610fa6565b925050606061101687828801610fa6565b91505092959194509250565b61102b81610f85565b82525050565b60006040820190506110466000830185611022565b6110536020830184611022565b9392505050565b600080600080600060a0868803121561107657611075610f80565b5b600061108488828901610fa6565b955050602061109588828901610fa6565b94505060406110a688828901610fa6565b93505060606110b788828901610fa6565b92505060806110c888828901610fa6565b9150509295509295909350565b60008115159050919050565b6110ea816110d5565b82525050565b600060208201905061110560008301846110e1565b92915050565b60006020820190506111206000830184611022565b92915050565b60008060006060848603121561113f5761113e610f80565b5b600061114d86828701610fa6565b935050602061115e86828701610fa6565b925050604061116f86828701610fa6565b9150509250925092565b60006020828403121561118f5761118e610f80565b5b600061119d84828501610fa6565b91505092915050565b60006060820190506111bb6000830186611022565b6111c86020830185611022565b6111d56040830184611022565b949350505050565b60008060008060008060c087890312156111fa576111f9610f80565b5b600061120889828a01610fa6565b965050602061121989828a01610fa6565b955050604061122a89828a01610fa6565b945050606061123b89828a01610fa6565b935050608061124c89828a01610fa6565b92505060a061125d89828a01610fa6565b9150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006112a482610f85565b91506112af83610f85565b9250826112bf576112be61126a565b5b828206905092915050565b6000819050919050565b6000819050919050565b60008160001b9050919050565b60006113066113016112fc846112ca565b6112de565b6112d4565b9050919050565b611316816112eb565b82525050565b600060ff82169050919050565b6113328161131c565b82525050565b611341816112d4565b82525050565b600060808201905061135c600083018761130d565b6113696020830186611329565b6113766040830185611338565b6113836060830184611338565b95945050505050565b6000819050919050565b6113a76113a282610f85565b61138c565b82525050565b60006113b98285611396565b6020820191506113c98284611396565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061141382610f85565b915061141e83610f85565b925082821015611431576114306113d9565b5b828203905092915050565b600061144782610f85565b915061145283610f85565b9250826114625761146161126a565b5b828204905092915050565b600061147882610f85565b915061148383610f85565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156114bc576114bb6113d9565b5b82820290509291505056fea2646970667358221220abc1bc01c042aca46e9c89b605e166729e81f78f39fde5517df198dedf274d6c64736f6c63430008090033", } // SwapDLEQABI is the input ABI used to generate the binding from. diff --git a/swapOnChain-contract/swapOnChain.go b/swapOnChain-contract/swapOnChain.go deleted file mode 100644 index 40a93f41..00000000 --- a/swapOnChain-contract/swapOnChain.go +++ /dev/null @@ -1,925 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package swapOnChain - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription -) - -// SwapOnChainMetaData contains all meta data concerning the SwapOnChain contract. -var SwapOnChainMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_pubKeyClaim\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_pubKeyRefund\",\"type\":\"bytes32\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"p\",\"type\":\"bytes32\"}],\"name\":\"Constructed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"b\",\"type\":\"bool\"}],\"name\":\"IsReady\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"Refunded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_s\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyClaim\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pubKeyRefund\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_s\",\"type\":\"uint256\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"set_ready\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeout_0\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"timeout_1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x6101206040526000600160006101000a81548160ff02191690831515021790555060405162001c7738038062001c77833981810160405281019062000045919062000190565b3373ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff16815250508160c081815250508060e0818152505062015180426200009a919062000210565b6101008181525050604051620000b09062000142565b604051809103906000f080158015620000cd573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250507f1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb816040516200013291906200027e565b60405180910390a150506200029b565b610df78062000e8083390190565b600080fd5b6000819050919050565b6200016a8162000155565b81146200017657600080fd5b50565b6000815190506200018a816200015f565b92915050565b60008060408385031215620001aa57620001a962000150565b5b6000620001ba8582860162000179565b9250506020620001cd8582860162000179565b9150509250929050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006200021d82620001d7565b91506200022a83620001d7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115620002625762000261620001e1565b5b828201905092915050565b620002788162000155565b82525050565b60006020820190506200029560008301846200026d565b92915050565b60805160a05160c05160e05161010051610b766200030a600039600081816101c80152818161032a0152818161040e01526104c501526000818161013e015261022f015260008181610392015261043201526000818161028c015261046e0152600061055e0152610b766000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806345bb8e091161005b57806345bb8e09146100d85780634ded8d52146100f6578063736290f81461011457806374d7c138146101325761007d565b806303f7e24614610082578063278ecde1146100a0578063379607f5146100bc575b600080fd5b61008a61013c565b6040516100979190610684565b60405180910390f35b6100ba60048036038101906100b591906106da565b610160565b005b6100d660048036038101906100d191906106da565b6102c3565b005b6100e0610406565b6040516100ed9190610716565b60405180910390f35b6100fe61040c565b60405161010b9190610716565b60405180910390f35b61011c610430565b6040516101299190610684565b60405180910390f35b61013a610454565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b60011515600160009054906101000a900460ff16151514156101c6576000544210156101c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101b8906107b4565b60405180910390fd5b610229565b7f00000000000000000000000000000000000000000000000000000000000000004210610228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021f90610820565b60405180910390fd5b5b610253817f0000000000000000000000000000000000000000000000000000000000000000610559565b7f3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c816040516102829190610716565b60405180910390a17f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16ff5b60011515600160009054906101000a900460ff1615151415610328576000544210610323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161031a9061088c565b60405180910390fd5b61038c565b7f000000000000000000000000000000000000000000000000000000000000000042101561038b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103829061091e565b60405180910390fd5b5b6103b6817f0000000000000000000000000000000000000000000000000000000000000000610559565b7f7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8816040516103e59190610716565b60405180910390a13373ffffffffffffffffffffffffffffffffffffffff16ff5b60005481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600160009054906101000a900460ff161580156104bc57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80156104e757507f000000000000000000000000000000000000000000000000000000000000000042105b6104f057600080fd5b60018060006101000a81548160ff0219169083151502179055506201518042610519919061096d565b6000819055507f2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4600160405161054f91906109de565b60405180910390a1565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c4f4912b856040518263ffffffff1660e01b81526004016105b59190610716565b604080518083038186803b1580156105cc57600080fd5b505afa1580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106049190610a0e565b91509150600060ff6002846106199190610a7d565b901b82179050838160001b14610664576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065b90610b20565b60405180910390fd5b5050505050565b6000819050919050565b61067e8161066b565b82525050565b60006020820190506106996000830184610675565b92915050565b600080fd5b6000819050919050565b6106b7816106a4565b81146106c257600080fd5b50565b6000813590506106d4816106ae565b92915050565b6000602082840312156106f0576106ef61069f565b5b60006106fe848285016106c5565b91505092915050565b610710816106a4565b82525050565b600060208201905061072b6000830184610707565b92915050565b600082825260208201905092915050565b7f4974277320426f622773207475726e206e6f772c20706c65617365207761697460008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b600061079e602183610731565b91506107a982610742565b604082019050919050565b600060208201905081810360008301526107cd81610791565b9050919050565b7f4d697373656420796f7572206368616e63652100000000000000000000000000600082015250565b600061080a601383610731565b9150610815826107d4565b602082019050919050565b60006020820190508181036000830152610839816107fd565b9050919050565b7f546f6f206c61746520746f20636c61696d210000000000000000000000000000600082015250565b6000610876601283610731565b915061088182610840565b602082019050919050565b600060208201905081810360008301526108a581610869565b9050919050565b7f2769735265616479203d3d2066616c7365272063616e6e6f7420636c61696d2060008201527f7965742100000000000000000000000000000000000000000000000000000000602082015250565b6000610908602483610731565b9150610913826108ac565b604082019050919050565b60006020820190508181036000830152610937816108fb565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610978826106a4565b9150610983836106a4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156109b8576109b761093e565b5b828201905092915050565b60008115159050919050565b6109d8816109c3565b82525050565b60006020820190506109f360008301846109cf565b92915050565b600081519050610a08816106ae565b92915050565b60008060408385031215610a2557610a2461069f565b5b6000610a33858286016109f9565b9250506020610a44858286016109f9565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000610a88826106a4565b9150610a93836106a4565b925082610aa357610aa2610a4e565b5b828206905092915050565b7f70726f76696465642073656372657420646f6573206e6f74206d61746368207460008201527f6865206578706563746564207075624b65790000000000000000000000000000602082015250565b6000610b0a603283610731565b9150610b1582610aae565b604082019050919050565b60006020820190508181036000830152610b3981610afd565b905091905056fea26469706673582212200094259fccf6352712768e50e970ba52232a8591f9a94c62135d10808705691364736f6c63430008090033608060405234801561001057600080fd5b50610dd7806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c4f4912b14610030575b600080fd5b61004a60048036038101906100459190610caa565b610061565b604051610058929190610ce6565b60405180910390f35b60008061006c610c09565b610074610c09565b7f216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a8260000181815250507f666666666666666666666666666666666666666666666666666666666666665882602001818152505060018260400181815250506000816000018181525050600181602001818152505060018160400181815250505b600085111561012d57600180861614156101165761011381836101d2565b90505b600185901c945061012682610701565b91506100f5565b600061013c8260400151610b6b565b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061016d5761016c610d0f565b5b818360000151098260000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806101ac576101ab610d0f565b5b818360200151098260200181815250508160000151826020015194509450505050915091565b6101da610c09565b6101e2610c2a565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061021157610210610d0f565b5b83604001518560400151098160000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061025457610253610d0f565b5b81600001518260000151098160200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061029757610296610d0f565b5b83600001518560000151098160400181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806102da576102d9610d0f565b5b83602001518560200151098160600181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061031d5761031c610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061034c5761034b610d0f565b5b82606001518360400151097f52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3098160800181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806103b1576103b0610d0f565b5b81608001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed6103e19190610d6d565b8260200151088160a00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061041f5761041e610d0f565b5b81608001518260200151088160c00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061046257610461610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061049157610490610d0f565b5b82606001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed6104c19190610d6d565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806104f0576104ef610d0f565b5b84604001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed6105209190610d6d565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061054f5761054e610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061057e5761057d610d0f565b5b89602001518a60000151087f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806105b8576105b7610d0f565b5b8b602001518c60000151080908087f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806105f5576105f4610d0f565b5b8360a00151846000015109098260000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061063957610638610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061066857610667610d0f565b5b82604001518360600151087f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806106a2576106a1610d0f565b5b8360c00151846000015109098260200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806106e6576106e5610d0f565b5b8160c001518260a00151098260400181815250505092915050565b610709610c09565b610711610c2a565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806107405761073f610d0f565b5b83602001518460000151088160000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061078357610782610d0f565b5b81600001518260000151098160200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806107c6576107c5610d0f565b5b83600001518460000151098160400181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061080957610808610d0f565b5b836020015184602001510981606001818152505080604001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed61084d9190610d6d565b8160800181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061088557610884610d0f565b5b81606001518260800151088160a00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806108c8576108c7610d0f565b5b83604001518460400151098160e00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061090b5761090a610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed8061093a57610939610d0f565b5b8260e001516002097f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed61096d9190610d6d565b8260a00151088160c00181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806109ab576109aa610d0f565b5b8160c001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed806109df576109de610d0f565b5b83606001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610a0f9190610d6d565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610a3e57610a3d610d0f565b5b85604001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610a6e9190610d6d565b86602001510808098260000181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610aae57610aad610d0f565b5b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610add57610adc610d0f565b5b82606001517f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610b0d9190610d6d565b8360800151088260a00151098260200181815250507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed80610b5157610b50610d0f565b5b8160c001518260a001510982604001818152505050919050565b60008060027f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed610b9b9190610d6d565b905060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed905060405160208152602080820152602060408201528460608201528260808201528160a082015260208160c0836005600019fa610bfd57600080fd5b80519350505050919050565b60405180606001604052806000815260200160008152602001600081525090565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600080fd5b6000819050919050565b610c8781610c74565b8114610c9257600080fd5b50565b600081359050610ca481610c7e565b92915050565b600060208284031215610cc057610cbf610c6f565b5b6000610cce84828501610c95565b91505092915050565b610ce081610c74565b82525050565b6000604082019050610cfb6000830185610cd7565b610d086020830184610cd7565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610d7882610c74565b9150610d8383610c74565b925082821015610d9657610d95610d3e565b5b82820390509291505056fea264697066735822122026763aba14e28dd6f9cbc211a6db8bcee0af925f8e7aef10e72e4164c3feaf8c64736f6c63430008090033", -} - -// SwapOnChainABI is the input ABI used to generate the binding from. -// Deprecated: Use SwapOnChainMetaData.ABI instead. -var SwapOnChainABI = SwapOnChainMetaData.ABI - -// SwapOnChainBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use SwapOnChainMetaData.Bin instead. -var SwapOnChainBin = SwapOnChainMetaData.Bin - -// DeploySwapOnChain deploys a new Ethereum contract, binding an instance of SwapOnChain to it. -func DeploySwapOnChain(auth *bind.TransactOpts, backend bind.ContractBackend, _pubKeyClaim [32]byte, _pubKeyRefund [32]byte) (common.Address, *types.Transaction, *SwapOnChain, error) { - parsed, err := SwapOnChainMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SwapOnChainBin), backend, _pubKeyClaim, _pubKeyRefund) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SwapOnChain{SwapOnChainCaller: SwapOnChainCaller{contract: contract}, SwapOnChainTransactor: SwapOnChainTransactor{contract: contract}, SwapOnChainFilterer: SwapOnChainFilterer{contract: contract}}, nil -} - -// SwapOnChain is an auto generated Go binding around an Ethereum contract. -type SwapOnChain struct { - SwapOnChainCaller // Read-only binding to the contract - SwapOnChainTransactor // Write-only binding to the contract - SwapOnChainFilterer // Log filterer for contract events -} - -// SwapOnChainCaller is an auto generated read-only Go binding around an Ethereum contract. -type SwapOnChainCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SwapOnChainTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SwapOnChainTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SwapOnChainFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SwapOnChainFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SwapOnChainSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SwapOnChainSession struct { - Contract *SwapOnChain // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SwapOnChainCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SwapOnChainCallerSession struct { - Contract *SwapOnChainCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SwapOnChainTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SwapOnChainTransactorSession struct { - Contract *SwapOnChainTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SwapOnChainRaw is an auto generated low-level Go binding around an Ethereum contract. -type SwapOnChainRaw struct { - Contract *SwapOnChain // Generic contract binding to access the raw methods on -} - -// SwapOnChainCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SwapOnChainCallerRaw struct { - Contract *SwapOnChainCaller // Generic read-only contract binding to access the raw methods on -} - -// SwapOnChainTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SwapOnChainTransactorRaw struct { - Contract *SwapOnChainTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSwapOnChain creates a new instance of SwapOnChain, bound to a specific deployed contract. -func NewSwapOnChain(address common.Address, backend bind.ContractBackend) (*SwapOnChain, error) { - contract, err := bindSwapOnChain(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SwapOnChain{SwapOnChainCaller: SwapOnChainCaller{contract: contract}, SwapOnChainTransactor: SwapOnChainTransactor{contract: contract}, SwapOnChainFilterer: SwapOnChainFilterer{contract: contract}}, nil -} - -// NewSwapOnChainCaller creates a new read-only instance of SwapOnChain, bound to a specific deployed contract. -func NewSwapOnChainCaller(address common.Address, caller bind.ContractCaller) (*SwapOnChainCaller, error) { - contract, err := bindSwapOnChain(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SwapOnChainCaller{contract: contract}, nil -} - -// NewSwapOnChainTransactor creates a new write-only instance of SwapOnChain, bound to a specific deployed contract. -func NewSwapOnChainTransactor(address common.Address, transactor bind.ContractTransactor) (*SwapOnChainTransactor, error) { - contract, err := bindSwapOnChain(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SwapOnChainTransactor{contract: contract}, nil -} - -// NewSwapOnChainFilterer creates a new log filterer instance of SwapOnChain, bound to a specific deployed contract. -func NewSwapOnChainFilterer(address common.Address, filterer bind.ContractFilterer) (*SwapOnChainFilterer, error) { - contract, err := bindSwapOnChain(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SwapOnChainFilterer{contract: contract}, nil -} - -// bindSwapOnChain binds a generic wrapper to an already deployed contract. -func bindSwapOnChain(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(SwapOnChainABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SwapOnChain *SwapOnChainRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SwapOnChain.Contract.SwapOnChainCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SwapOnChain *SwapOnChainRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SwapOnChain.Contract.SwapOnChainTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SwapOnChain *SwapOnChainRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SwapOnChain.Contract.SwapOnChainTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SwapOnChain *SwapOnChainCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SwapOnChain.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SwapOnChain *SwapOnChainTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SwapOnChain.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SwapOnChain *SwapOnChainTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SwapOnChain.Contract.contract.Transact(opts, method, params...) -} - -// PubKeyClaim is a free data retrieval call binding the contract method 0x736290f8. -// -// Solidity: function pubKeyClaim() view returns(bytes32) -func (_SwapOnChain *SwapOnChainCaller) PubKeyClaim(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _SwapOnChain.contract.Call(opts, &out, "pubKeyClaim") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// PubKeyClaim is a free data retrieval call binding the contract method 0x736290f8. -// -// Solidity: function pubKeyClaim() view returns(bytes32) -func (_SwapOnChain *SwapOnChainSession) PubKeyClaim() ([32]byte, error) { - return _SwapOnChain.Contract.PubKeyClaim(&_SwapOnChain.CallOpts) -} - -// PubKeyClaim is a free data retrieval call binding the contract method 0x736290f8. -// -// Solidity: function pubKeyClaim() view returns(bytes32) -func (_SwapOnChain *SwapOnChainCallerSession) PubKeyClaim() ([32]byte, error) { - return _SwapOnChain.Contract.PubKeyClaim(&_SwapOnChain.CallOpts) -} - -// PubKeyRefund is a free data retrieval call binding the contract method 0x03f7e246. -// -// Solidity: function pubKeyRefund() view returns(bytes32) -func (_SwapOnChain *SwapOnChainCaller) PubKeyRefund(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _SwapOnChain.contract.Call(opts, &out, "pubKeyRefund") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// PubKeyRefund is a free data retrieval call binding the contract method 0x03f7e246. -// -// Solidity: function pubKeyRefund() view returns(bytes32) -func (_SwapOnChain *SwapOnChainSession) PubKeyRefund() ([32]byte, error) { - return _SwapOnChain.Contract.PubKeyRefund(&_SwapOnChain.CallOpts) -} - -// PubKeyRefund is a free data retrieval call binding the contract method 0x03f7e246. -// -// Solidity: function pubKeyRefund() view returns(bytes32) -func (_SwapOnChain *SwapOnChainCallerSession) PubKeyRefund() ([32]byte, error) { - return _SwapOnChain.Contract.PubKeyRefund(&_SwapOnChain.CallOpts) -} - -// Timeout0 is a free data retrieval call binding the contract method 0x4ded8d52. -// -// Solidity: function timeout_0() view returns(uint256) -func (_SwapOnChain *SwapOnChainCaller) Timeout0(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SwapOnChain.contract.Call(opts, &out, "timeout_0") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// Timeout0 is a free data retrieval call binding the contract method 0x4ded8d52. -// -// Solidity: function timeout_0() view returns(uint256) -func (_SwapOnChain *SwapOnChainSession) Timeout0() (*big.Int, error) { - return _SwapOnChain.Contract.Timeout0(&_SwapOnChain.CallOpts) -} - -// Timeout0 is a free data retrieval call binding the contract method 0x4ded8d52. -// -// Solidity: function timeout_0() view returns(uint256) -func (_SwapOnChain *SwapOnChainCallerSession) Timeout0() (*big.Int, error) { - return _SwapOnChain.Contract.Timeout0(&_SwapOnChain.CallOpts) -} - -// Timeout1 is a free data retrieval call binding the contract method 0x45bb8e09. -// -// Solidity: function timeout_1() view returns(uint256) -func (_SwapOnChain *SwapOnChainCaller) Timeout1(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SwapOnChain.contract.Call(opts, &out, "timeout_1") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// Timeout1 is a free data retrieval call binding the contract method 0x45bb8e09. -// -// Solidity: function timeout_1() view returns(uint256) -func (_SwapOnChain *SwapOnChainSession) Timeout1() (*big.Int, error) { - return _SwapOnChain.Contract.Timeout1(&_SwapOnChain.CallOpts) -} - -// Timeout1 is a free data retrieval call binding the contract method 0x45bb8e09. -// -// Solidity: function timeout_1() view returns(uint256) -func (_SwapOnChain *SwapOnChainCallerSession) Timeout1() (*big.Int, error) { - return _SwapOnChain.Contract.Timeout1(&_SwapOnChain.CallOpts) -} - -// Claim is a paid mutator transaction binding the contract method 0x379607f5. -// -// Solidity: function claim(uint256 _s) returns() -func (_SwapOnChain *SwapOnChainTransactor) Claim(opts *bind.TransactOpts, _s *big.Int) (*types.Transaction, error) { - return _SwapOnChain.contract.Transact(opts, "claim", _s) -} - -// Claim is a paid mutator transaction binding the contract method 0x379607f5. -// -// Solidity: function claim(uint256 _s) returns() -func (_SwapOnChain *SwapOnChainSession) Claim(_s *big.Int) (*types.Transaction, error) { - return _SwapOnChain.Contract.Claim(&_SwapOnChain.TransactOpts, _s) -} - -// Claim is a paid mutator transaction binding the contract method 0x379607f5. -// -// Solidity: function claim(uint256 _s) returns() -func (_SwapOnChain *SwapOnChainTransactorSession) Claim(_s *big.Int) (*types.Transaction, error) { - return _SwapOnChain.Contract.Claim(&_SwapOnChain.TransactOpts, _s) -} - -// Refund is a paid mutator transaction binding the contract method 0x278ecde1. -// -// Solidity: function refund(uint256 _s) returns() -func (_SwapOnChain *SwapOnChainTransactor) Refund(opts *bind.TransactOpts, _s *big.Int) (*types.Transaction, error) { - return _SwapOnChain.contract.Transact(opts, "refund", _s) -} - -// Refund is a paid mutator transaction binding the contract method 0x278ecde1. -// -// Solidity: function refund(uint256 _s) returns() -func (_SwapOnChain *SwapOnChainSession) Refund(_s *big.Int) (*types.Transaction, error) { - return _SwapOnChain.Contract.Refund(&_SwapOnChain.TransactOpts, _s) -} - -// Refund is a paid mutator transaction binding the contract method 0x278ecde1. -// -// Solidity: function refund(uint256 _s) returns() -func (_SwapOnChain *SwapOnChainTransactorSession) Refund(_s *big.Int) (*types.Transaction, error) { - return _SwapOnChain.Contract.Refund(&_SwapOnChain.TransactOpts, _s) -} - -// SetReady is a paid mutator transaction binding the contract method 0x74d7c138. -// -// Solidity: function set_ready() returns() -func (_SwapOnChain *SwapOnChainTransactor) SetReady(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SwapOnChain.contract.Transact(opts, "set_ready") -} - -// SetReady is a paid mutator transaction binding the contract method 0x74d7c138. -// -// Solidity: function set_ready() returns() -func (_SwapOnChain *SwapOnChainSession) SetReady() (*types.Transaction, error) { - return _SwapOnChain.Contract.SetReady(&_SwapOnChain.TransactOpts) -} - -// SetReady is a paid mutator transaction binding the contract method 0x74d7c138. -// -// Solidity: function set_ready() returns() -func (_SwapOnChain *SwapOnChainTransactorSession) SetReady() (*types.Transaction, error) { - return _SwapOnChain.Contract.SetReady(&_SwapOnChain.TransactOpts) -} - -// SwapOnChainClaimedIterator is returned from FilterClaimed and is used to iterate over the raw logs and unpacked data for Claimed events raised by the SwapOnChain contract. -type SwapOnChainClaimedIterator struct { - Event *SwapOnChainClaimed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SwapOnChainClaimedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SwapOnChainClaimed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SwapOnChainClaimed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SwapOnChainClaimedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SwapOnChainClaimedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SwapOnChainClaimed represents a Claimed event raised by the SwapOnChain contract. -type SwapOnChainClaimed struct { - S *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterClaimed is a free log retrieval operation binding the contract event 0x7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8. -// -// Solidity: event Claimed(uint256 s) -func (_SwapOnChain *SwapOnChainFilterer) FilterClaimed(opts *bind.FilterOpts) (*SwapOnChainClaimedIterator, error) { - - logs, sub, err := _SwapOnChain.contract.FilterLogs(opts, "Claimed") - if err != nil { - return nil, err - } - return &SwapOnChainClaimedIterator{contract: _SwapOnChain.contract, event: "Claimed", logs: logs, sub: sub}, nil -} - -// WatchClaimed is a free log subscription operation binding the contract event 0x7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8. -// -// Solidity: event Claimed(uint256 s) -func (_SwapOnChain *SwapOnChainFilterer) WatchClaimed(opts *bind.WatchOpts, sink chan<- *SwapOnChainClaimed) (event.Subscription, error) { - - logs, sub, err := _SwapOnChain.contract.WatchLogs(opts, "Claimed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SwapOnChainClaimed) - if err := _SwapOnChain.contract.UnpackLog(event, "Claimed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseClaimed is a log parse operation binding the contract event 0x7a355715549cfe7c1cba26304350343fbddc4b4f72d3ce3e7c27117dd20b5cb8. -// -// Solidity: event Claimed(uint256 s) -func (_SwapOnChain *SwapOnChainFilterer) ParseClaimed(log types.Log) (*SwapOnChainClaimed, error) { - event := new(SwapOnChainClaimed) - if err := _SwapOnChain.contract.UnpackLog(event, "Claimed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SwapOnChainConstructedIterator is returned from FilterConstructed and is used to iterate over the raw logs and unpacked data for Constructed events raised by the SwapOnChain contract. -type SwapOnChainConstructedIterator struct { - Event *SwapOnChainConstructed // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SwapOnChainConstructedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SwapOnChainConstructed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SwapOnChainConstructed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SwapOnChainConstructedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SwapOnChainConstructedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SwapOnChainConstructed represents a Constructed event raised by the SwapOnChain contract. -type SwapOnChainConstructed struct { - P [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterConstructed is a free log retrieval operation binding the contract event 0x1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb. -// -// Solidity: event Constructed(bytes32 p) -func (_SwapOnChain *SwapOnChainFilterer) FilterConstructed(opts *bind.FilterOpts) (*SwapOnChainConstructedIterator, error) { - - logs, sub, err := _SwapOnChain.contract.FilterLogs(opts, "Constructed") - if err != nil { - return nil, err - } - return &SwapOnChainConstructedIterator{contract: _SwapOnChain.contract, event: "Constructed", logs: logs, sub: sub}, nil -} - -// WatchConstructed is a free log subscription operation binding the contract event 0x1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb. -// -// Solidity: event Constructed(bytes32 p) -func (_SwapOnChain *SwapOnChainFilterer) WatchConstructed(opts *bind.WatchOpts, sink chan<- *SwapOnChainConstructed) (event.Subscription, error) { - - logs, sub, err := _SwapOnChain.contract.WatchLogs(opts, "Constructed") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SwapOnChainConstructed) - if err := _SwapOnChain.contract.UnpackLog(event, "Constructed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseConstructed is a log parse operation binding the contract event 0x1ba2159dcdf5aa313440d6540b9acb108e5f7907737e884db04579a584275fbb. -// -// Solidity: event Constructed(bytes32 p) -func (_SwapOnChain *SwapOnChainFilterer) ParseConstructed(log types.Log) (*SwapOnChainConstructed, error) { - event := new(SwapOnChainConstructed) - if err := _SwapOnChain.contract.UnpackLog(event, "Constructed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SwapOnChainIsReadyIterator is returned from FilterIsReady and is used to iterate over the raw logs and unpacked data for IsReady events raised by the SwapOnChain contract. -type SwapOnChainIsReadyIterator struct { - Event *SwapOnChainIsReady // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SwapOnChainIsReadyIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SwapOnChainIsReady) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SwapOnChainIsReady) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SwapOnChainIsReadyIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SwapOnChainIsReadyIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SwapOnChainIsReady represents a IsReady event raised by the SwapOnChain contract. -type SwapOnChainIsReady struct { - B bool - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIsReady is a free log retrieval operation binding the contract event 0x2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4. -// -// Solidity: event IsReady(bool b) -func (_SwapOnChain *SwapOnChainFilterer) FilterIsReady(opts *bind.FilterOpts) (*SwapOnChainIsReadyIterator, error) { - - logs, sub, err := _SwapOnChain.contract.FilterLogs(opts, "IsReady") - if err != nil { - return nil, err - } - return &SwapOnChainIsReadyIterator{contract: _SwapOnChain.contract, event: "IsReady", logs: logs, sub: sub}, nil -} - -// WatchIsReady is a free log subscription operation binding the contract event 0x2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4. -// -// Solidity: event IsReady(bool b) -func (_SwapOnChain *SwapOnChainFilterer) WatchIsReady(opts *bind.WatchOpts, sink chan<- *SwapOnChainIsReady) (event.Subscription, error) { - - logs, sub, err := _SwapOnChain.contract.WatchLogs(opts, "IsReady") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SwapOnChainIsReady) - if err := _SwapOnChain.contract.UnpackLog(event, "IsReady", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIsReady is a log parse operation binding the contract event 0x2724cf6c3ad6a3399ad72482e4013d0171794f3ef4c462b7e24790c658cb3cd4. -// -// Solidity: event IsReady(bool b) -func (_SwapOnChain *SwapOnChainFilterer) ParseIsReady(log types.Log) (*SwapOnChainIsReady, error) { - event := new(SwapOnChainIsReady) - if err := _SwapOnChain.contract.UnpackLog(event, "IsReady", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SwapOnChainRefundedIterator is returned from FilterRefunded and is used to iterate over the raw logs and unpacked data for Refunded events raised by the SwapOnChain contract. -type SwapOnChainRefundedIterator struct { - Event *SwapOnChainRefunded // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SwapOnChainRefundedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SwapOnChainRefunded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SwapOnChainRefunded) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SwapOnChainRefundedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SwapOnChainRefundedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SwapOnChainRefunded represents a Refunded event raised by the SwapOnChain contract. -type SwapOnChainRefunded struct { - S *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterRefunded is a free log retrieval operation binding the contract event 0x3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c. -// -// Solidity: event Refunded(uint256 s) -func (_SwapOnChain *SwapOnChainFilterer) FilterRefunded(opts *bind.FilterOpts) (*SwapOnChainRefundedIterator, error) { - - logs, sub, err := _SwapOnChain.contract.FilterLogs(opts, "Refunded") - if err != nil { - return nil, err - } - return &SwapOnChainRefundedIterator{contract: _SwapOnChain.contract, event: "Refunded", logs: logs, sub: sub}, nil -} - -// WatchRefunded is a free log subscription operation binding the contract event 0x3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c. -// -// Solidity: event Refunded(uint256 s) -func (_SwapOnChain *SwapOnChainFilterer) WatchRefunded(opts *bind.WatchOpts, sink chan<- *SwapOnChainRefunded) (event.Subscription, error) { - - logs, sub, err := _SwapOnChain.contract.WatchLogs(opts, "Refunded") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SwapOnChainRefunded) - if err := _SwapOnChain.contract.UnpackLog(event, "Refunded", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseRefunded is a log parse operation binding the contract event 0x3d2a04f53164bedf9a8a46353305d6b2d2261410406df3b41f99ce6489dc003c. -// -// Solidity: event Refunded(uint256 s) -func (_SwapOnChain *SwapOnChainFilterer) ParseRefunded(log types.Log) (*SwapOnChainRefunded, error) { - event := new(SwapOnChainRefunded) - if err := _SwapOnChain.contract.UnpackLog(event, "Refunded", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -}