From d6f5fb07a540c55274faf8ca883db98385816eac Mon Sep 17 00:00:00 2001 From: elv-preethi <39742400+elv-preethi@users.noreply.github.com> Date: Thu, 6 Oct 2022 15:12:04 -0700 Subject: [PATCH] Payments (#96) * added src file * added payments test * minor change * abigen payments file * rm extra payments folder --- .gitmodules | 6 +- build-go-payments.sh | 43 + cmds/go.mod | 1 + cmds/go.sum | 2 + contracts-go/payments/erc20_payments.go | 789 ++++ dist/payments/Context.abi | 1 + dist/payments/Context.bin | 0 dist/payments/Context.signatures | 1 + dist/payments/ERC20.abi | 1 + dist/payments/ERC20.bin | 1 + dist/payments/ERC20.signatures | 16 + dist/payments/ERC20Payments.abi | 1 + dist/payments/ERC20Payments.bin | 1 + dist/payments/ERC20Payments.signatures | 11 + dist/payments/IERC20.abi | 1 + dist/payments/IERC20.bin | 0 dist/payments/IERC20.signatures | 11 + dist/payments/IERC20Metadata.abi | 1 + dist/payments/IERC20Metadata.bin | 0 dist/payments/IERC20Metadata.signatures | 14 + foundry.toml | 3 +- lib/openzeppelin-contracts | 1 + openzeppelin | 1 - remappings.txt | 3 + script/tradable/redeemable.s.sol | 4 +- src/MinterRole.sol | 2 +- src/payments/ERC20Payments.sol | 245 ++ src/redeemable.sol | 2 +- test/payments/ERC20Payments.t.sol | 213 + test/tradable/redeemable.t.sol | 2 +- test/utils/Console.sol | 5203 +++++++++++++++++++++++ test/utils/Utilities.sol | 38 + 32 files changed, 6607 insertions(+), 11 deletions(-) create mode 100755 build-go-payments.sh create mode 100644 contracts-go/payments/erc20_payments.go create mode 100644 dist/payments/Context.abi create mode 100644 dist/payments/Context.bin create mode 100644 dist/payments/Context.signatures create mode 100644 dist/payments/ERC20.abi create mode 100644 dist/payments/ERC20.bin create mode 100644 dist/payments/ERC20.signatures create mode 100644 dist/payments/ERC20Payments.abi create mode 100644 dist/payments/ERC20Payments.bin create mode 100644 dist/payments/ERC20Payments.signatures create mode 100644 dist/payments/IERC20.abi create mode 100644 dist/payments/IERC20.bin create mode 100644 dist/payments/IERC20.signatures create mode 100644 dist/payments/IERC20Metadata.abi create mode 100644 dist/payments/IERC20Metadata.bin create mode 100644 dist/payments/IERC20Metadata.signatures create mode 160000 lib/openzeppelin-contracts delete mode 160000 openzeppelin create mode 100644 remappings.txt create mode 100644 src/payments/ERC20Payments.sol create mode 100644 test/payments/ERC20Payments.t.sol create mode 100644 test/utils/Console.sol create mode 100644 test/utils/Utilities.sol diff --git a/.gitmodules b/.gitmodules index 9d494b6..e80ffd8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std -[submodule "openzeppelin"] - path = openzeppelin - url = https://github.com/OpenZeppelin/openzeppelin-contracts.git +[submodule "lib/openzeppelin-contracts"] + path = lib/openzeppelin-contracts + url = https://github.com/openzeppelin/openzeppelin-contracts diff --git a/build-go-payments.sh b/build-go-payments.sh new file mode 100755 index 0000000..fb84535 --- /dev/null +++ b/build-go-payments.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -Eeuo pipefail + +if [ -z "${1-}" ]; then + echo "Usage: $0 SOLC_0_8_13_DIR" + exit 1 +fi + +solc_0_8_13_dir=$(realpath "$1") + +# check solc +"$solc_0_8_13_dir/solc" --version | grep "Version: 0.8.13+" + +# build abigen +( + echo "#### building abigen command" + cd cmds + go build -o ../abigen ./abigen + cd .. +) + + +( + base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + echo "BASE_DIR $base_dir" + # recent contracts require solc 0.8.13 + ( + hash -d solc 2>/dev/null || : # clear cache for solc location + # shellcheck disable=SC2030 + PATH="$solc_0_8_13_dir:$PATH" + export PATH + + payments_out_dir="${base_dir}/dist/payments" + payments_sol_file="${base_dir}/src/payments/ERC20Payments.sol" + payments_abigen_dir="${base_dir}/contracts-go/payments" + + solc @openzeppelin/=lib/openzeppelin-contracts/ ${payments_sol_file} --abi --hashes --optimize -o ${payments_out_dir} --overwrite + solc @openzeppelin/=lib/openzeppelin-contracts/ ${payments_sol_file} --bin --optimize -o ${payments_out_dir} --overwrite + + echo "#### generating latest src/payments/ERC20Payments.sol" + ./abigen --abi "${payments_out_dir}/ERC20Payments.abi" --bin "${payments_out_dir}/ERC20Payments.bin" --pkg payments --out "${payments_abigen_dir}/erc20_payments.go" + ) +) diff --git a/cmds/go.mod b/cmds/go.mod index 4b638e6..25ba8de 100644 --- a/cmds/go.mod +++ b/cmds/go.mod @@ -13,6 +13,7 @@ require ( github.com/spf13/cobra v1.1.1 github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.4.0 + golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/urfave/cli.v1 v1.20.0 ) diff --git a/cmds/go.sum b/cmds/go.sum index 9d0ff93..55c4c32 100644 --- a/cmds/go.sum +++ b/cmds/go.sum @@ -429,6 +429,8 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= +golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= diff --git a/contracts-go/payments/erc20_payments.go b/contracts-go/payments/erc20_payments.go new file mode 100644 index 0000000..67c07f1 --- /dev/null +++ b/contracts-go/payments/erc20_payments.go @@ -0,0 +1,789 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package payments + +import ( + "encoding/json" + "fmt" + "io" + "math/big" + "reflect" + "strings" + + c "github.com/eluv-io/contracts/contracts-go/events" + + 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 ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// Map of ABI names to *abi.ABI +// ABI names are constants starting with K_ +var ParsedABIS = map[string]*abi.ABI{} + +// Map of ABI names to *bind.BoundContract for log parsing only +// ABI names are constants starting with K_ +var BoundContracts = map[string]*bind.BoundContract{} + +// Map of Unique events names to *EventInfo. +// Unique events names are constants starting with E_ +var UniqueEvents = map[string]*EventInfo{} + +// Map of Unique events types to *EventInfo +var EventsByType = map[reflect.Type]*EventInfo{} + +// Map of Unique events IDs to *EventInfo +var EventsByID = map[common.Hash]*EventInfo{} + +// JSON returns a parsed ABI interface and error if it failed. +func JSON(reader io.Reader) (*abi.ABI, error) { + dec := json.NewDecoder(reader) + + var anAbi abi.ABI + if err := dec.Decode(&anAbi); err != nil { + return nil, err + } + + return &anAbi, nil +} + +func parseABI(name string) (*abi.ABI, error) { + sabi := ABIS[name] + if sabi == "" { + return nil, fmt.Errorf("no such ABI %s", name) + } + return JSON(strings.NewReader(sabi)) +} + +func ParsedABI(name string) (*abi.ABI, error) { + pabi, ok := ParsedABIS[name] + if ok { + return pabi, nil + } + return parseABI(name) +} + +// ERC20PaymentsPaymentID is an auto generated low-level Go binding around an user-defined struct. +type ERC20PaymentsPaymentID struct { + RefId [16]byte + OracleId common.Address +} + +func BoundContract(name string) *bind.BoundContract { + bc, ok := BoundContracts[name] + if !ok { + anABI, err := ParsedABI(name) + if err != nil { + panic(err) + } + bc = bind.NewBoundContract(common.Address{}, *anABI, nil, nil, nil) + BoundContracts[name] = bc + } + return bc +} + +// Type names of contract binding +const ( + K_Payments = "Payments" +) + +var ABIS = map[string]string{ + + K_Payments: PaymentsABI, +} + +// Unique events names. +// Unique events are events whose ID and name are unique across contracts. +const ( + E_Canceled = "Canceled" + E_Created = "Created" + E_Withdrawn = "Withdrawn" +) + +type EventInfo = c.EventInfo +type EventType = c.EventType + +func init() { + for name, _ := range ABIS { + a, err := parseABI(name) + if err == nil { + ParsedABIS[name] = a + } + } + var ev *EventInfo + + ev = &EventInfo{ + Name: "Canceled", + ID: common.HexToHash("0x25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea264"), + Types: []EventType{ + { + Type: reflect.TypeOf((*Canceled)(nil)), + BoundContract: BoundContract(K_Payments), + }, + }, + } + UniqueEvents[E_Canceled] = ev + EventsByType[ev.Types[0].Type] = ev + + ev = &EventInfo{ + Name: "Created", + ID: common.HexToHash("0xf5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e2"), + Types: []EventType{ + { + Type: reflect.TypeOf((*Created)(nil)), + BoundContract: BoundContract(K_Payments), + }, + }, + } + UniqueEvents[E_Created] = ev + EventsByType[ev.Types[0].Type] = ev + + ev = &EventInfo{ + Name: "Withdrawn", + ID: common.HexToHash("0xe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e9"), + Types: []EventType{ + { + Type: reflect.TypeOf((*Withdrawn)(nil)), + BoundContract: BoundContract(K_Payments), + }, + }, + } + UniqueEvents[E_Withdrawn] = ev + EventsByType[ev.Types[0].Type] = ev + +} + +// Unique events structs + +// Canceled event with ID 0x25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea264 +type Canceled struct { + ContractId [16]byte + Raw types.Log // Blockchain specific contextual infos +} + +// Created event with ID 0xf5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e2 +type Created struct { + ContractId [16]byte + Sender common.Address + Receivers []common.Address + TokenContract common.Address + Amounts []*big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// Withdrawn event with ID 0xe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e9 +type Withdrawn struct { + ContractId [16]byte + Raw types.Log // Blockchain specific contextual infos +} + +// PaymentsABI is the input ABI used to generate the binding from. +const PaymentsABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes16\",\"name\":\"contractId\",\"type\":\"bytes16\"}],\"name\":\"Canceled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes16\",\"name\":\"contractId\",\"type\":\"bytes16\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address[]\",\"name\":\"receivers\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"tokenContract\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"Created\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes16\",\"name\":\"contractId\",\"type\":\"bytes16\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"calculateTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes16\",\"name\":\"_refId\",\"type\":\"bytes16\"}],\"name\":\"cancelPayment\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes16\",\"name\":\"_refId\",\"type\":\"bytes16\"}],\"name\":\"claimPayment\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_receivers\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"bytes16\",\"name\":\"ref_id\",\"type\":\"bytes16\"},{\"internalType\":\"address\",\"name\":\"oracle_id\",\"type\":\"address\"}],\"internalType\":\"structERC20Payments.PaymentID\",\"name\":\"_paymentId\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"_tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"createPayment\",\"outputs\":[{\"internalType\":\"bytes16\",\"name\":\"refId\",\"type\":\"bytes16\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes16\",\"name\":\"_refId\",\"type\":\"bytes16\"}],\"name\":\"getContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"receivers\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"tokenContract\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"oracle\",\"type\":\"address\"},{\"internalType\":\"enumERC20Payments.PaymentState\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" + +// PaymentsBin is the compiled bytecode used for deploying new contracts. +var PaymentsBin = "0x608060405234801561001057600080fd5b50611487806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063732760a11461005c578063820b71ca1461008d5780639c6173be146100b0578063e2f5f998146100d5578063f2c9f603146100f6575b600080fd5b61006f61006a36600461107b565b610109565b6040516001600160801b031990911681526020015b60405180910390f35b6100a061009b36600461111b565b61050d565b6040519015158152602001610084565b6100c36100be36600461111b565b61089c565b60405161008496959493929190611184565b6100e86100e3366004611253565b610a10565b604051908152602001610084565b6100a061010436600461111b565b610a5c565b6000610118602086018661111b565b61012181610d70565b156101735760405162461bcd60e51b815260206004820152601860248201527f7061796d656e74494420616c726561647920657869737473000000000000000060448201526064015b60405180910390fd5b610180602087018761111b565b915060006101c28585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a9250610d97915050565b90506101cd83610d70565b1561021a5760405162461bcd60e51b815260206004820152601760248201527f436f6e747261637420616c726561647920657869737473000000000000000000604482015260640161016a565b6040516323b872dd60e01b8152336004820152306024820152604481018290526001600160a01b038716906323b872dd906064016020604051808303816000875af115801561026d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102919190611311565b6102e85760405162461bcd60e51b815260206004820152602260248201527f7472616e7366657246726f6d2073656e64657220746f2074686973206661696c604482015261195960f21b606482015260840161016a565b6040518060c00160405280336001600160a01b031681526020018a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506001600160a01b0388166020808301919091526040805188830281810184018352898252919093019291899189918291908501908490808284376000920191909152505050908252506020908101906103979060408b01908b01611333565b6001600160a01b03168152602001600090526001600160801b03198416600090815260208181526040909120825181546001600160a01b0319166001600160a01b0390911617815582820151805191926103f992600185019290910190610f5e565b5060408201516002820180546001600160a01b0319166001600160a01b039092169190911790556060820151805161043b916003840191602090910190610fc3565b5060808201516004820180546001600160a01b039092166001600160a01b031983168117825560a0850151926001600160a81b03191617600160a01b8360028111156104895761048961114c565b0217905550506040516104a091508a908a9061134e565b6040518091039020336001600160a01b0316846fffffffffffffffffffffffffffffffff19167ff5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e28989896040516104f99392919061138e565b60405180910390a450509695505050505050565b60008161051981610d70565b6105605760405162461bcd60e51b81526020600482015260186024820152771c185e5b595b9d125108191bd95cc81b9bdd08195e1a5cdd60421b604482015260640161016a565b8260016001600160801b03198216600090815260208190526040902060040154600160a01b900460ff16600281111561059b5761059b61114c565b036105e85760405162461bcd60e51b815260206004820152601f60248201527f776974686472617761626c653a20616c72656164792077697468647261776e00604482015260640161016a565b60026001600160801b03198216600090815260208190526040902060040154600160a01b900460ff1660028111156106225761062261114c565b0361066f5760405162461bcd60e51b815260206004820152601e60248201527f776974686472617761626c653a20616c726561647920726566756e6465640000604482015260640161016a565b6001600160801b0319841660009081526020819052604090206004015484906001600160a01b031633146106f75760405162461bcd60e51b815260206004820152602960248201527f6f6e6c794f7261636c653a206d6573736167652073656e646572206d757374206044820152686265206f7261636c6560b81b606482015260840161016a565b6001600160801b03198516600090815260208190526040812060048101805460ff60a01b1916600160a01b179055905b600182015481101561085a5760028201546001830180546001600160a01b039092169163a9059cbb919084908110610761576107616113db565b6000918252602090912001546003850180546001600160a01b03909216918590811061078f5761078f6113db565b6000918252602090912001546040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156107e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080a9190611311565b6108485760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015260640161016a565b8061085281611407565b915050610727565b506040516001600160801b03198716907fe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e990600090a250600195945050505050565b60006060600060606000806108b087610d70565b15156000036109015760405162461bcd60e51b815260206004820152601760248201527f436f6e747261637420646f6573206e6f74206578697374000000000000000000604482015260640161016a565b6001600160801b031987166000908152602081815260409182902080546002820154600483015460018401805487518188028101880190985280885294966001600160a01b0394851696919593851694600389019490841693600160a01b900460ff16928791908301828280156109a157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610983575b50505050509450828054806020026020016040519081016040528092919081815260200182805480156109f357602002820191906000526020600020905b8154815260200190600101908083116109df575b505050505092509650965096509650965096505091939550919395565b6000805b8251811015610a5657828181518110610a2f57610a2f6113db565b602002602001015182610a429190611420565b915080610a4e81611407565b915050610a14565b50919050565b600081610a6881610d70565b610aaf5760405162461bcd60e51b81526020600482015260186024820152771c185e5b595b9d125108191bd95cc81b9bdd08195e1a5cdd60421b604482015260640161016a565b6001600160801b0319831660009081526020819052604090206004015483906001600160a01b03163314610b1e5760405162461bcd60e51b8152602060048201526016602482015275726566756e6461626c653a206e6f74206f7261636c6560501b604482015260640161016a565b60026001600160801b03198216600090815260208190526040902060040154600160a01b900460ff166002811115610b5857610b5861114c565b03610ba55760405162461bcd60e51b815260206004820152601c60248201527f726566756e6461626c653a20616c726561647920726566756e64656400000000604482015260640161016a565b60016001600160801b03198216600090815260208190526040902060040154600160a01b900460ff166002811115610bdf57610bdf61114c565b03610c2c5760405162461bcd60e51b815260206004820152601d60248201527f726566756e6461626c653a20616c72656164792077697468647261776e000000604482015260640161016a565b6001600160801b0319841660009081526020818152604080832060048101805460ff60a01b1916600160a11b179055600381018054835181860281018601909452808452919493610cb2939290830182828015610ca857602002820191906000526020600020905b815481526020019060010190808311610c94575b5050505050610a10565b6002830154835460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af1158015610d0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2e9190611311565b506040516001600160801b03198716907f25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea26490600090a250600195945050505050565b6001600160801b0319166000908152602081905260409020546001600160a01b0316151590565b600080835111610ddf5760405162461bcd60e51b81526020600482015260136024820152721b9bc8185b5bdd5b9d1cc81c1c9bdd9a591959606a1b604482015260640161016a565b506000805b8351811015610e8f576000848281518110610e0157610e016113db565b602002602001015111610e565760405162461bcd60e51b815260206004820152601d60248201527f616d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161016a565b838181518110610e6857610e686113db565b602002602001015182610e7b9190611420565b915080610e8781611407565b915050610de4565b50604051636eb1769f60e11b815233600482015230602482015281906001600160a01b0384169063dd62ed3e90604401602060405180830381865afa158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f009190611438565b1015610f585760405162461bcd60e51b815260206004820152602160248201527f616c6c6f77616e6365206d757374206265203e3d2073756d28616d6f756e74736044820152602960f81b606482015260840161016a565b92915050565b828054828255906000526020600020908101928215610fb3579160200282015b82811115610fb357825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610f7e565b50610fbf929150610ffe565b5090565b828054828255906000526020600020908101928215610fb3579160200282015b82811115610fb3578251825591602001919060010190610fe3565b5b80821115610fbf5760008155600101610fff565b60008083601f84011261102557600080fd5b50813567ffffffffffffffff81111561103d57600080fd5b6020830191508360208260051b850101111561105857600080fd5b9250929050565b80356001600160a01b038116811461107657600080fd5b919050565b60008060008060008086880360a081121561109557600080fd5b873567ffffffffffffffff808211156110ad57600080fd5b6110b98b838c01611013565b90995097508791506040601f19840112156110d357600080fd5b60208a0196506110e560608b0161105f565b955060808a01359250808311156110fb57600080fd5b505061110989828a01611013565b979a9699509497509295939492505050565b60006020828403121561112d57600080fd5b81356001600160801b03198116811461114557600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b6003811061118057634e487b7160e01b600052602160045260246000fd5b9052565b6001600160a01b03878116825260c0602080840182905288519184018290526000928982019290919060e0860190855b818110156111d25785518516835294830194918301916001016111b4565b5050918916604086015284820360608601528751808352918101925080880160005b83811015611210578151855293820193908201906001016111f4565b5050506001600160a01b038616608085015250905061123260a0830184611162565b979650505050505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561126657600080fd5b823567ffffffffffffffff8082111561127e57600080fd5b818501915085601f83011261129257600080fd5b8135818111156112a4576112a461123d565b8060051b604051601f19603f830116810181811085821117156112c9576112c961123d565b6040529182528482019250838101850191888311156112e757600080fd5b938501935b82851015611305578435845293850193928501926112ec565b98975050505050505050565b60006020828403121561132357600080fd5b8151801515811461114557600080fd5b60006020828403121561134557600080fd5b6111458261105f565b60008184825b85811015611383576001600160a01b0361136d8361105f565b1683526020928301929190910190600101611354565b509095945050505050565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b038311156113be57600080fd5b8260051b8085606085013760009201606001918252509392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611419576114196113f1565b5060010190565b60008219821115611433576114336113f1565b500190565b60006020828403121561144a57600080fd5b505191905056fea2646970667358221220b2da5b414cbc65def9095a490826355ec9c7b70b71674e3f2d1ee04b9b2eef6c64736f6c634300080d0033" + +// DeployPayments deploys a new Ethereum contract, binding an instance of Payments to it. +func DeployPayments(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Payments, error) { + parsed, err := ParsedABI(K_Payments) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(PaymentsBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Payments{PaymentsCaller: PaymentsCaller{contract: contract}, PaymentsTransactor: PaymentsTransactor{contract: contract}, PaymentsFilterer: PaymentsFilterer{contract: contract}}, nil +} + +// Payments is an auto generated Go binding around an Ethereum contract. +type Payments struct { + PaymentsCaller // Read-only binding to the contract + PaymentsTransactor // Write-only binding to the contract + PaymentsFilterer // Log filterer for contract events +} + +// PaymentsCaller is an auto generated read-only Go binding around an Ethereum contract. +type PaymentsCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PaymentsTransactor is an auto generated write-only Go binding around an Ethereum contract. +type PaymentsTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PaymentsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type PaymentsFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// NewPayments creates a new instance of Payments, bound to a specific deployed contract. +func NewPayments(address common.Address, backend bind.ContractBackend) (*Payments, error) { + contract, err := bindPayments(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Payments{PaymentsCaller: PaymentsCaller{contract: contract}, PaymentsTransactor: PaymentsTransactor{contract: contract}, PaymentsFilterer: PaymentsFilterer{contract: contract}}, nil +} + +// NewPaymentsCaller creates a new read-only instance of Payments, bound to a specific deployed contract. +func NewPaymentsCaller(address common.Address, caller bind.ContractCaller) (*PaymentsCaller, error) { + contract, err := bindPayments(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &PaymentsCaller{contract: contract}, nil +} + +// NewPaymentsTransactor creates a new write-only instance of Payments, bound to a specific deployed contract. +func NewPaymentsTransactor(address common.Address, transactor bind.ContractTransactor) (*PaymentsTransactor, error) { + contract, err := bindPayments(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &PaymentsTransactor{contract: contract}, nil +} + +// NewPaymentsFilterer creates a new log filterer instance of Payments, bound to a specific deployed contract. +func NewPaymentsFilterer(address common.Address, filterer bind.ContractFilterer) (*PaymentsFilterer, error) { + contract, err := bindPayments(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &PaymentsFilterer{contract: contract}, nil +} + +// bindPayments binds a generic wrapper to an already deployed contract. +func bindPayments(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ParsedABI(K_Payments) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// CalculateTotal is a free data retrieval call binding the contract method 0xe2f5f998. +// +// Solidity: function calculateTotal(uint256[] _amounts) pure returns(uint256 total) +func (_Payments *PaymentsCaller) CalculateTotal(opts *bind.CallOpts, _amounts []*big.Int) (*big.Int, error) { + var ( + ret0 = new(*big.Int) + ) + out := ret0 + err := _Payments.contract.Call(opts, out, "calculateTotal", _amounts) + return *ret0, err +} + +// GetContract is a free data retrieval call binding the contract method 0x9c6173be. +// +// Solidity: function getContract(bytes16 _refId) view returns(address sender, address[] receivers, address tokenContract, uint256[] amounts, address oracle, uint8 state) +func (_Payments *PaymentsCaller) GetContract(opts *bind.CallOpts, _refId [16]byte) (struct { + Sender common.Address + Receivers []common.Address + TokenContract common.Address + Amounts []*big.Int + Oracle common.Address + State uint8 +}, error) { + ret := new(struct { + Sender common.Address + Receivers []common.Address + TokenContract common.Address + Amounts []*big.Int + Oracle common.Address + State uint8 + }) + out := ret + err := _Payments.contract.Call(opts, out, "getContract", _refId) + return *ret, err +} + +// CancelPayment is a paid mutator transaction binding the contract method 0xf2c9f603. +// +// Solidity: function cancelPayment(bytes16 _refId) returns(bool) +func (_Payments *PaymentsTransactor) CancelPayment(opts *bind.TransactOpts, _refId [16]byte) (*types.Transaction, error) { + return _Payments.contract.Transact(opts, "cancelPayment", _refId) +} + +// ClaimPayment is a paid mutator transaction binding the contract method 0x820b71ca. +// +// Solidity: function claimPayment(bytes16 _refId) returns(bool) +func (_Payments *PaymentsTransactor) ClaimPayment(opts *bind.TransactOpts, _refId [16]byte) (*types.Transaction, error) { + return _Payments.contract.Transact(opts, "claimPayment", _refId) +} + +// CreatePayment is a paid mutator transaction binding the contract method 0x732760a1. +// +// Solidity: function createPayment(address[] _receivers, (bytes16,address) _paymentId, address _tokenContract, uint256[] _amounts) returns(bytes16 refId) +func (_Payments *PaymentsTransactor) CreatePayment(opts *bind.TransactOpts, _receivers []common.Address, _paymentId ERC20PaymentsPaymentID, _tokenContract common.Address, _amounts []*big.Int) (*types.Transaction, error) { + return _Payments.contract.Transact(opts, "createPayment", _receivers, _paymentId, _tokenContract, _amounts) +} + +// PaymentsCanceledIterator is returned from FilterCanceled and is used to iterate over the raw logs and unpacked data for Canceled events raised by the Payments contract. +type PaymentsCanceledIterator struct { + Event *PaymentsCanceled // 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 *PaymentsCanceledIterator) 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(PaymentsCanceled) + 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(PaymentsCanceled) + 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 *PaymentsCanceledIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentsCanceledIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentsCanceled represents a Canceled event raised by the Payments contract. +type PaymentsCanceled struct { + ContractId [16]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCanceled is a free log retrieval operation binding the contract event 0x25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea264. +// +// Solidity: event Canceled(bytes16 indexed contractId) +func (_Payments *PaymentsFilterer) FilterCanceled(opts *bind.FilterOpts, contractId [][16]byte) (*PaymentsCanceledIterator, error) { + + var contractIdRule []interface{} + for _, contractIdItem := range contractId { + contractIdRule = append(contractIdRule, contractIdItem) + } + + logs, sub, err := _Payments.contract.FilterLogs(opts, "Canceled", contractIdRule) + if err != nil { + return nil, err + } + return &PaymentsCanceledIterator{contract: _Payments.contract, event: "Canceled", logs: logs, sub: sub}, nil +} + +// WatchCanceled is a free log subscription operation binding the contract event 0x25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea264. +// +// Solidity: event Canceled(bytes16 indexed contractId) +func (_Payments *PaymentsFilterer) WatchCanceled(opts *bind.WatchOpts, sink chan<- *PaymentsCanceled, contractId [][16]byte) (event.Subscription, error) { + + var contractIdRule []interface{} + for _, contractIdItem := range contractId { + contractIdRule = append(contractIdRule, contractIdItem) + } + + logs, sub, err := _Payments.contract.WatchLogs(opts, "Canceled", contractIdRule) + 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(PaymentsCanceled) + if err := _Payments.contract.UnpackLog(event, "Canceled", 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 +} + +// ParseCanceled is a log parse operation binding the contract event 0x25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea264. +// +// Solidity: event Canceled(bytes16 indexed contractId) +func (_Payments *PaymentsFilterer) ParseCanceled(log types.Log) (*PaymentsCanceled, error) { + event := new(PaymentsCanceled) + if err := _Payments.contract.UnpackLog(event, "Canceled", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PaymentsCreatedIterator is returned from FilterCreated and is used to iterate over the raw logs and unpacked data for Created events raised by the Payments contract. +type PaymentsCreatedIterator struct { + Event *PaymentsCreated // 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 *PaymentsCreatedIterator) 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(PaymentsCreated) + 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(PaymentsCreated) + 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 *PaymentsCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentsCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentsCreated represents a Created event raised by the Payments contract. +type PaymentsCreated struct { + ContractId [16]byte + Sender common.Address + Receivers []common.Address + TokenContract common.Address + Amounts []*big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterCreated is a free log retrieval operation binding the contract event 0xf5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e2. +// +// Solidity: event Created(bytes16 indexed contractId, address indexed sender, address[] indexed receivers, address tokenContract, uint256[] amounts) +func (_Payments *PaymentsFilterer) FilterCreated(opts *bind.FilterOpts, contractId [][16]byte, sender []common.Address, receivers [][]common.Address) (*PaymentsCreatedIterator, error) { + + var contractIdRule []interface{} + for _, contractIdItem := range contractId { + contractIdRule = append(contractIdRule, contractIdItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var receiversRule []interface{} + for _, receiversItem := range receivers { + receiversRule = append(receiversRule, receiversItem) + } + + logs, sub, err := _Payments.contract.FilterLogs(opts, "Created", contractIdRule, senderRule, receiversRule) + if err != nil { + return nil, err + } + return &PaymentsCreatedIterator{contract: _Payments.contract, event: "Created", logs: logs, sub: sub}, nil +} + +// WatchCreated is a free log subscription operation binding the contract event 0xf5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e2. +// +// Solidity: event Created(bytes16 indexed contractId, address indexed sender, address[] indexed receivers, address tokenContract, uint256[] amounts) +func (_Payments *PaymentsFilterer) WatchCreated(opts *bind.WatchOpts, sink chan<- *PaymentsCreated, contractId [][16]byte, sender []common.Address, receivers [][]common.Address) (event.Subscription, error) { + + var contractIdRule []interface{} + for _, contractIdItem := range contractId { + contractIdRule = append(contractIdRule, contractIdItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var receiversRule []interface{} + for _, receiversItem := range receivers { + receiversRule = append(receiversRule, receiversItem) + } + + logs, sub, err := _Payments.contract.WatchLogs(opts, "Created", contractIdRule, senderRule, receiversRule) + 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(PaymentsCreated) + if err := _Payments.contract.UnpackLog(event, "Created", 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 +} + +// ParseCreated is a log parse operation binding the contract event 0xf5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e2. +// +// Solidity: event Created(bytes16 indexed contractId, address indexed sender, address[] indexed receivers, address tokenContract, uint256[] amounts) +func (_Payments *PaymentsFilterer) ParseCreated(log types.Log) (*PaymentsCreated, error) { + event := new(PaymentsCreated) + if err := _Payments.contract.UnpackLog(event, "Created", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PaymentsWithdrawnIterator is returned from FilterWithdrawn and is used to iterate over the raw logs and unpacked data for Withdrawn events raised by the Payments contract. +type PaymentsWithdrawnIterator struct { + Event *PaymentsWithdrawn // 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 *PaymentsWithdrawnIterator) 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(PaymentsWithdrawn) + 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(PaymentsWithdrawn) + 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 *PaymentsWithdrawnIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentsWithdrawnIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentsWithdrawn represents a Withdrawn event raised by the Payments contract. +type PaymentsWithdrawn struct { + ContractId [16]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterWithdrawn is a free log retrieval operation binding the contract event 0xe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e9. +// +// Solidity: event Withdrawn(bytes16 indexed contractId) +func (_Payments *PaymentsFilterer) FilterWithdrawn(opts *bind.FilterOpts, contractId [][16]byte) (*PaymentsWithdrawnIterator, error) { + + var contractIdRule []interface{} + for _, contractIdItem := range contractId { + contractIdRule = append(contractIdRule, contractIdItem) + } + + logs, sub, err := _Payments.contract.FilterLogs(opts, "Withdrawn", contractIdRule) + if err != nil { + return nil, err + } + return &PaymentsWithdrawnIterator{contract: _Payments.contract, event: "Withdrawn", logs: logs, sub: sub}, nil +} + +// WatchWithdrawn is a free log subscription operation binding the contract event 0xe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e9. +// +// Solidity: event Withdrawn(bytes16 indexed contractId) +func (_Payments *PaymentsFilterer) WatchWithdrawn(opts *bind.WatchOpts, sink chan<- *PaymentsWithdrawn, contractId [][16]byte) (event.Subscription, error) { + + var contractIdRule []interface{} + for _, contractIdItem := range contractId { + contractIdRule = append(contractIdRule, contractIdItem) + } + + logs, sub, err := _Payments.contract.WatchLogs(opts, "Withdrawn", contractIdRule) + 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(PaymentsWithdrawn) + if err := _Payments.contract.UnpackLog(event, "Withdrawn", 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 +} + +// ParseWithdrawn is a log parse operation binding the contract event 0xe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e9. +// +// Solidity: event Withdrawn(bytes16 indexed contractId) +func (_Payments *PaymentsFilterer) ParseWithdrawn(log types.Log) (*PaymentsWithdrawn, error) { + event := new(PaymentsWithdrawn) + if err := _Payments.contract.UnpackLog(event, "Withdrawn", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/dist/payments/Context.abi b/dist/payments/Context.abi new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/dist/payments/Context.abi @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/dist/payments/Context.bin b/dist/payments/Context.bin new file mode 100644 index 0000000..e69de29 diff --git a/dist/payments/Context.signatures b/dist/payments/Context.signatures new file mode 100644 index 0000000..540cb30 --- /dev/null +++ b/dist/payments/Context.signatures @@ -0,0 +1 @@ +Function signatures: diff --git a/dist/payments/ERC20.abi b/dist/payments/ERC20.abi new file mode 100644 index 0000000..b925133 --- /dev/null +++ b/dist/payments/ERC20.abi @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/dist/payments/ERC20.bin b/dist/payments/ERC20.bin new file mode 100644 index 0000000..a55d3d6 --- /dev/null +++ b/dist/payments/ERC20.bin @@ -0,0 +1 @@ +60806040523480156200001157600080fd5b5060405162000aed38038062000aed8339810160408190526200003491620001db565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b50505062000281565b828054620000769062000245565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200013657600080fd5b81516001600160401b03808211156200015357620001536200010e565b604051601f8301601f19908116603f011681019082821181831017156200017e576200017e6200010e565b816040528381526020925086838588010111156200019b57600080fd5b600091505b83821015620001bf5785820183015181830184015290820190620001a0565b83821115620001d15760008385830101525b9695505050505050565b60008060408385031215620001ef57600080fd5b82516001600160401b03808211156200020757600080fd5b620002158683870162000124565b935060208501519150808211156200022c57600080fd5b506200023b8582860162000124565b9150509250929050565b600181811c908216806200025a57607f821691505b6020821081036200027b57634e487b7160e01b600052602260045260246000fd5b50919050565b61085c80620002916000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c3919061069a565b60405180910390f35b6100df6100da36600461070b565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610735565b61024a565b604051601281526020016100c3565b6100df61013136600461070b565b61026e565b6100f3610144366004610771565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df61017536600461070b565b61029f565b6100df61018836600461070b565b61031f565b6100f361019b366004610793565b61032d565b6060600380546101af906107c6565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107c6565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b9190610800565b610358565b6060600480546101af906107c6565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36104f0565b600060208083528351808285015260005b818110156106c7578581018301518582016040015282016106ab565b818111156106d9576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461070657600080fd5b919050565b6000806040838503121561071e57600080fd5b610727836106ef565b946020939093013593505050565b60008060006060848603121561074a57600080fd5b610753846106ef565b9250610761602085016106ef565b9150604084013590509250925092565b60006020828403121561078357600080fd5b61078c826106ef565b9392505050565b600080604083850312156107a657600080fd5b6107af836106ef565b91506107bd602084016106ef565b90509250929050565b600181811c908216806107da57607f821691505b6020821081036107fa57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561082157634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220e5879c50e8655fcd05d147315084fb6bd1982a6abf131b2ec3f0ba47d118c5e864736f6c634300080d0033 \ No newline at end of file diff --git a/dist/payments/ERC20.signatures b/dist/payments/ERC20.signatures new file mode 100644 index 0000000..97b3d2c --- /dev/null +++ b/dist/payments/ERC20.signatures @@ -0,0 +1,16 @@ +Function signatures: +dd62ed3e: allowance(address,address) +095ea7b3: approve(address,uint256) +70a08231: balanceOf(address) +313ce567: decimals() +a457c2d7: decreaseAllowance(address,uint256) +39509351: increaseAllowance(address,uint256) +06fdde03: name() +95d89b41: symbol() +18160ddd: totalSupply() +a9059cbb: transfer(address,uint256) +23b872dd: transferFrom(address,address,uint256) + +Event signatures: +8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925: Approval(address,address,uint256) +ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef: Transfer(address,address,uint256) diff --git a/dist/payments/ERC20Payments.abi b/dist/payments/ERC20Payments.abi new file mode 100644 index 0000000..3ff1b0e --- /dev/null +++ b/dist/payments/ERC20Payments.abi @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"contractId","type":"bytes16"}],"name":"Canceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"contractId","type":"bytes16"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address[]","name":"receivers","type":"address[]"},{"indexed":false,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"Created","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"contractId","type":"bytes16"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"calculateTotal","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes16","name":"_refId","type":"bytes16"}],"name":"cancelPayment","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"_refId","type":"bytes16"}],"name":"claimPayment","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_receivers","type":"address[]"},{"components":[{"internalType":"bytes16","name":"ref_id","type":"bytes16"},{"internalType":"address","name":"oracle_id","type":"address"}],"internalType":"struct ERC20Payments.PaymentID","name":"_paymentId","type":"tuple"},{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"createPayment","outputs":[{"internalType":"bytes16","name":"refId","type":"bytes16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16","name":"_refId","type":"bytes16"}],"name":"getContract","outputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"enum ERC20Payments.PaymentState","name":"state","type":"uint8"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/dist/payments/ERC20Payments.bin b/dist/payments/ERC20Payments.bin new file mode 100644 index 0000000..4634c29 --- /dev/null +++ b/dist/payments/ERC20Payments.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50611487806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063732760a11461005c578063820b71ca1461008d5780639c6173be146100b0578063e2f5f998146100d5578063f2c9f603146100f6575b600080fd5b61006f61006a36600461107b565b610109565b6040516001600160801b031990911681526020015b60405180910390f35b6100a061009b36600461111b565b61050d565b6040519015158152602001610084565b6100c36100be36600461111b565b61089c565b60405161008496959493929190611184565b6100e86100e3366004611253565b610a10565b604051908152602001610084565b6100a061010436600461111b565b610a5c565b6000610118602086018661111b565b61012181610d70565b156101735760405162461bcd60e51b815260206004820152601860248201527f7061796d656e74494420616c726561647920657869737473000000000000000060448201526064015b60405180910390fd5b610180602087018761111b565b915060006101c28585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a9250610d97915050565b90506101cd83610d70565b1561021a5760405162461bcd60e51b815260206004820152601760248201527f436f6e747261637420616c726561647920657869737473000000000000000000604482015260640161016a565b6040516323b872dd60e01b8152336004820152306024820152604481018290526001600160a01b038716906323b872dd906064016020604051808303816000875af115801561026d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102919190611311565b6102e85760405162461bcd60e51b815260206004820152602260248201527f7472616e7366657246726f6d2073656e64657220746f2074686973206661696c604482015261195960f21b606482015260840161016a565b6040518060c00160405280336001600160a01b031681526020018a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050908252506001600160a01b0388166020808301919091526040805188830281810184018352898252919093019291899189918291908501908490808284376000920191909152505050908252506020908101906103979060408b01908b01611333565b6001600160a01b03168152602001600090526001600160801b03198416600090815260208181526040909120825181546001600160a01b0319166001600160a01b0390911617815582820151805191926103f992600185019290910190610f5e565b5060408201516002820180546001600160a01b0319166001600160a01b039092169190911790556060820151805161043b916003840191602090910190610fc3565b5060808201516004820180546001600160a01b039092166001600160a01b031983168117825560a0850151926001600160a81b03191617600160a01b8360028111156104895761048961114c565b0217905550506040516104a091508a908a9061134e565b6040518091039020336001600160a01b0316846fffffffffffffffffffffffffffffffff19167ff5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e28989896040516104f99392919061138e565b60405180910390a450509695505050505050565b60008161051981610d70565b6105605760405162461bcd60e51b81526020600482015260186024820152771c185e5b595b9d125108191bd95cc81b9bdd08195e1a5cdd60421b604482015260640161016a565b8260016001600160801b03198216600090815260208190526040902060040154600160a01b900460ff16600281111561059b5761059b61114c565b036105e85760405162461bcd60e51b815260206004820152601f60248201527f776974686472617761626c653a20616c72656164792077697468647261776e00604482015260640161016a565b60026001600160801b03198216600090815260208190526040902060040154600160a01b900460ff1660028111156106225761062261114c565b0361066f5760405162461bcd60e51b815260206004820152601e60248201527f776974686472617761626c653a20616c726561647920726566756e6465640000604482015260640161016a565b6001600160801b0319841660009081526020819052604090206004015484906001600160a01b031633146106f75760405162461bcd60e51b815260206004820152602960248201527f6f6e6c794f7261636c653a206d6573736167652073656e646572206d757374206044820152686265206f7261636c6560b81b606482015260840161016a565b6001600160801b03198516600090815260208190526040812060048101805460ff60a01b1916600160a01b179055905b600182015481101561085a5760028201546001830180546001600160a01b039092169163a9059cbb919084908110610761576107616113db565b6000918252602090912001546003850180546001600160a01b03909216918590811061078f5761078f6113db565b6000918252602090912001546040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156107e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080a9190611311565b6108485760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015260640161016a565b8061085281611407565b915050610727565b506040516001600160801b03198716907fe2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e990600090a250600195945050505050565b60006060600060606000806108b087610d70565b15156000036109015760405162461bcd60e51b815260206004820152601760248201527f436f6e747261637420646f6573206e6f74206578697374000000000000000000604482015260640161016a565b6001600160801b031987166000908152602081815260409182902080546002820154600483015460018401805487518188028101880190985280885294966001600160a01b0394851696919593851694600389019490841693600160a01b900460ff16928791908301828280156109a157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610983575b50505050509450828054806020026020016040519081016040528092919081815260200182805480156109f357602002820191906000526020600020905b8154815260200190600101908083116109df575b505050505092509650965096509650965096505091939550919395565b6000805b8251811015610a5657828181518110610a2f57610a2f6113db565b602002602001015182610a429190611420565b915080610a4e81611407565b915050610a14565b50919050565b600081610a6881610d70565b610aaf5760405162461bcd60e51b81526020600482015260186024820152771c185e5b595b9d125108191bd95cc81b9bdd08195e1a5cdd60421b604482015260640161016a565b6001600160801b0319831660009081526020819052604090206004015483906001600160a01b03163314610b1e5760405162461bcd60e51b8152602060048201526016602482015275726566756e6461626c653a206e6f74206f7261636c6560501b604482015260640161016a565b60026001600160801b03198216600090815260208190526040902060040154600160a01b900460ff166002811115610b5857610b5861114c565b03610ba55760405162461bcd60e51b815260206004820152601c60248201527f726566756e6461626c653a20616c726561647920726566756e64656400000000604482015260640161016a565b60016001600160801b03198216600090815260208190526040902060040154600160a01b900460ff166002811115610bdf57610bdf61114c565b03610c2c5760405162461bcd60e51b815260206004820152601d60248201527f726566756e6461626c653a20616c72656164792077697468647261776e000000604482015260640161016a565b6001600160801b0319841660009081526020818152604080832060048101805460ff60a01b1916600160a11b179055600381018054835181860281018601909452808452919493610cb2939290830182828015610ca857602002820191906000526020600020905b815481526020019060010190808311610c94575b5050505050610a10565b6002830154835460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af1158015610d0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2e9190611311565b506040516001600160801b03198716907f25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea26490600090a250600195945050505050565b6001600160801b0319166000908152602081905260409020546001600160a01b0316151590565b600080835111610ddf5760405162461bcd60e51b81526020600482015260136024820152721b9bc8185b5bdd5b9d1cc81c1c9bdd9a591959606a1b604482015260640161016a565b506000805b8351811015610e8f576000848281518110610e0157610e016113db565b602002602001015111610e565760405162461bcd60e51b815260206004820152601d60248201527f616d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161016a565b838181518110610e6857610e686113db565b602002602001015182610e7b9190611420565b915080610e8781611407565b915050610de4565b50604051636eb1769f60e11b815233600482015230602482015281906001600160a01b0384169063dd62ed3e90604401602060405180830381865afa158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f009190611438565b1015610f585760405162461bcd60e51b815260206004820152602160248201527f616c6c6f77616e6365206d757374206265203e3d2073756d28616d6f756e74736044820152602960f81b606482015260840161016a565b92915050565b828054828255906000526020600020908101928215610fb3579160200282015b82811115610fb357825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190610f7e565b50610fbf929150610ffe565b5090565b828054828255906000526020600020908101928215610fb3579160200282015b82811115610fb3578251825591602001919060010190610fe3565b5b80821115610fbf5760008155600101610fff565b60008083601f84011261102557600080fd5b50813567ffffffffffffffff81111561103d57600080fd5b6020830191508360208260051b850101111561105857600080fd5b9250929050565b80356001600160a01b038116811461107657600080fd5b919050565b60008060008060008086880360a081121561109557600080fd5b873567ffffffffffffffff808211156110ad57600080fd5b6110b98b838c01611013565b90995097508791506040601f19840112156110d357600080fd5b60208a0196506110e560608b0161105f565b955060808a01359250808311156110fb57600080fd5b505061110989828a01611013565b979a9699509497509295939492505050565b60006020828403121561112d57600080fd5b81356001600160801b03198116811461114557600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b6003811061118057634e487b7160e01b600052602160045260246000fd5b9052565b6001600160a01b03878116825260c0602080840182905288519184018290526000928982019290919060e0860190855b818110156111d25785518516835294830194918301916001016111b4565b5050918916604086015284820360608601528751808352918101925080880160005b83811015611210578151855293820193908201906001016111f4565b5050506001600160a01b038616608085015250905061123260a0830184611162565b979650505050505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561126657600080fd5b823567ffffffffffffffff8082111561127e57600080fd5b818501915085601f83011261129257600080fd5b8135818111156112a4576112a461123d565b8060051b604051601f19603f830116810181811085821117156112c9576112c961123d565b6040529182528482019250838101850191888311156112e757600080fd5b938501935b82851015611305578435845293850193928501926112ec565b98975050505050505050565b60006020828403121561132357600080fd5b8151801515811461114557600080fd5b60006020828403121561134557600080fd5b6111458261105f565b60008184825b85811015611383576001600160a01b0361136d8361105f565b1683526020928301929190910190600101611354565b509095945050505050565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b038311156113be57600080fd5b8260051b8085606085013760009201606001918252509392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611419576114196113f1565b5060010190565b60008219821115611433576114336113f1565b500190565b60006020828403121561144a57600080fd5b505191905056fea2646970667358221220b2da5b414cbc65def9095a490826355ec9c7b70b71674e3f2d1ee04b9b2eef6c64736f6c634300080d0033 \ No newline at end of file diff --git a/dist/payments/ERC20Payments.signatures b/dist/payments/ERC20Payments.signatures new file mode 100644 index 0000000..46f865c --- /dev/null +++ b/dist/payments/ERC20Payments.signatures @@ -0,0 +1,11 @@ +Function signatures: +e2f5f998: calculateTotal(uint256[]) +f2c9f603: cancelPayment(bytes16) +820b71ca: claimPayment(bytes16) +732760a1: createPayment(address[],(bytes16,address),address,uint256[]) +9c6173be: getContract(bytes16) + +Event signatures: +25ccef20460325159f2f1853d4e2f53d50e508519fd950a1b57ca5f4f92ea264: Canceled(bytes16) +f5b628ae04a2e801c4184fb9b99c711c49643bbf8e1c6a0a70c10e3f5c32c0e2: Created(bytes16,address,address[],address,uint256[]) +e2676bf5a4d68036e2fc017546a033acda64f74e24c77a7aacea919422b891e9: Withdrawn(bytes16) diff --git a/dist/payments/IERC20.abi b/dist/payments/IERC20.abi new file mode 100644 index 0000000..83e67df --- /dev/null +++ b/dist/payments/IERC20.abi @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/dist/payments/IERC20.bin b/dist/payments/IERC20.bin new file mode 100644 index 0000000..e69de29 diff --git a/dist/payments/IERC20.signatures b/dist/payments/IERC20.signatures new file mode 100644 index 0000000..21450c3 --- /dev/null +++ b/dist/payments/IERC20.signatures @@ -0,0 +1,11 @@ +Function signatures: +dd62ed3e: allowance(address,address) +095ea7b3: approve(address,uint256) +70a08231: balanceOf(address) +18160ddd: totalSupply() +a9059cbb: transfer(address,uint256) +23b872dd: transferFrom(address,address,uint256) + +Event signatures: +8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925: Approval(address,address,uint256) +ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef: Transfer(address,address,uint256) diff --git a/dist/payments/IERC20Metadata.abi b/dist/payments/IERC20Metadata.abi new file mode 100644 index 0000000..42b7261 --- /dev/null +++ b/dist/payments/IERC20Metadata.abi @@ -0,0 +1 @@ +[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/dist/payments/IERC20Metadata.bin b/dist/payments/IERC20Metadata.bin new file mode 100644 index 0000000..e69de29 diff --git a/dist/payments/IERC20Metadata.signatures b/dist/payments/IERC20Metadata.signatures new file mode 100644 index 0000000..69eda49 --- /dev/null +++ b/dist/payments/IERC20Metadata.signatures @@ -0,0 +1,14 @@ +Function signatures: +dd62ed3e: allowance(address,address) +095ea7b3: approve(address,uint256) +70a08231: balanceOf(address) +313ce567: decimals() +06fdde03: name() +95d89b41: symbol() +18160ddd: totalSupply() +a9059cbb: transfer(address,uint256) +23b872dd: transferFrom(address,address,uint256) + +Event signatures: +8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925: Approval(address,address,uint256) +ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef: Transfer(address,address,uint256) diff --git a/foundry.toml b/foundry.toml index 6223b62..2373247 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,7 +3,6 @@ src = 'src' out = 'out' libs = ['lib'] test = 'test' -solc = "0.6.12" -script = 'script' +solc = "0.8.13" # See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts new file mode 160000 index 0000000..47003ae --- /dev/null +++ b/lib/openzeppelin-contracts @@ -0,0 +1 @@ +Subproject commit 47003aebec12314a7d409b685c40acb1e3c02c59 diff --git a/openzeppelin b/openzeppelin deleted file mode 160000 index f491e98..0000000 --- a/openzeppelin +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f491e98d37adb4684552b46c51510d18dd714702 diff --git a/remappings.txt b/remappings.txt new file mode 100644 index 0000000..1e11e4d --- /dev/null +++ b/remappings.txt @@ -0,0 +1,3 @@ +forge-std/=lib/forge-std/src/ +ds-test/=lib/forge-std/lib/ds-test/src/ +@openzeppelin/=lib/openzeppelin-contracts/ \ No newline at end of file diff --git a/script/tradable/redeemable.s.sol b/script/tradable/redeemable.s.sol index 65b469d..772c370 100644 --- a/script/tradable/redeemable.s.sol +++ b/script/tradable/redeemable.s.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.12; +pragma solidity ^0.8.13; import "forge-std/Script.sol"; import "forge-std/console2.sol"; @@ -8,7 +8,7 @@ import "src/redeemable.sol"; /** To run this script on the testnet: export PRIVATE_KEY=your_private_key - export RPC_URL=https://host-766.contentfabric.io/eth + export RPC_URL=https://host-766.contentfabric.io/eth forge script script/tradable/redeemable.s.sol:RedeemableScript --fork-url ${RPC_URL} --private-key ${PRIVATE_KEY} --broadcast --legacy */ contract RedeemableScript is Script { diff --git a/src/MinterRole.sol b/src/MinterRole.sol index 68941a2..6530953 100644 --- a/src/MinterRole.sol +++ b/src/MinterRole.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.12; +pragma solidity ^0.8.13; /** * MOCK IMPLEMENTATION diff --git a/src/payments/ERC20Payments.sol b/src/payments/ERC20Payments.sol new file mode 100644 index 0000000..31c7473 --- /dev/null +++ b/src/payments/ERC20Payments.sol @@ -0,0 +1,245 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract ERC20Payments { + struct PaymentID { + bytes16 ref_id; + address oracle_id; + } + + enum PaymentState { + Created, + Withdrawn, + Canceled + } + // Can be optimized by storing bytes instead of variable length arrays + struct LockPayment { + address sender; + address[] receivers; + address tokenContract; + uint256[] amounts; + address oracle; + PaymentState state; + } + + // Maybe this can be simplified to just be the contractId + event Created( + bytes16 indexed contractId, + address indexed sender, + address[] indexed receivers, + address tokenContract, + uint256[] amounts + ); + + event Withdrawn(bytes16 indexed contractId); + event Canceled(bytes16 indexed contractId); + + modifier tokensTransferable(address _token, uint256 _amount) { + require(_amount > 0, "token amount must be > 0"); + require( + ERC20(_token).allowance(msg.sender, address(this)) >= _amount, + "allowance must be >= amount" + ); + _; + } + + modifier contractExists(bytes16 _paymentID) { + require(havePayment(_paymentID), "paymentID does not exist"); + _; + } + + modifier paymentNotExists(bytes16 _paymentID) { + require(!havePayment(_paymentID), "paymentID already exists"); + _; + } + + modifier withdrawable(bytes16 _paymentID) { + // This can be simplified, but for error clarity, we keep it as is + require(paymentTransactions[_paymentID].state != PaymentState.Withdrawn, "withdrawable: already withdrawn"); + require(paymentTransactions[_paymentID].state != PaymentState.Canceled, "withdrawable: already refunded"); + _; + } + + modifier refundable(bytes16 _paymentID) { + require(paymentTransactions[_paymentID].oracle == msg.sender, "refundable: not oracle"); + // This can be simplified, but for error clarity, we keep it as is + require(paymentTransactions[_paymentID].state != PaymentState.Canceled, "refundable: already refunded"); + require(paymentTransactions[_paymentID].state != PaymentState.Withdrawn, "refundable: already withdrawn"); + _; + } + + modifier onlyOracle(bytes16 _paymentID) { + require(paymentTransactions[_paymentID].oracle == msg.sender, "onlyOracle: message sender must be oracle"); + _; + } + + mapping (bytes16 => LockPayment) paymentTransactions; // Change to paymentTransactions + + /** + * @dev Create a new payment contract between the sender and the reciever arrays + * + * NOTE: _receiver must first call approve() on the token contract. + * See allowance check in tokensTransferable modifier. + * @param _receivers Receivers of the tokens. + * @param _paymentId PaymentID of the payment. + * @param _tokenContract ERC20 Token contract address. + * @param _amounts Amounts of the token to lock up. + * @return refId Id of the payement. + */ + function createPayment( + address[] calldata _receivers, + PaymentID calldata _paymentId, + address _tokenContract, + uint256[] calldata _amounts + ) + external + paymentNotExists(_paymentId.ref_id) + returns (bytes16 refId) + { + refId = _paymentId.ref_id; + + uint256 total = verifyAmounts(_amounts, _tokenContract); + // Reject if a contract already exists with the same ID. + if (havePayment(refId)) + revert("Contract already exists"); + + // This contract becomes the temporary owner of the tokens + if (!ERC20(_tokenContract).transferFrom(msg.sender, address(this), total)) + revert("transferFrom sender to this failed"); + + paymentTransactions[refId] = LockPayment( + msg.sender, + _receivers, + _tokenContract, + _amounts, + _paymentId.oracle_id, + PaymentState.Created + ); + + emit Created(refId, msg.sender, _receivers, _tokenContract, _amounts); + } + + /** + * @dev Called by the oracle after the NFT has been transfered to the initiater's account + * + * @param _refId reference ID of the contract + * @return bool true on success + */ + function claimPayment(bytes16 _refId) + external + contractExists(_refId) + withdrawable(_refId) + onlyOracle(_refId) + returns (bool) + { + LockPayment storage c = paymentTransactions[_refId]; + c.state = PaymentState.Withdrawn; + // Iterate over all receivers and transfer the tokens to them + for (uint i = 0; i < c.receivers.length; i++) { + if (!ERC20(c.tokenContract).transfer(c.receivers[i], c.amounts[i])) + revert("transfer failed"); + } + emit Withdrawn(_refId); + return true; + } + + /** + * @dev Called by the oracle if there was no withdraw to refund the payment sender. + * + * @param _refId reference ID of the contract + * @return bool true on success + */ + function cancelPayment(bytes16 _refId) + external + contractExists(_refId) + refundable(_refId) + returns (bool) + { + LockPayment storage c = paymentTransactions[_refId]; + c.state = PaymentState.Canceled; + uint256 total = calculateTotal(c.amounts); + ERC20(c.tokenContract).transfer(c.sender, total); + emit Canceled(_refId); + return true; + } + + /** + * @dev Get contract details. + * @param _refId reference ID of the contract + */ + function getContract(bytes16 _refId) + public + view + returns ( + address sender, + address[] memory receivers, + address tokenContract, + uint256[] memory amounts, + address oracle, + PaymentState state + ) + { + if (havePayment(_refId) == false) + revert("Contract does not exist"); + LockPayment storage c = paymentTransactions[_refId]; + return ( + c.sender, + c.receivers, + c.tokenContract, + c.amounts, + c.oracle, + c.state + ); + } + + /** + * @dev Is there a contract with id _refId. + * @param _refId Id into paymentTransactions mapping. + */ + function havePayment(bytes16 _refId) + internal + view + returns (bool exists) + { + exists = (paymentTransactions[_refId].sender != address(0)); + } + + /** + * @dev Calculate the total amount of the tokens and confirm that the sender has allocated the correct + * number of tokens to the contract. + * @param _amounts Amounts of the tokens. + * @return total Total amount of the tokens. + */ + function verifyAmounts(uint256[] memory _amounts, address _tokenContract) + internal + view + returns (uint256 total) + { + require(_amounts.length > 0, "no amounts provided"); + total = 0; + for (uint i=0; i < _amounts.length; i++) { + require(_amounts[i] > 0, "amount must be greater than 0"); + total += _amounts[i]; + } + require( + ERC20(_tokenContract).allowance(msg.sender, address(this)) >= total, + "allowance must be >= sum(amounts)" + ); + } + + /** + * @dev Convenience method to calculate the total amount of the tokens. + * @param _amounts Amounts of the tokens. + * @return total Total amount of the tokens. + */ + + function calculateTotal(uint256[] memory _amounts) public pure returns (uint256 total) + { + total = 0; + for (uint i=0; i < _amounts.length; i++) { + total += _amounts[i]; + } + } +} \ No newline at end of file diff --git a/src/redeemable.sol b/src/redeemable.sol index 7c9833f..52333c1 100644 --- a/src/redeemable.sol +++ b/src/redeemable.sol @@ -28,7 +28,7 @@ contract Redeemable is MinterRole { // Redemption state - store an offers bitmap for each tokenId mapping(uint256 => uint256) private redemptions; - constructor() public { + constructor() { offers = 0; numOffers = 0; } diff --git a/test/payments/ERC20Payments.t.sol b/test/payments/ERC20Payments.t.sol new file mode 100644 index 0000000..ae249c9 --- /dev/null +++ b/test/payments/ERC20Payments.t.sol @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {console} from "forge-std/console.sol"; +import {Utilities} from "../utils/Utilities.sol"; +import {stdStorage, StdStorage, Test} from "forge-std/Test.sol"; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {ERC20Payments} from "../../src/payments/ERC20Payments.sol"; + +// Deployed at 0x60aa8e13feb9301ec17cdf07ff6a45b9cd472279 +contract TestToken is ERC20 { + address public admin; + + constructor() ERC20("dust", "TestToken") { + _mint(msg.sender, 20000000 * 10 ** decimals()); + admin = msg.sender; + } + + function name() override public pure returns (string memory) { + return "Test Coin"; + } +} + +contract ERC20PaymentsTest is Test { + + Utilities internal utils; + address payable[] internal users; + ERC20 internal token; + ERC20Payments internal escrow; + + + address internal alice; + address internal bob; + address internal carol; + + function setUp() public virtual { + utils = new Utilities(); + users = utils.createUsers(3); + + alice = users[0]; + vm.label(alice, "Alice"); + bob = users[1]; + vm.label(bob, "Bob"); + carol = users[2]; + vm.label(carol, "Carol"); + token = new TestToken(); + escrow = new ERC20Payments(); + } + + function aliceCreateEscrow(bytes16 refId, address[] memory recievers, uint256[] memory amounts, address oracle, uint init_bal) private { + token.transfer(alice, init_bal*10**token.decimals()); + uint256 total = escrow.calculateTotal(amounts); + vm.prank(alice); + token.approve(address(escrow), total); + vm.prank(alice); + escrow.createPayment( + recievers, + ERC20Payments.PaymentID(refId, oracle), + address(token), + amounts + ); + } + + function preloadedInit() private returns (bytes16 refId) { + refId = "stringliteral"; + address[] memory recievers = new address[](1); + uint256[] memory amounts = new uint256[](1); + recievers[0] = bob; + amounts[0] = 1000*10**token.decimals(); + uint initBal = 10000; + aliceCreateEscrow(refId, recievers, amounts, carol, initBal); + } + + function testCreateEscrowState() public { + console.log("Testing Correct Escrow Creation"); + token.transfer(alice, 10000*10**18); + uint256 initialBalance = token.balanceOf(alice); + bytes16 refId = "stringliteral"; + address[] memory recievers = new address[](1); + uint256[] memory amounts = new uint256[](1); + recievers[0] = bob; + amounts[0] = 1000*10**token.decimals(); + vm.prank(alice); + token.approve(address(escrow), amounts[0]); + vm.prank(alice); + escrow.createPayment( + recievers, ERC20Payments.PaymentID(refId, alice), + address(token), + amounts + ); + (address s, address[] memory r, address tc, uint256[] memory a, address o, ERC20Payments.PaymentState st) = escrow.getContract(refId); + require(initialBalance-token.balanceOf(alice) == 1000*10**token.decimals(), "Balance should be decreased by 1000"); + require(token.balanceOf(alice) == 9000*10**token.decimals(), "Alice should have 9k"); + require(s == alice, "sender is wrong"); + require(r[0] == bob, "receiver is not Bob"); + require(tc == address(token), "token contract is not token"); + require(a[0] == 1000*10**token.decimals(), "amount is not 1000"); + require(o == alice, "oracle is not alice"); + require(st == ERC20Payments.PaymentState.Created, "state is not Created"); + } + + function testCancelEscrow() public { + console.log("Testing Correct Escrow Cancelation"); + bytes16 refId = "stringliteral"; + address[] memory recievers = new address[](1); + uint256[] memory amounts = new uint256[](1); + recievers[0] = bob; + amounts[0] = 1000*10**token.decimals(); + uint init_bal = 10000; + aliceCreateEscrow(refId, recievers, amounts, carol, init_bal); + vm.prank(carol); + escrow.cancelPayment(refId); + (address s, address[] memory r, address tc, uint256[] memory a, address o, ERC20Payments.PaymentState st) = escrow.getContract(refId); + require(token.balanceOf(alice) == 10000*10**token.decimals(), "Alice should have 10k"); + require((token.balanceOf(address(escrow)) == 0), "Escrow should have 0 balance"); + require(s == alice, "sender is wrong"); + require(r[0] == bob, "receiver is not Bob"); + require(tc == address(token), "token contract is not token"); + require(a[0] == 1000*10**token.decimals(), "amount is not 1000"); + require(o == carol, "oracle is not carol"); + require(st == ERC20Payments.PaymentState.Canceled, "state is not Canceled"); + } + + function testWithdrawEscrow() public { + console.log("Testing Correct Escrow Withdrawal"); + bytes16 refId = preloadedInit(); + vm.startPrank(carol); + escrow.claimPayment(refId); + vm.stopPrank(); + (address s, address[] memory r, address tc, uint256[] memory a, address o, ERC20Payments.PaymentState st) = escrow.getContract(refId); + require(token.balanceOf(alice) == 9000*10**token.decimals(), "Alice should have 9k"); + require(token.balanceOf(bob) == 1000*10**token.decimals(), "Bob should have 1k"); + require(token.balanceOf(carol) == 0, "Carol should have 0"); + require(token.balanceOf(address(escrow)) == 0, "Escrow should have 0 balance"); + require(s == alice, "sender is wrong"); + require(r[0] == bob, "receiver is not Bob"); + require(tc == address(token), "token contract is not token"); + require(a[0] == 1000*10**token.decimals(), "amount is not 1000"); + require(o == carol, "oracle is not carol"); + require(st == ERC20Payments.PaymentState.Withdrawn, "state is not Withdrawn"); + } + + function testFailRepeatedCreate() public { + console.log("Testing Repeated Escrow Creation"); + bytes16 refId = "stringliteral"; + address[] memory recievers = new address[](1); + uint256[] memory amounts = new uint256[](1); + recievers[0] = bob; + amounts[0] = 1000*10**token.decimals(); + uint init_bal = 10000; + aliceCreateEscrow(refId, recievers, amounts, carol, init_bal); + // Idk why I can't get expect revert to work + // vm.expectRevert(bytes("contractId already exists")); + aliceCreateEscrow(refId, recievers, amounts, carol, init_bal); + } + + function testFailWithdraw() public { + console.log("Testing Escrow Withdrawal"); + bytes16 refId = preloadedInit(); + vm.prank(carol); + // Idk why I can't get expect revert to work + // vm.expectRevert(bytes("contractId does not exist")); + vm.prank(alice); + escrow.claimPayment(refId); + } + + function testMultipleRecievers(uint len) public { + vm.assume(len > 0 && len < 500); + uint256[] memory amounts = new uint256[](len); + for (uint i = 0; i < len; i++) { + amounts[i] = (i+1)*100*10**token.decimals(); + } + uint initBal = escrow.calculateTotal(amounts); + token.transfer(alice, initBal); + + console.log("Testing Multiple Recievers"); + bytes16 refId = "stringliteral"; + address[] memory recievers = new address[](amounts.length); + address payable[] memory payables = utils.createUsers(amounts.length); + for (uint i = 0; i < len; i++) { + recievers[i] = payables[i]; + } + + vm.startPrank(alice); + token.approve(address(escrow), initBal); + escrow.createPayment(recievers, ERC20Payments.PaymentID(refId, carol), address(token), amounts); + vm.stopPrank(); + vm.startPrank(carol); + escrow.claimPayment(refId); + vm.stopPrank(); + (address s, address[] memory r, address tc, , address o, ERC20Payments.PaymentState st) = escrow.getContract(refId); + require(token.balanceOf(alice) == 0, "Alice should have 0"); + for (uint i = 0; i < amounts.length; i++) { + require(token.balanceOf(payables[i]) == amounts[i], string(abi.encodePacked("Recipient ", i, " should have ", amounts[i]))); + } + require(token.balanceOf(address(escrow)) == 0, "Escrow should have 0 balance"); + require(s == alice, "sender is wrong"); + require(r[0] == payables[0], "receiver is not Bob"); + require(tc == address(token), "token contract is not token"); + require(o == carol, "oracle is not carol"); + require(st == ERC20Payments.PaymentState.Withdrawn, "state is not Confirmed"); + } + + function testFailBobCancels() public { + console.log("Testing Bob Cancelling"); + bytes16 refId = preloadedInit(); + vm.prank(bob); + escrow.cancelPayment(refId); + } +} + + + diff --git a/test/tradable/redeemable.t.sol b/test/tradable/redeemable.t.sol index 52b4452..2503455 100644 --- a/test/tradable/redeemable.t.sol +++ b/test/tradable/redeemable.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.12; +pragma solidity ^0.8.13; import "forge-std/Test.sol"; import "forge-std/console2.sol"; diff --git a/test/utils/Console.sol b/test/utils/Console.sol new file mode 100644 index 0000000..a837d22 --- /dev/null +++ b/test/utils/Console.sol @@ -0,0 +1,5203 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +/* solhint-disable */ +library console { + address constant CONSOLE_ADDRESS = + address(0x000000000000000000636F6e736F6c652e6c6f67); + + function _sendLogPayload(bytes memory payload) private view { + uint256 payloadLength = payload.length; + address consoleAddress = CONSOLE_ADDRESS; + assembly { + let payloadStart := add(payload, 32) + let r := staticcall( + gas(), + consoleAddress, + payloadStart, + payloadLength, + 0, + 0 + ) + } + } + + function log() internal view { + _sendLogPayload(abi.encodeWithSignature("log()")); + } + + function logInt(int256 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); + } + + function logUint(uint256 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); + } + + function logString(string memory p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function logBool(bool p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); + } + + function logAddress(address p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); + } + + function logBytes(bytes memory p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); + } + + function logBytes1(bytes1 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); + } + + function logBytes2(bytes2 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); + } + + function logBytes3(bytes3 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); + } + + function logBytes4(bytes4 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); + } + + function logBytes5(bytes5 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); + } + + function logBytes6(bytes6 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); + } + + function logBytes7(bytes7 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); + } + + function logBytes8(bytes8 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); + } + + function logBytes9(bytes9 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); + } + + function logBytes10(bytes10 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); + } + + function logBytes11(bytes11 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); + } + + function logBytes12(bytes12 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); + } + + function logBytes13(bytes13 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); + } + + function logBytes14(bytes14 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); + } + + function logBytes15(bytes15 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); + } + + function logBytes16(bytes16 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); + } + + function logBytes17(bytes17 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); + } + + function logBytes18(bytes18 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); + } + + function logBytes19(bytes19 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); + } + + function logBytes20(bytes20 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); + } + + function logBytes21(bytes21 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); + } + + function logBytes22(bytes22 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); + } + + function logBytes23(bytes23 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); + } + + function logBytes24(bytes24 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); + } + + function logBytes25(bytes25 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); + } + + function logBytes26(bytes26 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); + } + + function logBytes27(bytes27 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); + } + + function logBytes28(bytes28 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); + } + + function logBytes29(bytes29 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); + } + + function logBytes30(bytes30 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); + } + + function logBytes31(bytes31 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); + } + + function logBytes32(bytes32 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); + } + + function log(bytes32[] memory p0) internal view { + for (uint256 i; i < p0.length; ) { + _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0[i])); + unchecked { + ++i; + } + } + } + + function log(uint256 p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); + } + + function log(uint256[] memory p0) internal view { + for (uint256 i; i < p0.length; ) { + _sendLogPayload(abi.encodeWithSignature("log(uint)", p0[i])); + unchecked { + ++i; + } + } + } + + function log(string memory p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function log(string[] memory p0) internal view { + for (uint256 i; i < p0.length; ) { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0[i])); + unchecked { + ++i; + } + } + } + + function log(bool p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); + } + + function log(bool[] memory p0) internal view { + for (uint256 i; i < p0.length; ) { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0[i])); + unchecked { + ++i; + } + } + } + + function log(address p0) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); + } + + function log(address[] memory p0) internal view { + for (uint256 i; i < p0.length; ) { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0[i])); + unchecked { + ++i; + } + } + } + + function log(uint256 p0, uint256 p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); + } + + function log(uint256 p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); + } + + function log(uint256 p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); + } + + function log(uint256 p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); + } + + function log(string memory p0, uint256 p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); + } + + function log(string memory p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); + } + + function log(string memory p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); + } + + function log(string memory p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); + } + + function log(bool p0, uint256 p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); + } + + function log(bool p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); + } + + function log(bool p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); + } + + function log(bool p0, address p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); + } + + function log(address p0, uint256 p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); + } + + function log(address p0, string memory p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); + } + + function log(address p0, bool p1) internal view { + _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); + } + + function log(address p0, address p1) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,address)", p0, p1) + ); + } + + function log( + uint256 p0, + uint256 p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + uint256 p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + uint256 p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + uint256 p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + string memory p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + string memory p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + string memory p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + string memory p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + bool p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + bool p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + bool p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + bool p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + address p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + address p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + address p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + address p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2) + ); + } + + function log( + string memory p0, + uint256 p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2) + ); + } + + function log( + string memory p0, + uint256 p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2) + ); + } + + function log( + string memory p0, + uint256 p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2) + ); + } + + function log( + string memory p0, + uint256 p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2) + ); + } + + function log( + string memory p0, + string memory p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2) + ); + } + + function log( + string memory p0, + string memory p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,string,string)", p0, p1, p2) + ); + } + + function log( + string memory p0, + string memory p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2) + ); + } + + function log( + string memory p0, + string memory p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,string,address)", p0, p1, p2) + ); + } + + function log( + string memory p0, + bool p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2) + ); + } + + function log( + string memory p0, + bool p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2) + ); + } + + function log( + string memory p0, + bool p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2) + ); + } + + function log( + string memory p0, + bool p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2) + ); + } + + function log( + string memory p0, + address p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2) + ); + } + + function log( + string memory p0, + address p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,address,string)", p0, p1, p2) + ); + } + + function log( + string memory p0, + address p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2) + ); + } + + function log( + string memory p0, + address p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(string,address,address)", p0, p1, p2) + ); + } + + function log( + bool p0, + uint256 p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2) + ); + } + + function log( + bool p0, + uint256 p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2) + ); + } + + function log( + bool p0, + uint256 p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2) + ); + } + + function log( + bool p0, + uint256 p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2) + ); + } + + function log( + bool p0, + string memory p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2) + ); + } + + function log( + bool p0, + string memory p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2) + ); + } + + function log( + bool p0, + string memory p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2) + ); + } + + function log( + bool p0, + string memory p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2) + ); + } + + function log( + bool p0, + bool p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2) + ); + } + + function log( + bool p0, + bool p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2) + ); + } + + function log( + bool p0, + bool p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2) + ); + } + + function log( + bool p0, + bool p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2) + ); + } + + function log( + bool p0, + address p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2) + ); + } + + function log( + bool p0, + address p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2) + ); + } + + function log( + bool p0, + address p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2) + ); + } + + function log( + bool p0, + address p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2) + ); + } + + function log( + address p0, + uint256 p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2) + ); + } + + function log( + address p0, + uint256 p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2) + ); + } + + function log( + address p0, + uint256 p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2) + ); + } + + function log( + address p0, + uint256 p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2) + ); + } + + function log( + address p0, + string memory p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2) + ); + } + + function log( + address p0, + string memory p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,string,string)", p0, p1, p2) + ); + } + + function log( + address p0, + string memory p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2) + ); + } + + function log( + address p0, + string memory p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,string,address)", p0, p1, p2) + ); + } + + function log( + address p0, + bool p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2) + ); + } + + function log( + address p0, + bool p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2) + ); + } + + function log( + address p0, + bool p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2) + ); + } + + function log( + address p0, + bool p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2) + ); + } + + function log( + address p0, + address p1, + uint256 p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2) + ); + } + + function log( + address p0, + address p1, + string memory p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,address,string)", p0, p1, p2) + ); + } + + function log( + address p0, + address p1, + bool p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2) + ); + } + + function log( + address p0, + address p1, + address p2 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(address,address,address)", p0, p1, p2) + ); + } + + function log( + uint256 p0, + uint256 p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + uint256 p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + uint256 p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + uint256 p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + uint256 p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + uint256 p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,uint,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + string memory p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,string,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + bool p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + bool p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + bool p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3) + ); + } + + function log( + uint256 p0, + bool p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + bool p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,bool,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + uint256 p0, + address p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(uint,address,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + uint256 p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,uint,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + string memory p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,string,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + bool p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,bool,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + string memory p0, + address p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(string,address,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + uint256 p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + uint256 p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + uint256 p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + uint256 p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + uint256 p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,uint,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + string memory p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,string,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + bool p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + bool p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + bool p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3) + ); + } + + function log( + bool p0, + bool p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + bool p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,bool,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + bool p0, + address p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(bool,address,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + uint256 p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,uint,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + string memory p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,string,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + bool p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,bool,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + uint256 p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,uint,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + uint256 p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,uint,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + uint256 p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,uint,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + uint256 p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,uint,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + string memory p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,string,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + string memory p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,string,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + string memory p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,string,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + string memory p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,string,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + bool p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,bool,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + bool p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,bool,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + bool p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,bool,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + bool p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,bool,address)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + address p2, + uint256 p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,address,uint)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + address p2, + string memory p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,address,string)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + address p2, + bool p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,address,bool)", + p0, + p1, + p2, + p3 + ) + ); + } + + function log( + address p0, + address p1, + address p2, + address p3 + ) internal view { + _sendLogPayload( + abi.encodeWithSignature( + "log(address,address,address,address)", + p0, + p1, + p2, + p3 + ) + ); + } +} \ No newline at end of file diff --git a/test/utils/Utilities.sol b/test/utils/Utilities.sol new file mode 100644 index 0000000..93d545b --- /dev/null +++ b/test/utils/Utilities.sol @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import {DSTest} from "ds-test/test.sol"; +import {Vm} from "forge-std/Vm.sol"; + +//common utilities for forge tests +contract Utilities is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + bytes32 internal nextUser = keccak256(abi.encodePacked("user address")); + + function getNextUserAddress() external returns (address payable) { + //bytes32 to address conversion + address payable user = payable(address(uint160(uint256(nextUser)))); + nextUser = keccak256(abi.encodePacked(nextUser)); + return user; + } + + //create users with 100 ether balance + function createUsers(uint256 userNum) + external + returns (address payable[] memory) + { + address payable[] memory users = new address payable[](userNum); + for (uint256 i = 0; i < userNum; i++) { + address payable user = this.getNextUserAddress(); + vm.deal(user, 100 ether); + users[i] = user; + } + return users; + } + + //move block.number forward by a given number of blocks + function mineBlocks(uint256 numBlocks) external { + uint256 targetBlock = block.number + numBlocks; + vm.roll(targetBlock); + } +}