From 9b8d24f4ea4513e7745308cd70c160425eb3d3a1 Mon Sep 17 00:00:00 2001 From: laocheng-cheng <73106671+laocheng-cheng@users.noreply.github.com> Date: Mon, 28 Nov 2022 15:01:52 +0800 Subject: [PATCH] feat: upload file with muti token, and bt protocol (#269) * feat: muti token upload_shard * feat: vault implementation upgrade * feat: mod code incompent * chore: modify test vault logic contract address * chore: vault incopenment * chore: vault incopenment, add muti func * chore: mod cheque of muti * chore: mod tokon string to common.address * chore: test * chore: test * chore: debug muti token * chore: debug cash cheque * chore: debug price contract * chore: add token-type for more cmd * feat: add support tokens * feat: add support tokens * chore: add ChequeStatsAllCmd * feat: mod receive_history_stats_all send-history-stats-all * test: other token upload ok * chore: vault logic contract address * test: chequeRecordRet add token * test: send_history_list + send_history_peer * test: LastCheques of one token * test: cheque recievelist * test: receive_history_list receive_history_peer receive_total_count * test: cash_list * test: receive_list_all send_list_all * test: cashout event * test: muti token vault deposit * feat: add bittorrent cmd (#265) * feat: rm the QUIC dependence of go-libp2p-quic-transport temporarily * feat: update golang version * build: golang1.18 require a new format when there is a build in the first line * feat: add bittorrent cmd * feat[bittorrent]: add metainfo cmd * feat[bittorrent]: add scrape and bencode cmds * feat[bittorrent]: add download cmd * feat: add some human-readable statistics * feat: rm the file after download completed * feat[bittorrent]: add bt serve cmd * fix: getting metainfo support magnet * ci: update go mod * test: fix cmd test * fix[bittorrent]: update the description of serveing * test: balance of bttc, and transfer * feat[bittorrent]: listen port from 30000 to 31000 (#267) * feat: add adds pin (#268) * feat[bittorrent]: listen port from 30000 to 31000 * fix: add adds pin * test: unit test * test: receive_list_all update sort * test: mod token type Co-authored-by: fish <920886811@163.com> Co-authored-by: steve Co-authored-by: Shawn-Huang-Tron <107823650+Shawn-Huang-Tron@users.noreply.github.com> --- .gitignore | 5 + Dockerfile | 2 +- Dockerfile.testing | 2 +- Dockerfile.unit_testing | 2 +- accounting/accounting.go | 11 +- assets/bindata_dep.go | 3 +- chain/abi/muti_vault_abi.go | 653 ++++++++++++++++++ chain/abi/price_abi.go | 213 ++++++ chain/chain.go | 18 +- chain/config/config.go | 17 +- chain/tokencfg/tokencfg.go | 89 +++ chain/tokencfg/tokencfg_test.go | 15 + cmd/btfs/daemon.go | 20 +- cmd/btfs/daemon_linux.go | 1 + cmd/btfs/daemon_other.go | 1 + cmd/btfs/runmain_test.go | 1 + cmd/btfs/util/ui.go | 3 +- cmd/btfs/util/ulimit_freebsd.go | 1 + cmd/btfs/util/ulimit_test.go | 1 + cmd/btfs/util/ulimit_unix.go | 1 + cmd/btfs/util/ulimit_windows.go | 1 + core/commands/bittorrent.go | 468 +++++++++++++ core/commands/bttc/bttc.go | 9 +- core/commands/bttc/send_token_to.go | 66 ++ .../cheque/{btt_balance.go => balance_btt.go} | 0 core/commands/cheque/balance_muti_tokens.go | 86 +++ core/commands/cheque/cash_list.go | 14 + core/commands/cheque/cash_status.go | 15 +- core/commands/cheque/cheque.go | 78 ++- core/commands/cheque/receive.go | 17 +- core/commands/cheque/receive_history_list.go | 2 +- core/commands/cheque/receive_history_peer.go | 3 +- core/commands/cheque/receive_history_stats.go | 15 +- .../cheque/receive_history_stats_all.go | 56 ++ core/commands/cheque/receive_list.go | 24 +- core/commands/cheque/receive_list_all.go | 108 +++ core/commands/cheque/receive_total_count.go | 11 +- .../commands/cheque/send-history-stats-all.go | 52 ++ core/commands/cheque/send-history-stats.go | 15 +- core/commands/cheque/send.go | 15 +- core/commands/cheque/send_history_list.go | 12 +- core/commands/cheque/send_history_peer.go | 9 +- core/commands/cheque/send_list.go | 15 +- core/commands/cheque/send_list_all.go | 57 ++ core/commands/cheque/send_total_count.go | 14 +- core/commands/cheque/stats-all.go | 52 ++ core/commands/cheque/stats.go | 114 +-- core/commands/commands_test.go | 16 + core/commands/mount_nofuse.go | 1 + core/commands/mount_unix.go | 1 + core/commands/root.go | 8 +- core/commands/settlements/list.go | 22 +- core/commands/settlements/peer.go | 15 +- core/commands/storage/path/dir_other.go | 1 + core/commands/storage/path/dir_windows.go | 1 + core/commands/storage/path/path_darwin.go | 1 + core/commands/storage/path/path_unix.go | 1 + core/commands/storage/path/path_windows.go | 1 + .../upload/sessions/renter_sessions.go | 42 ++ core/commands/storage/upload/upload/do_pay.go | 15 +- .../storage/upload/upload/do_submit.go | 11 +- .../upload/upload/receive_check_tokens.go | 30 + .../storage/upload/upload/recieve_cheque.go | 18 +- core/commands/storage/upload/upload/repair.go | 5 +- core/commands/storage/upload/upload/upload.go | 24 +- .../storage/upload/upload/upload_shard.go | 64 +- core/commands/test.go | 3 +- core/commands/vault/vault.go | 1 + core/commands/vault/vault_balance.go | 14 +- core/commands/vault/vault_balance_all.go | 41 ++ core/commands/vault/vault_deposit.go | 15 +- core/commands/vault/vault_withdraw.go | 15 +- core/coreapi/unixfs.go | 4 +- core/node/libp2p/transport.go | 8 +- core/wallet/speed_darwin.go | 1 + core/wallet/speed_other.go | 1 + core/wallet/speed_windows.go | 1 + coverage/main/main.go | 1 + fuse/ipns/ipns_test.go | 1 + fuse/ipns/ipns_unix.go | 1 + fuse/ipns/link_unix.go | 1 + fuse/ipns/mount_unix.go | 1 + fuse/mount/fuse.go | 1 + fuse/node/mount_nofuse.go | 1 + fuse/node/mount_test.go | 1 + fuse/node/mount_unix.go | 1 + fuse/readonly/ipfs_test.go | 1 + fuse/readonly/mount_unix.go | 1 + fuse/readonly/readonly_unix.go | 1 + go.mod | 258 ++++++- go.sum | 538 ++++++++++----- guide/pkged.go | 1 + plugin/loader/load_nocgo.go | 4 +- plugin/loader/load_noplugin.go | 1 + plugin/loader/load_unix.go | 4 +- settlement/interface.go | 7 +- settlement/swap/bttc/bttc.go | 32 +- settlement/swap/bttc/bttc_test.go | 6 + .../swap/chequestore/mock/chequestore.go | 12 +- settlement/swap/priceoracle/priceoracle.go | 52 +- settlement/swap/swap.go | 78 ++- settlement/swap/swap_test.go | 62 +- settlement/swap/swapprotocol/swapprotocol.go | 31 +- settlement/swap/vault/cashout.go | 236 +++++-- settlement/swap/vault/cashout_test.go | 16 +- settlement/swap/vault/cheque.go | 47 +- settlement/swap/vault/chequestore.go | 93 ++- settlement/swap/vault/chequestore_test.go | 24 +- settlement/swap/vault/contract.go | 77 ++- settlement/swap/vault/contract_muti.go | 307 ++++++++ settlement/swap/vault/init.go | 17 +- settlement/swap/vault/mock/vault.go | 132 ++-- settlement/swap/vault/vault.go | 357 +++++----- settlement/swap/vault/vault_test.go | 58 +- statestore/keys.go | 33 +- test/dependencies/dependencies.go | 1 + utils/token.go | 25 + 117 files changed, 4430 insertions(+), 859 deletions(-) create mode 100644 chain/abi/muti_vault_abi.go create mode 100644 chain/abi/price_abi.go create mode 100644 chain/tokencfg/tokencfg.go create mode 100644 chain/tokencfg/tokencfg_test.go create mode 100644 core/commands/bittorrent.go create mode 100644 core/commands/bttc/send_token_to.go rename core/commands/cheque/{btt_balance.go => balance_btt.go} (100%) create mode 100644 core/commands/cheque/balance_muti_tokens.go create mode 100644 core/commands/cheque/receive_history_stats_all.go create mode 100644 core/commands/cheque/receive_list_all.go create mode 100644 core/commands/cheque/send-history-stats-all.go create mode 100644 core/commands/cheque/send_list_all.go create mode 100644 core/commands/cheque/stats-all.go create mode 100644 core/commands/storage/upload/upload/receive_check_tokens.go create mode 100644 core/commands/vault/vault_balance_all.go create mode 100644 settlement/swap/vault/contract_muti.go create mode 100644 utils/token.go diff --git a/.gitignore b/.gitignore index eb83e71ff..f783fde35 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,8 @@ cmd/.DS_Store cmd/btfs/s cmd/btfs/btfs .DS_Store + +cmd/btfs/btfs.upgrade +cmd/btfs/ttt +cmd/btfs/tt +cmd/btfs/t \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 241cbf882..7c2cd965c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16 +FROM golang:1.18 MAINTAINER TRON-US # Install deps diff --git a/Dockerfile.testing b/Dockerfile.testing index fe0218fb2..723d2a24f 100644 --- a/Dockerfile.testing +++ b/Dockerfile.testing @@ -1,4 +1,4 @@ -FROM golang:1.15 +FROM golang:1.18 MAINTAINER TRON-US # Install deps diff --git a/Dockerfile.unit_testing b/Dockerfile.unit_testing index a05589c3d..b57784f55 100644 --- a/Dockerfile.unit_testing +++ b/Dockerfile.unit_testing @@ -1,4 +1,4 @@ -FROM golang:1.15 +FROM golang:1.18 MAINTAINER TRON-US # Dockerfile.unit_testing will build an image to run the go unit tests. diff --git a/accounting/accounting.go b/accounting/accounting.go index dd52e884d..95c7c9e42 100644 --- a/accounting/accounting.go +++ b/accounting/accounting.go @@ -9,6 +9,7 @@ package accounting import ( "context" "fmt" + "github.com/ethereum/go-ethereum/common" "math/big" "sync" "time" @@ -20,7 +21,7 @@ import ( var log = logging.Logger("accounting") // PayFunc is the function used for async monetary settlement -type PayFunc func(context.Context, string, *big.Int, string) +type PayFunc func(context.Context, string, *big.Int, string, common.Address) // accountingPeer holds all in-memory accounting information for one peer. type accountingPeer struct { @@ -70,10 +71,10 @@ func (a *Accounting) Close() error { } // Settle to a peer. The lock on the accountingPeer must be held when called. -func (a *Accounting) Settle(toPeer string, paymentAmount *big.Int, contractId string) error { +func (a *Accounting) Settle(toPeer string, paymentAmount *big.Int, contractId string, token common.Address) error { if paymentAmount.Cmp(a.minimumPayment) >= 0 { a.wg.Add(1) - go a.payFunction(context.Background(), toPeer, paymentAmount, contractId) + go a.payFunction(context.Background(), toPeer, paymentAmount, contractId, token) } return nil @@ -97,7 +98,7 @@ func (a *Accounting) getAccountingPeer(peer string) *accountingPeer { } // NotifyPaymentSent is triggered by async monetary settlement to update our balance and remove it's price from the shadow reserve -func (a *Accounting) NotifyPaymentSent(peer string, amount *big.Int, receivedError error) { +func (a *Accounting) NotifyPaymentSent(peer string, amount *big.Int, receivedError error, token common.Address) { defer a.wg.Done() accountingPeer := a.getAccountingPeer(peer) @@ -114,7 +115,7 @@ func (a *Accounting) NotifyPaymentSent(peer string, amount *big.Int, receivedErr } // NotifyPayment is called by Settlement when we receive a payment. -func (a *Accounting) NotifyPaymentReceived(peer string, amount *big.Int) error { +func (a *Accounting) NotifyPaymentReceived(peer string, amount *big.Int, token common.Address) error { accountingPeer := a.getAccountingPeer(peer) accountingPeer.lock.Lock() diff --git a/assets/bindata_dep.go b/assets/bindata_dep.go index 50459a445..f99ebf750 100644 --- a/assets/bindata_dep.go +++ b/assets/bindata_dep.go @@ -1,4 +1,5 @@ -//+build never,!never +//go:build never && !never +// +build never,!never package assets diff --git a/chain/abi/muti_vault_abi.go b/chain/abi/muti_vault_abi.go new file mode 100644 index 000000000..e5664e916 --- /dev/null +++ b/chain/abi/muti_vault_abi.go @@ -0,0 +1,653 @@ +package abi + +const MutiVaultABI2 = `[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "ChequeBounced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalPayout", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cumulativePayout", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "callerPayout", + "type": "uint256" + } + ], + "name": "ChequeCashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "MultiTokenChequeBounced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalPayout", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cumulativePayout", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "callerPayout", + "type": "uint256" + } + ], + "name": "MultiTokenChequeCashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "MultiTokenVaultDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "MultiTokenVaultWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "VaultDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "VaultWithdraw", + "type": "event" + }, + { + "inputs": [], + "name": "CHEQUE_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "EIP712DOMAIN_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MULTI_TOKEN_CHEQUE_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bounced", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "cumulativePayout", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "issuerSig", + "type": "bytes" + } + ], + "name": "cashChequeBeneficiary", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "impl", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_issuer", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "issuer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "cumulativePayout", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "issuerSig", + "type": "bytes" + } + ], + "name": "multiTokenCashChequeBeneficiary", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "multiTokenDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "multiTokenWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "multiTokensBounced", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "multiTokensPaidOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "multiTokensTotalPaidOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "paidOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract ERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalPaidOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalbalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "totalbalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +]` diff --git a/chain/abi/price_abi.go b/chain/abi/price_abi.go new file mode 100644 index 000000000..9a0f44fd8 --- /dev/null +++ b/chain/abi/price_abi.go @@ -0,0 +1,213 @@ +package abi + +const OracleAbi2 = `[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "rate", + "type": "uint256" + } + ], + "name": "ExchangeRateUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newPrices", + "type": "uint256[]" + } + ], + "name": "PricesUpdate", + "type": "event" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRate", + "type": "uint256" + } + ], + "name": "updateExchangeRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "newPrices", + "type": "uint256[]" + } + ], + "name": "updatePrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_exchangeRate", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "exchangeRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getExchangeRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "name": "getPrices", + "outputs": [ + { + "internalType": "uint256[]", + "name": "result", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "prices", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +]` diff --git a/chain/chain.go b/chain/chain.go index c47a420e9..84801153e 100644 --- a/chain/chain.go +++ b/chain/chain.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "strings" @@ -140,8 +141,16 @@ func InitSettlement( } erc20Service := erc20.New(chaininfo.Backend, chaininfo.TransactionService, erc20Address) + fmt.Println("...InitSettlement erc20Address ", erc20Address) + + // muti tokens + mpErc20Service := make(map[string]erc20.Service) + for k, tokenAddr := range tokencfg.MpTokenAddr { + mpErc20Service[k] = erc20.New(chaininfo.Backend, chaininfo.TransactionService, tokenAddr) + } + // init bttc service - bttcService := bttc.New(chaininfo.TransactionService, erc20Service) + bttcService := bttc.New(chaininfo.TransactionService, erc20Service, mpErc20Service) //initChequeStoreCashout chequeStore, cashoutService := initChequeStoreCashout( @@ -175,6 +184,7 @@ func InitSettlement( deployGasPrice, chequeStore, erc20Service, + mpErc20Service, ) if err != nil { @@ -195,7 +205,7 @@ func InitSettlement( ) if err != nil { - return nil, errors.New("init swap service error") + return nil, errors.New("init swap service error , " + err.Error()) } accounting.SetPayFunc(swapService.Pay) @@ -256,6 +266,7 @@ func initVaultService( deployGasPrice string, chequeStore vault.ChequeStore, erc20Service erc20.Service, + mpErc20Service map[string]erc20.Service, ) (vault.Service, error) { chequeSigner := vault.NewChequeSigner(signer, chainID) @@ -280,6 +291,7 @@ func initVaultService( chequeSigner, chequeStore, erc20Service, + mpErc20Service, ) if err != nil { return nil, fmt.Errorf("vault init: %w", err) @@ -336,7 +348,7 @@ func initSwap( } priceOracle := priceoracle.New(currentPriceOracleAddress, transactionService) - _, err := priceOracle.CheckNewPrice() // CheckNewPrice when node starts + _, err := priceOracle.CheckNewPrice(tokencfg.GetWbttToken()) // CheckNewPrice when node starts if err != nil { return nil, nil, err } diff --git a/chain/config/config.go b/chain/config/config.go index 145fee883..248aecd46 100644 --- a/chain/config/config.go +++ b/chain/config/config.go @@ -2,7 +2,6 @@ package config import ( "errors" - cfg "github.com/TRON-US/go-btfs-config" "github.com/ethereum/go-ethereum/common" ) @@ -30,17 +29,19 @@ var ( bttcTestFactoryAddressV1 = common.HexToAddress("0xc4e269975e5277eA16c32023A5A70F96541ED854") bttcTestFactoryAddress = common.HexToAddress("0x47caA2198A7614E68a9F9578e217535Ef9674040") // https://testnet.bttcscan.com/address/0x47caA2198A7614E68a9F9578e217535Ef9674040 - bttcTestOracleAddress = common.HexToAddress("0xb2C746a9C81564bEF8382e885AF11e73De4a9E15") + bttcTestOracleAddress = common.HexToAddress("0x4Ef7658416E2CC662492d4D37917D340425522Fc") bttcTestBatchAddress = common.HexToAddress("0x0c9de531dcb38b758fe8a2c163444a5e54ee0db2") bttcTestVaultLogicAddressV1 = common.HexToAddress("0x212324b18255593AdE87597Fa37C2c582aD72d24") - bttcTestVaultLogicAddress = common.HexToAddress("0x73bcbE03999913dB7229FD5dC485cf23247c58B5") // https://testnet.bttcscan.com/address/0x73bcbE03999913dB7229FD5dC485cf23247c58B5 + bttcTestVaultLogicAddressV2 = common.HexToAddress("0x73bcbE03999913dB7229FD5dC485cf23247c58B5") // https://testnet.bttcscan.com/address/0x73bcbE03999913dB7229FD5dC485cf23247c58B5 + bttcTestVaultLogicAddress = common.HexToAddress("0x67F0366c4c0c83F55D4759D301BEe051EF01E350") // https://testnet.bttcscan.com/address/0x67F0366c4c0c83F55D4759D301BEe051EF01E350 bttcTestStatusAddress = common.HexToAddress("0x38d1fF2C2e9744273E4531FA4608eB6432c1F26A") bttcFactoryAddressV1 = common.HexToAddress("0x9AF4bEc1A30BeC47756Ecef4cf43B91592121bC9") bttcFactoryAddress = common.HexToAddress("0x763d7858287B9a33F4bE5bb3df0241dACc59BCc7") // https://bttcscan.com/address/0x763d7858287B9a33F4bE5bb3df0241dACc59BCc7 - bttcOracleAddress = common.HexToAddress("0x0064d80C42b6E2cE3aC92eaD445B3D83C510c7AA") + bttcOracleAddress = common.HexToAddress("") bttcBatchAddress = common.HexToAddress("0x0c9de531dcb38b758fe8a2c163444a5e54ee0db2") bttcVaultLogicAddressV1 = common.HexToAddress("0x102dbCe01394C4a44Da3a1DF1De418e3fC225077") // https://bttcscan.com/address/0x102dbce01394c4a44da3a1df1de418e3fc225077 + bttcVaultLogicAddressV2 = common.HexToAddress("0x11a91B7270ea000768F7A2C543547e832b5cb031") // https://bttcscan.com/address/0x11a91B7270ea000768F7A2C543547e832b5cb031 bttcVaultLogicAddress = common.HexToAddress("0x11a91B7270ea000768F7A2C543547e832b5cb031") // https://bttcscan.com/address/0x11a91B7270ea000768F7A2C543547e832b5cb031 bttcStatusAddress = common.HexToAddress("0x6DBAd4Bd16C15AE6dDEaA640626e5A3E151F02fC") @@ -145,9 +146,9 @@ func InitChainConfig( if len(cfg.ChainInfo.CurrentFactory) <= 0 { return nil, errors.New("CurrentFactory is None in config file") } - if len(cfg.ChainInfo.PriceOracleAddress) <= 0 { - return nil, errors.New("PriceOracleAddress is None in config file") - } + //if len(cfg.ChainInfo.PriceOracleAddress) <= 0 { + // return nil, errors.New("PriceOracleAddress is None in config file") + //} if len(cfg.ChainInfo.Endpoint) <= 0 { return nil, errors.New("Endpoint is None in config file") } @@ -160,7 +161,7 @@ func InitChainConfig( if stored { chainconfig.CurrentFactory = common.HexToAddress(cfg.ChainInfo.CurrentFactory) - chainconfig.PriceOracleAddress = common.HexToAddress(cfg.ChainInfo.PriceOracleAddress) + //chainconfig.PriceOracleAddress = common.HexToAddress(cfg.ChainInfo.PriceOracleAddress) chainconfig.Endpoint = cfg.ChainInfo.Endpoint } diff --git a/chain/tokencfg/tokencfg.go b/chain/tokencfg/tokencfg.go new file mode 100644 index 000000000..62dd0df9c --- /dev/null +++ b/chain/tokencfg/tokencfg.go @@ -0,0 +1,89 @@ +package tokencfg + +import ( + "fmt" + "github.com/ethereum/go-ethereum/common" +) + +const ( + TokenTypeName = "token-type" + + WBTT = "WBTT" + TRX = "TRX" + USDD = "USDD" + USDT = "USDT" + TST = "TST" + + // online + bttcWBTTHex = "0x23181F21DEa5936e24163FFABa4Ea3B316B57f3C" + bttcTRXHex = "" + bttcUSDDHex = "" + bttcUSDTHex = "" + + // test + bttcTestWBTTHex = "0x107742eb846b86ceaaf7528d5c85cddcad3e409a" + bttcTestTRXHex = "0x8e009872b8a6d469939139be5e3bbd99a731212f" + bttcTestUSDDHex = "0xa092706717dcb6892b93f0baacc07b902dbd509c" + bttcTestUSDTHex = "0x7b906030735435422675e0679bc02dae7dfc71da" + bttcTestTSTHex = "0xb1cB0B7637C357108E1B72E191Aa41962019c7cc" +) + +var chainIDStore int64 + +var MpTokenAddr map[string]common.Address +var MpTokenStr map[common.Address]string + +func init() { + MpTokenAddr = make(map[string]common.Address) + MpTokenStr = make(map[common.Address]string) +} + +func InitToken(chainID int64) { + chainIDStore = chainID + fmt.Println("------ InitToken ", chainIDStore) + + if chainID == 199 { + MpTokenAddr[WBTT] = common.HexToAddress(bttcWBTTHex) + MpTokenAddr[TRX] = common.HexToAddress(bttcTRXHex) + MpTokenAddr[USDD] = common.HexToAddress(bttcUSDDHex) + MpTokenAddr[USDT] = common.HexToAddress(bttcUSDTHex) + + MpTokenStr[common.HexToAddress(bttcWBTTHex)] = WBTT + MpTokenStr[common.HexToAddress(bttcTRXHex)] = TRX + MpTokenStr[common.HexToAddress(bttcUSDDHex)] = USDD + MpTokenStr[common.HexToAddress(bttcUSDTHex)] = USDT + } else { + MpTokenAddr[WBTT] = common.HexToAddress(bttcTestWBTTHex) + MpTokenAddr[TRX] = common.HexToAddress(bttcTestTRXHex) + MpTokenAddr[USDD] = common.HexToAddress(bttcTestUSDDHex) + MpTokenAddr[USDT] = common.HexToAddress(bttcTestUSDTHex) + MpTokenAddr[TST] = common.HexToAddress(bttcTestTSTHex) + + MpTokenStr[common.HexToAddress(bttcTestWBTTHex)] = WBTT + MpTokenStr[common.HexToAddress(bttcTestTRXHex)] = TRX + MpTokenStr[common.HexToAddress(bttcTestUSDDHex)] = USDD + MpTokenStr[common.HexToAddress(bttcTestUSDTHex)] = USDT + MpTokenStr[common.HexToAddress(bttcTestTSTHex)] = TST + } +} + +func GetWbttToken() common.Address { + fmt.Println("------ GetWbttToken ", chainIDStore) + + if chainIDStore == 199 { + return common.HexToAddress(bttcWBTTHex) + } else { + return common.HexToAddress(bttcTestWBTTHex) + } +} + +func IsWBTT(token common.Address) bool { + return token == MpTokenAddr["WBTT"] +} + +func AddToken(s string, token common.Address) string { + if token == MpTokenAddr["WBTT"] { + return s + } + return fmt.Sprintf("%s_%s", token.String(), s) +} diff --git a/chain/tokencfg/tokencfg_test.go b/chain/tokencfg/tokencfg_test.go new file mode 100644 index 000000000..e0f6ca6e3 --- /dev/null +++ b/chain/tokencfg/tokencfg_test.go @@ -0,0 +1,15 @@ +package tokencfg + +import ( + "fmt" + "github.com/ethereum/go-ethereum/common" + "testing" +) + +func TestTokenConfig(t *testing.T) { + InitToken(1029) + fmt.Println(MpTokenAddr) + fmt.Println(MpTokenStr) + + fmt.Println("zero address, ", common.HexToAddress("")) +} diff --git a/cmd/btfs/daemon.go b/cmd/btfs/daemon.go index 203daaa7c..719814954 100644 --- a/cmd/btfs/daemon.go +++ b/cmd/btfs/daemon.go @@ -7,6 +7,7 @@ import ( "errors" _ "expvar" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io/ioutil" "math/rand" "net" @@ -443,6 +444,8 @@ If the user need to start multiple nodes on the same machine, the configuration } } + tokencfg.InitToken(chainid) + //endpoint chainInfo, err := chain.InitChain(context.Background(), statestore, singer, time.Duration(1000000000), chainid, cfg.Identity.PeerID, chainCfg) @@ -471,7 +474,7 @@ If the user need to start multiple nodes on the same machine, the configuration } /*settleinfo*/ - _, err = chain.InitSettlement(context.Background(), statestore, chainInfo, deployGasPrice, chainInfo.ChainID) + settleInfo, err := chain.InitSettlement(context.Background(), statestore, chainInfo, deployGasPrice, chainInfo.ChainID) if err != nil { fmt.Println("init settlement err: ", err) if strings.Contains(err.Error(), "insufficient funds") { @@ -485,6 +488,21 @@ If the user need to start multiple nodes on the same machine, the configuration return err } + /*upgrade vault implementation*/ + oldImpl, newImpl, err := settleInfo.VaultService.UpgradeTo(context.Background(), chainInfo.Chainconfig.VaultLogicAddress) + if err != nil { + emsg := err.Error() + if strings.Contains(emsg, "already upgraded") { + fmt.Printf("vault implementation is updated: %s\n", chainInfo.Chainconfig.VaultLogicAddress) + err = nil + } else { + fmt.Println("upgrade vault implementation err: ", err) + return err + } + } else { + fmt.Printf("vault logic implementation upgrade from %s to %s\n", oldImpl, newImpl) + } + // init report status contract reportStatusServ := reportstatus.Init(chainInfo.TransactionService, cfg, chainCfg.StatusAddress) err = CheckExistLastOnlineReport(cfg, configRoot, chainid, reportStatusServ) diff --git a/cmd/btfs/daemon_linux.go b/cmd/btfs/daemon_linux.go index a1123b003..d06baf286 100644 --- a/cmd/btfs/daemon_linux.go +++ b/cmd/btfs/daemon_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package main diff --git a/cmd/btfs/daemon_other.go b/cmd/btfs/daemon_other.go index 4ffdd8b8e..cb96ce1b9 100644 --- a/cmd/btfs/daemon_other.go +++ b/cmd/btfs/daemon_other.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package main diff --git a/cmd/btfs/runmain_test.go b/cmd/btfs/runmain_test.go index 8eecce334..360f2bc53 100644 --- a/cmd/btfs/runmain_test.go +++ b/cmd/btfs/runmain_test.go @@ -1,3 +1,4 @@ +//go:build testrunmain // +build testrunmain package main diff --git a/cmd/btfs/util/ui.go b/cmd/btfs/util/ui.go index d68c9d7a5..cf8ad5067 100644 --- a/cmd/btfs/util/ui.go +++ b/cmd/btfs/util/ui.go @@ -1,4 +1,5 @@ -//+build !windows +//go:build !windows +// +build !windows package util diff --git a/cmd/btfs/util/ulimit_freebsd.go b/cmd/btfs/util/ulimit_freebsd.go index d4a36de44..27b31349b 100644 --- a/cmd/btfs/util/ulimit_freebsd.go +++ b/cmd/btfs/util/ulimit_freebsd.go @@ -1,3 +1,4 @@ +//go:build freebsd // +build freebsd package util diff --git a/cmd/btfs/util/ulimit_test.go b/cmd/btfs/util/ulimit_test.go index 70527cf62..394c7d337 100644 --- a/cmd/btfs/util/ulimit_test.go +++ b/cmd/btfs/util/ulimit_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package util diff --git a/cmd/btfs/util/ulimit_unix.go b/cmd/btfs/util/ulimit_unix.go index ee30dadaf..d3b0ec43c 100644 --- a/cmd/btfs/util/ulimit_unix.go +++ b/cmd/btfs/util/ulimit_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || linux || netbsd || openbsd // +build darwin linux netbsd openbsd package util diff --git a/cmd/btfs/util/ulimit_windows.go b/cmd/btfs/util/ulimit_windows.go index 3cd9908c3..5dbfd26f7 100644 --- a/cmd/btfs/util/ulimit_windows.go +++ b/cmd/btfs/util/ulimit_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package util diff --git a/core/commands/bittorrent.go b/core/commands/bittorrent.go new file mode 100644 index 000000000..251cceecd --- /dev/null +++ b/core/commands/bittorrent.go @@ -0,0 +1,468 @@ +package commands + +import ( + "bytes" + "context" + "encoding/hex" + "encoding/json" + "fmt" + "io" + "net/url" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + + "github.com/anacrolix/torrent" + "github.com/anacrolix/torrent/bencode" + "github.com/anacrolix/torrent/metainfo" + "github.com/anacrolix/torrent/storage" + "github.com/anacrolix/torrent/tracker/udp" + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bradfitz/iter" + humanize "github.com/dustin/go-humanize" +) + +var bittorrentCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "A tool command to integrate with bittorrent net(support bittorrent seed or a magnet URI scheme).", + }, + Subcommands: map[string]*cmds.Command{ + "metainfo": metainfoBTCmd, + "scrape": scrapeBTCmd, + "bencode": bencodeBTCmd, + "download": downloadBTCmd, + "serve": serveBTCmd, + }, + Extra: CreateCmdExtras(SetDoesNotUseRepo(true)), +} + +var metainfoBTCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Print the metainfo of a bittorrent file from a bittorrent seed file.", + }, + Options: []cmds.Option{ + cmds.StringOption("t", "Bittorrent seed file."), + cmds.StringOption("m", "Magnet uri."), + }, + Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { + btFilePath, _ := req.Options["t"].(string) + magnetUri, _ := req.Options["m"].(string) + var mi *metainfo.MetaInfo + var err error + if btFilePath != "" { + mi, err = metainfo.LoadFromFile(btFilePath) + if err != nil { + return fmt.Errorf("LoadFromFile bittorrent seed file: %w", err) + } + } else if magnetUri != "" { + clientConfig := torrent.NewDefaultClientConfig() + clientConfig.ListenPort = 0 + client, err := torrent.NewClient(clientConfig) + if err != nil { + return fmt.Errorf("creating client: %w", err) + } + defer client.Close() + t, err := client.AddMagnet(magnetUri) + if err != nil { + return fmt.Errorf("client.AddMagnet: %w", err) + } + select { + case <-t.GotInfo(): + case <-time.After(5 * time.Minute): + return fmt.Errorf("get magnet from bt network timeout, may be this seed cannot find") + } + m := t.Metainfo() + mi = &m + } else { + return fmt.Errorf("you must specify a -t to represent the path of a bt seed file or -m to represent a magnet uri") + } + + info, err := mi.UnmarshalInfo() + if err != nil { + return fmt.Errorf("error unmarshalling info: %s", err) + } + d := map[string]interface{}{ + "Name": info.Name, + "Name.Utf8": info.NameUtf8, + "NumPieces": info.NumPieces(), + "PieceLength": info.PieceLength, + "InfoHash": mi.HashInfoBytes().HexString(), + "NumFiles": len(info.UpvertedFiles()), + "TotalLength": info.TotalLength(), + "Announce": mi.Announce, + "AnnounceList": mi.AnnounceList, + "UrlList": mi.UrlList, + "Files": info.UpvertedFiles(), + } + if len(mi.Nodes) > 0 { + d["Nodes"] = mi.Nodes + } + d["PieceHashes"] = func() (ret []string) { + for i := range iter.N(info.NumPieces()) { + ret = append(ret, hex.EncodeToString(info.Pieces[i*20:(i+1)*20])) + } + return + }() + return resp.Emit(d) + }, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeEncoder(func(req *cmds.Request, w io.Writer, out interface{}) error { + marshaled, err := json.MarshalIndent(out, "", " ") + if err != nil { + return err + } + marshaled = append(marshaled, byte('\n')) + fmt.Fprintln(w, string(marshaled)) + return nil + }), + }, +} + +var scrapeBTCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Fetch swarm metrics for info-hashes from tracker.", + }, + Options: []cmds.Option{ + cmds.StringOption("t", "The tracker url."), + cmds.StringOption("i", "the hash list of a file or piece which is separated by commas"), + }, + Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { + tracker, _ := req.Options["t"].(string) + if tracker == "" { + return fmt.Errorf("tracker(-t) must be specified") + } + hashListStr, _ := req.Options["i"].(string) + if hashListStr == "" { + return fmt.Errorf("hash list(-i) must be specified and is separated by commas") + } + hashList := strings.Split(hashListStr, ",") + var ihs []udp.InfoHash + for _, hashStr := range hashList { + if len(hashStr) != 2*metainfo.HashSize { + return fmt.Errorf("hash info must be %d characters", 2*metainfo.HashSize) + } + ih := metainfo.NewHashFromHex(hashStr) + ihs = append(ihs, ih) + } + trackerUrl, err := url.Parse(tracker) + if err != nil { + return fmt.Errorf("parsing tracker url: %w", err) + } + cc, err := udp.NewConnClient(udp.NewConnClientOpts{ + Network: trackerUrl.Scheme, + Host: trackerUrl.Host, + }) + if err != nil { + return fmt.Errorf("creating new udp tracker conn client: %w", err) + } + defer cc.Close() + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + scrapeOut, err := cc.Client.Scrape(ctx, ihs) + if err != nil { + return fmt.Errorf("scraping: %w", err) + } + return resp.Emit(scrapeOut) + }, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeEncoder(func(req *cmds.Request, w io.Writer, out interface{}) error { + marshaled, err := json.MarshalIndent(out, "", " ") + if err != nil { + return err + } + marshaled = append(marshaled, byte('\n')) + fmt.Fprintln(w, string(marshaled)) + return nil + }), + }, +} + +var bencodeBTCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Print the bencoded info person-friendly of a bittorrent file from a bittorrent seed file.", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, true, "The path to a bittorrent file in which bencoded data stored."), + }, + Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { + btFilePath := req.Arguments[0] + f, err := os.Open(btFilePath) + if err != nil { + return err + } + defer f.Close() + d := bencode.NewDecoder(f) + var v interface{} + err = d.Decode(&v) + if err != nil { + return fmt.Errorf("decoding message : %w", err) + } + resp.Emit(v) + return nil + }, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeEncoder(func(req *cmds.Request, w io.Writer, out interface{}) error { + marshaled, err := json.MarshalIndent(out, "", " ") + if err != nil { + return err + } + marshaled = append(marshaled, byte('\n')) + fmt.Fprintln(w, string(marshaled)) + return nil + }), + }, +} + +var downloadBTCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Download a bittorrent file from the bittorrent seed or a magnet URL.", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("magnet uri", false, false, "Magnet uri if your seed is coming from magnet."), + }, + Options: []cmds.Option{ + cmds.StringOption("t", "Bittorrent seed file."), + }, + Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { + magnet := req.Arguments[0] + btFilePath, _ := req.Options["t"].(string) + clientConfig := torrent.NewDefaultClientConfig() + clientConfig.ListenPort = 0 + client, err := torrent.NewClient(clientConfig) + if err != nil { + return fmt.Errorf("creating client: %w", err) + } + defer client.Close() + var t *torrent.Torrent + if btFilePath != "" { + metaInfo, err := metainfo.LoadFromFile(btFilePath) + if err != nil { + return fmt.Errorf("error loading torrent file %s: %w", btFilePath, err) + } + t, err = client.AddTorrent(metaInfo) + if err != nil { + return fmt.Errorf("adding torrent: %w", err) + } + } else if magnet != "" { + t, err = client.AddMagnet(magnet) + if err != nil { + return fmt.Errorf("error adding magnet: %w", err) + } + } else { + return fmt.Errorf("your must provide a magnet uri or a torrent file path") + } + select { + case <-t.GotInfo(): + fmt.Println("Got metainfo done.Begin to download files...") + case <-time.After(5 * time.Minute): + log.Error("Get metainfo timeout,exceed two minutes, we can't find the metainfo for this torrent.") + return fmt.Errorf("get metainfo timeout") + } + t.DownloadAll() + // print the progress of the download. + fmt.Printf("This torrent needs storage space about: %s\n", humanize.Bytes(uint64(t.Length()))) + torrentBar(t, false) + isCompleted := client.WaitAll() + if !isCompleted { + log.Error("download error because of the closed of the client") + return fmt.Errorf("download error because of the closed of the client") + } + + btfsBinaryPath := "btfs" + cmd := exec.Command(btfsBinaryPath, "add", "-r", "--pin", t.Name()) + + go func() { + time.Sleep(10 * time.Minute) + _, err := os.FindProcess(int(cmd.Process.Pid)) + if err != nil { + log.Info("process already finished\n") + } else { + err := cmd.Process.Kill() + if err != nil { + if !strings.Contains(err.Error(), "process already finished") { + log.Errorf("cannot kill process: [%v] \n", err) + } + } + } + }() + // No matter what, delete the files after the download completed. + defer func() { + err := os.RemoveAll(t.Name()) + if err != nil { + log.Errorf("cannot remove the downloaded files: [%s], [%v] \n", t.Name(), err) + } + }() + var errbuf bytes.Buffer + out, err := cmd.Output() + if err != nil { + return fmt.Errorf("btfs add [%s] failed: [%v], [%s]", t.Name(), err, errbuf.String()) + } + s := strings.Split(string(out), " ") + if len(s) < 2 { + return fmt.Errorf("btfs add test failed: invalid add result[%s]", string(out)) + } + fmt.Println(string(out)) + return nil + }, +} + +var minBTListenPort = 30000 +var maxBTListenPort = 31000 + +var serveBTCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Serve as a bittorrent client with the specified files.", + LongDescription: "Serve as a bittorrent client with the specified files.", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, true, "the paths of some files that you want to serve as seeds"), + }, + Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { + filePaths := req.Arguments + if len(filePaths) == 0 { + return fmt.Errorf("you must provide the paths of some files that you want to serve as seeds") + } + cfg := torrent.NewDefaultClientConfig() + cfg.ListenPort = minBTListenPort + cfg.Seed = true + retry: + cl, err := torrent.NewClient(cfg) + if err != nil { + if strings.Contains(err.Error(), "address already in use") { + fmt.Println(err) + cfg.ListenPort = cfg.ListenPort + 1 + if cfg.ListenPort > maxBTListenPort { + return fmt.Errorf("we have try all the port between %d and %d ,but they are all in used", minBTListenPort, maxBTListenPort) + } + goto retry + } else { + return fmt.Errorf("new torrent client: %w", err) + } + } + defer cl.Close() + + for _, filePath := range filePaths { + totalLength, err := totalLength(filePath) + if err != nil { + return fmt.Errorf("calculating total length of %q: %v", filePath, err) + } + pieceLength := metainfo.ChoosePieceLength(totalLength) + info := metainfo.Info{ + PieceLength: pieceLength, + } + err = info.BuildFromFilePath(filePath) + if err != nil { + return fmt.Errorf("building info from path %q: %w", filePath, err) + } + for _, fi := range info.Files { + fmt.Printf("added %q\n", fi.Path) + } + mi := metainfo.MetaInfo{ + InfoBytes: bencode.MustMarshal(info), + } + pc, err := storage.NewDefaultPieceCompletionForDir(".") + if err != nil { + return fmt.Errorf("new piece completion: %w", err) + } + defer pc.Close() + ih := mi.HashInfoBytes() + to, _ := cl.AddTorrentOpt(torrent.AddTorrentOpts{ + InfoHash: ih, + Storage: storage.NewFileOpts(storage.NewFileClientOpts{ + ClientBaseDir: filePath, + FilePathMaker: func(opts storage.FilePathMakerOpts) string { + return filepath.Join(opts.File.Path...) + }, + TorrentDirMaker: nil, + PieceCompletion: pc, + }), + }) + defer to.Drop() + err = to.MergeSpec(&torrent.TorrentSpec{ + InfoBytes: mi.InfoBytes, + Trackers: [][]string{{ + `wss://tracker.btorrent.xyz`, + `wss://tracker.openwebtorrent.com`, + "http://p4p.arenabg.com:1337/announce", + "udp://tracker.opentrackr.org:1337/announce", + "udp://tracker.openbittorrent.com:6969/announce", + }}, + }) + if err != nil { + return fmt.Errorf("setting trackers: %w", err) + } + fmt.Printf("%v: %v\n", to, to.Metainfo().Magnet(&ih, &info)) + } + select {} + }, +} + +func torrentBar(t *torrent.Torrent, pieceStates bool) { + go func() { + start := time.Now() + if t.Info() == nil { + fmt.Printf("%v: getting torrent info for %q\n", time.Since(start), t.Name()) + <-t.GotInfo() + } + lastStats := t.Stats() + var lastLine string + interval := 10 * time.Second + tick := time.NewTicker(interval) + for range tick.C { + var completedPieces, partialPieces int + psrs := t.PieceStateRuns() + for _, r := range psrs { + if r.Complete { + completedPieces += r.Length + } + if r.Partial { + partialPieces += r.Length + } + } + stats := t.Stats() + byteRate := int64(time.Second) + byteRate *= stats.BytesReadUsefulData.Int64() - lastStats.BytesReadUsefulData.Int64() + byteRate /= int64(interval) + line := fmt.Sprintf( + "%v: downloading %q: %s/%s, %d/%d pieces completed (%d partial): %v/s\n", + time.Since(start), + t.Name(), + humanize.Bytes(uint64(t.BytesCompleted())), + humanize.Bytes(uint64(t.Length())), + completedPieces, + t.NumPieces(), + partialPieces, + humanize.Bytes(uint64(byteRate)), + ) + if line != lastLine { + lastLine = line + fmt.Println(line) + } + if pieceStates { + fmt.Println(psrs) + } + lastStats = stats + if t.Complete.Bool() { + fmt.Println("Download completed!!!") + tick.Stop() + return + } + } + }() +} + +func totalLength(path string) (totalLength int64, err error) { + err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error { + if info.IsDir() { + return nil + } + totalLength += info.Size() + return nil + }) + if err != nil { + return 0, fmt.Errorf("walking path, %w", err) + } + return totalLength, nil +} diff --git a/core/commands/bttc/bttc.go b/core/commands/bttc/bttc.go index 066eba5be..99f571273 100644 --- a/core/commands/bttc/bttc.go +++ b/core/commands/bttc/bttc.go @@ -7,9 +7,10 @@ var BttcCmd = &cmds.Command{ Tagline: "Interact with bttc related services.", }, Subcommands: map[string]*cmds.Command{ - "btt2wbtt": BttcBtt2WbttCmd, - "wbtt2btt": BttcWbtt2BttCmd, - "send-btt-to": BttcSendBttToCmd, - "send-wbtt-to": BttcSendWbttToCmd, + "btt2wbtt": BttcBtt2WbttCmd, + "wbtt2btt": BttcWbtt2BttCmd, + "send-btt-to": BttcSendBttToCmd, + "send-wbtt-to": BttcSendWbttToCmd, + "send-token-to": BttcSendTokenToCmd, }, } diff --git a/core/commands/bttc/send_token_to.go b/core/commands/bttc/send_token_to.go new file mode 100644 index 000000000..18ff00682 --- /dev/null +++ b/core/commands/bttc/send_token_to.go @@ -0,0 +1,66 @@ +package bttc + +import ( + "context" + "errors" + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" + "math/big" + "time" + + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "github.com/bittorrent/go-btfs/utils" + "github.com/ethereum/go-ethereum/common" +) + +type BttcSendTokenToCmdRet struct { + Hash string `json:"hash"` +} + +var BttcSendTokenToCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Transfer your WBTT to other bttc address", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("addr", true, false, "target bttc address"), + cmds.StringArg("amount", true, false, "amount you want to send"), + }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, + RunTimeout: 5 * time.Minute, + Type: &BttcSendTokenToCmdRet{}, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) (err error) { + addressStr := req.Arguments[0] + if !common.IsHexAddress(addressStr) { + return fmt.Errorf("invalid bttc address %s", addressStr) + } + + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + _, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + amount, ok := new(big.Int).SetString(utils.RemoveSpaceAndComma(req.Arguments[1]), 10) + if !ok { + return fmt.Errorf("invalid argument amount %s", req.Arguments[1]) + } + + trx, err := chain.SettleObject.BttcService.SendTokenTo(context.Background(), common.HexToAddress(addressStr), amount, tokenStr) + if err != nil { + return + } + + return cmds.EmitOnce(res, &BttcSendTokenToCmdRet{Hash: trx.String()}) + }, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *BttcSendTokenToCmdRet) error { + _, err := fmt.Fprintf(w, "the hash of transaction: %s\n", out.Hash) + return err + }), + }, +} diff --git a/core/commands/cheque/btt_balance.go b/core/commands/cheque/balance_btt.go similarity index 100% rename from core/commands/cheque/btt_balance.go rename to core/commands/cheque/balance_btt.go diff --git a/core/commands/cheque/balance_muti_tokens.go b/core/commands/cheque/balance_muti_tokens.go new file mode 100644 index 000000000..f33b2dddc --- /dev/null +++ b/core/commands/cheque/balance_muti_tokens.go @@ -0,0 +1,86 @@ +package cheque + +import ( + "errors" + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" + "math/big" + "time" + + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "github.com/ethereum/go-ethereum/common" + "golang.org/x/net/context" +) + +var ChequeAllTokenBalanceCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Get all token balance by addr.", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("addr", true, false, "bttc account address"), + }, + RunTimeout: 5 * time.Minute, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + addr := req.Arguments[0] + + mp := make(map[string]*big.Int, 0) + for k := range tokencfg.MpTokenAddr { + balance, err := chain.SettleObject.VaultService.TokenBalanceOf(context.Background(), common.HexToAddress(addr), k) + if err != nil { + return err + } + + mp[k] = balance + } + + return cmds.EmitOnce(res, &mp) + }, + Type: &ChequeBttBalanceCmdRet{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ChequeBttBalanceCmdRet) error { + _, err := fmt.Fprintf(w, "the balance is: %v\n", out.Balance) + return err + }), + }, +} + +var ChequeTokenBalanceCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Get one token balance by addr.", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("addr", true, false, "bttc account address"), + }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, + RunTimeout: 5 * time.Minute, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + addr := req.Arguments[0] + + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + _, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + balance, err := chain.SettleObject.VaultService.TokenBalanceOf(context.Background(), common.HexToAddress(addr), tokenStr) + if err != nil { + return err + } + + return cmds.EmitOnce(res, &ChequeBttBalanceCmdRet{ + Balance: balance, + }) + }, + Type: &ChequeBttBalanceCmdRet{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ChequeBttBalanceCmdRet) error { + _, err := fmt.Fprintf(w, "the balance is: %v\n", out.Balance) + return err + }), + }, +} diff --git a/core/commands/cheque/cash_list.go b/core/commands/cheque/cash_list.go index 93f872d7e..b752fdf3f 100644 --- a/core/commands/cheque/cash_list.go +++ b/core/commands/cheque/cash_list.go @@ -16,6 +16,7 @@ import ( type ChequeCashListRet struct { TxHash string `json:"tx_hash"` PeerID string `json:"peer_id"` + Token string `json:"token"` Vault string `json:"vault"` Amount *big.Int `json:"amount"` CashTime int64 `json:"cash_time"` @@ -35,6 +36,9 @@ var ChequeCashListCmd = &cmds.Command{ cmds.StringArg("from", true, false, "page offset"), cmds.StringArg("limit", true, false, "page limit."), }, + //Options: []cmds.Option{ + // cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + //}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { from, err := strconv.Atoi(req.Arguments[0]) if err != nil { @@ -51,10 +55,19 @@ var ChequeCashListCmd = &cmds.Command{ return fmt.Errorf("invalid limit: %d", limit) } + //tokenStr := req.Options[tokencfg.TokenTypeName].(string) + //fmt.Printf("... token:%+v\n", tokenStr) + //token, bl := tokencfg.MpTokenAddr[tokenStr] + //if !bl { + // return errors.New("your input token is none. ") + //} + results, err := chain.SettleObject.CashoutService.CashoutResults() if err != nil { return err } + fmt.Println("get CashoutResults, ", results) + sort.Slice(results, func(i, j int) bool { return results[i].CashTime > results[j].CashTime }) @@ -76,6 +89,7 @@ var ChequeCashListCmd = &cmds.Command{ r := ChequeCashListRet{ TxHash: result.TxHash.String(), PeerID: peer, + Token: result.Token.String(), Vault: result.Vault.String(), Amount: result.Amount, CashTime: result.CashTime, diff --git a/core/commands/cheque/cash_status.go b/core/commands/cheque/cash_status.go index b2edc3d52..9a2b619e1 100644 --- a/core/commands/cheque/cash_status.go +++ b/core/commands/cheque/cash_status.go @@ -1,6 +1,9 @@ package cheque import ( + "errors" + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "time" @@ -28,12 +31,22 @@ var ChequeCashStatusCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "Peer id tobe cashed."), }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, RunTimeout: 5 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { // get the peer id peerID := req.Arguments[0] - cashStatus, err := chain.SettleObject.SwapService.CashoutStatus(req.Context, peerID) + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... peerID:%+v, token:%+v\n", peerID, tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + cashStatus, err := chain.SettleObject.SwapService.CashoutStatus(req.Context, peerID, token) if err != nil { return err } diff --git a/core/commands/cheque/cheque.go b/core/commands/cheque/cheque.go index a3b979cbd..87ff1058f 100644 --- a/core/commands/cheque/cheque.go +++ b/core/commands/cheque/cheque.go @@ -1,7 +1,9 @@ package cheque import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "time" @@ -21,6 +23,7 @@ type CashChequeRet struct { type cheque struct { PeerID string + Token string Beneficiary string Vault string Payout *big.Int @@ -32,6 +35,14 @@ type ListChequeRet struct { Len int } +type ReceiveCheque struct { + PeerID string + Token common.Address + Vault common.Address + Beneficiary common.Address + CumulativePayout *big.Int +} + type ChequeRecords struct { Records []chequeRecordRet Len int @@ -39,6 +50,7 @@ type ChequeRecords struct { type chequeRecordRet struct { PeerId string + Token common.Address Vault common.Address Beneficiary common.Address Amount *big.Int @@ -57,23 +69,30 @@ Vault services include issue cheque to peer, receive cheque and store operations "cashlist": ChequeCashListCmd, "price": StorePriceCmd, - "send": SendChequeCmd, - "sendlist": ListSendChequesCmd, - "send-history-peer": ChequeSendHistoryPeerCmd, - "send-history-list": ChequeSendHistoryListCmd, - "send-history-stats": ChequeSendHistoryStatsCmd, - "send-total-count": SendChequesCountCmd, - - "receive": ReceiveChequeCmd, - "receivelist": ListReceiveChequeCmd, - "receive-history-peer": ChequeReceiveHistoryPeerCmd, - "receive-history-list": ChequeReceiveHistoryListCmd, - "receive-history-stats": ChequeReceiveHistoryStatsCmd, - "receive-total-count": ReceiveChequesCountCmd, - "stats": ChequeStatsCmd, - - "chaininfo": ChequeChainInfoCmd, - "bttbalance": ChequeBttBalanceCmd, + "send": SendChequeCmd, + "sendlist": ListSendChequesCmd, + "sendlistall": ListSendChequesAllCmd, + "send-history-peer": ChequeSendHistoryPeerCmd, + "send-history-list": ChequeSendHistoryListCmd, + "send-history-stats": ChequeSendHistoryStatsCmd, + "send-history-stats-all": ChequeSendHistoryStatsAllCmd, + "send-total-count": SendChequesCountCmd, + + "receive": ReceiveChequeCmd, + "receivelist": ListReceiveChequeCmd, + "receivelistall": ListReceiveChequeAllCmd, + "receive-history-peer": ChequeReceiveHistoryPeerCmd, + "receive-history-list": ChequeReceiveHistoryListCmd, + "receive-history-stats": ChequeReceiveHistoryStatsCmd, + "receive-history-stats-all": ChequeReceiveHistoryStatsAllCmd, + "receive-total-count": ReceiveChequesCountCmd, + "stats": ChequeStatsCmd, + "stats-all": ChequeStatsAllCmd, + + "chaininfo": ChequeChainInfoCmd, + "bttbalance": ChequeBttBalanceCmd, + "token_balance": ChequeTokenBalanceCmd, + "all_token_balance": ChequeAllTokenBalanceCmd, }, } @@ -81,9 +100,20 @@ var StorePriceCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "Get btfs store price.", }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, RunTimeout: 5 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { - totalPrice, err := chain.SettleObject.OracleService.CheckNewPrice() + // token: parse token option + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Println("... use token = ", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + totalPrice, err := chain.SettleObject.OracleService.CheckNewPrice(token) if err != nil { return err } @@ -108,12 +138,22 @@ var CashChequeCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "Peer id tobe cashed."), }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, RunTimeout: 5 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { // get the peer id peerID := req.Arguments[0] - tx_hash, err := chain.SettleObject.SwapService.CashCheque(req.Context, peerID) + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + tx_hash, err := chain.SettleObject.SwapService.CashCheque(req.Context, peerID, token) if err != nil { return err } diff --git a/core/commands/cheque/receive.go b/core/commands/cheque/receive.go index 530495624..99e35c69a 100644 --- a/core/commands/cheque/receive.go +++ b/core/commands/cheque/receive.go @@ -2,7 +2,9 @@ package cheque import ( "context" + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" @@ -17,15 +19,22 @@ var ReceiveChequeCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "deposit amount."), }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { var record cheque peer_id := req.Arguments[0] - fmt.Println("ReceiveChequeCmd peer_id = ", peer_id) + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("ReceiveChequeCmd peer_id:%+v, token:%+v\n", peer_id, tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } if len(peer_id) > 0 { - chequeTmp, err := chain.SettleObject.SwapService.LastReceivedCheque(peer_id) + chequeTmp, err := chain.SettleObject.SwapService.LastReceivedCheque(peer_id, token) if err != nil { return err } @@ -35,7 +44,7 @@ var ReceiveChequeCmd = &cmds.Command{ record.Payout = chequeTmp.CumulativePayout record.PeerID = peer_id - cashStatus, err := chain.SettleObject.CashoutService.CashoutStatus(context.Background(), chequeTmp.Vault) + cashStatus, err := chain.SettleObject.CashoutService.CashoutStatus(context.Background(), chequeTmp.Vault, token) if err != nil { return err } diff --git a/core/commands/cheque/receive_history_list.go b/core/commands/cheque/receive_history_list.go index 378c7b7d9..30697e972 100644 --- a/core/commands/cheque/receive_history_list.go +++ b/core/commands/cheque/receive_history_list.go @@ -24,7 +24,6 @@ var ChequeReceiveHistoryListCmd = &cmds.Command{ cmds.StringArg("from", true, false, "page offset"), cmds.StringArg("limit", true, false, "page limit."), }, - Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { from, err := strconv.Atoi(req.Arguments[0]) if err != nil { @@ -66,6 +65,7 @@ var ChequeReceiveHistoryListCmd = &cmds.Command{ } r := chequeRecordRet{ PeerId: peer, + Token: result.Token, Vault: result.Vault, Beneficiary: result.Beneficiary, Amount: result.Amount, diff --git a/core/commands/cheque/receive_history_peer.go b/core/commands/cheque/receive_history_peer.go index 3849d85c8..1b6b85ffb 100644 --- a/core/commands/cheque/receive_history_peer.go +++ b/core/commands/cheque/receive_history_peer.go @@ -16,9 +16,7 @@ var ChequeReceiveHistoryPeerCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "The peer id of cheques received."), }, - Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { - var listRet ChequeRecords peer_id := req.Arguments[0] fmt.Println("ChequeReceiveHistoryPeerCmd peer_id = ", peer_id) @@ -32,6 +30,7 @@ var ChequeReceiveHistoryPeerCmd = &cmds.Command{ for _, v := range records { recordsRet = append(recordsRet, chequeRecordRet{ PeerId: peer_id, + Token: v.Token, Vault: v.Vault, Beneficiary: v.Beneficiary, Amount: v.Amount, diff --git a/core/commands/cheque/receive_history_stats.go b/core/commands/cheque/receive_history_stats.go index 250c90fe6..8ab030bc8 100644 --- a/core/commands/cheque/receive_history_stats.go +++ b/core/commands/cheque/receive_history_stats.go @@ -2,7 +2,9 @@ package cheque import ( "encoding/json" + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" @@ -20,11 +22,20 @@ var ChequeReceiveHistoryStatsCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "Display the received cheques from peer.", }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + // now only return 30days cheque received stats const receivedStatsDuration = 30 - stats, err := chain.SettleObject.ChequeStore.ReceivedStatsHistory(receivedStatsDuration) + stats, err := chain.SettleObject.ChequeStore.ReceivedStatsHistory(receivedStatsDuration, token) if err != nil { return err } diff --git a/core/commands/cheque/receive_history_stats_all.go b/core/commands/cheque/receive_history_stats_all.go new file mode 100644 index 000000000..ee3457b59 --- /dev/null +++ b/core/commands/cheque/receive_history_stats_all.go @@ -0,0 +1,56 @@ +package cheque + +import ( + "encoding/json" + "fmt" + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" +) + +var ChequeReceiveHistoryStatsAllCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Display the received cheques from peer, of all tokens.", + }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + mp := make(map[string][]chequeReceivedHistoryStats, 0) + for k, tokenAddr := range tokencfg.MpTokenAddr { + + // now only return 30days cheque received stats + const receivedStatsDuration = 30 + stats, err := chain.SettleObject.ChequeStore.ReceivedStatsHistory(receivedStatsDuration, tokenAddr) + if err != nil { + return err + } + + ret := make([]chequeReceivedHistoryStats, 0, len(stats)) + for _, stat := range stats { + ret = append(ret, chequeReceivedHistoryStats{ + TotalReceived: stat.Amount, + TotalReceivedCount: stat.Count, + Date: stat.Date, + }) + } + + mp[k] = ret + } + + return cmds.EmitOnce(res, &mp) + }, + Type: []chequeReceivedHistoryStats{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *[]chequeReceivedHistoryStats) error { + marshaled, err := json.MarshalIndent(out, "", "\t") + if err != nil { + return err + } + marshaled = append(marshaled, byte('\n')) + fmt.Fprintln(w, string(marshaled)) + return nil + }), + }, +} diff --git a/core/commands/cheque/receive_list.go b/core/commands/cheque/receive_list.go index 2272b9f63..145b1f5bc 100644 --- a/core/commands/cheque/receive_list.go +++ b/core/commands/cheque/receive_list.go @@ -1,7 +1,9 @@ package cheque import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "strconv" @@ -20,7 +22,9 @@ var ListReceiveChequeCmd = &cmds.Command{ cmds.StringArg("offset", true, false, "page offset"), cmds.StringArg("limit", true, false, "page limit."), }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { offset, err := strconv.Atoi(req.Arguments[0]) if err != nil { @@ -30,9 +34,18 @@ var ListReceiveChequeCmd = &cmds.Command{ if err != nil { return fmt.Errorf("parse limit:%v failed", req.Arguments[1]) } + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + fmt.Println("receive list ... 1") var listRet ListChequeRet - cheques, err := chain.SettleObject.SwapService.LastReceivedCheques() + cheques, err := chain.SettleObject.SwapService.LastReceivedCheques(token) + fmt.Println("receive list ... 2", cheques, err) + if err != nil { return err } @@ -52,15 +65,18 @@ var ListReceiveChequeCmd = &cmds.Command{ peerIds = peerIds[:limit] } + fmt.Println("receive list ... 3") for _, k := range peerIds { v := cheques[k] var record cheque record.PeerID = k + record.Token = v.Token.String() record.Beneficiary = v.Beneficiary.String() record.Vault = v.Vault.String() record.Payout = v.CumulativePayout - cashStatus, err := chain.SettleObject.CashoutService.CashoutStatus(context.Background(), v.Vault) + cashStatus, err := chain.SettleObject.CashoutService.CashoutStatus(context.Background(), v.Vault, token) + fmt.Println("receive list ... 3.2", cashStatus, err, token) if err != nil { return err } @@ -70,7 +86,7 @@ var ListReceiveChequeCmd = &cmds.Command{ listRet.Cheques = append(listRet.Cheques, record) } - + fmt.Println("receive list ... 4") listRet.Len = len(listRet.Cheques) return cmds.EmitOnce(res, &listRet) }, diff --git a/core/commands/cheque/receive_list_all.go b/core/commands/cheque/receive_list_all.go new file mode 100644 index 000000000..b1e97ca00 --- /dev/null +++ b/core/commands/cheque/receive_list_all.go @@ -0,0 +1,108 @@ +package cheque + +import ( + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" + "math/big" + "sort" + "strconv" + + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "golang.org/x/net/context" +) + +var ListReceiveChequeAllCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "List cheque(s) received from peers.", + }, + Arguments: []cmds.Argument{ + cmds.StringArg("offset", true, false, "page offset"), + cmds.StringArg("limit", true, false, "page limit."), + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + offset, err := strconv.Atoi(req.Arguments[0]) + if err != nil { + return fmt.Errorf("parse offset:%v failed", req.Arguments[0]) + } + limit, err := strconv.Atoi(req.Arguments[1]) + if err != nil { + return fmt.Errorf("parse limit:%v failed", req.Arguments[1]) + } + + listCheques := make([]ReceiveCheque, 0) + for _, tokenAddr := range tokencfg.MpTokenAddr { + cheques, err := chain.SettleObject.SwapService.LastReceivedCheques(tokenAddr) + if err != nil { + return err + } + for k, v := range cheques { + var record ReceiveCheque + record.PeerID = k + record.Token = v.Token + record.Vault = v.Vault + record.Beneficiary = v.Beneficiary + record.CumulativePayout = v.CumulativePayout + + listCheques = append(listCheques, record) + } + } + + sort.Slice(listCheques, func(i, j int) bool { + return listCheques[i].PeerID < listCheques[j].PeerID + }) + + //[offset:offset+limit] + if len(listCheques) < offset+1 { + listCheques = listCheques[0:0] + } else { + listCheques = listCheques[offset:] + } + + if len(listCheques) > limit { + listCheques = listCheques[:limit] + } + + var listRet ListChequeRet + for _, v := range listCheques { + k := v.PeerID + var record cheque + record.PeerID = k + record.Token = v.Token.String() + record.Beneficiary = v.Beneficiary.String() + record.Vault = v.Vault.String() + record.Payout = v.CumulativePayout + + cashStatus, err := chain.SettleObject.CashoutService.CashoutStatus(context.Background(), v.Vault, v.Token) + if err != nil { + return err + } + if cashStatus.UncashedAmount != nil { + record.CashedAmount = big.NewInt(0).Sub(v.CumulativePayout, cashStatus.UncashedAmount) + } + + listRet.Cheques = append(listRet.Cheques, record) + } + + listRet.Len = len(listRet.Cheques) + return cmds.EmitOnce(res, &listRet) + }, + Type: ListChequeRet{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ListChequeRet) error { + fmt.Fprintf(w, "\t%-55s\t%-46s\t%-46s\t%-46s\tamount: \n", "peerID:", "vault:", "beneficiary:", "cashout_amount:") + for iter := 0; iter < out.Len; iter++ { + fmt.Fprintf(w, "\t%-55s\t%-46s\t%-46s\t%d\t%d \n", + out.Cheques[iter].PeerID, + out.Cheques[iter].Beneficiary, + out.Cheques[iter].Vault, + out.Cheques[iter].Payout.Uint64(), + out.Cheques[iter].CashedAmount.Uint64(), + ) + } + + return nil + }), + }, +} diff --git a/core/commands/cheque/receive_total_count.go b/core/commands/cheque/receive_total_count.go index d2ccd4a77..26092c891 100644 --- a/core/commands/cheque/receive_total_count.go +++ b/core/commands/cheque/receive_total_count.go @@ -16,8 +16,17 @@ var ReceiveChequesCountCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "send cheque(s) count", }, - + //Options: []cmds.Option{ + // cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + //}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + //tokenStr := req.Options[tokencfg.TokenTypeName].(string) + //fmt.Printf("... token:%+v\n", tokenStr) + //token, bl := tokencfg.MpTokenAddr[tokenStr] + //if !bl { + // return errors.New("your input token is none. ") + //} + count, err := chain.SettleObject.SwapService.ReceivedChequeRecordsCount() if err != nil { return err diff --git a/core/commands/cheque/send-history-stats-all.go b/core/commands/cheque/send-history-stats-all.go new file mode 100644 index 000000000..146a46aaf --- /dev/null +++ b/core/commands/cheque/send-history-stats-all.go @@ -0,0 +1,52 @@ +package cheque + +import ( + "encoding/json" + "fmt" + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" +) + +var ChequeSendHistoryStatsAllCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Display the received cheques from peer, of all tokens", + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + mp := make(map[string][]chequeSentHistoryStats, 0) + for k, tokenAddr := range tokencfg.MpTokenAddr { + // now only return 30days cheque sent stats + const sentStatsDuration = 30 + stats, err := chain.SettleObject.ChequeStore.SentStatsHistory(sentStatsDuration, tokenAddr) + if err != nil { + return err + } + + ret := make([]chequeSentHistoryStats, 0, len(stats)) + for _, stat := range stats { + ret = append(ret, chequeSentHistoryStats{ + TotalIssued: stat.Amount, + TotalIssuedCount: stat.Count, + Date: stat.Date, + }) + } + + mp[k] = ret + } + + return cmds.EmitOnce(res, &mp) + }, + Type: []chequeSentHistoryStats{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *[]chequeSentHistoryStats) error { + marshaled, err := json.MarshalIndent(out, "", "\t") + if err != nil { + return err + } + marshaled = append(marshaled, byte('\n')) + fmt.Fprintln(w, string(marshaled)) + return nil + }), + }, +} diff --git a/core/commands/cheque/send-history-stats.go b/core/commands/cheque/send-history-stats.go index ebbe62d59..96eb7b18f 100644 --- a/core/commands/cheque/send-history-stats.go +++ b/core/commands/cheque/send-history-stats.go @@ -2,7 +2,9 @@ package cheque import ( "encoding/json" + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" @@ -20,11 +22,20 @@ var ChequeSendHistoryStatsCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "Display the received cheques from peer.", }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + // now only return 30days cheque sent stats const sentStatsDuration = 30 - stats, err := chain.SettleObject.ChequeStore.SentStatsHistory(sentStatsDuration) + stats, err := chain.SettleObject.ChequeStore.SentStatsHistory(sentStatsDuration, token) if err != nil { return err } diff --git a/core/commands/cheque/send.go b/core/commands/cheque/send.go index fed79933b..b407c96cd 100644 --- a/core/commands/cheque/send.go +++ b/core/commands/cheque/send.go @@ -1,7 +1,9 @@ package cheque import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" cmds "github.com/bittorrent/go-btfs-cmds" @@ -15,14 +17,23 @@ var SendChequeCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "deposit amount."), }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { var record cheque peer_id := req.Arguments[0] fmt.Println("SendChequeCmd peer_id = ", peer_id) + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + if len(peer_id) > 0 { - chequeTmp, err := chain.SettleObject.SwapService.LastSendCheque(peer_id) + chequeTmp, err := chain.SettleObject.SwapService.LastSendCheque(peer_id, token) if err != nil { return err } diff --git a/core/commands/cheque/send_history_list.go b/core/commands/cheque/send_history_list.go index 584522b76..8556fe1fd 100644 --- a/core/commands/cheque/send_history_list.go +++ b/core/commands/cheque/send_history_list.go @@ -19,7 +19,9 @@ var ChequeSendHistoryListCmd = &cmds.Command{ cmds.StringArg("from", true, false, "page offset"), cmds.StringArg("limit", true, false, "page limit."), }, - + //Options: []cmds.Option{ + // cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + //}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { from, err := strconv.Atoi(req.Arguments[0]) if err != nil { @@ -36,6 +38,13 @@ var ChequeSendHistoryListCmd = &cmds.Command{ return fmt.Errorf("invalid limit: %d", limit) } + //tokenStr := req.Options[tokencfg.TokenTypeName].(string) + //fmt.Printf("... token:%+v\n", tokenStr) + //token, bl := tokencfg.MpTokenAddr[tokenStr] + //if !bl { + // return errors.New("your input token is none. ") + //} + var listRet chequeReceivedHistoryListRet records, err := chain.SettleObject.SwapService.SendChequeRecordsAll() if err != nil { @@ -60,6 +69,7 @@ var ChequeSendHistoryListCmd = &cmds.Command{ } r := chequeRecordRet{ PeerId: peer, + Token: result.Token, Vault: result.Vault, Beneficiary: result.Beneficiary, Amount: result.Amount, diff --git a/core/commands/cheque/send_history_peer.go b/core/commands/cheque/send_history_peer.go index 63c0518ea..9a1b09ec2 100644 --- a/core/commands/cheque/send_history_peer.go +++ b/core/commands/cheque/send_history_peer.go @@ -16,13 +16,19 @@ var ChequeSendHistoryPeerCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "The peer id of cheques send."), }, - Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { var listRet ChequeRecords peer_id := req.Arguments[0] fmt.Println("ChequeReceiveHistoryPeerCmd peer_id = ", peer_id) + //tokenStr := req.Options[tokencfg.TokenTypeName].(string) + //fmt.Printf("... token:%+v\n", tokenStr) + //token, bl := tokencfg.MpTokenAddr[tokenStr] + //if !bl { + // return errors.New("your input token is none. ") + //} + records, err := chain.SettleObject.SwapService.SendChequeRecordsByPeer(peer_id) if err != nil { return err @@ -31,6 +37,7 @@ var ChequeSendHistoryPeerCmd = &cmds.Command{ for _, v := range records { recordsRet = append(recordsRet, chequeRecordRet{ PeerId: peer_id, + Token: v.Token, Vault: v.Vault, Beneficiary: v.Beneficiary, Amount: v.Amount, diff --git a/core/commands/cheque/send_list.go b/core/commands/cheque/send_list.go index 7c8538806..60b8baaf3 100644 --- a/core/commands/cheque/send_list.go +++ b/core/commands/cheque/send_list.go @@ -1,7 +1,9 @@ package cheque import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" cmds "github.com/bittorrent/go-btfs-cmds" @@ -12,12 +14,20 @@ var ListSendChequesCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "List cheque(s) send to peers.", }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } listRet := ListChequeRet{} listRet.Cheques = make([]cheque, 0, 0) - cheques, err := chain.SettleObject.SwapService.LastSendCheques() + cheques, err := chain.SettleObject.SwapService.LastSendCheques(token) if err != nil { return err @@ -25,6 +35,7 @@ var ListSendChequesCmd = &cmds.Command{ for k, v := range cheques { var record cheque record.PeerID = k + record.Token = v.Token.String() record.Beneficiary = v.Beneficiary.String() record.Vault = v.Vault.String() record.Payout = v.CumulativePayout diff --git a/core/commands/cheque/send_list_all.go b/core/commands/cheque/send_list_all.go new file mode 100644 index 000000000..a213d0996 --- /dev/null +++ b/core/commands/cheque/send_list_all.go @@ -0,0 +1,57 @@ +package cheque + +import ( + "fmt" + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" +) + +var ListSendChequesAllCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "List cheque(s) send to peers.", + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + listRet := ListChequeRet{} + listRet.Cheques = make([]cheque, 0, 0) + listRet.Len = 0 + + for _, tokenAddr := range tokencfg.MpTokenAddr { + cheques, err := chain.SettleObject.SwapService.LastSendCheques(tokenAddr) + if err != nil { + return err + } + for k, v := range cheques { + var record cheque + record.PeerID = k + record.Token = v.Token.String() + record.Beneficiary = v.Beneficiary.String() + record.Vault = v.Vault.String() + record.Payout = v.CumulativePayout + + listRet.Cheques = append(listRet.Cheques, record) + } + + listRet.Len += len(cheques) + } + + return cmds.EmitOnce(res, &listRet) + }, + Type: ListChequeRet{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ListChequeRet) error { + fmt.Fprintf(w, "\t%-55s\t%-46s\t%-46s\tamount: \n", "peerID:", "vault:", "beneficiary:") + for iter := 0; iter < out.Len; iter++ { + fmt.Fprintf(w, "\t%-55s\t%-46s\t%-46s\t%d \n", + out.Cheques[iter].PeerID, + out.Cheques[iter].Vault, + out.Cheques[iter].Beneficiary, + out.Cheques[iter].Payout.Uint64(), + ) + } + + return nil + }), + }, +} diff --git a/core/commands/cheque/send_total_count.go b/core/commands/cheque/send_total_count.go index c4439e340..97e6623e5 100644 --- a/core/commands/cheque/send_total_count.go +++ b/core/commands/cheque/send_total_count.go @@ -1,7 +1,9 @@ package cheque import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" cmds "github.com/bittorrent/go-btfs-cmds" @@ -16,10 +18,18 @@ var SendChequesCountCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "send cheque(s) count", }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { - count, err := chain.SettleObject.VaultService.TotalIssuedCount() + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + count, err := chain.SettleObject.VaultService.TotalIssuedCount(token) if err != nil { return err } diff --git a/core/commands/cheque/stats-all.go b/core/commands/cheque/stats-all.go new file mode 100644 index 000000000..abf24c7a5 --- /dev/null +++ b/core/commands/cheque/stats-all.go @@ -0,0 +1,52 @@ +package cheque + +import ( + "encoding/json" + "fmt" + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" + "math/big" +) + +var ChequeStatsAllCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "List cheque(s) received from peers, of all tokens", + }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + mp := make(map[string]*chequeStats, 0) + for k, tokenAddr := range tokencfg.MpTokenAddr { + cs := chequeStats{ + TotalIssued: big.NewInt(0), + TotalIssuedCashed: big.NewInt(0), + TotalReceived: big.NewInt(0), + TotalReceivedUncashed: big.NewInt(0), + TotalReceivedDailyUncashed: big.NewInt(0), + } + + err := GetChequeStatsToken(&cs, tokenAddr) + if err != nil { + return err + } + + mp[k] = &cs + } + + return cmds.EmitOnce(res, &mp) + }, + Type: &chequeStats{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *chequeStats) error { + marshaled, err := json.MarshalIndent(out, "", "\t") + if err != nil { + return err + } + marshaled = append(marshaled, byte('\n')) + fmt.Fprintln(w, string(marshaled)) + return nil + }), + }, +} diff --git a/core/commands/cheque/stats.go b/core/commands/cheque/stats.go index 6c077a204..4136fa0cb 100644 --- a/core/commands/cheque/stats.go +++ b/core/commands/cheque/stats.go @@ -2,13 +2,16 @@ package cheque import ( "encoding/json" + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "github.com/ethereum/go-ethereum/common" + "golang.org/x/net/context" "io" "math/big" cmds "github.com/bittorrent/go-btfs-cmds" - "github.com/bittorrent/go-btfs/chain" - "golang.org/x/net/context" ) type chequeStats struct { @@ -27,8 +30,17 @@ var ChequeStatsCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "List cheque(s) received from peers.", }, - + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + cs := chequeStats{ TotalIssued: big.NewInt(0), TotalIssuedCashed: big.NewInt(0), @@ -36,53 +48,11 @@ var ChequeStatsCmd = &cmds.Command{ TotalReceivedUncashed: big.NewInt(0), TotalReceivedDailyUncashed: big.NewInt(0), } - issued, err := chain.SettleObject.VaultService.TotalIssued() - if err != nil { - return err - } - cs.TotalIssued = issued - issuedCount, err := chain.SettleObject.VaultService.TotalIssuedCount() + err := GetChequeStatsToken(&cs, token) if err != nil { - return err - } - cs.TotalIssuedCount = issuedCount - paidOut, err := chain.SettleObject.VaultService.TotalPaidOut(context.Background()) - if err != nil { - return err - } - cs.TotalIssuedCashed = paidOut - - received, err := chain.SettleObject.VaultService.TotalReceived() - if err != nil { - return err } - cs.TotalReceived = received - - cashed, err := chain.SettleObject.VaultService.TotalReceivedCashed() - if err != nil { - return err - } - cs.TotalReceivedUncashed.Sub(cs.TotalReceived, cashed) - - count, err := chain.SettleObject.VaultService.TotalReceivedCount() - if err != nil { - return err - } - cs.TotalReceivedCount = count - - receivedCount, err := chain.SettleObject.VaultService.TotalReceivedCashedCount() - if err != nil { - return err - } - cs.TotalReceivedCashedCount = receivedCount - - dailyReceived, err := chain.SettleObject.VaultService.TotalDailyReceived() - if err != nil { - return err - } - cs.TotalReceivedDailyUncashed = dailyReceived return cmds.EmitOnce(res, &cs) }, @@ -99,3 +69,55 @@ var ChequeStatsCmd = &cmds.Command{ }), }, } + +func GetChequeStatsToken(cs *chequeStats, token common.Address) error { + issued, err := chain.SettleObject.VaultService.TotalIssued(token) + if err != nil { + return err + } + cs.TotalIssued = issued + + issuedCount, err := chain.SettleObject.VaultService.TotalIssuedCount(token) + if err != nil { + return err + } + cs.TotalIssuedCount = issuedCount + + paidOut, err := chain.SettleObject.VaultService.TotalPaidOut(context.Background(), token) + if err != nil { + return err + } + cs.TotalIssuedCashed = paidOut + + received, err := chain.SettleObject.VaultService.TotalReceived(token) + if err != nil { + return err + } + cs.TotalReceived = received + + cashed, err := chain.SettleObject.VaultService.TotalReceivedCashed(token) + if err != nil { + return err + } + cs.TotalReceivedUncashed.Sub(cs.TotalReceived, cashed) + + count, err := chain.SettleObject.VaultService.TotalReceivedCount(token) + if err != nil { + return err + } + cs.TotalReceivedCount = count + + receivedCount, err := chain.SettleObject.VaultService.TotalReceivedCashedCount(token) + if err != nil { + return err + } + cs.TotalReceivedCashedCount = receivedCount + + dailyReceived, err := chain.SettleObject.VaultService.TotalDailyReceived(token) + if err != nil { + return err + } + cs.TotalReceivedDailyUncashed = dailyReceived + + return nil +} diff --git a/core/commands/commands_test.go b/core/commands/commands_test.go index 7f05daa70..0881848c0 100644 --- a/core/commands/commands_test.go +++ b/core/commands/commands_test.go @@ -273,10 +273,15 @@ func TestCommands(t *testing.T) { "/guard/test/send-challenges", "/cheque", "/cheque/stats", + "/cheque/stats-all", "/cheque/send-history-stats", + "/cheque/send-history-stats-all", "/cheque/cashlist", "/cheque/receive-history-stats", + "/cheque/receive-history-stats-all", "/cheque/bttbalance", + "/cheque/token_balance", + "/cheque/all_token_balance", "/cheque/cash", "/cheque/cashstatus", "/cheque/chaininfo", @@ -286,16 +291,19 @@ func TestCommands(t *testing.T) { "/cheque/receive-history-peer", "/cheque/receive-total-count", "/cheque/receivelist", + "/cheque/receivelistall", "/cheque/send", "/cheque/send-history-list", "/cheque/send-history-peer", "/cheque/send-total-count", "/cheque/sendlist", + "/cheque/sendlistall", "/p2p/handshake", "/settlement", "/settlement/list", "/settlement/peer", "/storage/upload/cheque", + "/storage/upload/supporttokens", "/test", "/test/cheque", "/test/hosts", @@ -303,6 +311,7 @@ func TestCommands(t *testing.T) { "/vault", "/vault/address", "/vault/balance", + "/vault/balance_all", "/vault/deposit", "/vault/wbttbalance", "/vault/withdraw", @@ -313,6 +322,7 @@ func TestCommands(t *testing.T) { "/bttc/wbtt2btt", "/bttc/send-btt-to", "/bttc/send-wbtt-to", + "/bttc/send-token-to", //"/wallet/discovery", "/wallet/balance", //"/wallet/init", @@ -331,6 +341,12 @@ func TestCommands(t *testing.T) { "/statuscontract/config", "/statuscontract/report_online_server", "/statuscontract/report_status_contract", + "/bittorrent", + "/bittorrent/download", + "/bittorrent/serve", + "/bittorrent/scrape", + "/bittorrent/metainfo", + "/bittorrent/bencode", } cmdSet := make(map[string]struct{}) diff --git a/core/commands/mount_nofuse.go b/core/commands/mount_nofuse.go index 1bfde21f8..03d7806f0 100644 --- a/core/commands/mount_nofuse.go +++ b/core/commands/mount_nofuse.go @@ -1,3 +1,4 @@ +//go:build !windows && nofuse // +build !windows,nofuse package commands diff --git a/core/commands/mount_unix.go b/core/commands/mount_unix.go index 3cb50b098..9e238070a 100644 --- a/core/commands/mount_unix.go +++ b/core/commands/mount_unix.go @@ -1,3 +1,4 @@ +//go:build !windows && !nofuse // +build !windows,!nofuse package commands diff --git a/core/commands/root.go b/core/commands/root.go index 305b0fe54..7e547fa7f 100644 --- a/core/commands/root.go +++ b/core/commands/root.go @@ -179,6 +179,7 @@ var rootSubcommands = map[string]*cmds.Command{ "network": NetworkCmd, "wallet": WalletCmd, "statuscontract": StatusContractCmd, + "bittorrent": bittorrentCmd, } // RootRO is the readonly version of Root @@ -240,9 +241,10 @@ var rootRemoteSubcommands = map[string]*cmds.Command{ }, "upload": &cmds.Command{ Subcommands: map[string]*cmds.Command{ - "init": upload.StorageUploadInitCmd, - "recvcontract": upload.StorageUploadRecvContractCmd, - "cheque": upload.StorageUploadChequeCmd, + "init": upload.StorageUploadInitCmd, + "supporttokens": upload.StorageUploadSupportTokensCmd, + "recvcontract": upload.StorageUploadRecvContractCmd, + "cheque": upload.StorageUploadChequeCmd, }, }, "dcrepair": &cmds.Command{ diff --git a/core/commands/settlements/list.go b/core/commands/settlements/list.go index 020bbd248..68fbb9fe5 100644 --- a/core/commands/settlements/list.go +++ b/core/commands/settlements/list.go @@ -2,6 +2,9 @@ package settlement import ( "context" + "errors" + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "time" @@ -28,12 +31,23 @@ var ListSettlementCmd = &cmds.Command{ Tagline: "list all settlements.", }, RunTimeout: 5 * time.Minute, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { - settlementsSent, err := chain.SettleObject.SwapService.SettlementsSent() + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + settlementsSent, err := chain.SettleObject.SwapService.SettlementsSent(token) if err != nil { return err } - settlementsReceived, err := chain.SettleObject.SwapService.SettlementsReceived() + settlementsReceived, err := chain.SettleObject.SwapService.SettlementsReceived(token) if err != nil { return err } @@ -66,7 +80,7 @@ var ListSettlementCmd = &cmds.Command{ } } totalReceived.Add(b, totalReceived) - if has, err := chain.SettleObject.SwapService.HasCashoutAction(context.Background(), a); err == nil && has { + if has, err := chain.SettleObject.SwapService.HasCashoutAction(context.Background(), a, token); err == nil && has { totalReceivedCashed.Add(b, totalReceivedCashed) } } @@ -77,7 +91,7 @@ var ListSettlementCmd = &cmds.Command{ i++ } - totalPaidOut, err := chain.SettleObject.VaultService.TotalPaidOut(context.Background()) + totalPaidOut, err := chain.SettleObject.VaultService.TotalPaidOut(context.Background(), token) if err != nil { return err } diff --git a/core/commands/settlements/peer.go b/core/commands/settlements/peer.go index 76682dcc4..02ad353d1 100644 --- a/core/commands/settlements/peer.go +++ b/core/commands/settlements/peer.go @@ -3,6 +3,7 @@ package settlement import ( "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "time" @@ -19,11 +20,21 @@ var PeerSettlementCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("peer-id", true, false, "Peer id."), }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { peerID := req.Arguments[0] peerexists := false - received, err := chain.SettleObject.SwapService.TotalReceived(peerID) + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + received, err := chain.SettleObject.SwapService.TotalReceived(peerID, token) if err != nil { if !errors.Is(err, settlement.ErrPeerNoSettlements) { return err @@ -36,7 +47,7 @@ var PeerSettlementCmd = &cmds.Command{ peerexists = true } - sent, err := chain.SettleObject.SwapService.TotalSent(peerID) + sent, err := chain.SettleObject.SwapService.TotalSent(peerID, token) if err != nil { if !errors.Is(err, settlement.ErrPeerNoSettlements) { return err diff --git a/core/commands/storage/path/dir_other.go b/core/commands/storage/path/dir_other.go index b2f5d18fc..f5819c0da 100644 --- a/core/commands/storage/path/dir_other.go +++ b/core/commands/storage/path/dir_other.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package path diff --git a/core/commands/storage/path/dir_windows.go b/core/commands/storage/path/dir_windows.go index 4b6382144..8f23ba82b 100644 --- a/core/commands/storage/path/dir_windows.go +++ b/core/commands/storage/path/dir_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package path diff --git a/core/commands/storage/path/path_darwin.go b/core/commands/storage/path/path_darwin.go index dfdba732a..04e73d735 100644 --- a/core/commands/storage/path/path_darwin.go +++ b/core/commands/storage/path/path_darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin package path diff --git a/core/commands/storage/path/path_unix.go b/core/commands/storage/path/path_unix.go index 3871bda67..226a4a486 100644 --- a/core/commands/storage/path/path_unix.go +++ b/core/commands/storage/path/path_unix.go @@ -1,3 +1,4 @@ +//go:build linux || freebsd // +build linux freebsd package path diff --git a/core/commands/storage/path/path_windows.go b/core/commands/storage/path/path_windows.go index a7832b3dd..fab6955fa 100644 --- a/core/commands/storage/path/path_windows.go +++ b/core/commands/storage/path/path_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package path diff --git a/core/commands/storage/upload/sessions/renter_sessions.go b/core/commands/storage/upload/sessions/renter_sessions.go index 42290fad4..87259e9ae 100644 --- a/core/commands/storage/upload/sessions/renter_sessions.go +++ b/core/commands/storage/upload/sessions/renter_sessions.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/ethereum/go-ethereum/common" "regexp" "strings" "time" @@ -84,6 +85,7 @@ type RenterSession struct { CtxParams *uh.ContextParams Ctx context.Context Cancel context.CancelFunc + Token common.Address } func GetRenterSession(ctxParams *uh.ContextParams, ssId string, hash string, shardHashes []string) (*RenterSession, @@ -125,6 +127,46 @@ func GetRenterSession(ctxParams *uh.ContextParams, ssId string, hash string, sha return rs, nil } +func GetRenterSessionWithToken(ctxParams *uh.ContextParams, ssId string, hash string, shardHashes []string, token common.Address) (*RenterSession, + error) { + k := fmt.Sprintf(RenterSessionInMemKey, ctxParams.N.Identity.Pretty(), ssId) + var rs *RenterSession + if tmp, ok := renterSessionsInMem.Get(k); ok { + log.Debugf("get renter_session:%s from cache.", k) + rs = tmp.(*RenterSession) + } else { + log.Debugf("new renter_session:%s.", k) + ctx, cancel := helper.NewGoContext(ctxParams.Ctx) + rs = &RenterSession{ + PeerId: ctxParams.N.Identity.Pretty(), + SsId: ssId, + Hash: hash, + ShardHashes: shardHashes, + Ctx: ctx, + Cancel: cancel, + CtxParams: ctxParams, + Token: token, + } + status, err := rs.Status() + if err != nil { + return nil, err + } + if rs.Hash = hash; hash == "" { + rs.Hash = status.Hash + } + if rs.ShardHashes = shardHashes; shardHashes == nil || len(shardHashes) == 0 { + rs.ShardHashes = status.ShardHashes + } + if status.Status != RssCompleteStatus { + rs.fsm = fsm.NewFSM(status.Status, rssFsmEvents, fsm.Callbacks{ + "enter_state": rs.enterState, + }) + } + renterSessionsInMem.Set(k, rs) + } + return rs, nil +} + var helperText = map[string]string{ RssInitStatus: "Searching for recommended hosts…", RssSubmitStatus: "Hosts found! Checking chequebook balance, and visiting guard.", diff --git a/core/commands/storage/upload/upload/do_pay.go b/core/commands/storage/upload/upload/do_pay.go index 9cc943ccc..61a0eb1f0 100644 --- a/core/commands/storage/upload/upload/do_pay.go +++ b/core/commands/storage/upload/upload/do_pay.go @@ -2,6 +2,7 @@ package upload import ( "fmt" + "github.com/ethereum/go-ethereum/common" "math/big" "time" @@ -20,16 +21,18 @@ func payInCheque(rss *sessions.RenterSession) error { return err } - realAmount, err := getRealAmount(c.SignedGuardContract.Amount) + // token: get real amount + //realAmount, err := getRealAmount(c.SignedGuardContract.Amount) + realAmount, err := getRealAmount(c.SignedGuardContract.Amount, rss.Token) if err != nil { return err } host := c.SignedGuardContract.HostPid contractId := c.SignedGuardContract.ContractId - fmt.Printf("send cheque: paying... host:%v, amount:%v, contractId:%v. \n", host, realAmount.String(), contractId) + fmt.Printf("send cheque: paying... host:%v, amount:%v, contractId:%v, token:%v. \n", host, realAmount.String(), contractId, rss.Token.String()) - err = chain.SettleObject.SwapService.Settle(host, realAmount, contractId) + err = chain.SettleObject.SwapService.Settle(host, realAmount, contractId, rss.Token) if err != nil { return err } @@ -39,9 +42,9 @@ func payInCheque(rss *sessions.RenterSession) error { return nil } -func getRealAmount(amount int64) (*big.Int, error) { - //this is old price's rate [Compatible with older versions] - rateObj, err := chain.SettleObject.OracleService.CurrentRate() +func getRealAmount(amount int64, token common.Address) (*big.Int, error) { + //this is price's rate [Compatible with older versions] + rateObj, err := chain.SettleObject.OracleService.CurrentRate(token) if err != nil { return nil, err } diff --git a/core/commands/storage/upload/upload/do_submit.go b/core/commands/storage/upload/upload/do_submit.go index e073d0b74..149a9b779 100644 --- a/core/commands/storage/upload/upload/do_submit.go +++ b/core/commands/storage/upload/upload/do_submit.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/bittorrent/go-btfs/settlement/swap/vault" + "github.com/ethereum/go-ethereum/common" "github.com/bittorrent/go-btfs/chain" "github.com/bittorrent/go-btfs/core/commands/storage/upload/sessions" @@ -43,7 +44,7 @@ func doSubmit(rss *sessions.RenterSession) error { return err } - err = checkAvailableBalance(rss.Ctx, amount) + err = checkAvailableBalance(rss.Ctx, amount, rss.Token) if err != nil { return err } @@ -51,13 +52,15 @@ func doSubmit(rss *sessions.RenterSession) error { return nil } -func checkAvailableBalance(ctx context.Context, amount int64) error { - realAmount, err := getRealAmount(amount) +func checkAvailableBalance(ctx context.Context, amount int64, token common.Address) error { + realAmount, err := getRealAmount(amount, token) if err != nil { return err } - AvailableBalance, err := chain.SettleObject.VaultService.AvailableBalance(ctx) + // token: get available balance of token. + //AvailableBalance, err := chain.SettleObject.VaultService.AvailableBalance(ctx, token) + AvailableBalance, err := chain.SettleObject.VaultService.AvailableBalance(ctx, token) if err != nil { return err } diff --git a/core/commands/storage/upload/upload/receive_check_tokens.go b/core/commands/storage/upload/upload/receive_check_tokens.go new file mode 100644 index 000000000..2aac1933c --- /dev/null +++ b/core/commands/storage/upload/upload/receive_check_tokens.go @@ -0,0 +1,30 @@ +package upload + +import ( + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "time" + + cmds "github.com/bittorrent/go-btfs-cmds" + uh "github.com/bittorrent/go-btfs/core/commands/storage/upload/helper" +) + +var StorageUploadSupportTokensCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "support cheque, return tokens.", + ShortDescription: `support cheque, return tokens.`, + }, + Arguments: []cmds.Argument{}, + RunTimeout: 5 * time.Minute, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + ctxParams, err := uh.ExtractContextParams(req, env) + if err != nil { + return err + } + if !ctxParams.Cfg.Experimental.StorageHostEnabled { + return fmt.Errorf("storage host api not enabled") + } + + return cmds.EmitOnce(res, &tokencfg.MpTokenAddr) + }, +} diff --git a/core/commands/storage/upload/upload/recieve_cheque.go b/core/commands/storage/upload/upload/recieve_cheque.go index 0a78ed42f..06e0bcf15 100644 --- a/core/commands/storage/upload/upload/recieve_cheque.go +++ b/core/commands/storage/upload/upload/recieve_cheque.go @@ -2,7 +2,10 @@ package upload import ( "context" + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "github.com/ethereum/go-ethereum/common" "math/big" "time" @@ -21,9 +24,12 @@ var StorageUploadChequeCmd = &cmds.Command{ cmds.StringArg("encoded-cheque", true, false, "encoded-cheque from peer-id."), cmds.StringArg("amount", true, false, "amount"), cmds.StringArg("contract-id", false, false, "contract-id."), + cmds.StringArg("token", false, false, "token."), }, RunTimeout: 5 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + fmt.Printf("receive cheque ...\n") + ctxParams, err := uh.ExtractContextParams(req, env) if err != nil { return err @@ -44,10 +50,18 @@ var StorageUploadChequeCmd = &cmds.Command{ encodedCheque := req.Arguments[0] contractId := req.Arguments[2] - fmt.Printf("receive cheque, requestPid:%s contractId:%+v,encodedCheque:%+v \n", requestPid.String(), contractId, encodedCheque) + tokenHex := req.Arguments[3] + fmt.Printf("receive cheque, requestPid:%s contractId:%+v,encodedCheque:%+v token:%+v\n", + requestPid.String(), contractId, encodedCheque, tokenHex) + + token := common.HexToAddress(tokenHex) + _, bl := tokencfg.MpTokenStr[token] + if !bl { + return errors.New("your input token is none. ") + } // decode and deal the cheque - err = swapprotocol.SwapProtocol.Handler(context.Background(), requestPid.String(), encodedCheque, price) + err = swapprotocol.SwapProtocol.Handler(context.Background(), requestPid.String(), encodedCheque, price, token) if err != nil { fmt.Println("receive cheque, swapprotocol.SwapProtocol.Handler, error:", err) return err diff --git a/core/commands/storage/upload/upload/repair.go b/core/commands/storage/upload/upload/repair.go index 6b9968de6..c0af4ddb9 100644 --- a/core/commands/storage/upload/upload/repair.go +++ b/core/commands/storage/upload/upload/repair.go @@ -3,6 +3,7 @@ package upload import ( "context" "errors" + "github.com/bittorrent/go-btfs/chain/tokencfg" "strings" "time" @@ -85,7 +86,9 @@ This command repairs the given shards of a file.`, if err != nil { return err } - UploadShard(rss, hp, m.Price, m.ShardFileSize, -1, false, renterPid, -1, + + // token: notice repair is dropped. This is just a compatible function of 'UploadShard'. + UploadShard(rss, hp, m.Price, tokencfg.MpTokenAddr["WBTT"], m.ShardFileSize, -1, false, renterPid, -1, shardIndexes, &RepairParams{ RenterStart: m.RentStart, RenterEnd: m.RentEnd, diff --git a/core/commands/storage/upload/upload/upload.go b/core/commands/storage/upload/upload/upload.go index ee5250fdc..a84a54f69 100644 --- a/core/commands/storage/upload/upload/upload.go +++ b/core/commands/storage/upload/upload/upload.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "strconv" "strings" "time" @@ -79,6 +80,7 @@ Use status command to check for completion: }, Subcommands: map[string]*cmds.Command{ "init": StorageUploadInitCmd, + "supporttokens": StorageUploadSupportTokensCmd, "cheque": StorageUploadChequeCmd, "recvcontract": StorageUploadRecvContractCmd, "status": StorageUploadStatusCmd, @@ -104,6 +106,7 @@ Use status command to check for completion: cmds.BoolOption(customizedPayoutOptionName, "Enable file storage customized payout schedule.").WithDefault(false), cmds.IntOption(customizedPayoutPeriodOptionName, "Period of customized payout schedule.").WithDefault(1), cmds.IntOption(copyName, "copy num of file hash.").WithDefault(0), + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), }, RunTimeout: 15 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -141,6 +144,14 @@ Use status command to check for completion: var fileSize int64 var shardSize int64 + // token: parse token argument + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Println("... use token = ", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + fileHash := req.Arguments[0] shardHashes, fileSize, shardSize, err = helper.GetShardHashes(ctxParams, fileHash) if len(shardHashes) == 0 && fileSize == -1 && shardSize == -1 && @@ -154,22 +165,25 @@ Use status command to check for completion: if err != nil { return err } - _, storageLength, err := helper.GetPriceAndMinStorageLength(ctxParams) if err != nil { return err } // CheckNewPrice, get latest price when upload. - _, err = chain.SettleObject.OracleService.CheckNewPrice() + _, err = chain.SettleObject.OracleService.CheckNewPrice(token) if err != nil { return err } - priceObj, err := chain.SettleObject.OracleService.CurrentPrice() + + // token: get new price + //priceObj, err := chain.SettleObject.OracleService.CurrentPrice(token) + priceObj, err := chain.SettleObject.OracleService.CurrentPrice(token) if err != nil { return err } price := priceObj.Int64() + // sync hosts from hub hosts. if !ctxParams.Cfg.Experimental.HostsSyncEnabled { _ = SyncHosts(ctxParams) } @@ -186,7 +200,7 @@ Use status command to check for completion: hp = helper.GetCustomizedHostsProvider(ctxParams, hostIDs) } } - rss, err := sessions.GetRenterSession(ctxParams, ssId, fileHash, shardHashes) + rss, err := sessions.GetRenterSessionWithToken(ctxParams, ssId, fileHash, shardHashes, token) if err != nil { return err } @@ -208,7 +222,7 @@ Use status command to check for completion: for i, _ := range rss.ShardHashes { shardIndexes = append(shardIndexes, i) } - UploadShard(rss, hp, price, shardSize, storageLength, offlineSigning, renterId, fileSize, shardIndexes, nil) + UploadShard(rss, hp, price, token, shardSize, storageLength, offlineSigning, renterId, fileSize, shardIndexes, nil) seRes := &Res{ ID: ssId, } diff --git a/core/commands/storage/upload/upload/upload_shard.go b/core/commands/storage/upload/upload/upload_shard.go index 372d05661..4f137493f 100644 --- a/core/commands/storage/upload/upload/upload_shard.go +++ b/core/commands/storage/upload/upload/upload_shard.go @@ -2,7 +2,11 @@ package upload import ( "context" + "encoding/json" "errors" + "fmt" + "github.com/ethereum/go-ethereum/common" + "reflect" "time" "github.com/bittorrent/go-btfs/core/commands/storage/upload/helper" @@ -13,16 +17,18 @@ import ( "github.com/libp2p/go-libp2p-core/peer" ) -func UploadShard(rss *sessions.RenterSession, hp helper.IHostsProvider, price int64, shardSize int64, +func UploadShard(rss *sessions.RenterSession, hp helper.IHostsProvider, price int64, token common.Address, shardSize int64, storageLength int, offlineSigning bool, renterId peer.ID, fileSize int64, shardIndexes []int, rp *RepairParams) error { expectTotalPay := helper.TotalPay(shardSize, price, storageLength) * int64(len(rss.ShardHashes)) - err := checkAvailableBalance(rss.Ctx, expectTotalPay) + err := checkAvailableBalance(rss.Ctx, expectTotalPay, token) if err != nil { return err } + var cannot int + var pass int for index, shardHash := range rss.ShardHashes { go func(i int, h string) { err := backoff.Retry(func() error { @@ -32,6 +38,12 @@ func UploadShard(rss *sessions.RenterSession, hp helper.IHostsProvider, price in default: break } + + // check some host, if not matching, return err. + if cannot >= 10 && pass <= 0 { + return errors.New("There are no valid matching hosts to upload. ") + } + host, err := hp.NextValidHost() if err != nil { terr := rss.To(sessions.RssToErrorEvent, err) @@ -41,6 +53,49 @@ func UploadShard(rss *sessions.RenterSession, hp helper.IHostsProvider, price in } return nil } + + hostPid, err := peer.IDB58Decode(host) + if err != nil { + log.Errorf("shard %s decodes host_pid error: %s", h, err.Error()) + return err + } + + //token: check host tokens + { + ctx, _ := context.WithTimeout(rss.Ctx, 60*time.Second) + output, err := remote.P2PCall(ctx, rss.CtxParams.N, rss.CtxParams.Api, hostPid, "/storage/upload/supporttokens") + if err != nil { + return nil + } + + fmt.Println("1 get from supporttokens,", string(output), reflect.TypeOf(output)) + //return nil + + var mpToken map[string]common.Address + err = json.Unmarshal(output, &mpToken) + fmt.Println("1.2 get from supporttokens, err = ", err) + if err != nil { + return err + } + + fmt.Println("2 get from supporttokens, mpToken = ", mpToken) + + ok := false + for _, v := range mpToken { + if token == v { + ok = true + } + } + if !ok { + cannot++ + return nil + } + } + pass++ + + fmt.Println("3 get from supporttokens .... continue ") + + // TotalPay contractId := helper.NewContractID(rss.SsId) cb := make(chan error) ShardErrChanMap.Set(contractId, cb) @@ -83,11 +138,6 @@ func UploadShard(rss *sessions.RenterSession, hp helper.IHostsProvider, price in } } - hostPid, err := peer.IDB58Decode(host) - if err != nil { - log.Errorf("shard %s decodes host_pid error: %s", h, err.Error()) - return err - } go func() { ctx, _ := context.WithTimeout(rss.Ctx, 10*time.Second) _, err := remote.P2PCall(ctx, rss.CtxParams.N, rss.CtxParams.Api, hostPid, "/storage/upload/init", diff --git a/core/commands/test.go b/core/commands/test.go index d08f50d01..9ef0b3a2b 100644 --- a/core/commands/test.go +++ b/core/commands/test.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "time" @@ -138,7 +139,7 @@ var testChequeCmd = &cmds.Command{ toPeer := "16Uiu2HAmQ4VAZdAmXJKapZYAib2BZpsSkVQfTwowCYvSqbEyuTnQ" //toPeer := nodes[0].NodeId - chain.SettleObject.SwapService.Settle(toPeer, big.NewInt(10), "") + chain.SettleObject.SwapService.Settle(toPeer, big.NewInt(10), "", tokencfg.MpTokenAddr["WBTT"]) return cmds.EmitOnce(res, &TestOutput{"send cheque ok"}) }, diff --git a/core/commands/vault/vault.go b/core/commands/vault/vault.go index 970f6240a..3719772d6 100644 --- a/core/commands/vault/vault.go +++ b/core/commands/vault/vault.go @@ -12,6 +12,7 @@ Vault services include balance, address, withdraw, deposit operations.`, }, Subcommands: map[string]*cmds.Command{ "balance": VaultBalanceCmd, + "balance_all": VaultBalanceAllCmd, "address": VaultAddrCmd, "withdraw": VaultWithdrawCmd, "deposit": VaultDepositCmd, diff --git a/core/commands/vault/vault_balance.go b/core/commands/vault/vault_balance.go index ccf9c1238..c44f050e0 100644 --- a/core/commands/vault/vault_balance.go +++ b/core/commands/vault/vault_balance.go @@ -1,7 +1,9 @@ package vault import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "time" @@ -20,8 +22,18 @@ var VaultBalanceCmd = &cmds.Command{ Tagline: "Get vault balance.", }, RunTimeout: 5 * time.Minute, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { - balance, err := chain.SettleObject.VaultService.AvailableBalance(context.Background()) + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + balance, err := chain.SettleObject.VaultService.AvailableBalance(context.Background(), token) if err != nil { return err } diff --git a/core/commands/vault/vault_balance_all.go b/core/commands/vault/vault_balance_all.go new file mode 100644 index 000000000..b66455084 --- /dev/null +++ b/core/commands/vault/vault_balance_all.go @@ -0,0 +1,41 @@ +package vault + +import ( + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "io" + "math/big" + "time" + + cmds "github.com/bittorrent/go-btfs-cmds" + "github.com/bittorrent/go-btfs/chain" + "golang.org/x/net/context" +) + +var VaultBalanceAllCmd = &cmds.Command{ + Helptext: cmds.HelpText{ + Tagline: "Get vault balance.", + }, + RunTimeout: 5 * time.Minute, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + + mp := make(map[string]*big.Int, 0) + for k, tokenAddr := range tokencfg.MpTokenAddr { + balance, err := chain.SettleObject.VaultService.AvailableBalance(context.Background(), tokenAddr) + if err != nil { + return err + } + + mp[k] = balance + } + + return cmds.EmitOnce(res, &mp) + }, + Type: &VaultBalanceCmdRet{}, + Encoders: cmds.EncoderMap{ + cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *VaultBalanceCmdRet) error { + _, err := fmt.Fprintf(w, "the vault available balance: %v\n", out.Balance) + return err + }), + }, +} diff --git a/core/commands/vault/vault_deposit.go b/core/commands/vault/vault_deposit.go index c48d65db2..791177f8c 100644 --- a/core/commands/vault/vault_deposit.go +++ b/core/commands/vault/vault_deposit.go @@ -1,7 +1,9 @@ package vault import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "time" @@ -23,6 +25,9 @@ var VaultDepositCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("amount", true, false, "deposit amount."), }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, RunTimeout: 5 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { argAmount := utils.RemoveSpaceAndComma(req.Arguments[0]) @@ -30,7 +35,15 @@ var VaultDepositCmd = &cmds.Command{ if !ok { return fmt.Errorf("amount:%s cannot be parsed", req.Arguments[0]) } - hash, err := chain.SettleObject.VaultService.Deposit(context.Background(), amount) + + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + hash, err := chain.SettleObject.VaultService.Deposit(context.Background(), amount, token) if err != nil { return err } diff --git a/core/commands/vault/vault_withdraw.go b/core/commands/vault/vault_withdraw.go index 224abf7c9..8402664d4 100644 --- a/core/commands/vault/vault_withdraw.go +++ b/core/commands/vault/vault_withdraw.go @@ -1,7 +1,9 @@ package vault import ( + "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "io" "math/big" "time" @@ -23,6 +25,9 @@ var VaultWithdrawCmd = &cmds.Command{ Arguments: []cmds.Argument{ cmds.StringArg("amount", true, false, "withdraw amount."), }, + Options: []cmds.Option{ + cmds.StringOption(tokencfg.TokenTypeName, "tk", "file storage with token type,default WBTT, other TRX/USDD/USDT.").WithDefault("WBTT"), + }, RunTimeout: 5 * time.Minute, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { argAmount := utils.RemoveSpaceAndComma(req.Arguments[0]) @@ -30,7 +35,15 @@ var VaultWithdrawCmd = &cmds.Command{ if !ok { return fmt.Errorf("amount:%s cannot be parsed", req.Arguments[0]) } - hash, err := chain.SettleObject.VaultService.Withdraw(context.Background(), amount) + + tokenStr := req.Options[tokencfg.TokenTypeName].(string) + fmt.Printf("... token:%+v\n", tokenStr) + token, bl := tokencfg.MpTokenAddr[tokenStr] + if !bl { + return errors.New("your input token is none. ") + } + + hash, err := chain.SettleObject.VaultService.Withdraw(context.Background(), amount, token) if err != nil { return err } diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index 281485c59..fdc83ed67 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -38,7 +38,7 @@ import ( dagtest "github.com/ipfs/go-merkledag/test" "github.com/ipfs/go-path/resolver" "github.com/libp2p/go-libp2p-core/peer" - "github.com/prometheus/common/log" + // "github.com/prometheus/common/log" ) type UnixfsAPI CoreAPI @@ -193,7 +193,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, filesNode files.Node, opts ...opt return nil, err } } - log.Infof("The file will be encrypted with pubkey: %s", settings.Pubkey) + // log.Infof("The file will be encrypted with pubkey: %s", settings.Pubkey) switch f := filesNode.(type) { case files.File: bytes, err := ioutil.ReadAll(f) diff --git a/core/node/libp2p/transport.go b/core/node/libp2p/transport.go index 3ad4ad966..16274f498 100644 --- a/core/node/libp2p/transport.go +++ b/core/node/libp2p/transport.go @@ -7,10 +7,10 @@ import ( libp2p "github.com/libp2p/go-libp2p" metrics "github.com/libp2p/go-libp2p-core/metrics" - libp2pquic "github.com/libp2p/go-libp2p-quic-transport" + + // libp2pquic "github.com/libp2p/go-libp2p-quic-transport" tcp "github.com/libp2p/go-tcp-transport" websocket "github.com/libp2p/go-ws-transport" - quic "github.com/lucas-clemente/quic-go" "go.uber.org/fx" ) @@ -19,7 +19,7 @@ import ( // https://github.com/lucas-clemente/quic-go/releases/tag/v0.17.3. // TODO: remove this once the network has upgraded to > v0.6.0. func init() { - quic.RetireBugBackwardsCompatibilityMode = true + // quic.RetireBugBackwardsCompatibilityMode = true } func Transports(tptConfig config.Transports) interface{} { @@ -46,7 +46,7 @@ func Transports(tptConfig config.Transports) interface{} { "Please disable Swarm.Transports.Network.QUIC.", ) } - opts.Opts = append(opts.Opts, libp2p.Transport(libp2pquic.NewTransport)) + // opts.Opts = append(opts.Opts, libp2p.Transport(libp2pquic.NewTransport)) } return opts, nil diff --git a/core/wallet/speed_darwin.go b/core/wallet/speed_darwin.go index 2df9d8c3b..e08891e3c 100644 --- a/core/wallet/speed_darwin.go +++ b/core/wallet/speed_darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin package wallet diff --git a/core/wallet/speed_other.go b/core/wallet/speed_other.go index d8fdc61d6..35c32023e 100644 --- a/core/wallet/speed_other.go +++ b/core/wallet/speed_other.go @@ -1,3 +1,4 @@ +//go:build !windows && !darwin // +build !windows,!darwin package wallet diff --git a/core/wallet/speed_windows.go b/core/wallet/speed_windows.go index 6db6c7086..f9aa35d58 100644 --- a/core/wallet/speed_windows.go +++ b/core/wallet/speed_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package wallet diff --git a/coverage/main/main.go b/coverage/main/main.go index 95b3186f3..005c2f1ef 100644 --- a/coverage/main/main.go +++ b/coverage/main/main.go @@ -1,3 +1,4 @@ +//go:build testrunmain // +build testrunmain package main diff --git a/fuse/ipns/ipns_test.go b/fuse/ipns/ipns_test.go index 032790ae7..276f6a0dc 100644 --- a/fuse/ipns/ipns_test.go +++ b/fuse/ipns/ipns_test.go @@ -1,3 +1,4 @@ +//go:build !nofuse && !openbsd && !netbsd // +build !nofuse,!openbsd,!netbsd package ipns diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 01d2a3d6f..f3fd8ceff 100644 --- a/fuse/ipns/ipns_unix.go +++ b/fuse/ipns/ipns_unix.go @@ -1,3 +1,4 @@ +//go:build !nofuse && !openbsd && !netbsd // +build !nofuse,!openbsd,!netbsd // package fuse/ipns implements a fuse filesystem that interfaces diff --git a/fuse/ipns/link_unix.go b/fuse/ipns/link_unix.go index 3cc9effd6..e7101f551 100644 --- a/fuse/ipns/link_unix.go +++ b/fuse/ipns/link_unix.go @@ -1,3 +1,4 @@ +//go:build !nofuse && !openbsd && !netbsd // +build !nofuse,!openbsd,!netbsd package ipns diff --git a/fuse/ipns/mount_unix.go b/fuse/ipns/mount_unix.go index e0d67d53d..3263662ee 100644 --- a/fuse/ipns/mount_unix.go +++ b/fuse/ipns/mount_unix.go @@ -1,3 +1,4 @@ +//go:build (linux || darwin || freebsd || netbsd || openbsd) && !nofuse // +build linux darwin freebsd netbsd openbsd // +build !nofuse diff --git a/fuse/mount/fuse.go b/fuse/mount/fuse.go index 1c5f0d2ce..7e5ec61df 100644 --- a/fuse/mount/fuse.go +++ b/fuse/mount/fuse.go @@ -1,3 +1,4 @@ +//go:build !nofuse && !windows && !openbsd && !netbsd // +build !nofuse,!windows,!openbsd,!netbsd package mount diff --git a/fuse/node/mount_nofuse.go b/fuse/node/mount_nofuse.go index b64cc8dbe..750c91da5 100644 --- a/fuse/node/mount_nofuse.go +++ b/fuse/node/mount_nofuse.go @@ -1,3 +1,4 @@ +//go:build !windows && nofuse // +build !windows,nofuse package node diff --git a/fuse/node/mount_test.go b/fuse/node/mount_test.go index f94a31640..717119fb1 100644 --- a/fuse/node/mount_test.go +++ b/fuse/node/mount_test.go @@ -1,3 +1,4 @@ +//go:build !openbsd && !nofuse && !netbsd // +build !openbsd,!nofuse,!netbsd package node diff --git a/fuse/node/mount_unix.go b/fuse/node/mount_unix.go index 1dfe071a8..cdea23a64 100644 --- a/fuse/node/mount_unix.go +++ b/fuse/node/mount_unix.go @@ -1,3 +1,4 @@ +//go:build !windows && !openbsd && !netbsd && !nofuse // +build !windows,!openbsd,!netbsd,!nofuse package node diff --git a/fuse/readonly/ipfs_test.go b/fuse/readonly/ipfs_test.go index c5ecb2800..84f32ef7e 100644 --- a/fuse/readonly/ipfs_test.go +++ b/fuse/readonly/ipfs_test.go @@ -1,3 +1,4 @@ +//go:build !nofuse && !openbsd && !netbsd // +build !nofuse,!openbsd,!netbsd package readonly diff --git a/fuse/readonly/mount_unix.go b/fuse/readonly/mount_unix.go index 8accea480..c0b29f6ab 100644 --- a/fuse/readonly/mount_unix.go +++ b/fuse/readonly/mount_unix.go @@ -1,3 +1,4 @@ +//go:build (linux || darwin || freebsd) && !nofuse // +build linux darwin freebsd // +build !nofuse diff --git a/fuse/readonly/readonly_unix.go b/fuse/readonly/readonly_unix.go index 63af66dfa..b391b5c59 100644 --- a/fuse/readonly/readonly_unix.go +++ b/fuse/readonly/readonly_unix.go @@ -1,3 +1,4 @@ +//go:build (linux || darwin || freebsd) && !nofuse // +build linux darwin freebsd // +build !nofuse diff --git a/go.mod b/go.mod index 6e5e90d9a..bb9c03372 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,9 @@ module github.com/bittorrent/go-btfs -go 1.15 +go 1.18 require ( bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc - github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect - github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect github.com/TRON-US/go-btfs-api v0.3.0 github.com/TRON-US/go-btfs-chunker v0.3.0 github.com/TRON-US/go-btfs-config v0.11.12 @@ -20,21 +18,21 @@ require ( github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d github.com/bittorrent/go-btfs-cmds v0.2.14 github.com/blang/semver v3.5.1+incompatible + github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d github.com/btcsuite/btcd v0.22.0-beta - github.com/cenkalti/backoff/v4 v4.0.2 - github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e // indirect + github.com/cenkalti/backoff/v4 v4.1.3 github.com/coreos/go-systemd/v22 v22.1.0 github.com/dustin/go-humanize v1.0.0 github.com/elgris/jsondiff v0.0.0-20160530203242-765b5c24c302 github.com/ethereum/go-ethereum v1.10.3 github.com/ethersphere/go-sw3-abi v0.4.0 - github.com/fsnotify/fsnotify v1.4.9 + github.com/fsnotify/fsnotify v1.5.4 github.com/gabriel-vasile/mimetype v1.1.2 github.com/go-bindata/go-bindata/v3 v3.1.3 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.2 - github.com/google/uuid v1.2.0 + github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/ip2location/ip2location-go/v9 v9.0.0 @@ -78,7 +76,7 @@ require ( github.com/libp2p/go-libp2p v0.11.0 github.com/libp2p/go-libp2p-circuit v0.4.0 github.com/libp2p/go-libp2p-connmgr v0.2.4 - github.com/libp2p/go-libp2p-core v0.9.0 + github.com/libp2p/go-libp2p-core v0.14.0 github.com/libp2p/go-libp2p-crypto v0.1.0 github.com/libp2p/go-libp2p-discovery v0.5.1 github.com/libp2p/go-libp2p-http v0.1.5 @@ -90,12 +88,11 @@ require ( github.com/libp2p/go-libp2p-peerstore v0.2.7 github.com/libp2p/go-libp2p-pubsub v0.3.5 github.com/libp2p/go-libp2p-pubsub-router v0.3.2 - github.com/libp2p/go-libp2p-quic-transport v0.10.0 github.com/libp2p/go-libp2p-record v0.1.3 github.com/libp2p/go-libp2p-routing-helpers v0.2.3 github.com/libp2p/go-libp2p-secio v0.2.2 github.com/libp2p/go-libp2p-swarm v0.5.0 - github.com/libp2p/go-libp2p-testing v0.4.0 + github.com/libp2p/go-libp2p-testing v0.9.0 github.com/libp2p/go-libp2p-tls v0.1.3 github.com/libp2p/go-libp2p-yamux v0.5.4 github.com/libp2p/go-socket-activation v0.0.2 @@ -103,14 +100,11 @@ require ( github.com/libp2p/go-testutil v0.1.0 github.com/libp2p/go-ws-transport v0.4.0 github.com/looplab/fsm v0.1.0 - github.com/lucas-clemente/quic-go v0.19.3 github.com/markbates/pkger v0.17.0 - github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mholt/archiver/v3 v3.3.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/mmcloughlin/avo v0.0.0-20200523190732-4439b6b2c061 // indirect github.com/mr-tron/base58 v1.2.0 - github.com/multiformats/go-multiaddr v0.3.3 + github.com/multiformats/go-multiaddr v0.4.1 github.com/multiformats/go-multiaddr-dns v0.2.0 github.com/multiformats/go-multibase v0.0.3 github.com/multiformats/go-multihash v0.0.15 @@ -118,11 +112,10 @@ require ( github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.11.0 - github.com/prometheus/common v0.26.0 + github.com/prometheus/client_golang v1.12.2 github.com/shirou/gopsutil/v3 v3.20.12 github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.0 github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 github.com/thedevsaddam/gojsonq/v2 v2.5.2 github.com/tron-us/go-btfs-common v0.8.10 @@ -135,17 +128,236 @@ require ( github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c go.uber.org/fx v1.13.1 - go.uber.org/zap v1.18.1 + go.uber.org/zap v1.19.1 go4.org v0.0.0-20200411211856-f5505b9728dd - golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e - golang.org/x/net v0.0.0-20210614182718-04defd469f4e - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c + golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d + golang.org/x/net v0.0.0-20220630215102-69896b714898 + golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f + golang.org/x/sys v0.0.0-20220702020025-31831981b65f gopkg.in/cheggaaa/pb.v1 v1.0.28 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/yaml.v2 v2.4.0 gotest.tools v2.2.0+incompatible +) + +require ( + crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 // indirect + github.com/RoaringBitmap/roaring v1.2.1 // indirect + github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect + github.com/alecthomas/atomic v0.1.0-alpha2 // indirect + github.com/anacrolix/chansync v0.3.0 // indirect + github.com/anacrolix/dht/v2 v2.19.0 // indirect + github.com/anacrolix/envpprof v1.2.1 // indirect + github.com/anacrolix/generics v0.0.0-20220618083756-f99e35403a60 // indirect + github.com/anacrolix/go-libutp v1.2.0 // indirect + github.com/anacrolix/log v0.13.2-0.20220711050817-613cb738ef30 // indirect + github.com/anacrolix/missinggo v1.3.0 // indirect + github.com/anacrolix/missinggo/perf v1.0.0 // indirect + github.com/anacrolix/missinggo/v2 v2.7.0 // indirect + github.com/anacrolix/mmsg v1.0.0 // indirect + github.com/anacrolix/multiless v0.3.0 // indirect + github.com/anacrolix/stm v0.4.0 // indirect + github.com/anacrolix/sync v0.4.0 // indirect + github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 // indirect + github.com/anacrolix/utp v0.1.0 // indirect + github.com/bahlo/generic-list-go v0.2.0 // indirect + github.com/benbjohnson/immutable v0.3.0 // indirect + github.com/bits-and-blooms/bitset v1.2.2 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/btree v1.1.2 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/lispad/go-generics-tools v1.1.0 // indirect + github.com/mschoch/smat v0.2.0 // indirect + github.com/pion/datachannel v1.5.2 // indirect + github.com/pion/dtls/v2 v2.1.5 // indirect + github.com/pion/ice/v2 v2.2.6 // indirect + github.com/pion/interceptor v0.1.11 // indirect + github.com/pion/logging v0.2.2 // indirect + github.com/pion/mdns v0.0.5 // indirect + github.com/pion/randutil v0.1.0 // indirect + github.com/pion/rtcp v1.2.9 // indirect + github.com/pion/rtp v1.7.13 // indirect + github.com/pion/sctp v1.8.2 // indirect + github.com/pion/sdp/v3 v3.0.5 // indirect + github.com/pion/srtp/v2 v2.0.9 // indirect + github.com/pion/stun v0.3.5 // indirect + github.com/pion/transport v0.13.1 // indirect + github.com/pion/turn/v2 v2.0.8 // indirect + github.com/pion/udp v0.1.1 // indirect + github.com/pion/webrtc/v3 v3.1.42 // indirect + github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 // indirect + github.com/tidwall/btree v1.3.1 // indirect + go.etcd.io/bbolt v1.3.6 // indirect + go.opentelemetry.io/otel v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect + golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d // indirect +) + +require ( + github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 // indirect + github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect + github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect + github.com/Kubuxu/go-os-helper v0.0.1 // indirect + github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect + github.com/Stebalien/go-bitfield v0.0.1 // indirect + github.com/VictoriaMetrics/fastcache v1.5.7 // indirect + github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5 // indirect + github.com/anacrolix/torrent v1.47.0 + github.com/andybalholm/brotli v0.0.0-20190621154722-5f990b63d2d6 // indirect + github.com/benbjohnson/clock v1.1.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect + github.com/cenkalti/backoff v2.2.1+incompatible // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e // indirect + github.com/codemodus/kace v0.5.1 // indirect + github.com/coreos/go-semver v0.3.0 // indirect + github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect + github.com/cskr/pubsub v1.0.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018 // indirect + github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect + github.com/dgraph-io/badger v1.6.1 // indirect + github.com/dgraph-io/ristretto v0.0.2 // indirect + github.com/dsnet/compress v0.0.1 // indirect + github.com/edsrzf/mmap-go v1.1.0 // indirect + github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 // indirect + github.com/flynn/noise v1.0.0 // indirect + github.com/fomichev/secp256k1 v0.0.0-20180413221153-00116ff8c62f // indirect + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + github.com/go-ole/go-ole v1.2.4 // indirect + github.com/go-pg/migrations/v7 v7.1.11 // indirect + github.com/go-pg/pg/v9 v9.2.0 // indirect + github.com/go-pg/zerochecker v0.2.0 // indirect + github.com/go-redis/redis/v7 v7.4.0 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/gobuffalo/here v0.6.0 // indirect + github.com/golang/gddo v0.0.0-20190419222130-af0f2af80721 // indirect + github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 // indirect + github.com/google/go-cmp v0.5.8 // indirect + github.com/google/gopacket v1.1.19 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect + github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect + github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/holiman/bloomfilter/v2 v2.0.3 // indirect + github.com/holiman/uint256 v1.1.1 // indirect + github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 // indirect + github.com/hypnoglow/go-pg-monitor v0.1.0 // indirect + github.com/hypnoglow/go-pg-monitor/gopgv9 v0.1.0 // indirect + github.com/ipfs/bbloom v0.0.4 // indirect + github.com/ipfs/go-ipfs-delay v0.0.1 // indirect + github.com/ipfs/go-ipfs-pq v0.0.2 // indirect + github.com/ipfs/go-log/v2 v2.5.0 // indirect + github.com/ipfs/go-peertaskqueue v0.2.0 // indirect + github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018 // indirect + github.com/ipld/go-ipld-prime-proto v0.1.0 // indirect + github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 // indirect + github.com/kisielk/errcheck v1.5.0 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/cpuid v1.2.4 // indirect + github.com/klauspost/cpuid/v2 v2.0.4 // indirect + github.com/klauspost/pgzip v1.2.1 // indirect + github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d // indirect + github.com/libp2p/go-addr-util v0.0.2 // indirect + github.com/libp2p/go-buffer-pool v0.0.2 // indirect + github.com/libp2p/go-cidranger v1.1.0 // indirect + github.com/libp2p/go-conn-security-multistream v0.2.0 // indirect + github.com/libp2p/go-eventbus v0.2.1 // indirect + github.com/libp2p/go-flow-metrics v0.0.3 // indirect + github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052 // indirect + github.com/libp2p/go-libp2p-autonat v0.3.2 // indirect + github.com/libp2p/go-libp2p-blankhost v0.2.0 // indirect + github.com/libp2p/go-libp2p-gostream v0.2.1 // indirect + github.com/libp2p/go-libp2p-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p-nat v0.0.6 // indirect + github.com/libp2p/go-libp2p-netutil v0.1.0 // indirect + github.com/libp2p/go-libp2p-peer v0.2.0 // indirect + github.com/libp2p/go-libp2p-pnet v0.2.0 // indirect + github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 // indirect + github.com/libp2p/go-mplex v0.1.2 // indirect + github.com/libp2p/go-msgio v0.0.6 // indirect + github.com/libp2p/go-nat v0.0.5 // indirect + github.com/libp2p/go-netroute v0.2.0 // indirect + github.com/libp2p/go-openssl v0.0.7 // indirect + github.com/libp2p/go-reuseport v0.0.2 // indirect + github.com/libp2p/go-reuseport-transport v0.0.4 // indirect + github.com/libp2p/go-stream-muxer-multistream v0.3.0 // indirect + github.com/libp2p/go-yamux v1.3.7 // indirect + github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect + github.com/mattn/go-colorable v0.1.2 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect + github.com/miekg/dns v1.1.31 // indirect + github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect + github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect + github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect + github.com/minio/sha256-simd v1.0.0 // indirect + github.com/mmcloughlin/avo v0.0.0-20200523190732-4439b6b2c061 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/multiformats/go-base32 v0.0.3 // indirect + github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect + github.com/multiformats/go-multiaddr-net v0.2.0 // indirect + github.com/multiformats/go-multistream v0.2.0 // indirect + github.com/multiformats/go-varint v0.0.6 // indirect + github.com/nwaples/rardecode v1.0.0 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect + github.com/pierrec/lz4 v2.0.5+incompatible // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.35.0 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/prometheus/tsdb v0.7.1 // indirect + github.com/rjeczalik/notify v0.9.1 // indirect + github.com/rs/cors v1.7.0 // indirect + github.com/segmentio/encoding v0.1.15 // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e // indirect + github.com/tklauser/go-sysconf v0.3.5 // indirect + github.com/tklauser/numcpus v0.2.2 // indirect + github.com/ulikunitz/xz v0.5.6 // indirect + github.com/vmihailenco/bufpool v0.1.11 // indirect + github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect + github.com/vmihailenco/tagparser v0.1.1 // indirect + github.com/whyrusleeping/cbor-gen v0.0.0-20200710004633-5379fc63235d // indirect + github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect + github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect + github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 // indirect + github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect + go.opencensus.io v0.22.4 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/dig v1.10.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect + golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect + golang.org/x/tools v0.1.10 // indirect + golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect + google.golang.org/appengine v1.6.6 // indirect + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + google.golang.org/grpc v1.46.2 // indirect + google.golang.org/protobuf v1.28.0 // indirect + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect + mellium.im/sasl v0.2.1 // indirect ) replace github.com/ipfs/go-ipld-format => github.com/TRON-US/go-ipld-format v0.2.0 @@ -176,4 +388,4 @@ replace github.com/libp2p/go-libp2p => github.com/libp2p/go-libp2p v0.11.0 replace github.com/libp2p/go-libp2p-circuit => github.com/libp2p/go-libp2p-circuit v0.3.1 -replace github.com/libp2p/go-libp2p-quic-transport => github.com/libp2p/go-libp2p-quic-transport v0.8.0 +exclude github.com/anacrolix/dht/v2 v2.15.2-0.20220123034220-0538803801cb diff --git a/go.sum b/go.sum index 69bfc8a45..ae5bb5830 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,7 @@ bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc h1:utDghgcjE8u+EBjHOgYT+dJPcnDF05KqWMBcjuJy510= bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= @@ -15,25 +13,36 @@ cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gc cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797 h1:yDf7ARQc637HoxDho7xjqdvO5ZA2Yb+xzv/fOnnvZzw= +crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oXPKINnZ8mcqnye1EkVkqsectk= +crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4= +crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508 h1:fILCBBFnjnrQ0whVJlGhfv1E/QiaFDNtGFBObEVRnYg= +crawshaw.io/sqlite v0.3.3-0.20210127221821-98b1f83c5508/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -77,6 +86,11 @@ github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w= +github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI= +github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= +github.com/RoaringBitmap/roaring v1.2.1 h1:58/LJlg/81wfEHd5L9qsHduznOIhyv4qb1yWcSvVq9A= +github.com/RoaringBitmap/roaring v1.2.1/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= @@ -134,8 +148,13 @@ github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3 github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 h1:byYvvbfSo3+9efR4IeReh77gVs4PnNDR3AMOE9NJ7a0= +github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0/go.mod h1:q37NoqncT41qKc048STsifIt69LfUJ8SrWWcz/yam5k= +github.com/alecthomas/assert/v2 v2.0.0-alpha3 h1:pcHeMvQ3OMstAWgaeaXIAL8uzB9xMm2zlxt+/4ml8lk= +github.com/alecthomas/atomic v0.1.0-alpha2 h1:dqwXmax66gXvHhsOS4pGPZKqYOlTkapELkLb3MNdlH8= +github.com/alecthomas/atomic v0.1.0-alpha2/go.mod h1:zD6QGEyw49HIq19caJDc2NMXAy8rNi9ROrxtMXATfyI= +github.com/alecthomas/repr v0.0.0-20210801044451-80ca428c5142 h1:8Uy0oSf5co/NZXje7U1z8Mpep++QJOldL2hs/sBQf48= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -145,10 +164,65 @@ github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5 h1:iW0a5 github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5/go.mod h1:Y2QMoi1vgtOIfc+6DhrMOGkLoGzqSV2rKp4Sm+opsyA= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/anacrolix/chansync v0.3.0 h1:lRu9tbeuw3wl+PhMu/r+JJCRu5ArFXIluOgdF0ao6/U= +github.com/anacrolix/chansync v0.3.0/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k= +github.com/anacrolix/dht/v2 v2.19.0 h1:A9oMHWRGbLmCyx1JlYzg79bDrur8V60+0ts8ZwEVYt4= +github.com/anacrolix/dht/v2 v2.19.0/go.mod h1:0h83KnnAQ2AUYhpQ/CkoZP45K41pjDAlPR9zGHgFjQE= +github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c= +github.com/anacrolix/envpprof v1.0.0/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c= +github.com/anacrolix/envpprof v1.1.0/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4= +github.com/anacrolix/envpprof v1.2.1 h1:25TJe6t/i0AfzzldiGFKCpD+s+dk8lONBcacJZB2rdE= +github.com/anacrolix/envpprof v1.2.1/go.mod h1:My7T5oSqVfEn4MD4Meczkw/f5lSIndGAKu/0SM/rkf4= +github.com/anacrolix/generics v0.0.0-20220618083756-f99e35403a60 h1:k4/h2B1gGF+PJGyGHxs8nmHHt1pzWXZWBj6jn4OBlRc= +github.com/anacrolix/generics v0.0.0-20220618083756-f99e35403a60/go.mod h1:ff2rHB/joTV03aMSSn/AZNnaIpUw0h3njetGsaXcMy8= +github.com/anacrolix/go-libutp v1.2.0 h1:sjxoB+/ARiKUR7IK/6wLWyADIBqGmu1fm0xo+8Yy7u0= +github.com/anacrolix/go-libutp v1.2.0/go.mod h1:RrJ3KcaDcf9Jqp33YL5V/5CBEc6xMc7aJL8wXfuWL50= +github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= +github.com/anacrolix/log v0.6.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= +github.com/anacrolix/log v0.10.0/go.mod h1:s5yBP/j046fm9odtUTbHOfDUq/zh1W8OkPpJtnX0oQI= +github.com/anacrolix/log v0.10.1-0.20220123034749-3920702c17f8/go.mod h1:GmnE2c0nvz8pOIPUSC9Rawgefy1sDXqposC2wgtBZE4= +github.com/anacrolix/log v0.13.2-0.20220711050817-613cb738ef30 h1:bAgFzUxN1K3U8KwOzqCOhiygOr5NqYO3kNlV9tvp2Rc= +github.com/anacrolix/log v0.13.2-0.20220711050817-613cb738ef30/go.mod h1:D4+CvN8SnruK6zIFS/xPoRJmtvtnxs+CSfDQ+BFxZ68= +github.com/anacrolix/lsan v0.0.0-20211126052245-807000409a62 h1:P04VG6Td13FHMgS5ZBcJX23NPC/fiC4cp9bXwYujdYM= +github.com/anacrolix/lsan v0.0.0-20211126052245-807000409a62/go.mod h1:66cFKPCO7Sl4vbFnAaSq7e4OXtdMhRSBagJGWgmpJbM= +github.com/anacrolix/missinggo v0.0.0-20180725070939-60ef2fbf63df/go.mod h1:kwGiTUTZ0+p4vAz3VbAI5a30t2YbvemcmspjKwrAz5s= +github.com/anacrolix/missinggo v1.1.0/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo= +github.com/anacrolix/missinggo v1.1.2-0.20190815015349-b888af804467/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo= +github.com/anacrolix/missinggo v1.2.1/go.mod h1:J5cMhif8jPmFoC3+Uvob3OXXNIhOUikzMt+uUjeM21Y= +github.com/anacrolix/missinggo v1.3.0 h1:06HlMsudotL7BAELRZs0yDZ4yVXsHXGi323QBjAVASw= +github.com/anacrolix/missinggo v1.3.0/go.mod h1:bqHm8cE8xr+15uVfMG3BFui/TxyB6//H5fwlq/TeqMc= +github.com/anacrolix/missinggo/perf v1.0.0 h1:7ZOGYziGEBytW49+KmYGTaNfnwUqP1HBsy6BqESAJVw= +github.com/anacrolix/missinggo/perf v1.0.0/go.mod h1:ljAFWkBuzkO12MQclXzZrosP5urunoLS0Cbvb4V0uMQ= +github.com/anacrolix/missinggo/v2 v2.2.0/go.mod h1:o0jgJoYOyaoYQ4E2ZMISVa9c88BbUBVQQW4QeRkNCGY= +github.com/anacrolix/missinggo/v2 v2.5.1/go.mod h1:WEjqh2rmKECd0t1VhQkLGTdIWXO6f6NLjp5GlMZ+6FA= +github.com/anacrolix/missinggo/v2 v2.5.2/go.mod h1:yNvsLrtZYRYCOI+KRH/JM8TodHjtIE/bjOGhQaLOWIE= +github.com/anacrolix/missinggo/v2 v2.7.0 h1:4fzOAAn/VCvfWGviLmh64MPMttrlYew81JdPO7nSHvI= +github.com/anacrolix/missinggo/v2 v2.7.0/go.mod h1:2IZIvmRTizALNYFYXsPR7ofXPzJgyBpKZ4kMqMEICkI= +github.com/anacrolix/mmsg v0.0.0-20180515031531-a4a3ba1fc8bb/go.mod h1:x2/ErsYUmT77kezS63+wzZp8E3byYB0gzirM/WMBLfw= +github.com/anacrolix/mmsg v1.0.0 h1:btC7YLjOn29aTUAExJiVUhQOuf/8rhm+/nWCMAnL3Hg= +github.com/anacrolix/mmsg v1.0.0/go.mod h1:x8kRaJY/dCrY9Al0PEcj1mb/uFHwP6GCJ9fLl4thEPc= +github.com/anacrolix/multiless v0.3.0 h1:5Bu0DZncjE4e06b9r1Ap2tUY4Au0NToBP5RpuEngSis= +github.com/anacrolix/multiless v0.3.0/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4= +github.com/anacrolix/stm v0.2.0/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg= +github.com/anacrolix/stm v0.4.0 h1:tOGvuFwaBjeu1u9X1eIh9TX8OEedEiEQ1se1FjhFnXY= +github.com/anacrolix/stm v0.4.0/go.mod h1:GCkwqWoAsP7RfLW+jw+Z0ovrt2OO7wRzcTtFYMYY5t8= +github.com/anacrolix/sync v0.0.0-20180808010631-44578de4e778/go.mod h1:s735Etp3joe/voe2sdaXLcqDdJSay1O0OPnM0ystjqk= +github.com/anacrolix/sync v0.3.0/go.mod h1:BbecHL6jDSExojhNtgTFSBcdGerzNc64tz3DCOj/I0g= +github.com/anacrolix/sync v0.4.0 h1:T+MdO/u87ir/ijWsTFsPYw5jVm0SMm4kVpg8t4KF38o= +github.com/anacrolix/sync v0.4.0/go.mod h1:BbecHL6jDSExojhNtgTFSBcdGerzNc64tz3DCOj/I0g= +github.com/anacrolix/tagflag v0.0.0-20180109131632-2146c8d41bf0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw= +github.com/anacrolix/tagflag v1.0.0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw= +github.com/anacrolix/tagflag v1.1.0/go.mod h1:Scxs9CV10NQatSmbyjqmqmeQNwGzlNe0CMUMIxqHIG8= +github.com/anacrolix/torrent v1.47.0 h1:aDUnhQZ8+kfStLICHiXOGGYVFgDENK+kz4q96linyRg= +github.com/anacrolix/torrent v1.47.0/go.mod h1:SYPxEUjMwqhDr3kWGzyQLkFMuAb1bgJ57JRMpuD3ZzE= +github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 h1:QAVZ3pN/J4/UziniAhJR2OZ9Ox5kOY2053tBbbqUPYA= +github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96/go.mod h1:Wa6n8cYIdaG35x15aH3Zy6d03f7P728QfdcDeD/IEOs= +github.com/anacrolix/utp v0.1.0 h1:FOpQOmIwYsnENnz7tAGohA+r6iXpRjrq8ssKSre2Cp4= +github.com/anacrolix/utp v0.1.0/go.mod h1:MDwc+vsGEq7RMw6lr2GKOEqjWny5hO5OZXRVNaBJ2Dk= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andybalholm/brotli v0.0.0-20190621154722-5f990b63d2d6 h1:bZ28Hqta7TFAK3Q08CMvv8y3/8ATaEqv2nGoc6yff6c= github.com/andybalholm/brotli v0.0.0-20190621154722-5f990b63d2d6/go.mod h1:+lx6/Aqd1kLJ1GQfkvOnaZ1WGmLpMpbprPuIOOZX30U= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -172,22 +246,33 @@ github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7 github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/benbjohnson/clock v1.0.2/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/immutable v0.2.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI= +github.com/benbjohnson/immutable v0.3.0 h1:TVRhuZx2wG9SZ0LRdqlbs9S5BZ6Y24hJEHTCgWHZEIw= +github.com/benbjohnson/immutable v0.3.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.2.2 h1:J5gbX05GpMdBjCvQ9MteIg2KKDExr7DrgK+Yc15FvIk= +github.com/bits-and-blooms/bitset v1.2.2/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bittorrent/go-btfs-cmds v0.2.14 h1:0cy2Jh4/bEw6Kf5FEgpo7umpnOC86BjRnTctHDCnQ5c= github.com/bittorrent/go-btfs-cmds v0.2.14/go.mod h1:wfgWxf016bZPTztF9BeEKSkvEhcjC1MbufhXFnoetSU= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo= +github.com/bradfitz/iter v0.0.0-20190303215204-33e6a9893b0c/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo= +github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaqKnf+7Qs6GbEPfd4iMOitWzXJx8= +github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8/go.mod h1:spo1JLcs67NmW1aVLEgtA8Yy1elc+X8y5SRW1sFW4Og= github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d h1:QgeLLoPD3kRVmeu/1al9iIpIANMi9O1zXFm8BnYGCJg= github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d/go.mod h1:Jbj8eKecMNwf0KFI75skSUZqMB4UCRcndUScVBTWyUI= github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= @@ -210,22 +295,20 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs= -github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -239,6 +322,12 @@ github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e h1:0XBUw73chJ1VYSsfvcP github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:P13beTBKr5Q18lJe1rIoLUqjM+CB1zYrRg44ZqGuQSA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/codemodus/kace v0.5.1 h1:4OCsBlE2c/rSJo375ggfnucv9eRzge/U5LrrOZd47HA= @@ -252,8 +341,6 @@ github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelY github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d h1:t5Wuyh53qYyg9eqn4BbnlIT+vmhyww0TatL+zT3uWgI= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.1.0 h1:kq/SbG2BCKLkDKkjQf5OWwKWUKj1lgs3lFI4PxnR5lg= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= @@ -263,6 +350,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= @@ -297,6 +385,7 @@ github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= @@ -305,8 +394,9 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ= +github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elgris/jsondiff v0.0.0-20160530203242-765b5c24c302 h1:QV0ZrfBLpFc2KDk+a4LJefDczXnonRwrYrQJY/9L4dA= @@ -317,6 +407,9 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.24/go.mod h1:JIfVb6esrqALTExdz9hRYvrP0xBDf6wCncIu1hNwHpM= github.com/ethereum/go-ethereum v1.10.3 h1:SEYOYARvbWnoDl1hOSks3ZJQpRiiRJe8ubaQGJQwq0s= @@ -333,7 +426,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= @@ -341,26 +433,29 @@ github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/ github.com/fomichev/secp256k1 v0.0.0-20180413221153-00116ff8c62f h1:YbIfHI+s+tauzUAdNw+lF8a9o056PoIPaLGodgh5D7g= github.com/fomichev/secp256k1 v0.0.0-20180413221153-00116ff8c62f/go.mod h1:X4BmRxczPduAy11nSLYwnR11VuvnbG7ozOTDKLHhx70= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= -github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.9.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/gabriel-vasile/mimetype v1.1.2 h1:gaPnPcNor5aZSVCJVSGipcpbgMWiAAj9z182ocSGbHU= github.com/gabriel-vasile/mimetype v1.1.2/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20180728074245-46e3a41ad493/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/glycerine/goconvey v0.0.0-20190315024820-982ee783a72e/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-bindata/go-bindata/v3 v3.1.3 h1:F0nVttLC3ws0ojc7p60veTurcOm//D4QBODNM7EGrCI= github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -369,12 +464,19 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= @@ -418,6 +520,7 @@ github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobuffalo/here v0.6.0 h1:hYrd0a6gDmWxBM4TnrGw8mQg24iSVoIkHEk7FodQcBI= github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -437,17 +540,15 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -456,6 +557,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -472,8 +574,11 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 h1:ur2rms48b3Ep1dxh7aUV2FZEQ8jEVO2F6ILKx8ofkAg= github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -484,10 +589,10 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -497,36 +602,41 @@ github.com/google/gopacket v1.1.18/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8v github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190309154008-847fc94819f9/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw= +github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -536,8 +646,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 h1:FlFbCRLd5Jr4iYXZufAvgWN6A github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1/go.mod h1:jvfsLIxk0fY/2BKSQ1xf2406AKA5dwMmKKv0ADcOfN8= @@ -571,11 +681,18 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.1.1 h1:4JywC80b+/hSfljFlEBLHrrh+CIONLDz9NuFl0af4Mw= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= +github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= +github.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 h1:bcAj8KroPf552TScjFPIakjH2/tdIrIH8F+cc4v4SRo= @@ -599,7 +716,6 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/ip2location/ip2location-go v8.2.0+incompatible h1:JPZVNMZgrxpA1JchRUBSBDBaGVtWU/dDoZgyjBLf3cg= github.com/ip2location/ip2location-go v8.2.0+incompatible/go.mod h1:3JUY1TBjTx1GdA7oRT7Zeqfc0bg3lMMuU5lXmzdpuME= github.com/ip2location/ip2location-go/v9 v9.0.0 h1:7Yc2txYtbnwIUSP+YIUPO1lEgcPchx0jKohBbvbJuHw= github.com/ip2location/ip2location-go/v9 v9.0.0/go.mod h1:s5SV6YZL10TpfPpXw//7fEJC65G/yH7Oh+Tjq9JcQEQ= @@ -709,8 +825,9 @@ github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBW github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM= -github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= +github.com/ipfs/go-log/v2 v2.5.0 h1:+MhAooFd9XZNvR0i9FriKW6HB0ql7HNXUuflWtc0dd4= +github.com/ipfs/go-log/v2 v2.5.0/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKys/4GQQfto= github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk= github.com/ipfs/go-merkledag v0.3.0/go.mod h1:4pymaZLhSLNVuiCITYrpViD6vmfZ/Ws4n/L9tfNv3S4= @@ -750,7 +867,6 @@ github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZl github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= @@ -767,8 +883,9 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= @@ -790,8 +907,9 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.2 h1:LfVyl+ZlLlLDeQ/d2AqfGIIH4qEDu0Ed2S5GyhCWIWY= github.com/klauspost/compress v1.9.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -807,20 +925,20 @@ github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ github.com/klauspost/reedsolomon v1.9.9 h1:qCL7LZlv17xMixl55nq2/Oa1Y86nfO8EqDfv2GHND54= github.com/klauspost/reedsolomon v1.9.9/go.mod h1:O7yFFHiQwDR6b2t63KPUpccPtNdp5ADgh1gg4fd12wo= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -908,8 +1026,6 @@ github.com/libp2p/go-libp2p-pubsub v0.3.5 h1:iF75GWpcxKEUQU8tTkgLy69qIQvfhL+t6U6 github.com/libp2p/go-libp2p-pubsub v0.3.5/go.mod h1:DTMSVmZZfXodB/pvdTGrY2eHPZ9W2ev7hzTH83OKHrI= github.com/libp2p/go-libp2p-pubsub-router v0.3.2 h1:BGC4irCUXlwmlCSxnA2DVDNY8JqhfAUUaiq3CZvcddw= github.com/libp2p/go-libp2p-pubsub-router v0.3.2/go.mod h1:G4MAvYzPxhoR0LEBluS9Ow+Nnr/8iDalUN+RNwVgNkY= -github.com/libp2p/go-libp2p-quic-transport v0.8.0 h1:mHA94K2+TD0e9XtjWx/P5jGGZn0GdQ4OFYwNllagv4E= -github.com/libp2p/go-libp2p-quic-transport v0.8.0/go.mod h1:F2FG/6Bzz0U6essUVxDzE0s9CrY4XGLbl7QEmDNvU7A= github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q= github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q= github.com/libp2p/go-libp2p-record v0.1.1/go.mod h1:VRgKajOyMVgP/F0L5g3kH7SVskp17vFi2xheb5uMJtg= @@ -930,8 +1046,9 @@ github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MB github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= github.com/libp2p/go-libp2p-testing v0.2.0/go.mod h1:Qy8sAncLKpwXtS2dSnDOP8ktexIAHKu+J+pnZOFZLTc= -github.com/libp2p/go-libp2p-testing v0.4.0 h1:PrwHRi0IGqOwVQWR3xzgigSlhlLfxgfXgkHxr77EghQ= github.com/libp2p/go-libp2p-testing v0.4.0/go.mod h1:Q+PFXYoiYFN5CAEG2w3gLPEzotlKsNSbKQ/lImlOWF0= +github.com/libp2p/go-libp2p-testing v0.9.0 h1:NnqhCnKispyyodubaZY0TYRh3Nz2DMBjmeKJJuPoos8= +github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-tls v0.1.3 h1:twKMhMu44jQO+HgQK9X8NHO5HkeJu2QbhLzLJpa8oNM= github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40sKitV4c50uI1M= github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns= @@ -952,8 +1069,9 @@ github.com/libp2p/go-nat v0.0.5 h1:qxnwkco8RLKqVh1NmjQ+tJ8p8khNLFxuElYG/TwqW4Q= github.com/libp2p/go-nat v0.0.5/go.mod h1:B7NxsVNPZmRLvMOwiEO1scOSyjA56zxYAGv1yQgRkEU= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= github.com/libp2p/go-netroute v0.1.3/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-netroute v0.1.5 h1:Qj8GE/6Cxmw9aQUYTA9BrS+TELTqU7kKKspWBR4ieVw= github.com/libp2p/go-netroute v0.1.5/go.mod h1:V1SR3AaECRkEQCoFFzYwVYWvYIEtlxx89+O3qcpCl4A= +github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE= +github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= github.com/libp2p/go-openssl v0.0.7 h1:eCAzdLejcNVBzP/iZM9vqHnQm+XyCEbSSIheIPRGNsw= github.com/libp2p/go-openssl v0.0.7/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= @@ -963,7 +1081,6 @@ github.com/libp2p/go-reuseport-transport v0.0.3/go.mod h1:Spv+MPft1exxARzP2Sruj2 github.com/libp2p/go-reuseport-transport v0.0.4 h1:OZGz0RB620QDGpv300n1zaOcKGGAoGVf8h9txtt/1uM= github.com/libp2p/go-reuseport-transport v0.0.4/go.mod h1:trPa7r/7TJK/d+0hdBLOCGvpQQVOU74OXbNCIMkufGw= github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-sockaddr v0.1.0 h1:Y4s3/jNoryVRKEBrkJ576F17CPOaMIzUeCsg7dlTDj0= github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= github.com/libp2p/go-socket-activation v0.0.2 h1:VLU3IbrUUqu4DMhxA9857Q63qUpEAbCz5RqSnLCx5jE= github.com/libp2p/go-socket-activation v0.0.2/go.mod h1:KP44C+yZ7gA8sTxavgaD0b8vXVFJwam2CEW0s7+f094= @@ -986,27 +1103,17 @@ github.com/libp2p/go-yamux v1.3.7 h1:v40A1eSPJDIZwz2AvrV3cxpTZEGDP11QJbukmEhYyQI github.com/libp2p/go-yamux v1.3.7/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lispad/go-generics-tools v1.1.0 h1:mbSgcxdFVmpoyso1X/MJHXbSbSL3dD+qhRryyxk+/XY= +github.com/lispad/go-generics-tools v1.1.0/go.mod h1:2csd1EJljo/gy5qG4khXol7ivCPptNjG5Uv2X8MgK84= github.com/looplab/fsm v0.1.0 h1:Qte7Zdn/5hBNbXzP7yxVU4OIFHWXBovyTT2LaBTyC20= github.com/looplab/fsm v0.1.0/go.mod h1:m2VaOfDHxqXBBMgc26m6yUOwkFn8H2AlJDE+jd/uafI= -github.com/lucas-clemente/quic-go v0.18.0/go.mod h1:yXttHsSNxQi8AWijC/vLP+OJczXqzHSOcJrM5ITUlCg= -github.com/lucas-clemente/quic-go v0.19.3 h1:eCDQqvGBB+kCTkA0XrAFtNe81FMa0/fn4QSoeAbmiF4= -github.com/lucas-clemente/quic-go v0.19.3/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/markbates/pkger v0.17.0 h1:RFfyBPufP2V6cddUyyEVSHBpaAnM1WzaMNyqomeT+iY= github.com/markbates/pkger v0.17.0/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= -github.com/marten-seemann/qpack v0.2.0/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qtls v0.10.0 h1:ECsuYUKalRL240rRD4Ri33ISb7kAQ3qGDlrrl55b2pc= -github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs= -github.com/marten-seemann/qtls-go1-15 v0.1.0/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-15 v0.1.1 h1:LIH6K34bPVttyXnUWixk0bzH6/N07VxbSabxn5A5gZQ= -github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -1020,8 +1127,9 @@ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -1035,7 +1143,6 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1f github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mholt/archiver/v3 v3.3.0 h1:vWjhY8SQp5yzM9P6OJ/eZEkmi3UAbRrxCq48MxjAzig= github.com/mholt/archiver/v3 v3.3.0/go.mod h1:YnQtqsp+94Rwd0D/rk5cnLrxusUBUXg+08Ebtr1Mqao= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo= github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= @@ -1070,14 +1177,17 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= +github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= +github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= @@ -1130,12 +1240,11 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs= github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -1152,8 +1261,10 @@ github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -1161,8 +1272,9 @@ github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= @@ -1172,7 +1284,6 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= @@ -1195,6 +1306,46 @@ github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pion/datachannel v1.5.2 h1:piB93s8LGmbECrpO84DnkIVWasRMk3IimbcXkTQLE6E= +github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ= +github.com/pion/dtls/v2 v2.1.3/go.mod h1:o6+WvyLDAlXF7YiPB/RlskRoeK+/JtuaZa5emwQcWus= +github.com/pion/dtls/v2 v2.1.5 h1:jlh2vtIyUBShchoTDqpCCqiYCyRFJ/lvf/gQ8TALs+c= +github.com/pion/dtls/v2 v2.1.5/go.mod h1:BqCE7xPZbPSubGasRoDFJeTsyJtdD1FanJYL0JGheqY= +github.com/pion/ice/v2 v2.2.6 h1:R/vaLlI1J2gCx141L5PEwtuGAGcyS6e7E0hDeJFq5Ig= +github.com/pion/ice/v2 v2.2.6/go.mod h1:SWuHiOGP17lGromHTFadUe1EuPgFh/oCU6FCMZHooVE= +github.com/pion/interceptor v0.1.11 h1:00U6OlqxA3FFB50HSg25J/8cWi7P6FbSzw4eFn24Bvs= +github.com/pion/interceptor v0.1.11/go.mod h1:tbtKjZY14awXd7Bq0mmWvgtHB5MDaRN7HV3OZ/uy7s8= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.5 h1:Q2oj/JB3NqfzY9xGZ1fPzZzK7sDSD8rZPOvcIQ10BCw= +github.com/pion/mdns v0.0.5/go.mod h1:UgssrvdD3mxpi8tMxAXbsppL3vJ4Jipw1mTCW+al01g= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.9 h1:1ujStwg++IOLIEoOiIQ2s+qBuJ1VN81KW+9pMPsif+U= +github.com/pion/rtcp v1.2.9/go.mod h1:qVPhiCzAm4D/rxb6XzKeyZiQK69yJpbUDJSF7TgrqNo= +github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= +github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= +github.com/pion/sctp v1.8.0/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s= +github.com/pion/sctp v1.8.2 h1:yBBCIrUMJ4yFICL3RIvR4eh/H2BTTvlligmSTy+3kiA= +github.com/pion/sctp v1.8.2/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s= +github.com/pion/sdp/v3 v3.0.5 h1:ouvI7IgGl+V4CrqskVtr3AaTrPvPisEOxwgpdktctkU= +github.com/pion/sdp/v3 v3.0.5/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= +github.com/pion/srtp/v2 v2.0.9 h1:JJq3jClmDFBPX/F5roEb0U19jSU7eUhyDqR/NZ34EKQ= +github.com/pion/srtp/v2 v2.0.9/go.mod h1:5TtM9yw6lsH0ppNCehB/EjEUli7VkUgKSPJqWVqbhQ4= +github.com/pion/stun v0.3.5 h1:uLUCBCkQby4S1cf6CGuR9QrVOKcvUwFeemaC865QHDg= +github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA= +github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= +github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A= +github.com/pion/transport v0.13.0/go.mod h1:yxm9uXpK9bpBBWkITk13cLo1y5/ur5VQpG22ny6EP7g= +github.com/pion/transport v0.13.1 h1:/UH5yLeQtwm2VZIPjxwnNFxjS4DFhyLfS4GlfuKUzfA= +github.com/pion/transport v0.13.1/go.mod h1:EBxbqzyv+ZrmDb82XswEE0BjfQFtuw1Nu6sjnjWCsGg= +github.com/pion/turn/v2 v2.0.8 h1:KEstL92OUN3k5k8qxsXHpr7WWfrdp7iJZHx99ud8muw= +github.com/pion/turn/v2 v2.0.8/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw= +github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o= +github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M= +github.com/pion/webrtc/v3 v3.1.42 h1:wJEQFIXVanptnQcHOLTuIo4AtGB2+mG2x4OhIhnITOA= +github.com/pion/webrtc/v3 v3.1.42/go.mod h1:ffD9DulDrPxyWvDPUIPAOSAWx9GUlOExiJPf7cCcMLA= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1210,17 +1361,19 @@ github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXx github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr2us7vdy04YWz3LVAirzP7reh8+M= github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= github.com/prometheus/client_golang v1.10.0/go.mod h1:WJM3cc3yu7XKBKa/I8WeZm+V3eltZnBwfENSU7mdogU= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1228,28 +1381,31 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.18.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.35.0 h1:Eyr+Pw2VymWejHqCugNaQXkAi6KayVNxaHeu6khmFBE= +github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= @@ -1258,16 +1414,25 @@ github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1 github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 h1:Lt9DzQALzHoDwMBGJ6v8ObDPR0dzr2a6sXTB1Fq7IHs= +github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417/go.mod h1:qe5TWALJ8/a1Lqznoc5BDHpYX/8HU60Hm2AwRmqzxqA= github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8= +github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5PCi+MFsC7HjREoAz1BU+Mq60+05gifQSsHSDG/8= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/encoding v0.1.10/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw= github.com/segmentio/encoding v0.1.11/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw= @@ -1281,45 +1446,23 @@ github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1 github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil/v3 v3.20.12 h1:abpcjSQRHdb3thCge/UyJty9CnvvmUHljTSrjtFU+Og= github.com/shirou/gopsutil/v3 v3.20.12/go.mod h1:igHnfak0qnw1biGeI2qKQvu0ZkwvEkUcCLlYhZzdr/4= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v0.0.0-20190215210624-980c5ac6f3ac/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= +github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= +github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= @@ -1348,25 +1491,32 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e h1:T5PdfK/M1xyrHwynxMIVMWLS7f/qHwfslZphxtGnw7s= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g= github.com/thedevsaddam/gojsonq/v2 v2.5.2 h1:CoMVaYyKFsVj6TjU6APqAhAvC07hTI6IQen8PHzHYY0= github.com/thedevsaddam/gojsonq/v2 v2.5.2/go.mod h1:bv6Xa7kWy82uT0LnXPE2SzGqTj33TAEeR560MdJkiXs= +github.com/tidwall/btree v1.3.1 h1:636+tdVDs8Hjcf35Di260W2xCW4KuoXOKyk9QWOvCpA= +github.com/tidwall/btree v1.3.1/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYmsObdKE= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= @@ -1397,8 +1547,6 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.0.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= -github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk= github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94= github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ= @@ -1436,18 +1584,23 @@ github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c/go.mod h1: github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow= github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -1456,6 +1609,11 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/otel v1.8.0 h1:zcvBFizPbpa1q7FehvFiHbQwGzmPILebO0tyqIR5Djg= +go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM= +go.opentelemetry.io/otel/trace v1.8.0 h1:cSy0DF9eGI5WIfNwZ1q2iUyGj00tGzP24dE1lOlHrfY= +go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1468,8 +1626,8 @@ go.uber.org/fx v1.13.1 h1:CFNTr1oin5OJ0VCZ8EycL3wzF29Jz2g0xe55RFsf2a4= go.uber.org/fx v1.13.1/go.mod h1:bREWhavnedxpJeTq9pQT53BbvwhUv7TcpsOqcH4a+3w= go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= @@ -1483,24 +1641,20 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= -go.uber.org/zap v1.18.1 h1:CSUJ2mjFszzEWt4CdKISEuChVIXGBn3lAPwkRGyVrc4= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go4.org v0.0.0-20200411211856-f5505b9728dd h1:BNJlw5kRTzdmyfh5U8F93HA2OwkP7ZGwA51eJ/0wKOU= go4.org v0.0.0-20200411211856-f5505b9728dd/go.mod h1:CIiUVy99QCPfoE13bO4EZaz5GZMZXMSBGhxRdsvzbkg= golang.org/x/arch v0.0.0-20190909030613-46d78d1859ac/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1525,8 +1679,11 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220516162934-403b01795ae8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1542,10 +1699,11 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d h1:vtUKgx8dahOomfFzLREU8nSv25YHnTgLBn4rDnWZdU0= +golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1567,17 +1725,17 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1586,7 +1744,6 @@ golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -1596,6 +1753,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1611,27 +1769,42 @@ golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220630215102-69896b714898 h1:K7wO6V1IrczY9QOQ2WkVpw4JQSwCd52UsxVEirZUfiw= +golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1642,15 +1815,15 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1662,7 +1835,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1699,34 +1871,53 @@ golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201024232916-9f70ab9862d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210317225723-c4fcb01b228e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220702020025-31831981b65f h1:xdsejrW/0Wf2diT5CPp3XmKUNbr7Xvw8kYilQ+6qjRY= +golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1734,21 +1925,23 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220609170525-579cf78fd858 h1:Dpdu/EMxGMFgq0CeYMh4fazTD2vtlZRYE7wyynxJb9U= +golang.org/x/time v0.0.0-20220609170525-579cf78fd858/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1790,27 +1983,38 @@ golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200827010519-17fd2f27a9e3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1821,10 +2025,15 @@ google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsb google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -1833,9 +2042,6 @@ google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuh google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1855,12 +2061,22 @@ google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1874,10 +2090,17 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.34.0 h1:raiipEjMOIC/TO2AvyTxP25XFdLxNIBwzDh3FM3XztI= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1886,11 +2109,13 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1927,11 +2152,11 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1939,6 +2164,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA= @@ -1973,5 +2199,3 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/guide/pkged.go b/guide/pkged.go index 1df6c0709..ec9a57074 100644 --- a/guide/pkged.go +++ b/guide/pkged.go @@ -1,5 +1,6 @@ // Code generated by pkger; DO NOT EDIT. +//go:build !skippkger // +build !skippkger package guide diff --git a/plugin/loader/load_nocgo.go b/plugin/loader/load_nocgo.go index c8a0d7f93..ed178d2ea 100644 --- a/plugin/loader/load_nocgo.go +++ b/plugin/loader/load_nocgo.go @@ -1,4 +1,6 @@ -// +build !cgo,!noplugin +//go:build !cgo && !noplugin && (linux || darwin) +// +build !cgo +// +build !noplugin // +build linux darwin package loader diff --git a/plugin/loader/load_noplugin.go b/plugin/loader/load_noplugin.go index 068426526..b3913b9e2 100644 --- a/plugin/loader/load_noplugin.go +++ b/plugin/loader/load_noplugin.go @@ -1,3 +1,4 @@ +//go:build noplugin // +build noplugin package loader diff --git a/plugin/loader/load_unix.go b/plugin/loader/load_unix.go index f86254048..316f369ba 100644 --- a/plugin/loader/load_unix.go +++ b/plugin/loader/load_unix.go @@ -1,4 +1,6 @@ -// +build cgo,!noplugin +//go:build cgo && !noplugin && (linux || darwin) +// +build cgo +// +build !noplugin // +build linux darwin package loader diff --git a/settlement/interface.go b/settlement/interface.go index 34e41d987..7fd1daf7b 100644 --- a/settlement/interface.go +++ b/settlement/interface.go @@ -2,6 +2,7 @@ package settlement import ( "errors" + "github.com/ethereum/go-ethereum/common" "math/big" ) @@ -22,7 +23,7 @@ type Interface interface { } type Accounting interface { - Settle(peer string, amount *big.Int, contractId string) error - NotifyPaymentReceived(peer string, amount *big.Int) error - NotifyPaymentSent(peer string, amount *big.Int, receivedError error) + Settle(peer string, amount *big.Int, contractId string, token common.Address) error + NotifyPaymentReceived(peer string, amount *big.Int, token common.Address) error + NotifyPaymentSent(peer string, amount *big.Int, receivedError error, token common.Address) } diff --git a/settlement/swap/bttc/bttc.go b/settlement/swap/bttc/bttc.go index 71a611d45..da20e1d6c 100644 --- a/settlement/swap/bttc/bttc.go +++ b/settlement/swap/bttc/bttc.go @@ -28,17 +28,21 @@ type Service interface { SendBttTo(ctx context.Context, to common.Address, amount *big.Int) (trx common.Hash, err error) // SendWbttTo transfers `amount` of WBTT to the given address `to` SendWbttTo(ctx context.Context, to common.Address, amount *big.Int) (trx common.Hash, err error) + // SendTokenTo transfers `amount` of WBTT to the given address `to` + SendTokenTo(ctx context.Context, to common.Address, amount *big.Int, tokenStr string) (trx common.Hash, err error) } type service struct { - trxService transaction.Service - erc20Service erc20.Service + trxService transaction.Service + erc20Service erc20.Service + mpErc20Service map[string]erc20.Service } -func New(trxSvc transaction.Service, erc20Svc erc20.Service) Service { +func New(trxSvc transaction.Service, erc20Svc erc20.Service, mpErc20Service map[string]erc20.Service) Service { return &service{ - trxService: trxSvc, - erc20Service: erc20Svc, + trxService: trxSvc, + erc20Service: erc20Svc, + mpErc20Service: mpErc20Service, } } @@ -93,6 +97,24 @@ func (svc *service) SendWbttTo(ctx context.Context, to common.Address, amount *b return } +func (svc *service) SendTokenTo(ctx context.Context, to common.Address, amount *big.Int, tokenStr string) (trx common.Hash, err error) { + myAddr := svc.trxService.OverlayEthAddress(ctx) + err = validateBeforeTransfer(ctx, myAddr, to, amount) + if err != nil { + return zeroHash, err + } + balance, err := svc.mpErc20Service[tokenStr].BalanceOf(ctx, myAddr) + if err != nil { + return + } + fmt.Printf("your %s balance is %d, will transfer %d wbtt to address %s\n", tokenStr, balance, amount, to) + if balance.Cmp(amount) < 0 { + return zeroHash, ErrInsufficientWBTT + } + trx, err = svc.mpErc20Service[tokenStr].Transfer(ctx, to, amount) + return +} + func (svc *service) SendBttTo(ctx context.Context, to common.Address, amount *big.Int) (trx common.Hash, err error) { myAddr := svc.trxService.OverlayEthAddress(ctx) err = validateBeforeTransfer(ctx, myAddr, to, amount) diff --git a/settlement/swap/bttc/bttc_test.go b/settlement/swap/bttc/bttc_test.go index a526b7155..02a755315 100644 --- a/settlement/swap/bttc/bttc_test.go +++ b/settlement/swap/bttc/bttc_test.go @@ -2,6 +2,7 @@ package bttc_test import ( "context" + "github.com/bittorrent/go-btfs/settlement/swap/erc20" "math/big" "testing" @@ -28,6 +29,7 @@ func TestSwapBtt2WbttSucc(t *testing.T) { return common.HexToHash("0x123"), nil }), ), + make(map[string]erc20.Service), ) trxHash, err := bttcSvc.SwapBtt2Wbtt(context.Background(), big.NewInt(50)) @@ -48,6 +50,7 @@ func TestSwapBtt2WbttFail(t *testing.T) { return common.HexToHash("0x123"), nil }), ), + make(map[string]erc20.Service), ) trxHash, err := bttcSvc.SwapBtt2Wbtt(context.Background(), big.NewInt(101)) @@ -73,6 +76,7 @@ func TestSwapWbtt2BttSucc(t *testing.T) { return big.NewInt(100), nil }), ), + make(map[string]erc20.Service), ) trxHash, err := bttcSvc.SwapWbtt2Btt(context.Background(), big.NewInt(50)) @@ -99,6 +103,7 @@ func TestSendWbttToSucc(t *testing.T) { return common.HexToHash("0x123"), nil }), ), + make(map[string]erc20.Service), ) trxHash, err := bttcSvc.SendWbttTo(context.Background(), toAddr, big.NewInt(50)) @@ -124,6 +129,7 @@ func TestSendBttToSucc(t *testing.T) { }), ), erc20Mock.New(), + make(map[string]erc20.Service), ) trxHash, err := bttcSvc.SendBttTo(context.Background(), toAddr, big.NewInt(50)) diff --git a/settlement/swap/chequestore/mock/chequestore.go b/settlement/swap/chequestore/mock/chequestore.go index 59be45bbc..fddb4f9f7 100644 --- a/settlement/swap/chequestore/mock/chequestore.go +++ b/settlement/swap/chequestore/mock/chequestore.go @@ -107,7 +107,7 @@ func NewChequeStore(opts ...Option) vault.ChequeStore { return mock } -func (s *Service) ReceiveCheque(ctx context.Context, cheque *vault.SignedCheque, exchangeRate *big.Int) (*big.Int, error) { +func (s *Service) ReceiveCheque(ctx context.Context, cheque *vault.SignedCheque, exchangeRate *big.Int, token common.Address) (*big.Int, error) { if s.receiveCheque != nil { return s.receiveCheque(ctx, cheque, exchangeRate) } @@ -129,7 +129,7 @@ func (s *Service) LastCheques() (map[common.Address]*vault.SignedCheque, error) } // LastReceivedCheque returns the last cheque we received from a specific vault. -func (s *Service) LastReceivedCheque(vault common.Address) (*vault.SignedCheque, error) { +func (s *Service) LastReceivedCheque(vault common.Address, token common.Address) (*vault.SignedCheque, error) { if s.lastReceivedChequeFunc != nil { return s.lastReceivedChequeFunc(vault) } @@ -137,7 +137,7 @@ func (s *Service) LastReceivedCheque(vault common.Address) (*vault.SignedCheque, } // LastReceivedCheques return map[vault]cheque -func (s *Service) LastReceivedCheques() (map[common.Address]*vault.SignedCheque, error) { +func (s *Service) LastReceivedCheques(token common.Address) (map[common.Address]*vault.SignedCheque, error) { if s.lastReceivedChequesFunc != nil { return s.lastReceivedChequesFunc() } @@ -160,14 +160,14 @@ func (s *Service) ReceivedChequeRecordsAll() (map[common.Address][]vault.ChequeR return nil, errors.New("checkstoreMock.receivedChequeRecordsAllFunc not implemented") } -func (s *Service) ReceivedStatsHistory(days int) ([]vault.DailyReceivedStats, error) { +func (s *Service) ReceivedStatsHistory(days int, token common.Address) ([]vault.DailyReceivedStats, error) { if s.receivedStatsHistoryFunc != nil { return s.receivedStatsHistoryFunc(days) } return nil, errors.New("checkstoreMock.receivedStatsHistoryFunc not implemented") } -func (s *Service) SentStatsHistory(days int) ([]vault.DailySentStats, error) { +func (s *Service) SentStatsHistory(days int, token common.Address) ([]vault.DailySentStats, error) { if s.sentStatsHistoryFunc != nil { return s.sentStatsHistoryFunc(days) } @@ -175,7 +175,7 @@ func (s *Service) SentStatsHistory(days int) ([]vault.DailySentStats, error) { } // StoreSendChequeRecord store send cheque records. -func (s *Service) StoreSendChequeRecord(vault, beneficiary common.Address, amount *big.Int) error { +func (s *Service) StoreSendChequeRecord(vault, beneficiary common.Address, amount *big.Int, token common.Address) error { if s.storeSendChequeRecordFunc != nil { return s.storeSendChequeRecordFunc(vault, beneficiary, amount) } diff --git a/settlement/swap/priceoracle/priceoracle.go b/settlement/swap/priceoracle/priceoracle.go index f6a729265..31741e610 100644 --- a/settlement/swap/priceoracle/priceoracle.go +++ b/settlement/swap/priceoracle/priceoracle.go @@ -23,20 +23,21 @@ type service struct { type Service interface { // CurrentPrice CurrentRate CurrentTotalPrice get cached info from memory. - CurrentPrice() (*big.Int, error) - CurrentRate() (*big.Int, error) - CurrentTotalPrice() (*big.Int, error) + CurrentPrice(token common.Address) (*big.Int, error) + CurrentRate(token common.Address) (*big.Int, error) + CurrentTotalPrice(token common.Address) (*big.Int, error) + // CheckNewPrice retrieves latest available information from oracle - CheckNewPrice() (*big.Int, error) + CheckNewPrice(token common.Address) (*big.Int, error) } var ( - priceOracleABI = transaction.ParseABIUnchecked(conabi.OracleAbi) + priceOracleABI = transaction.ParseABIUnchecked(conabi.OracleAbi2) - curMutex sync.Mutex - curPrice = new(big.Int) - curRate = new(big.Int) - curTotalPrice = new(big.Int) + curMutex sync.Mutex + mpCurPrice = make(map[common.Address]*big.Int) + curRate = big.NewInt(0) + mpCurTotalPrice = make(map[common.Address]*big.Int) ) func New(priceOracleAddress common.Address, transactionService transaction.Service) Service { @@ -46,46 +47,48 @@ func New(priceOracleAddress common.Address, transactionService transaction.Servi } } -func (s *service) CurrentPrice() (price *big.Int, err error) { +func (s *service) CurrentPrice(token common.Address) (price *big.Int, err error) { curMutex.Lock() - price = big.NewInt(0).Set(curPrice) + price = big.NewInt(0).Set(mpCurPrice[token]) curMutex.Unlock() return price, nil } -func (s *service) CurrentRate() (rate *big.Int, err error) { +func (s *service) CurrentRate(token common.Address) (rate *big.Int, err error) { curMutex.Lock() rate = big.NewInt(0).Set(curRate) curMutex.Unlock() return rate, nil } -func (s *service) CurrentTotalPrice() (totalPrice *big.Int, err error) { +func (s *service) CurrentTotalPrice(token common.Address) (totalPrice *big.Int, err error) { curMutex.Lock() - totalPrice = big.NewInt(0).Set(curTotalPrice) + totalPrice = big.NewInt(0).Set(mpCurTotalPrice[token]) curMutex.Unlock() return totalPrice, nil } -func (s *service) CheckNewPrice() (*big.Int, error) { - price, err := s.currentPrice() +func (s *service) CheckNewPrice(token common.Address) (*big.Int, error) { + price, err := s.currentPrice(token) if err != nil { return nil, err } + //fmt.Println("currentPrice ", price) rate, err := s.currentRate() if err != nil { return nil, err } + //fmt.Println("currentRate ", rate) curMutex.Lock() defer curMutex.Unlock() - curPrice = price + mpCurPrice[token] = price curRate = rate - curTotalPrice = big.NewInt(0).Mul(price, rate) + mpCurTotalPrice[token] = big.NewInt(0).Mul(price, rate) - return big.NewInt(0).Set(curTotalPrice), nil + return big.NewInt(0).Set(mpCurTotalPrice[token]), nil } func (s *service) currentRate() (*big.Int, error) { @@ -115,11 +118,13 @@ func (s *service) currentRate() (*big.Int, error) { return nil, errDecodeABI } + //fmt.Println("currentRate, rate = ", rate) + return rate, nil } -func (s *service) currentPrice() (*big.Int, error) { - callData, err := priceOracleABI.Pack("getPrice") +func (s *service) currentPrice(token common.Address) (*big.Int, error) { + callData, err := priceOracleABI.Pack("getPrice", token) if err != nil { return nil, err } @@ -130,20 +135,19 @@ func (s *service) currentPrice() (*big.Int, error) { if err != nil { return nil, err } - results, err := priceOracleABI.Unpack("getPrice", result) if err != nil { return nil, err } - if len(results) != 1 { return nil, errDecodeABI } - price, ok := abi.ConvertType(results[0], new(big.Int)).(*big.Int) if !ok || price == nil { return nil, errDecodeABI } + //fmt.Println("currentPrice, price = ", price) + return price, nil } diff --git a/settlement/swap/swap.go b/settlement/swap/swap.go index e86c794a3..d78dad3e1 100644 --- a/settlement/swap/swap.go +++ b/settlement/swap/swap.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "sync" @@ -42,7 +43,7 @@ type Interface interface { // ReceivedChequeRecordsCount ReceivedChequeRecordsCount() (int, error) - // LastReceivedCheque returns the last received cheque for the peer + // LastSendCheque returns the last received cheque for the peer LastSendCheque(peer string) (*vault.SignedCheque, error) // LastSendCheques returns the list of last send cheques for this peer LastSendCheques() (map[string]*vault.SignedCheque, error) @@ -55,6 +56,7 @@ type Interface interface { CashCheque(ctx context.Context, peer string) (common.Hash, error) // CashoutStatus gets the status of the latest cashout transaction for the peers vault CashoutStatus(ctx context.Context, peer string) (*vault.CashoutStatus, error) + // HasCashoutAction HasCashoutAction(ctx context.Context, peer string) (bool, error) } @@ -92,7 +94,7 @@ func (s *Service) GetProtocols() swapprotocol.Interface { } // ReceiveCheque is called by the swap protocol if a cheque is received. -func (s *Service) ReceiveCheque(ctx context.Context, peer string, cheque *vault.SignedCheque, price *big.Int) (err error) { +func (s *Service) ReceiveCheque(ctx context.Context, peer string, cheque *vault.SignedCheque, price *big.Int, token common.Address) (err error) { // check this is the same vault for this peer as previously expectedVault, known, err := s.addressbook.Vault(peer) if err != nil { @@ -105,7 +107,7 @@ func (s *Service) ReceiveCheque(ctx context.Context, peer string, cheque *vault. s.lock.Lock() defer s.lock.Unlock() - receivedAmount, err := s.chequeStore.ReceiveCheque(ctx, cheque, price) + receivedAmount, err := s.chequeStore.ReceiveCheque(ctx, cheque, price, token) if err != nil { s.metrics.ChequesRejected.Inc() return fmt.Errorf("rejecting cheque: %w", err) @@ -123,36 +125,36 @@ func (s *Service) ReceiveCheque(ctx context.Context, peer string, cheque *vault. s.metrics.ChequesReceived.Inc() // total received count - totalReceivedCount, err := s.vault.TotalReceivedCount() + totalReceivedCount, err := s.vault.TotalReceivedCount(token) if err != nil { return err } totalReceivedCount = totalReceivedCount + 1 - err = s.store.Put(statestore.TotalReceivedCountKey, totalReceivedCount) + err = s.store.Put(tokencfg.AddToken(statestore.TotalReceivedCountKey, token), totalReceivedCount) if err != nil { return err } // totalReceived - totalReceived, err := s.vault.TotalReceived() + totalReceived, err := s.vault.TotalReceived(token) if err != nil { return err } totalReceived = totalReceived.Add(totalReceived, receivedAmount) - err = s.store.Put(statestore.TotalReceivedKey, totalReceived) + err = s.store.Put(tokencfg.AddToken(statestore.TotalReceivedKey, token), totalReceived) if err != nil { return err } - return s.accounting.NotifyPaymentReceived(peer, receivedAmount) + return s.accounting.NotifyPaymentReceived(peer, receivedAmount, token) } // Pay initiates a payment to the given peer -func (s *Service) Pay(ctx context.Context, peer string, amount *big.Int, contractId string) { +func (s *Service) Pay(ctx context.Context, peer string, amount *big.Int, contractId string, token common.Address) { var err error defer func() { if err != nil { - s.accounting.NotifyPaymentSent(peer, amount, err) + s.accounting.NotifyPaymentSent(peer, amount, err, token) } }() @@ -166,7 +168,7 @@ func (s *Service) Pay(ctx context.Context, peer string, amount *big.Int, contrac return } */ - balance, err := s.proto.EmitCheque(ctx, peer, amount, contractId, s.vault.Issue) + balance, err := s.proto.EmitCheque(ctx, peer, amount, contractId, token, s.vault.Issue) if err != nil { return @@ -174,7 +176,7 @@ func (s *Service) Pay(ctx context.Context, peer string, amount *big.Int, contrac bal, _ := big.NewFloat(0).SetInt(balance).Float64() s.metrics.AvailableBalance.Set(bal) - s.accounting.NotifyPaymentSent(peer, amount, nil) + s.accounting.NotifyPaymentSent(peer, amount, nil, token) amountFloat, _ := big.NewFloat(0).SetInt(amount).Float64() s.metrics.TotalSent.Add(amountFloat) s.metrics.ChequesSent.Inc() @@ -185,7 +187,7 @@ func (s *Service) SetAccounting(accounting settlement.Accounting) { } // TotalSent returns the total amount sent to a peer -func (s *Service) TotalSent(peer string) (totalSent *big.Int, err error) { +func (s *Service) TotalSent(peer string, token common.Address) (totalSent *big.Int, err error) { beneficiary, known, err := s.addressbook.Beneficiary(peer) if err != nil { return nil, err @@ -193,7 +195,7 @@ func (s *Service) TotalSent(peer string) (totalSent *big.Int, err error) { if !known { return nil, settlement.ErrPeerNoSettlements } - cheque, err := s.vault.LastCheque(beneficiary) + cheque, err := s.vault.LastCheque(beneficiary, token) if err != nil { if err == vault.ErrNoCheque { return nil, settlement.ErrPeerNoSettlements @@ -204,7 +206,7 @@ func (s *Service) TotalSent(peer string) (totalSent *big.Int, err error) { } // TotalReceived returns the total amount received from a peer -func (s *Service) TotalReceived(peer string) (totalReceived *big.Int, err error) { +func (s *Service) TotalReceived(peer string, token common.Address) (totalReceived *big.Int, err error) { vaultAddress, known, err := s.addressbook.Vault(peer) if err != nil { return nil, err @@ -213,7 +215,7 @@ func (s *Service) TotalReceived(peer string) (totalReceived *big.Int, err error) return nil, settlement.ErrPeerNoSettlements } - cheque, err := s.chequeStore.LastReceivedCheque(vaultAddress) + cheque, err := s.chequeStore.LastReceivedCheque(vaultAddress, token) if err != nil { if err == vault.ErrNoCheque { return nil, settlement.ErrPeerNoSettlements @@ -224,9 +226,9 @@ func (s *Service) TotalReceived(peer string) (totalReceived *big.Int, err error) } // SettlementsSent returns sent settlements for each individual known peer -func (s *Service) SettlementsSent() (map[string]*big.Int, error) { +func (s *Service) SettlementsSent(token common.Address) (map[string]*big.Int, error) { result := make(map[string]*big.Int) - cheques, err := s.vault.LastCheques() + cheques, err := s.vault.LastCheques(token) if err != nil { return nil, err } @@ -246,9 +248,9 @@ func (s *Service) SettlementsSent() (map[string]*big.Int, error) { } // SettlementsReceived returns received settlements for each individual known peer. -func (s *Service) SettlementsReceived() (map[string]*big.Int, error) { +func (s *Service) SettlementsReceived(token common.Address) (map[string]*big.Int, error) { result := make(map[string]*big.Int) - cheques, err := s.chequeStore.LastReceivedCheques() + cheques, err := s.chequeStore.LastReceivedCheques(token) if err != nil { return nil, err } @@ -297,7 +299,7 @@ func (s *Service) SettlementsReceived() (map[string]*big.Int, error) { //} // LastReceivedCheque returns the last received cheque for the peer -func (s *Service) LastReceivedCheque(peer string) (*vault.SignedCheque, error) { +func (s *Service) LastReceivedCheque(peer string, token common.Address) (*vault.SignedCheque, error) { common, known, err := s.addressbook.Vault(peer) @@ -309,12 +311,12 @@ func (s *Service) LastReceivedCheque(peer string) (*vault.SignedCheque, error) { return nil, vault.ErrNoCheque } - return s.chequeStore.LastReceivedCheque(common) + return s.chequeStore.LastReceivedCheque(common, token) } // LastReceivedCheques returns map[peer]cheque -func (s *Service) LastReceivedCheques() (map[string]*vault.SignedCheque, error) { - lastcheques, err := s.chequeStore.LastReceivedCheques() +func (s *Service) LastReceivedCheques(token common.Address) (map[string]*vault.SignedCheque, error) { + lastcheques, err := s.chequeStore.LastReceivedCheques(token) if err != nil { return nil, err } @@ -388,7 +390,7 @@ func (s *Service) ReceivedChequeRecordsCount() (int, error) { } // LastReceivedCheque returns the last received cheque for the peer -func (s *Service) LastSendCheque(peer string) (*vault.SignedCheque, error) { +func (s *Service) LastSendCheque(peer string, token common.Address) (*vault.SignedCheque, error) { comm, known, err := s.addressbook.Vault(peer) if err != nil { return nil, err @@ -398,12 +400,14 @@ func (s *Service) LastSendCheque(peer string) (*vault.SignedCheque, error) { return nil, vault.ErrNoCheque } - return s.vault.LastCheque(comm) + return s.vault.LastCheque(comm, token) } // LastReceivedCheques returns the list of last received cheques for all peers -func (s *Service) LastSendCheques() (map[string]*vault.SignedCheque, error) { - lastcheques, err := s.vault.LastCheques() +func (s *Service) LastSendCheques(token common.Address) (map[string]*vault.SignedCheque, error) { + lastcheques, err := s.vault.LastCheques(token) + fmt.Println("LastSendCheques ", lastcheques, err) + if err != nil { return nil, err } @@ -457,7 +461,7 @@ func (s *Service) SendChequeRecordsAll() ([]vault.ChequeRecord, error) { } // CashCheque sends a cashing transaction for the last cheque of the peer -func (s *Service) CashCheque(ctx context.Context, peer string) (common.Hash, error) { +func (s *Service) CashCheque(ctx context.Context, peer string, token common.Address) (common.Hash, error) { vaultAddress, known, err := s.addressbook.Vault(peer) if err != nil { return common.Hash{}, err @@ -465,11 +469,13 @@ func (s *Service) CashCheque(ctx context.Context, peer string) (common.Hash, err if !known { return common.Hash{}, vault.ErrNoCheque } - return s.cashout.CashCheque(ctx, vaultAddress, s.vault.Address()) + + fmt.Println("...CashCheque, vaultAddress, s.vault.Address(), token ", vaultAddress, s.vault.Address(), token) + return s.cashout.CashCheque(ctx, vaultAddress, s.vault.Address(), token) } // CashoutStatus gets the status of the latest cashout transaction for the peers vault -func (s *Service) CashoutStatus(ctx context.Context, peer string) (*vault.CashoutStatus, error) { +func (s *Service) CashoutStatus(ctx context.Context, peer string, token common.Address) (*vault.CashoutStatus, error) { vaultAddress, known, err := s.addressbook.Vault(peer) if err != nil { return nil, err @@ -477,15 +483,15 @@ func (s *Service) CashoutStatus(ctx context.Context, peer string) (*vault.Cashou if !known { return nil, vault.ErrNoCheque } - return s.cashout.CashoutStatus(ctx, vaultAddress) + return s.cashout.CashoutStatus(ctx, vaultAddress, token) } func (s *Service) GetChainid() int64 { return s.chainID } -func (s *Service) Settle(toPeer string, paymentAmount *big.Int, contractId string) error { - return s.accounting.Settle(toPeer, paymentAmount, contractId) +func (s *Service) Settle(toPeer string, paymentAmount *big.Int, contractId string, token common.Address) error { + return s.accounting.Settle(toPeer, paymentAmount, contractId, token) } func (s *Service) PutBeneficiary(peer string, beneficiary common.Address) (common.Address, error) { @@ -517,7 +523,7 @@ func (s *Service) BeneficiaryPeer(beneficiary common.Address) (peer string, know return s.addressbook.BeneficiaryPeer(beneficiary) } -func (s *Service) HasCashoutAction(ctx context.Context, peer string) (bool, error) { +func (s *Service) HasCashoutAction(ctx context.Context, peer string, token common.Address) (bool, error) { vault, known, err := s.addressbook.Vault(peer) if err != nil { return false, err @@ -525,5 +531,5 @@ func (s *Service) HasCashoutAction(ctx context.Context, peer string) (bool, erro if !known { return false, fmt.Errorf("unkonw peer") } - return s.cashout.HasCashoutAction(ctx, vault) + return s.cashout.HasCashoutAction(ctx, vault, token) } diff --git a/settlement/swap/swap_test.go b/settlement/swap/swap_test.go index 85d9d302f..bcf11952a 100644 --- a/settlement/swap/swap_test.go +++ b/settlement/swap/swap_test.go @@ -19,13 +19,15 @@ import ( peerInfo "github.com/libp2p/go-libp2p-core/peer" ) +var TOKEN = common.HexToAddress("0x000") + type swapProtocolMock struct { - emitCheque func(context.Context, string, *big.Int, string, swapprotocol.IssueFunc) (*big.Int, error) + emitCheque func(context.Context, string, *big.Int, string, common.Address, swapprotocol.IssueFunc) (*big.Int, error) } -func (m *swapProtocolMock) EmitCheque(ctx context.Context, peer string, value *big.Int, contractId string, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { +func (m *swapProtocolMock) EmitCheque(ctx context.Context, peer string, value *big.Int, contractId string, token common.Address, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { if m.emitCheque != nil { - return m.emitCheque(ctx, peer, value, contractId, issueFunc) + return m.emitCheque(ctx, peer, value, contractId, token, issueFunc) } return nil, errors.New("not implemented") } @@ -57,7 +59,7 @@ func (t *testObserver) PeerDebt(peer string) (*big.Int, error) { return nil, nil } -func (t *testObserver) NotifyPaymentReceived(peer string, amount *big.Int) error { +func (t *testObserver) NotifyPaymentReceived(peer string, amount *big.Int, token common.Address) error { t.receivedCalled <- notifyPaymentReceivedCall{ peer: peer, amount: amount, @@ -69,11 +71,11 @@ func (t *testObserver) NotifyRefreshmentReceived(peer string, amount *big.Int) e return nil } -func (t *testObserver) Settle(peer string, amount *big.Int, contractId string) error { +func (t *testObserver) Settle(peer string, amount *big.Int, contractId string, token common.Address) error { return nil } -func (t *testObserver) NotifyPaymentSent(peer string, amount *big.Int, err error) { +func (t *testObserver) NotifyPaymentSent(peer string, amount *big.Int, err error, token common.Address) { t.sentCalled <- notifyPaymentSentCall{ peer: peer, amount: amount, @@ -122,31 +124,31 @@ func (m *addressbookMock) PutVault(peer string, vault common.Address) error { } type cashoutMock struct { - cashCheque func(ctx context.Context, vault, recipient common.Address) (common.Hash, error) - cashoutStatus func(ctx context.Context, vaultAddress common.Address) (*vault.CashoutStatus, error) + cashCheque func(ctx context.Context, vault, recipient common.Address, token common.Address) (common.Hash, error) + cashoutStatus func(ctx context.Context, vaultAddress common.Address, token common.Address) (*vault.CashoutStatus, error) cashoutResults func() ([]vault.CashOutResult, error) - hasCashoutAction func(ctx context.Context, peer common.Address) (bool, error) + hasCashoutAction func(ctx context.Context, peer common.Address, token common.Address) (bool, error) } -func (m *cashoutMock) CashCheque(ctx context.Context, vault, recipient common.Address) (common.Hash, error) { - return m.cashCheque(ctx, vault, recipient) +func (m *cashoutMock) CashCheque(ctx context.Context, vault, recipient common.Address, token common.Address) (common.Hash, error) { + return m.cashCheque(ctx, vault, recipient, token) } -func (m *cashoutMock) CashoutStatus(ctx context.Context, vaultAddress common.Address) (*vault.CashoutStatus, error) { - return m.cashoutStatus(ctx, vaultAddress) +func (m *cashoutMock) CashoutStatus(ctx context.Context, vaultAddress common.Address, token common.Address) (*vault.CashoutStatus, error) { + return m.cashoutStatus(ctx, vaultAddress, token) } func (m *cashoutMock) CashoutResults() ([]vault.CashOutResult, error) { return m.cashoutResults() } -func (m *cashoutMock) HasCashoutAction(ctx context.Context, peer common.Address) (bool, error) { - return m.hasCashoutAction(ctx, peer) +func (m *cashoutMock) HasCashoutAction(ctx context.Context, peer common.Address, token common.Address) (bool, error) { + return m.hasCashoutAction(ctx, peer, token) } func TestReceiveCheque(t *testing.T) { store := mockstore.NewStateStore() vaultService := mockvault.NewVault( - mockvault.WithTotalReceivedFunc(func() (*big.Int, error) { + mockvault.WithTotalReceivedFunc(func(token common.Address) (*big.Int, error) { return big.NewInt(0), nil }), - mockvault.WithTotalReceivedCountFunc(func() (int, error) { + mockvault.WithTotalReceivedCountFunc(func(token common.Address) (int, error) { return 0, nil }), ) @@ -210,7 +212,7 @@ func TestReceiveCheque(t *testing.T) { observer, ) - err := swap.ReceiveCheque(context.Background(), peer, cheque, exchangeRate) + err := swap.ReceiveCheque(context.Background(), peer, cheque, exchangeRate, TOKEN) if err != nil { t.Fatal(err) } @@ -277,7 +279,7 @@ func TestReceiveChequeReject(t *testing.T) { observer, ) - err := swap.ReceiveCheque(context.Background(), peer, cheque, exchangeRate) + err := swap.ReceiveCheque(context.Background(), peer, cheque, exchangeRate, TOKEN) if err == nil { t.Fatal("accepted invalid cheque") } @@ -329,7 +331,7 @@ func TestReceiveChequeWrongVault(t *testing.T) { observer, ) - err := swapService.ReceiveCheque(context.Background(), peer, cheque, exchangeRate) + err := swapService.ReceiveCheque(context.Background(), peer, cheque, exchangeRate, TOKEN) if err == nil { t.Fatal("accepted invalid cheque") } @@ -369,7 +371,7 @@ func TestPay(t *testing.T) { var emitCalled bool swap := swap.New( &swapProtocolMock{ - emitCheque: func(ctx context.Context, p string, a *big.Int, s string, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { + emitCheque: func(ctx context.Context, p string, a *big.Int, s string, token common.Address, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { //if !peer.Equal(p) { if strings.Compare(peer, p) != 0 { t.Fatal("sending to wrong peer") @@ -395,7 +397,7 @@ func TestPay(t *testing.T) { observer, ) - swap.Pay(context.Background(), peer, amount, "") + swap.Pay(context.Background(), peer, amount, "", TOKEN) if !emitCalled { t.Fatal("swap protocol was not called") @@ -423,7 +425,7 @@ func TestPayIssueError(t *testing.T) { swap := swap.New( &swapProtocolMock{ - emitCheque: func(c context.Context, a1 string, i *big.Int, s string, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { + emitCheque: func(c context.Context, a1 string, i *big.Int, s string, token common.Address, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { return nil, errReject }, }, @@ -439,7 +441,7 @@ func TestPayIssueError(t *testing.T) { observer := newTestObserver() swap.SetAccounting(observer) - swap.Pay(context.Background(), peer, amount, "") + swap.Pay(context.Background(), peer, amount, "", TOKEN) select { case call := <-observer.sentCalled: @@ -477,7 +479,7 @@ func TestPayUnknownBeneficiary(t *testing.T) { swapService := swap.New( &swapProtocolMock{ - emitCheque: func(ctx context.Context, p string, a *big.Int, s string, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { + emitCheque: func(ctx context.Context, p string, a *big.Int, s string, token common.Address, issueFunc swapprotocol.IssueFunc) (*big.Int, error) { //if !peer.Equal(p) { if strings.Compare(peer, p) != 0 { t.Fatal("sending to wrong peer") @@ -500,7 +502,7 @@ func TestPayUnknownBeneficiary(t *testing.T) { observer, ) - swapService.Pay(context.Background(), peer, amount, "") + swapService.Pay(context.Background(), peer, amount, "", TOKEN) select { case call := <-observer.sentCalled: @@ -548,7 +550,7 @@ func TestCashout(t *testing.T) { addressbook, int64(1), &cashoutMock{ - cashCheque: func(ctx context.Context, c common.Address, r common.Address) (common.Hash, error) { + cashCheque: func(ctx context.Context, c common.Address, r common.Address, token common.Address) (common.Hash, error) { if c != theirVaultAddress { t.Fatalf("not cashing with the right vault. wanted %v, got %v", theirVaultAddress, c) } @@ -561,7 +563,7 @@ func TestCashout(t *testing.T) { nil, ) - returnedHash, err := swapService.CashCheque(context.Background(), peer) + returnedHash, err := swapService.CashCheque(context.Background(), peer, TOKEN) if err != nil { t.Fatal(err) } @@ -596,7 +598,7 @@ func TestCashoutStatus(t *testing.T) { addressbook, int64(1), &cashoutMock{ - cashoutStatus: func(ctx context.Context, c common.Address) (*vault.CashoutStatus, error) { + cashoutStatus: func(ctx context.Context, c common.Address, token common.Address) (*vault.CashoutStatus, error) { if c != theirVaultAddress { t.Fatalf("getting status for wrong vault. wanted %v, got %v", theirVaultAddress, c) } @@ -606,7 +608,7 @@ func TestCashoutStatus(t *testing.T) { nil, ) - returnedStatus, err := swapService.CashoutStatus(context.Background(), peer) + returnedStatus, err := swapService.CashoutStatus(context.Background(), peer, TOKEN) if err != nil { t.Fatal(err) } diff --git a/settlement/swap/swapprotocol/swapprotocol.go b/settlement/swap/swapprotocol/swapprotocol.go index a4031565f..cfb722af7 100644 --- a/settlement/swap/swapprotocol/swapprotocol.go +++ b/settlement/swap/swapprotocol/swapprotocol.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "sync" "time" @@ -45,20 +46,20 @@ var ( type SendChequeFunc vault.SendChequeFunc -type IssueFunc func(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc vault.SendChequeFunc) (*big.Int, error) +type IssueFunc func(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc vault.SendChequeFunc) (*big.Int, error) // (context.Context, common.Address, *big.Int, vault.SendChequeFunc) (*big.Int, error) // Interface is the main interface to send messages over swap protocol. type Interface interface { // EmitCheque sends a signed cheque to a peer. - EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, issue IssueFunc) (balance *big.Int, err error) + EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, token common.Address, issue IssueFunc) (balance *big.Int, err error) } // Swap is the interface the settlement layer should implement to receive cheques. type Swap interface { // ReceiveCheque is called by the swap protocol if a cheque is received. - ReceiveCheque(ctx context.Context, peer string, cheque *vault.SignedCheque, price *big.Int) error + ReceiveCheque(ctx context.Context, peer string, cheque *vault.SignedCheque, price *big.Int, token common.Address) error GetChainid() int64 PutBeneficiary(peer string, beneficiary common.Address) (common.Address, error) Beneficiary(peer string) (beneficiary common.Address, known bool, err error) @@ -103,7 +104,7 @@ func (s *Service) SetSwap(swap Swap) { s.swap = swap } -func (s *Service) Handler(ctx context.Context, requestPid string, encodedCheque string, price *big.Int) (err error) { +func (s *Service) Handler(ctx context.Context, requestPid string, encodedCheque string, price *big.Int, token common.Address) (err error) { var signedCheque *vault.SignedCheque err = json.Unmarshal([]byte(encodedCheque), &signedCheque) if err != nil { @@ -111,11 +112,11 @@ func (s *Service) Handler(ctx context.Context, requestPid string, encodedCheque } // signature validation - return s.swap.ReceiveCheque(ctx, requestPid, signedCheque, price) + return s.swap.ReceiveCheque(ctx, requestPid, signedCheque, price, token) } // InitiateCheque attempts to send a cheque to a peer. -func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, issue IssueFunc) (balance *big.Int, err error) { +func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, contractId string, token common.Address, issue IssueFunc) (balance *big.Int, err error) { ctx, cancel := context.WithTimeout(ctx, 60*time.Second) defer cancel() @@ -129,7 +130,7 @@ func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, // call P2PCall to get beneficiary address handshakeInfo := &pb.Handshake{} - log.Infof("get handshakeInfo from peer %v (%v)", peerhostPid) + log.Infof("get handshakeInfo from peer %v (%v)", peerhostPid, token.String()) var wg sync.WaitGroup times := 0 wg.Add(1) @@ -188,21 +189,27 @@ func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, return nil, ErrGetBeneficiary } - fmt.Println("send cheque: /p2p/handshake ok, ", common.BytesToAddress(handshakeInfo.Beneficiary)) + fmt.Println("send cheque: /p2p/handshake ok, ", common.BytesToAddress(handshakeInfo.Beneficiary), token.String()) // issue cheque call with provided callback for sending cheque to finish transaction - balance, err = issue(ctx, common.BytesToAddress(handshakeInfo.Beneficiary), sentAmount, func(cheque *vault.SignedCheque) error { + balance, err = issue(ctx, common.BytesToAddress(handshakeInfo.Beneficiary), sentAmount, token, func(cheque *vault.SignedCheque) error { + fmt.Println("begin send cheque: 1") + // for simplicity we use json marshaller. can be replaced by a binary encoding in the future. encodedCheque, err := json.Marshal(cheque) if err != nil { return err } - price, err := s.priceOracle.CurrentPrice() + fmt.Println("begin send cheque: 2") + + price, err := s.priceOracle.CurrentPrice(token) if err != nil { return err } + fmt.Println("begin send cheque: 3") + // sending cheque log.Infof("sending cheque message to peer %v (%v)", peer, cheque) { @@ -222,12 +229,14 @@ func (s *Service) EmitCheque(ctx context.Context, peer string, amount *big.Int, return err } - //fmt.Println("begin send cheque: /storage/upload/cheque, hostPid, contractId = ", hostPid, contractId) + fmt.Println("begin send cheque: /storage/upload/cheque, hostPid, contractId, token = ", hostPid, contractId, token.String(), token.Hex(), tokencfg.MpTokenStr[token]) + //send cheque _, err = remote.P2PCall(ctx, node, coreApi, hostPid, "/storage/upload/cheque", encodedCheque, price, contractId, + token.Hex(), ) if err != nil { fmt.Printf("end send cheque: /storage/upload/cheque, hostPid:%+v, encodedCheque:%+v,price:%+v,contractId:%+v, err:%+v \n", diff --git a/settlement/swap/vault/cashout.go b/settlement/swap/vault/cashout.go index 04430a610..7d0f54dd8 100644 --- a/settlement/swap/vault/cashout.go +++ b/settlement/swap/vault/cashout.go @@ -4,6 +4,8 @@ import ( "context" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "github.com/status-im/keycard-go/hexutils" "math/big" "time" @@ -11,7 +13,6 @@ import ( "github.com/bittorrent/go-btfs/transaction" "github.com/bittorrent/go-btfs/transaction/storage" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" ) @@ -24,10 +25,10 @@ var ( // CashoutService is the service responsible for managing cashout actions type CashoutService interface { // CashCheque sends a cashing transaction for the last cheque of the vault - CashCheque(ctx context.Context, vault, recipient common.Address) (common.Hash, error) + CashCheque(ctx context.Context, vault, recipient common.Address, token common.Address) (common.Hash, error) // CashoutStatus gets the status of the latest cashout transaction for the vault - CashoutStatus(ctx context.Context, vaultAddress common.Address) (*CashoutStatus, error) - HasCashoutAction(ctx context.Context, peer common.Address) (bool, error) + CashoutStatus(ctx context.Context, vaultAddress common.Address, token common.Address) (*CashoutStatus, error) + HasCashoutAction(ctx context.Context, peer common.Address, token common.Address) (bool, error) CashoutResults() ([]CashOutResult, error) } @@ -71,6 +72,7 @@ type cashoutAction struct { type CashOutResult struct { TxHash common.Hash + Token common.Address Vault common.Address Amount *big.Int CashTime int64 @@ -86,6 +88,20 @@ type chequeCashedEvent struct { CallerPayout *big.Int } +type mutiChequeCashedEvent struct { + Token common.Address + Beneficiary common.Address + Recipient common.Address + Caller common.Address + TotalPayout *big.Int + CumulativePayout *big.Int + CallerPayout *big.Int +} + +type mutiChequeBouncedEvent struct { + Token common.Address +} + // NewCashoutService creates a new CashoutService func NewCashoutService( store storage.StateStorer, @@ -102,40 +118,47 @@ func NewCashoutService( } // cashoutActionKey computes the store key for the last cashout action for the vault -func cashoutActionKey(vault common.Address) string { - return fmt.Sprintf("swap_cashout_%x", vault) +func cashoutActionKey(vault common.Address, token common.Address) string { + return tokencfg.AddToken(fmt.Sprintf("swap_cashout_%x", vault), token) } -func (s *cashoutService) paidOut(ctx context.Context, vault, beneficiary common.Address) (*big.Int, error) { - callData, err := vaultABI.Pack("paidOut", beneficiary) - if err != nil { - return nil, err - } - - output, err := s.transactionService.Call(ctx, &transaction.TxRequest{ - To: &vault, - Data: callData, - }) - if err != nil { - return nil, err - } - - results, err := vaultABI.Unpack("paidOut", output) - if err != nil { - return nil, err - } - - if len(results) != 1 { - return nil, errDecodeABI - } - - paidOut, ok := abi.ConvertType(results[0], new(big.Int)).(*big.Int) - if !ok || paidOut == nil { - return nil, errDecodeABI - } - - return paidOut, nil +// paidOut (dropped 2.3.0) +//func (s *cashoutService) paidOut(ctx context.Context, vault, beneficiary common.Address) (*big.Int, error) { +// callData, err := vaultABI.Pack("paidOut", beneficiary) +// if err != nil { +// return nil, err +// } +// +// output, err := s.transactionService.Call(ctx, &transaction.TxRequest{ +// To: &vault, +// Data: callData, +// }) +// if err != nil { +// return nil, err +// } +// +// results, err := vaultABI.Unpack("paidOut", output) +// if err != nil { +// return nil, err +// } +// +// if len(results) != 1 { +// return nil, errDecodeABI +// } +// +// paidOut, ok := abi.ConvertType(results[0], new(big.Int)).(*big.Int) +// if !ok || paidOut == nil { +// return nil, errDecodeABI +// } +// +// return paidOut, nil +//} + +// paidOutMuti (2.3.0 import) +func (s *cashoutService) paidOutMuti(ctx context.Context, vault, beneficiary common.Address, token common.Address) (*big.Int, error) { + return _PaidOutMuti(ctx, vault, beneficiary, s.transactionService, token) } + func (s *cashoutService) CashoutResults() ([]CashOutResult, error) { result := make([]CashOutResult, 0, 0) err := s.store.Iterate(statestore.CashoutResultPrefixKey(), func(key, val []byte) (stop bool, err error) { @@ -154,29 +177,37 @@ func (s *cashoutService) CashoutResults() ([]CashOutResult, error) { } // CashCheque sends a cashout transaction for the last cheque of the vault -func (s *cashoutService) CashCheque(ctx context.Context, vault, recipient common.Address) (common.Hash, error) { - cheque, err := s.chequeStore.LastReceivedCheque(vault) - if err != nil { - return common.Hash{}, err - } - - callData, err := vaultABI.Pack("cashChequeBeneficiary", recipient, cheque.CumulativePayout, cheque.Signature) +func (s *cashoutService) CashCheque(ctx context.Context, vault, recipient common.Address, token common.Address) (common.Hash, error) { + cheque, err := s.chequeStore.LastReceivedCheque(vault, token) if err != nil { return common.Hash{}, err } - request := &transaction.TxRequest{ - To: &vault, - Data: callData, - Value: big.NewInt(0), - Description: "cheque cashout", - } - txHash, err := s.transactionService.Send(ctx, request) + fmt.Println("_CashCheque ", vault, recipient, cheque.CumulativePayout, hexutils.BytesToHex(cheque.Signature), cheque.Token) + + //callData, err := vaultABI.Pack("cashChequeBeneficiary", recipient, cheque.CumulativePayout, cheque.Signature) + //if err != nil { + // return common.Hash{}, err + //} + //request := &transaction.TxRequest{ + // To: &vault, + // Data: callData, + // Value: big.NewInt(0), + // Description: "cheque cashout", + //} + // + //txHash, err := s.transactionService.Send(ctx, request) + //if err != nil { + // return common.Hash{}, err + //} + + // 2.3.0 import + txHash, err := _CashChequeMuti(ctx, vault, recipient, cheque, s.transactionService, token) if err != nil { return common.Hash{}, err } - err = s.store.Put(cashoutActionKey(vault), &cashoutAction{ + err = s.store.Put(cashoutActionKey(vault, token), &cashoutAction{ TxHash: txHash, Cheque: *cheque, }) @@ -191,24 +222,31 @@ func (s *cashoutService) CashCheque(ctx context.Context, vault, recipient common log.Errorf("storeCashResult recovered:%+v", err) } }() - s.storeCashResult(context.Background(), vault, txHash, cheque) + s.storeCashResult(context.Background(), vault, txHash, cheque, token) }() return txHash, nil } -func (s *cashoutService) storeCashResult(ctx context.Context, vault common.Address, txHash common.Hash, cheque *SignedCheque) error { +func (s *cashoutService) storeCashResult(ctx context.Context, vault common.Address, txHash common.Hash, cheque *SignedCheque, token common.Address) error { cashResult := CashOutResult{ TxHash: txHash, Vault: vault, + Token: token, Amount: cheque.CumulativePayout, CashTime: time.Now().Unix(), Status: "fail", } + fmt.Println("1 put CashoutResultKey ", cashResult) + _, err := s.transactionService.WaitForReceipt(ctx, txHash) if err != nil { + fmt.Println("2 put CashoutResultKey ", cashResult) + log.Infof("storeCashResult err:%+v", err) } else { - cs, err := s.CashoutStatus(ctx, vault) + fmt.Println("3 put CashoutResultKey ", cashResult) + + cs, err := s.CashoutStatus(ctx, vault, token) if err != nil { log.Infof("CashOutStats:get cashout status err:%+v", err) if cs.UncashedAmount != nil { @@ -225,18 +263,25 @@ func (s *cashoutService) storeCashResult(ctx context.Context, vault common.Addre } cashResult.Amount = totalPaidOut totalReceivedCashed := big.NewInt(0) - if err = s.store.Get(statestore.TotalReceivedCashedKey, &totalReceivedCashed); err == nil || err == storage.ErrNotFound { + + fmt.Println("3.1 put CashoutResultKey ", token.String()) + if err = s.store.Get(tokencfg.AddToken(statestore.TotalReceivedCashedKey, token), &totalReceivedCashed); err == nil || err == storage.ErrNotFound { + fmt.Println("3.2 put CashoutResultKey ", totalReceivedCashed.String()) totalReceivedCashed = totalReceivedCashed.Add(totalReceivedCashed, totalPaidOut) - err := s.store.Put(statestore.TotalReceivedCashedKey, totalReceivedCashed) + fmt.Println("3.3 put CashoutResultKey ", totalReceivedCashed.String()) + err := s.store.Put(tokencfg.AddToken(statestore.TotalReceivedCashedKey, token), totalReceivedCashed) + fmt.Println("3.4 put CashoutResultKey ", totalReceivedCashed.String()) if err != nil { log.Infof("CashOutStats:put totalReceivedCashdKey err:%+v", err) } } + fmt.Println("3.5 put CashoutResultKey ", totalReceivedCashed.String()) + totalDailyReceivedCashed := big.NewInt(0) - if err = s.store.Get(statestore.GetTodayTotalDailyReceivedCashedKey(), &totalDailyReceivedCashed); err == nil || err == storage.ErrNotFound { + if err = s.store.Get(statestore.GetTodayTotalDailyReceivedCashedKey(token), &totalDailyReceivedCashed); err == nil || err == storage.ErrNotFound { totalDailyReceivedCashed = totalDailyReceivedCashed.Add(totalDailyReceivedCashed, totalPaidOut) - err := s.store.Put(statestore.GetTodayTotalDailyReceivedCashedKey(), totalDailyReceivedCashed) + err := s.store.Put(statestore.GetTodayTotalDailyReceivedCashedKey(token), totalDailyReceivedCashed) if err != nil { log.Infof("CashOutStats:put totalReceivedDailyCashdKey err:%+v", err) } @@ -244,18 +289,18 @@ func (s *cashoutService) storeCashResult(ctx context.Context, vault common.Addre // update TotalReceivedCountCashed uncashed := 0 - err := s.store.Get(statestore.PeerReceivedUncashRecordsCountKey(vault), &uncashed) + err := s.store.Get(statestore.PeerReceivedUncashRecordsCountKey(vault, token), &uncashed) if err != nil { log.Infof("CashOutStats:put totalReceivedCountCashed err:%+v", err) } else { cashedCount := 0 - err := s.store.Get(statestore.TotalReceivedCashedCountKey, &cashedCount) + err := s.store.Get(tokencfg.AddToken(statestore.TotalReceivedCashedCountKey, token), &cashedCount) if err == nil || err == storage.ErrNotFound { - err := s.store.Put(statestore.TotalReceivedCashedCountKey, cashedCount+uncashed) + err := s.store.Put(tokencfg.AddToken(statestore.TotalReceivedCashedCountKey, token), cashedCount+uncashed) if err != nil { log.Infof("CashOutStats:put totalReceivedCashedConuntKey err:%+v", err) } else { - err := s.store.Put(statestore.PeerReceivedUncashRecordsCountKey(vault), 0) + err := s.store.Put(statestore.PeerReceivedUncashRecordsCountKey(vault, token), 0) if err != nil { log.Infof("CashOutStats:put totalReceivedCashedConuntKey err:%+v", err) } @@ -265,6 +310,7 @@ func (s *cashoutService) storeCashResult(ctx context.Context, vault common.Addre } } err = s.store.Put(statestore.CashoutResultKey(vault), &cashResult) + fmt.Println("4 put CashoutResultKey ", cashResult) if err != nil { log.Infof("CashOutStats:put cashoutResultKey err:%+v", err) } @@ -272,14 +318,19 @@ func (s *cashoutService) storeCashResult(ctx context.Context, vault common.Addre } // CashoutStatus gets the status of the latest cashout transaction for the vault -func (s *cashoutService) CashoutStatus(ctx context.Context, vaultAddress common.Address) (*CashoutStatus, error) { - cheque, err := s.chequeStore.LastReceivedCheque(vaultAddress) +func (s *cashoutService) CashoutStatus(ctx context.Context, vaultAddress common.Address, token common.Address) (*CashoutStatus, error) { + fmt.Println("...1 CashoutStatus ") + + cheque, err := s.chequeStore.LastReceivedCheque(vaultAddress, token) if err != nil { return nil, err } + fmt.Println("...2 CashoutStatus ", cheque, err) + var action cashoutAction - err = s.store.Get(cashoutActionKey(vaultAddress), &action) + err = s.store.Get(cashoutActionKey(vaultAddress, token), &action) + fmt.Println("...3 CashoutStatus ", err) if err != nil { if errors.Is(err, storage.ErrNotFound) { return &CashoutStatus{ @@ -291,6 +342,7 @@ func (s *cashoutService) CashoutStatus(ctx context.Context, vaultAddress common. } _, pending, err := s.backend.TransactionByHash(ctx, action.TxHash) + fmt.Println("...3 CashoutStatus ", pending, err) if err != nil { // treat not found as pending if !errors.Is(err, ethereum.NotFound) { @@ -312,15 +364,19 @@ func (s *cashoutService) CashoutStatus(ctx context.Context, vaultAddress common. }, nil } + fmt.Println("...4 CashoutStatus ") + receipt, err := s.backend.TransactionReceipt(ctx, action.TxHash) if err != nil { return nil, err } + fmt.Println("...5 CashoutStatus ", receipt) + if receipt.Status == types.ReceiptStatusFailed { // if a tx failed (should be almost impossible in practice) we no longer have the necessary information to compute uncashed locally // assume there are no pending transactions and that the on-chain paidOut is the last cashout action - paidOut, err := s.paidOut(ctx, vaultAddress, cheque.Beneficiary) + paidOut, err := s.paidOutMuti(ctx, vaultAddress, cheque.Beneficiary, token) if err != nil { return nil, err } @@ -336,11 +392,15 @@ func (s *cashoutService) CashoutStatus(ctx context.Context, vaultAddress common. }, nil } - result, err := s.parseCashChequeBeneficiaryReceipt(vaultAddress, receipt) + fmt.Println("...6 CashoutStatus ") + + result, err := s.parseCashChequeBeneficiaryReceiptMuti(vaultAddress, receipt, token) if err != nil { return nil, err } + fmt.Println("...7 CashoutStatus ", result) + return &CashoutStatus{ Last: &LastCashout{ TxHash: action.TxHash, @@ -382,6 +442,46 @@ func (s *cashoutService) parseCashChequeBeneficiaryReceipt(vaultAddress common.A return result, nil } +// parseCashChequeBeneficiaryReceiptMuti processes the receipt from a CashChequeBeneficiary transaction +func (s *cashoutService) parseCashChequeBeneficiaryReceiptMuti(vaultAddress common.Address, receipt *types.Receipt, token common.Address) (*CashChequeResult, error) { + fmt.Println("parseCashChequeBeneficiaryReceiptMuti ... 1", vaultAddress, token) + if tokencfg.IsWBTT(token) { + return s.parseCashChequeBeneficiaryReceipt(vaultAddress, receipt) + } + + fmt.Println("parseCashChequeBeneficiaryReceiptMuti ... 2", vaultAddress, token) + + result := &CashChequeResult{ + Bounced: false, + } + + var mtCashedEvent mutiChequeCashedEvent + err := transaction.FindSingleEvent(&vaultABINew, receipt, vaultAddress, mutiChequeCashedEventType, &mtCashedEvent) + fmt.Println("parseCashChequeBeneficiaryReceiptMuti ... 3", err, mtCashedEvent) + if err != nil { + return nil, err + } + + result.Beneficiary = mtCashedEvent.Beneficiary + result.Caller = mtCashedEvent.Caller + result.CallerPayout = mtCashedEvent.CallerPayout + result.TotalPayout = mtCashedEvent.TotalPayout + result.CumulativePayout = mtCashedEvent.CumulativePayout + result.Recipient = mtCashedEvent.Recipient + + //var mtBouncedEvent mutiChequeBouncedEvent + err = transaction.FindSingleEvent(&vaultABINew, receipt, vaultAddress, mutiChequeBouncedEventType, nil) + fmt.Println("parseCashChequeBeneficiaryReceiptMuti ... 4", err) + if err == nil { + result.Bounced = true + } else if !errors.Is(err, transaction.ErrEventNotFound) { + return nil, err + } + + fmt.Println("parseCashChequeBeneficiaryReceiptMuti ... 4") + return result, nil +} + // Equal compares to CashChequeResults func (r *CashChequeResult) Equal(o *CashChequeResult) bool { if r.Beneficiary != o.Beneficiary { @@ -408,9 +508,9 @@ func (r *CashChequeResult) Equal(o *CashChequeResult) bool { return true } -func (s *cashoutService) HasCashoutAction(ctx context.Context, peer common.Address) (bool, error) { +func (s *cashoutService) HasCashoutAction(ctx context.Context, peer common.Address, token common.Address) (bool, error) { var action cashoutAction - err := s.store.Get(cashoutActionKey(peer), &action) + err := s.store.Get(cashoutActionKey(peer, token), &action) if err != nil { if errors.Is(err, storage.ErrNotFound) { diff --git a/settlement/swap/vault/cashout_test.go b/settlement/swap/vault/cashout_test.go index 5614a44b6..252d130f4 100644 --- a/settlement/swap/vault/cashout_test.go +++ b/settlement/swap/vault/cashout_test.go @@ -89,7 +89,7 @@ func TestCashout(t *testing.T) { ), ) - returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress) + returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -98,7 +98,7 @@ func TestCashout(t *testing.T) { t.Fatalf("returned wrong transaction hash. wanted %v, got %v", txHash, returnedTxHash) } - status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress) + status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -193,7 +193,7 @@ func TestCashoutBounced(t *testing.T) { ), ) - returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress) + returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -202,7 +202,7 @@ func TestCashoutBounced(t *testing.T) { t.Fatalf("returned wrong transaction hash. wanted %v, got %v", txHash, returnedTxHash) } - status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress) + status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -282,7 +282,7 @@ func TestCashoutStatusReverted(t *testing.T) { ), ) - returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress) + returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -291,7 +291,7 @@ func TestCashoutStatusReverted(t *testing.T) { t.Fatalf("returned wrong transaction hash. wanted %v, got %v", txHash, returnedTxHash) } - status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress) + status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -351,7 +351,7 @@ func TestCashoutStatusPending(t *testing.T) { ), ) - returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress) + returnedTxHash, err := cashoutService.CashCheque(context.Background(), vaultAddress, recipientAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -360,7 +360,7 @@ func TestCashoutStatusPending(t *testing.T) { t.Fatalf("returned wrong transaction hash. wanted %v, got %v", txHash, returnedTxHash) } - status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress) + status, err := cashoutService.CashoutStatus(context.Background(), vaultAddress, TOKEN) if err != nil { t.Fatal(err) } diff --git a/settlement/swap/vault/cheque.go b/settlement/swap/vault/cheque.go index 2f3f57225..47295380f 100644 --- a/settlement/swap/vault/cheque.go +++ b/settlement/swap/vault/cheque.go @@ -3,6 +3,7 @@ package vault import ( "bytes" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "github.com/bittorrent/go-btfs/transaction/crypto" @@ -13,12 +14,14 @@ import ( // Cheque represents a cheque for a SimpleSwap vault type Cheque struct { + Token common.Address Vault common.Address Beneficiary common.Address CumulativePayout *big.Int } type ChequeRecord struct { + Token common.Address Vault common.Address Beneficiary common.Address Amount *big.Int @@ -77,6 +80,28 @@ var ChequeTypes = eip712.Types{ }, } +var MutiChequeTypes = eip712.Types{ + "EIP712Domain": eip712.EIP712DomainType, + "MultiTokenCheque": []eip712.Type{ + { + Name: "token", + Type: "address", + }, + { + Name: "vault", + Type: "address", + }, + { + Name: "beneficiary", + Type: "address", + }, + { + Name: "cumulativePayout", + Type: "uint256", + }, + }, +} + // ChequeSigner signs cheque type ChequeSigner interface { // Sign signs a cheque @@ -98,15 +123,31 @@ func NewChequeSigner(signer crypto.Signer, chainID int64) ChequeSigner { // eip712DataForCheque converts a cheque into the correct TypedData structure. func eip712DataForCheque(cheque *Cheque, chainID int64) *eip712.TypedData { + if tokencfg.IsWBTT(cheque.Token) { + fmt.Println("muti token: wbtt sign.", cheque.Token.String()) + return &eip712.TypedData{ + Domain: vaultDomain(chainID), + Types: ChequeTypes, + Message: eip712.TypedDataMessage{ + "vault": cheque.Vault.Hex(), + "beneficiary": cheque.Beneficiary.Hex(), + "cumulativePayout": cheque.CumulativePayout.String(), + }, + PrimaryType: "Cheque", + } + } + + fmt.Println("muti token: other token sign.", cheque.Token.String()) return &eip712.TypedData{ Domain: vaultDomain(chainID), - Types: ChequeTypes, + Types: MutiChequeTypes, Message: eip712.TypedDataMessage{ + "token": cheque.Token.Hex(), "vault": cheque.Vault.Hex(), "beneficiary": cheque.Beneficiary.Hex(), "cumulativePayout": cheque.CumulativePayout.String(), }, - PrimaryType: "Cheque", + PrimaryType: "MultiTokenCheque", } } @@ -116,7 +157,7 @@ func (s *chequeSigner) Sign(cheque *Cheque) ([]byte, error) { } func (cheque *Cheque) String() string { - return fmt.Sprintf("Contract: %x Beneficiary: %x CumulativePayout: %v", cheque.Vault, cheque.Beneficiary, cheque.CumulativePayout) + return fmt.Sprintf("Token: %x Contract: %x Beneficiary: %x CumulativePayout: %v", cheque.Token, cheque.Vault, cheque.Beneficiary, cheque.CumulativePayout) } func (cheque *Cheque) Equal(other *Cheque) bool { diff --git a/settlement/swap/vault/chequestore.go b/settlement/swap/vault/chequestore.go index 4a572e36e..38ae0916d 100644 --- a/settlement/swap/vault/chequestore.go +++ b/settlement/swap/vault/chequestore.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "strings" "sync" @@ -41,6 +42,7 @@ var ( ErrWrongBeneficiary = errors.New("wrong beneficiary") // ErrBouncingCheque is the error returned if the vault is demonstrably illiquid. ErrBouncingCheque = errors.New("bouncing cheque") + ErrTokenCheque = errors.New("wrong token cheque") // ErrChequeValueTooLow is the error returned if the after deduction value of a cheque did not cover 1 accounting credit ErrChequeValueTooLow = errors.New("cheque value lower than acceptable") ) @@ -48,20 +50,20 @@ var ( // ChequeStore handles the verification and storage of received cheques type ChequeStore interface { // ReceiveCheque verifies and stores a cheque. It returns the total amount earned. - ReceiveCheque(ctx context.Context, cheque *SignedCheque, price *big.Int) (*big.Int, error) + ReceiveCheque(ctx context.Context, cheque *SignedCheque, price *big.Int, token common.Address) (*big.Int, error) // LastReceivedCheque returns the last cheque we received from a specific vault. - LastReceivedCheque(vault common.Address) (*SignedCheque, error) + LastReceivedCheque(vault common.Address, token common.Address) (*SignedCheque, error) // LastReceivedCheques return map[vault]cheque - LastReceivedCheques() (map[common.Address]*SignedCheque, error) + LastReceivedCheques(token common.Address) (map[common.Address]*SignedCheque, error) // ReceivedChequeRecordsByPeer returns the records we received from a specific vault. ReceivedChequeRecordsByPeer(vault common.Address) ([]ChequeRecord, error) // ListReceivedChequeRecords returns the records we received from a specific vault. ReceivedChequeRecordsAll() (map[common.Address][]ChequeRecord, error) - ReceivedStatsHistory(days int) ([]DailyReceivedStats, error) - SentStatsHistory(days int) ([]DailySentStats, error) + ReceivedStatsHistory(days int, token common.Address) ([]DailyReceivedStats, error) + SentStatsHistory(days int, token common.Address) ([]DailySentStats, error) // StoreSendChequeRecord store send cheque records. - StoreSendChequeRecord(vault, beneficiary common.Address, amount *big.Int) error + StoreSendChequeRecord(vault, beneficiary common.Address, amount *big.Int, token common.Address) error // SendChequeRecordsByPeer returns the records we send to a specific vault. SendChequeRecordsByPeer(beneficiary common.Address) ([]ChequeRecord, error) // SendChequeRecordsAll returns the records we send to a specific vault. @@ -99,8 +101,8 @@ func NewChequeStore( } // lastReceivedChequeKey computes the key where to store the last cheque received from a vault. -func lastReceivedChequeKey(vault common.Address) string { - return fmt.Sprintf("%s_%x", lastReceivedChequePrefix, vault) +func lastReceivedChequeKey(vault common.Address, token common.Address) string { + return fmt.Sprintf("%s_%x", tokencfg.AddToken(lastReceivedChequePrefix, token), vault) } func historyReceivedChequeIndexKey(vault common.Address) string { @@ -113,9 +115,9 @@ func historyReceivedChequeKey(vault common.Address, index uint64) string { } // LastReceivedCheque map[vault]cheque -func (s *chequeStore) LastReceivedCheque(vault common.Address) (*SignedCheque, error) { +func (s *chequeStore) LastReceivedCheque(vault common.Address, token common.Address) (*SignedCheque, error) { var cheque *SignedCheque - err := s.store.Get(lastReceivedChequeKey(vault), &cheque) + err := s.store.Get(lastReceivedChequeKey(vault, token), &cheque) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -127,12 +129,16 @@ func (s *chequeStore) LastReceivedCheque(vault common.Address) (*SignedCheque, e } // ReceiveCheque verifies and stores a cheque. It returns the totam amount earned. -func (s *chequeStore) ReceiveCheque(ctx context.Context, cheque *SignedCheque, price *big.Int) (*big.Int, error) { +func (s *chequeStore) ReceiveCheque(ctx context.Context, cheque *SignedCheque, price *big.Int, token common.Address) (*big.Int, error) { // verify we are the beneficiary if cheque.Beneficiary != s.beneficiary { return nil, ErrWrongBeneficiary } + //if token != cheque.Token { + // return nil, ErrTokenCheque + //} + // don't allow concurrent processing of cheques // this would be sufficient on a per vault basis s.lock.Lock() @@ -141,7 +147,7 @@ func (s *chequeStore) ReceiveCheque(ctx context.Context, cheque *SignedCheque, p // load the lastCumulativePayout for the cheques vault var lastCumulativePayout *big.Int var lastReceivedCheque *SignedCheque - err := s.store.Get(lastReceivedChequeKey(cheque.Vault), &lastReceivedCheque) + err := s.store.Get(lastReceivedChequeKey(cheque.Vault, token), &lastReceivedCheque) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -160,17 +166,18 @@ func (s *chequeStore) ReceiveCheque(ctx context.Context, cheque *SignedCheque, p // check this cheque is actually increasing in value by local storage amount := big.NewInt(0).Sub(cheque.CumulativePayout, lastCumulativePayout) if amount.Cmp(big.NewInt(0)) <= 0 { + fmt.Println("amount < 0, ", ErrChequeNotIncreasing, cheque.CumulativePayout.String(), lastCumulativePayout.String(), token.Hex()) return nil, ErrChequeNotIncreasing } // blockchain calls below - contract := newVaultContract(cheque.Vault, s.transactionService) + contract := newVaultContractMuti(cheque.Vault, s.transactionService) // this does not change for the same vault expectedIssuer, err := contract.Issuer(ctx) if err != nil { return nil, err } - // verify the cheque signature + // verify the cheque signature, (cheque contains token) issuer, err := s.recoverChequeFunc(cheque, s.chaindID) if err != nil { return nil, err @@ -182,12 +189,12 @@ func (s *chequeStore) ReceiveCheque(ctx context.Context, cheque *SignedCheque, p // basic balance check // could be omitted as it is not particularly useful - balance, err := contract.TotalBalance(ctx) + balance, err := contract.TotalBalance(ctx, token) if err != nil { return nil, err } - alreadyPaidOut, err := contract.PaidOut(ctx, s.beneficiary) + alreadyPaidOut, err := contract.PaidOut(ctx, s.beneficiary, token) if err != nil { return nil, err } @@ -199,17 +206,18 @@ func (s *chequeStore) ReceiveCheque(ctx context.Context, cheque *SignedCheque, p // check this cheque is actually increasing in value by blockchain in case of the host migrate to another machine // https://github.com/bittorrent/go-btfs/issues/187 if cheque.CumulativePayout.Cmp(alreadyPaidOut) <= 0 { + fmt.Println("CumulativePayout < alreadyPaidOut, ", ErrChequeNotIncreasing, cheque.CumulativePayout.String(), alreadyPaidOut.String(), token.Hex()) return nil, ErrChequeNotIncreasing } // store the accepted cheque - err = s.store.Put(lastReceivedChequeKey(cheque.Vault), cheque) + err = s.store.Put(lastReceivedChequeKey(cheque.Vault, token), cheque) if err != nil { return nil, err } // store the history cheque - err = s.storeChequeRecord(cheque.Vault, amount) + err = s.storeChequeRecord(cheque.Vault, amount, token) if err != nil { return nil, err } @@ -243,7 +251,7 @@ func (s *chequeStore) ReceivedChequeRecordsByPeer(vault common.Address) ([]Chequ //store cheque record //Beneficiary common.Address -func (s *chequeStore) storeChequeRecord(vault common.Address, amount *big.Int) error { +func (s *chequeStore) storeChequeRecord(vault common.Address, amount *big.Int, token common.Address) error { var indexRange IndexRange err := s.store.Get(historyReceivedChequeIndexKey(vault), &indexRange) if err != nil { @@ -264,6 +272,7 @@ func (s *chequeStore) storeChequeRecord(vault common.Address, amount *big.Int) e //stroe cheque record with the key: historyReceivedChequeKey(index) chequeRecord := ChequeRecord{ + token, vault, s.beneficiary, amount, @@ -291,7 +300,7 @@ func (s *chequeStore) storeChequeRecord(vault common.Address, amount *big.Int) e var stat DailyReceivedStats stat.Amount = big.NewInt(0) - err = s.store.Get(statestore.GetTodayTotalDailyReceivedKey(), &stat) + err = s.store.Get(statestore.GetTodayTotalDailyReceivedKey(token), &stat) if err != nil { if err != storage.ErrNotFound { return err @@ -304,35 +313,35 @@ func (s *chequeStore) storeChequeRecord(vault common.Address, amount *big.Int) e } stat.Amount.Add(stat.Amount, amount) stat.Count += 1 - err = s.store.Put(statestore.GetTodayTotalDailyReceivedKey(), stat) + err = s.store.Put(statestore.GetTodayTotalDailyReceivedKey(token), stat) if err != nil { return err } // update uncashed records key uncashed := 0 - err = s.store.Get(statestore.PeerReceivedUncashRecordsCountKey(vault), &uncashed) + err = s.store.Get(statestore.PeerReceivedUncashRecordsCountKey(vault, token), &uncashed) if err != nil { if err != storage.ErrNotFound { return err } } uncashed += 1 - err = s.store.Put(statestore.PeerReceivedUncashRecordsCountKey(vault), uncashed) + err = s.store.Put(statestore.PeerReceivedUncashRecordsCountKey(vault, token), uncashed) if err != nil { return err } return nil } -func (s *chequeStore) ReceivedStatsHistory(days int) ([]DailyReceivedStats, error) { +func (s *chequeStore) ReceivedStatsHistory(days int, token common.Address) ([]DailyReceivedStats, error) { stats := make([]DailyReceivedStats, 0, days) y, m, d := time.Now().Date() todayStart := time.Date(y, m, d, 0, 0, 0, 0, time.UTC) for i := 0; i < days; i++ { stat := DailyReceivedStats{} t := todayStart.AddDate(0, 0, -1*i) - key := statestore.GetTotalDailyReceivedKeyByTime(t.Unix()) + key := statestore.GetTotalDailyReceivedKeyByTime(t.Unix(), token) err := s.store.Get(key, &stat) if err != nil { if err != storage.ErrNotFound { @@ -350,14 +359,14 @@ func (s *chequeStore) ReceivedStatsHistory(days int) ([]DailyReceivedStats, erro return stats, nil } -func (s *chequeStore) SentStatsHistory(days int) ([]DailySentStats, error) { +func (s *chequeStore) SentStatsHistory(days int, token common.Address) ([]DailySentStats, error) { stats := make([]DailySentStats, 0, days) y, m, d := time.Now().Date() todayStart := time.Date(y, m, d, 0, 0, 0, 0, time.UTC) for i := 0; i < days; i++ { stat := DailySentStats{} t := todayStart.AddDate(0, 0, -1*i) - key := statestore.GetTotalDailySentKeyByTime(t.Unix()) + key := statestore.GetTotalDailySentKeyByTime(t.Unix(), token) err := s.store.Get(key, &stat) if err != nil { if err != storage.ErrNotFound { @@ -443,16 +452,18 @@ func keyVault(key []byte, prefix string) (vault common.Address, err error) { } // LastCheques returns map[vault]cheque -func (s *chequeStore) LastReceivedCheques() (map[common.Address]*SignedCheque, error) { +func (s *chequeStore) LastReceivedCheques(token common.Address) (map[common.Address]*SignedCheque, error) { result := make(map[common.Address]*SignedCheque) - err := s.store.Iterate(lastReceivedChequePrefix, func(key, val []byte) (stop bool, err error) { - addr, err := keyVault(key, lastReceivedChequePrefix+"_") + err := s.store.Iterate(tokencfg.AddToken(lastReceivedChequePrefix, token), func(key, val []byte) (stop bool, err error) { + // if token is wbtt, need a wbtt key, other token is not this. + + addr, err := keyVault(key, tokencfg.AddToken(lastReceivedChequePrefix, token)+"_") if err != nil { return false, fmt.Errorf("parse address from key: %s: %w", string(key), err) } if _, ok := result[addr]; !ok { - lastCheque, err := s.LastReceivedCheque(addr) + lastCheque, err := s.LastReceivedCheque(addr, token) if err != nil && err != ErrNoCheque { return false, err } else if err == ErrNoCheque { @@ -507,7 +518,7 @@ func historySendChequeKey(beneficiary common.Address, index uint64) string { //store cheque record //Beneficiary common.Address -func (s *chequeStore) StoreSendChequeRecord(vault, beneficiary common.Address, amount *big.Int) error { +func (s *chequeStore) StoreSendChequeRecord(vault, beneficiary common.Address, amount *big.Int, token common.Address) error { var indexRange IndexRange err := s.store.Get(historySendChequeIndexKey(beneficiary), &indexRange) if err != nil { @@ -526,8 +537,12 @@ func (s *chequeStore) StoreSendChequeRecord(vault, beneficiary common.Address, a */ } + fmt.Printf("...1 StoreSendChequeRecord, historySendChequeIndexKey=%v, indexRange=%v, token=%v \n", + historySendChequeIndexKey(beneficiary), indexRange, token.Hex()) + //stroe cheque record with the key: historySendChequeKey(index) chequeRecord := ChequeRecord{ + token, vault, beneficiary, amount, @@ -539,6 +554,9 @@ func (s *chequeStore) StoreSendChequeRecord(vault, beneficiary common.Address, a return err } + fmt.Printf("...2 StoreSendChequeRecord, historySendChequeKey=%v, indexRange=%v \n", + historySendChequeKey(beneficiary, indexRange.MaxIndex), indexRange) + //update Max : add one record indexRange.MaxIndex += 1 //delete records if these record are old (half year) @@ -553,8 +571,11 @@ func (s *chequeStore) StoreSendChequeRecord(vault, beneficiary common.Address, a return err } + fmt.Printf("...3 StoreSendChequeRecord, historySendChequeKey=%v, indexRange=%v \n", + historySendChequeKey(beneficiary, indexRange.MaxIndex), indexRange) + var stat DailySentStats - err = s.store.Get(statestore.GetTodayTotalDailySentKey(), &stat) + err = s.store.Get(statestore.GetTodayTotalDailySentKey(token), &stat) if err != nil { if err != storage.ErrNotFound { return err @@ -567,7 +588,7 @@ func (s *chequeStore) StoreSendChequeRecord(vault, beneficiary common.Address, a } stat.Amount.Add(stat.Amount, amount) stat.Count += 1 - err = s.store.Put(statestore.GetTodayTotalDailySentKey(), stat) + err = s.store.Put(statestore.GetTodayTotalDailySentKey(token), stat) if err != nil { return err } @@ -661,5 +682,9 @@ func (s *chequeStore) SendChequeRecordsAll() (map[common.Address][]ChequeRecord, if err != nil { return nil, err } + + fmt.Println("SendChequeRecordsAll ... result = ", result) + fmt.Println("SendChequeRecordsAll ... result = ", sendChequeHistoryPrefix, sendChequeHistoryPrefix+"_") + return result, nil } diff --git a/settlement/swap/vault/chequestore_test.go b/settlement/swap/vault/chequestore_test.go index 812fcedfb..3b0e1fbe5 100644 --- a/settlement/swap/vault/chequestore_test.go +++ b/settlement/swap/vault/chequestore_test.go @@ -68,7 +68,7 @@ func TestReceiveCheque(t *testing.T) { return issuer, nil }) - received, err := chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate) + received, err := chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate, TOKEN) if err != nil { t.Fatal(err) } @@ -81,7 +81,7 @@ func TestReceiveCheque(t *testing.T) { t.Fatalf("calculated wrong received cumulativePayout. wanted %d, got %d", cumulativePayout, received) } - lastCheque, err := chequestore.LastReceivedCheque(vaultAddress) + lastCheque, err := chequestore.LastReceivedCheque(vaultAddress, TOKEN) if err != nil { t.Fatal(err) } @@ -100,7 +100,7 @@ func TestReceiveCheque(t *testing.T) { } verifiedWithFactory = false - received, err = chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate) + received, err = chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate, TOKEN) if err != nil { t.Fatal(err) } @@ -142,7 +142,7 @@ func TestReceiveChequeInvalidBeneficiary(t *testing.T) { nil, ) - _, err := chequestore.ReceiveCheque(context.Background(), cheque, cumulativePayout) + _, err := chequestore.ReceiveCheque(context.Background(), cheque, cumulativePayout, TOKEN) if err == nil { t.Fatal("accepted cheque with wrong beneficiary") } @@ -188,7 +188,7 @@ func TestReceiveChequeInvalidAmount(t *testing.T) { Vault: vaultAddress, }, Signature: sig, - }, cumulativePayout) + }, cumulativePayout, TOKEN) if err != nil { t.Fatal(err) } @@ -200,7 +200,7 @@ func TestReceiveChequeInvalidAmount(t *testing.T) { Vault: vaultAddress, }, Signature: sig, - }, cumulativePayout) + }, cumulativePayout, TOKEN) if err == nil { t.Fatal("accepted lower amount cheque") } @@ -244,7 +244,7 @@ func TestReceiveChequeInvalidVault(t *testing.T) { Vault: vaultAddress, }, Signature: sig, - }, cumulativePayout) + }, cumulativePayout, TOKEN) if !errors.Is(err, vault.ErrNotDeployedByFactory) { t.Fatalf("wrong error. wanted %v, got %v", vault.ErrNotDeployedByFactory, err) } @@ -284,7 +284,7 @@ func TestReceiveChequeInvalidSignature(t *testing.T) { Vault: vaultAddress, }, Signature: sig, - }, cumulativePayout) + }, cumulativePayout, TOKEN) if !errors.Is(err, vault.ErrChequeInvalid) { t.Fatalf("wrong error. wanted %v, got %v", vault.ErrChequeInvalid, err) } @@ -326,7 +326,7 @@ func TestReceiveChequeInsufficientBalance(t *testing.T) { Vault: vaultAddress, }, Signature: sig, - }, cumulativePayout) + }, cumulativePayout, TOKEN) if !errors.Is(err, vault.ErrBouncingCheque) { t.Fatalf("wrong error. wanted %v, got %v", vault.ErrBouncingCheque, err) } @@ -368,7 +368,7 @@ func TestReceiveChequeSufficientBalancePaidOut(t *testing.T) { Vault: vaultAddress, }, Signature: sig, - }, cumulativePayout) + }, cumulativePayout, TOKEN) if err != nil { t.Fatal(err) } @@ -424,7 +424,7 @@ func TestReceiveChequeNotEnoughValue(t *testing.T) { return issuer, nil }) - _, err := chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate) + _, err := chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate, TOKEN) if err != nil { t.Fatalf("got wrong error. wanted nil, got %v", err) } @@ -485,7 +485,7 @@ func TestReceiveChequeNotEnoughValue2(t *testing.T) { return issuer, nil }) - _, err := chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate) + _, err := chequestore.ReceiveCheque(context.Background(), cheque, exchangeRate, TOKEN) if err != nil { t.Fatalf("got wrong error. wanted nil, got %v", err) } diff --git a/settlement/swap/vault/contract.go b/settlement/swap/vault/contract.go index 38bdfdaa4..73f30209d 100644 --- a/settlement/swap/vault/contract.go +++ b/settlement/swap/vault/contract.go @@ -2,6 +2,7 @@ package vault import ( "context" + "fmt" "math/big" "github.com/bittorrent/go-btfs/transaction" @@ -89,8 +90,8 @@ func (c *vaultContract) LiquidBalance(ctx context.Context) (*big.Int, error) { return abi.ConvertType(results[0], new(big.Int)).(*big.Int), nil } -func (c *vaultContract) PaidOut(ctx context.Context, address common.Address) (*big.Int, error) { - callData, err := vaultABI.Pack("paidOut", address) +func (c *vaultContract) PaidOut(ctx context.Context, beneficiary common.Address) (*big.Int, error) { + callData, err := vaultABI.Pack("paidOut", beneficiary) if err != nil { return nil, err } @@ -192,6 +193,25 @@ func (c *vaultContract) UpgradeTo(ctx context.Context, newImpl common.Address) ( return } +func (c *vaultContract) Withdraw(ctx context.Context, amount *big.Int) (common.Hash, error) { + callData, err := vaultABI.Pack("withdraw", amount) + if err != nil { + return common.Hash{}, err + } + + hash, err := c.transactionService.Send(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + Value: big.NewInt(0), + Description: fmt.Sprintf("vault withdrawal of %d WBTT", amount), + }) + if err != nil { + return hash, err + } + + return hash, nil +} + // GetVaultImpl queries the vault implementation used for the proxy func GetVaultImpl(ctx context.Context, vault common.Address, trxSvc transaction.Service) (vaultImpl common.Address, err error) { callData, err := vaultABI.Pack("implementation") @@ -215,3 +235,56 @@ func GetVaultImpl(ctx context.Context, vault common.Address, trxSvc transaction. vaultImpl = *abi.ConvertType(results[0], new(common.Address)).(*common.Address) return } + +func _CashCheque(ctx context.Context, vault, recipient common.Address, cheque *SignedCheque, tS transaction.Service) (common.Hash, error) { + fmt.Println("_CashCheque ", vault, recipient, cheque.CumulativePayout, cheque.Signature) + + callData, err := vaultABI.Pack("cashChequeBeneficiary", recipient, cheque.CumulativePayout, cheque.Signature) + if err != nil { + return common.Hash{}, err + } + request := &transaction.TxRequest{ + To: &vault, + Data: callData, + Value: big.NewInt(0), + Description: "cheque cashout", + } + + txHash, err := tS.Send(ctx, request) + if err != nil { + return common.Hash{}, err + } + + return txHash, nil +} + +func _PaidOut(ctx context.Context, vault, beneficiary common.Address, tS transaction.Service) (*big.Int, error) { + callData, err := vaultABINew.Pack("paidOut", beneficiary) + if err != nil { + return nil, err + } + + output, err := tS.Call(ctx, &transaction.TxRequest{ + To: &vault, + Data: callData, + }) + if err != nil { + return nil, err + } + + results, err := vaultABINew.Unpack("paidOut", output) + if err != nil { + return nil, err + } + + if len(results) != 1 { + return nil, errDecodeABI + } + + paidOut, ok := abi.ConvertType(results[0], new(big.Int)).(*big.Int) + if !ok || paidOut == nil { + return nil, errDecodeABI + } + + return paidOut, nil +} diff --git a/settlement/swap/vault/contract_muti.go b/settlement/swap/vault/contract_muti.go new file mode 100644 index 000000000..2c3145cd3 --- /dev/null +++ b/settlement/swap/vault/contract_muti.go @@ -0,0 +1,307 @@ +package vault + +import ( + "context" + "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" + "math/big" + + "github.com/bittorrent/go-btfs/transaction" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/common" +) + +type vaultContractMuti struct { + address common.Address + transactionService transaction.Service + contractWBTT *vaultContract +} + +func newVaultContractMuti(address common.Address, transactionService transaction.Service) *vaultContractMuti { + return &vaultContractMuti{ + address: address, + transactionService: transactionService, + contractWBTT: newVaultContract(address, transactionService), + } +} + +// Issuer (all the same) +func (c *vaultContractMuti) Issuer(ctx context.Context) (common.Address, error) { + callData, err := vaultABINew.Pack("issuer") + if err != nil { + return common.Address{}, err + } + + output, err := c.transactionService.Call(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return common.Address{}, err + } + + results, err := vaultABINew.Unpack("issuer", output) + if err != nil { + return common.Address{}, err + } + + return *abi.ConvertType(results[0], new(common.Address)).(*common.Address), nil +} + +// TotalBalance returns the token balance of the vault.(new) +func (c *vaultContractMuti) TotalBalance(ctx context.Context, token common.Address) (*big.Int, error) { + if tokencfg.IsWBTT(token) { + return c.contractWBTT.TotalBalance(ctx) + } + + callData, err := vaultABINew.Pack("totalbalanceOf", token) + if err != nil { + return nil, err + } + + output, err := c.transactionService.Call(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return nil, err + } + + results, err := vaultABINew.Unpack("totalbalanceOf", output) + if err != nil { + return nil, err + } + + return abi.ConvertType(results[0], new(big.Int)).(*big.Int), nil +} + +// LiquidBalance returns the token balance of the vault sub stake amount (not use) +func (c *vaultContractMuti) LiquidBalance(ctx context.Context) (*big.Int, error) { + callData, err := vaultABINew.Pack("liquidBalance") + if err != nil { + return nil, err + } + + output, err := c.transactionService.Call(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return nil, err + } + + results, err := vaultABINew.Unpack("liquidBalance", output) + if err != nil { + return nil, err + } + + return abi.ConvertType(results[0], new(big.Int)).(*big.Int), nil +} + +// PaidOut (new) +func (c *vaultContractMuti) PaidOut(ctx context.Context, beneficiary common.Address, token common.Address) (*big.Int, error) { + if tokencfg.IsWBTT(token) { + return c.contractWBTT.PaidOut(ctx, beneficiary) + } + + fmt.Println("multiTokensPaidOut ", token, beneficiary, c.address) + callData, err := vaultABINew.Pack("multiTokensPaidOut", token, beneficiary) + if err != nil { + return nil, err + } + + output, err := c.transactionService.Call(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return nil, err + } + + results, err := vaultABINew.Unpack("multiTokensPaidOut", output) + if err != nil { + return nil, err + } + + return abi.ConvertType(results[0], new(big.Int)).(*big.Int), nil +} + +// TotalPaidOut (new) +func (c *vaultContractMuti) TotalPaidOut(ctx context.Context, token common.Address) (*big.Int, error) { + if tokencfg.IsWBTT(token) { + return c.contractWBTT.TotalPaidOut(ctx) + } + + callData, err := vaultABINew.Pack("multiTokensTotalPaidOut", token) + if err != nil { + return nil, err + } + + output, err := c.transactionService.Call(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return nil, err + } + + results, err := vaultABINew.Unpack("multiTokensTotalPaidOut", output) + if err != nil { + return nil, err + } + + return abi.ConvertType(results[0], new(big.Int)).(*big.Int), nil +} + +// SetReceiver (not use) +func (c *vaultContractMuti) SetReceiver(ctx context.Context, newReceiver common.Address) (common.Hash, error) { + callData, err := vaultABINew.Pack("setReciever", newReceiver) + if err != nil { + return common.Hash{}, err + } + + hash, err := c.transactionService.Send(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return hash, err + } + + return hash, nil +} + +// Deposit (new) +func (c *vaultContractMuti) Deposit(ctx context.Context, amount *big.Int, token common.Address) (common.Hash, error) { + if tokencfg.IsWBTT(token) { + return c.contractWBTT.Deposit(ctx, amount) + } + + fmt.Println("1 Deposit ", token, amount) + callData, err := vaultABINew.Pack("multiTokenDeposit", token, amount) + fmt.Println("2 Deposit err", err) + if err != nil { + return common.Hash{}, err + } + + hash, err := c.transactionService.Send(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + fmt.Println("3 Deposit err", err) + if err != nil { + return hash, err + } + + return hash, nil +} + +// Withdraw (new) +func (c *vaultContractMuti) Withdraw(ctx context.Context, amount *big.Int, token common.Address) (common.Hash, error) { + if tokencfg.IsWBTT(token) { + return c.contractWBTT.Withdraw(ctx, amount) + } + + callData, err := vaultABINew.Pack("multiTokenWithdraw", token, amount) + if err != nil { + return common.Hash{}, err + } + + hash, err := c.transactionService.Send(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + Value: big.NewInt(0), + Description: fmt.Sprintf("vault multi withdraw of %d [%s]", amount, token), + }) + if err != nil { + return hash, err + } + + return hash, nil +} + +// UpgradeTo will upgrade the vault impl to `newImpl` (all the same) +func (c *vaultContractMuti) UpgradeTo(ctx context.Context, newImpl common.Address) (err error) { + callData, err := vaultABINew.Pack("upgradeTo", newImpl) + if err != nil { + return + } + txHash, err := c.transactionService.Send(ctx, &transaction.TxRequest{ + To: &c.address, + Data: callData, + }) + if err != nil { + return + } + + // wait tx finish + receipt, err := c.transactionService.WaitForReceipt(ctx, txHash) + if err != nil { + return + } + if receipt.Status != 1 { + return transaction.ErrTransactionReverted + } + return +} + +// _CashChequeMuti (new) +func _CashChequeMuti(ctx context.Context, vault, recipient common.Address, cheque *SignedCheque, tS transaction.Service, token common.Address) (common.Hash, error) { + if tokencfg.IsWBTT(token) { + return _CashCheque(ctx, vault, recipient, cheque, tS) + } + + callData, err := vaultABINew.Pack("multiTokenCashChequeBeneficiary", token, recipient, cheque.CumulativePayout, cheque.Signature) + if err != nil { + return common.Hash{}, err + } + request := &transaction.TxRequest{ + To: &vault, + Data: callData, + Value: big.NewInt(0), + Description: "cheque muti cashout", + } + + txHash, err := tS.Send(ctx, request) + if err != nil { + return common.Hash{}, err + } + + return txHash, nil +} + +// _PaidOutMuti (new) +func _PaidOutMuti(ctx context.Context, vault, beneficiary common.Address, tS transaction.Service, token common.Address) (*big.Int, error) { + if tokencfg.IsWBTT(token) { + return _PaidOut(ctx, vault, beneficiary, tS) + } + + callData, err := vaultABINew.Pack("multiTokensPaidOut", token, beneficiary) + if err != nil { + return nil, err + } + + output, err := tS.Call(ctx, &transaction.TxRequest{ + To: &vault, + Data: callData, + }) + if err != nil { + return nil, err + } + + results, err := vaultABINew.Unpack("multiTokensPaidOut", output) + if err != nil { + return nil, err + } + + if len(results) != 1 { + return nil, errDecodeABI + } + + paidOut, ok := abi.ConvertType(results[0], new(big.Int)).(*big.Int) + if !ok || paidOut == nil { + return nil, errDecodeABI + } + + return paidOut, nil +} diff --git a/settlement/swap/vault/init.go b/settlement/swap/vault/init.go index 112a29fd2..7d1cc3440 100644 --- a/settlement/swap/vault/init.go +++ b/settlement/swap/vault/init.go @@ -65,6 +65,7 @@ func Init( chequeSigner ChequeSigner, chequeStore ChequeStore, erc20Service erc20.Service, + mpErc20Service map[string]erc20.Service, ) (vaultService Service, err error) { // verify that the supplied factory is valid @@ -89,12 +90,20 @@ func Init( } // approve to vaultAddress - err = erc20tokenApprove(ctx, erc20Service, overlayEthAddress, vaultAddress) + err = erc20tokenApprove(ctx, "WBTT", erc20Service, overlayEthAddress, vaultAddress) if err != nil { return nil, err } - vaultService, err = New(transactionService, vaultAddress, overlayEthAddress, stateStore, chequeSigner, erc20Service, chequeStore) + // muti tokens + for tokenStr, erc20Svr := range mpErc20Service { + err = erc20tokenApprove(ctx, tokenStr, erc20Svr, overlayEthAddress, vaultAddress) + if err != nil { + return nil, err + } + } + + vaultService, err = New(transactionService, vaultAddress, overlayEthAddress, stateStore, chequeSigner, erc20Service, mpErc20Service, chequeStore) return vaultService, err } @@ -170,7 +179,7 @@ func deployVaultIfNotExist( return vaultAddress, err } -func erc20tokenApprove(ctx context.Context, erc20Service erc20.Service, issuer, vault common.Address) error { +func erc20tokenApprove(ctx context.Context, tokenStr string, erc20Service erc20.Service, issuer, vault common.Address) error { allowance, err := erc20Service.Allowance(ctx, issuer, vault) if err != nil { return err @@ -183,7 +192,7 @@ func erc20tokenApprove(ctx context.Context, erc20Service erc20.Service, issuer, if err != nil { return err } - log.Infof("approve WBTT to vault [0x%x] at tx [0x%x] \n", vault, hash) + log.Infof("approve %s to vault [0x%x] at tx [0x%x] \n", tokenStr, vault, hash) } return nil } diff --git a/settlement/swap/vault/mock/vault.go b/settlement/swap/vault/mock/vault.go index 7ef7b8751..e2dce5bc9 100644 --- a/settlement/swap/vault/mock/vault.go +++ b/settlement/swap/vault/mock/vault.go @@ -14,28 +14,28 @@ type Service struct { checkBalanceFunc func(bal *big.Int) (err error) getWithdrawTimeFunc func(ctx context.Context) (ti *big.Int, err error) liquidBalanceFunc func(ctx context.Context) (ti *big.Int, err error) - totalBalanceFunc func(ctx context.Context) (ti *big.Int, err error) - totalIssuedCountFunc func() (ti int, err error) - totalPaidOutFunc func(ctx context.Context) (ti *big.Int, err error) + totalBalanceFunc func(ctx context.Context, token common.Address) (ti *big.Int, err error) + totalIssuedCountFunc func(token common.Address) (ti int, err error) + totalPaidOutFunc func(ctx context.Context, token common.Address) (ti *big.Int, err error) wbttBalanceFunc func(ctx context.Context, add common.Address) (bal *big.Int, err error) waitForDepositFunc func(ctx context.Context, txHash common.Hash) error - totalIssuedFunc func() (*big.Int, error) - totalReceivedCashedCountFunc func() (int, error) - totalReceivedCashedFunc func() (*big.Int, error) - totalDailyReceivedFunc func() (*big.Int, error) - totalDailyReceivedCashedFunc func() (*big.Int, error) + totalIssuedFunc func(common.Address) (*big.Int, error) + totalReceivedCashedCountFunc func(token common.Address) (int, error) + totalReceivedCashedFunc func(token common.Address) (*big.Int, error) + totalDailyReceivedFunc func(common.Address) (*big.Int, error) + totalDailyReceivedCashedFunc func(common.Address) (*big.Int, error) vaultBalanceFunc func(context.Context) (*big.Int, error) - vaultAvailableBalanceFunc func(context.Context) (*big.Int, error) + vaultAvailableBalanceFunc func(context.Context, common.Address) (*big.Int, error) vaultAddressFunc func() common.Address - vaultIssueFunc func(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc vault.SendChequeFunc) (*big.Int, error) - vaultWithdrawFunc func(ctx context.Context, amount *big.Int) (hash common.Hash, err error) - vaultDepositFunc func(ctx context.Context, amount *big.Int) (hash common.Hash, err error) - lastChequeFunc func(common.Address) (*vault.SignedCheque, error) - lastChequesFunc func() (map[common.Address]*vault.SignedCheque, error) + vaultIssueFunc func(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc vault.SendChequeFunc) (*big.Int, error) + vaultWithdrawFunc func(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) + vaultDepositFunc func(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) + lastChequeFunc func(common.Address, common.Address) (*vault.SignedCheque, error) + lastChequesFunc func(common.Address) (map[common.Address]*vault.SignedCheque, error) bttBalanceFunc func(context.Context) (*big.Int, error) - totalReceivedFunc func() (*big.Int, error) - totalReceivedCountFunc func() (int, error) + totalReceivedFunc func(token common.Address) (*big.Int, error) + totalReceivedCountFunc func(token common.Address) (int, error) } // WithVault*Functions set the mock vault functions @@ -45,7 +45,7 @@ func WithVaultBalanceFunc(f func(ctx context.Context) (*big.Int, error)) Option }) } -func WithVaultAvailableBalanceFunc(f func(ctx context.Context) (*big.Int, error)) Option { +func WithVaultAvailableBalanceFunc(f func(ctx context.Context, token common.Address) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.vaultAvailableBalanceFunc = f }) @@ -57,43 +57,43 @@ func WithVaultAddressFunc(f func() common.Address) Option { }) } -func WithVaultDepositFunc(f func(ctx context.Context, amount *big.Int) (hash common.Hash, err error)) Option { +func WithVaultDepositFunc(f func(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error)) Option { return optionFunc(func(s *Service) { s.vaultDepositFunc = f }) } -func WithVaultIssueFunc(f func(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc vault.SendChequeFunc) (*big.Int, error)) Option { +func WithVaultIssueFunc(f func(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc vault.SendChequeFunc) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.vaultIssueFunc = f }) } -func WithVaultWithdrawFunc(f func(ctx context.Context, amount *big.Int) (hash common.Hash, err error)) Option { +func WithVaultWithdrawFunc(f func(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error)) Option { return optionFunc(func(s *Service) { s.vaultWithdrawFunc = f }) } -func WithLastChequeFunc(f func(beneficiary common.Address) (*vault.SignedCheque, error)) Option { +func WithLastChequeFunc(f func(beneficiary common.Address, token common.Address) (*vault.SignedCheque, error)) Option { return optionFunc(func(s *Service) { s.lastChequeFunc = f }) } -func WithLastChequesFunc(f func() (map[common.Address]*vault.SignedCheque, error)) Option { +func WithLastChequesFunc(f func(token common.Address) (map[common.Address]*vault.SignedCheque, error)) Option { return optionFunc(func(s *Service) { s.lastChequesFunc = f }) } -func WithTotalReceivedFunc(f func() (*big.Int, error)) Option { +func WithTotalReceivedFunc(f func(token common.Address) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.totalReceivedFunc = f }) } -func WithTotalReceivedCountFunc(f func() (int, error)) Option { +func WithTotalReceivedCountFunc(f func(token common.Address) (int, error)) Option { return optionFunc(func(s *Service) { s.totalReceivedCountFunc = f }) @@ -117,19 +117,19 @@ func WithLiquidBalanceFunc(f func(ctx context.Context) (ti *big.Int, err error)) }) } -func WithTotalBalanceFunc(f func(ctx context.Context) (ti *big.Int, err error)) Option { +func WithTotalBalanceFunc(f func(ctx context.Context, token common.Address) (ti *big.Int, err error)) Option { return optionFunc(func(s *Service) { s.totalBalanceFunc = f }) } -func WithTotalIssuedCountFunc(f func() (int, error)) Option { +func WithTotalIssuedCountFunc(f func(token common.Address) (int, error)) Option { return optionFunc(func(s *Service) { s.totalIssuedCountFunc = f }) } -func WithTotalPaidOutFunc(f func(ctx context.Context) (ti *big.Int, err error)) Option { +func WithTotalPaidOutFunc(f func(ctx context.Context, token common.Address) (ti *big.Int, err error)) Option { return optionFunc(func(s *Service) { s.totalPaidOutFunc = f }) @@ -147,31 +147,31 @@ func WithWaitForDepositFunc(f func(ctx context.Context, txHash common.Hash) erro }) } -func WithTotalIssuedFunc(f func() (*big.Int, error)) Option { +func WithTotalIssuedFunc(f func(token common.Address) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.totalIssuedFunc = f }) } -func WithTotalReceivedCashedCountFunc(f func() (int, error)) Option { +func WithTotalReceivedCashedCountFunc(f func(token common.Address) (int, error)) Option { return optionFunc(func(s *Service) { s.totalReceivedCashedCountFunc = f }) } -func WithTotalReceivedCashedFunc(f func() (*big.Int, error)) Option { +func WithTotalReceivedCashedFunc(f func(token common.Address) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.totalReceivedCashedFunc = f }) } -func WithTotalDailyReceivedFunc(f func() (*big.Int, error)) Option { +func WithTotalDailyReceivedFunc(f func(token common.Address) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.totalDailyReceivedFunc = f }) } -func WithTotalDailyReceivedCashedFunc(f func() (*big.Int, error)) Option { +func WithTotalDailyReceivedCashedFunc(f func(token common.Address) (*big.Int, error)) Option { return optionFunc(func(s *Service) { s.totalDailyReceivedCashedFunc = f }) @@ -186,6 +186,10 @@ func NewVault(opts ...Option) vault.Service { return mock } +func (s *Service) TokenBalanceOf(ctx context.Context, addr common.Address, tokenStr string) (*big.Int, error) { + return nil, errors.New("vaultMock.TokenBalanceOf not implemented") +} + // Balance mocks the vault .Balance function func (s *Service) Balance(ctx context.Context) (bal *big.Int, err error) { if s.vaultBalanceFunc != nil { @@ -222,23 +226,23 @@ func (s *Service) LiquidBalance(ctx context.Context) (ti *big.Int, err error) { return nil, errors.New("vaultMock.liquidBalanceFunc not implemented") } -func (s *Service) TotalBalance(ctx context.Context) (ti *big.Int, err error) { +func (s *Service) TotalBalance(ctx context.Context, token common.Address) (ti *big.Int, err error) { if s.totalBalanceFunc != nil { - return s.totalBalanceFunc(ctx) + return s.totalBalanceFunc(ctx, token) } return nil, errors.New("vaultMock.totalBalanceFunc not implemented") } -func (s *Service) TotalIssuedCount() (ti int, err error) { +func (s *Service) TotalIssuedCount(token common.Address) (ti int, err error) { if s.totalIssuedCountFunc != nil { - return s.totalIssuedCountFunc() + return s.totalIssuedCountFunc(token) } return 0, errors.New("vaultMock.totalIssuedCountFunc not implemented") } -func (s *Service) TotalPaidOut(ctx context.Context) (ti *big.Int, err error) { +func (s *Service) TotalPaidOut(ctx context.Context, token common.Address) (ti *big.Int, err error) { if s.totalPaidOutFunc != nil { - return s.totalPaidOutFunc(ctx) + return s.totalPaidOutFunc(ctx, token) } return nil, errors.New("vaultMock.totalPaidOutFunc not implemented") } @@ -250,17 +254,17 @@ func (s *Service) WBTTBalanceOf(ctx context.Context, add common.Address) (bal *b return nil, errors.New("vaultMock.wbttBalanceFunc not implemented") } -func (s *Service) AvailableBalance(ctx context.Context) (bal *big.Int, err error) { +func (s *Service) AvailableBalance(ctx context.Context, token common.Address) (bal *big.Int, err error) { if s.vaultAvailableBalanceFunc != nil { - return s.vaultAvailableBalanceFunc(ctx) + return s.vaultAvailableBalanceFunc(ctx, token) } return nil, errors.New("vaultMock.vaultAvailableBalanceFunc not implemented") } // Deposit mocks the vault .Deposit function -func (s *Service) Deposit(ctx context.Context, amount *big.Int) (hash common.Hash, err error) { +func (s *Service) Deposit(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) { if s.vaultDepositFunc != nil { - return s.vaultDepositFunc(ctx, amount) + return s.vaultDepositFunc(ctx, amount, token) } return common.Hash{}, errors.New("vaultMock.vaultDepositFunc not implemented") } @@ -280,78 +284,78 @@ func (s *Service) Address() common.Address { return common.Address{} } -func (s *Service) Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc vault.SendChequeFunc) (*big.Int, error) { +func (s *Service) Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc vault.SendChequeFunc) (*big.Int, error) { if s.vaultIssueFunc != nil { - return s.vaultIssueFunc(ctx, beneficiary, amount, sendChequeFunc) + return s.vaultIssueFunc(ctx, beneficiary, amount, token, sendChequeFunc) } return nil, errors.New("vaultMock.vaultIssueFunc not implemented") } -func (s *Service) LastCheque(beneficiary common.Address) (*vault.SignedCheque, error) { +func (s *Service) LastCheque(beneficiary common.Address, token common.Address) (*vault.SignedCheque, error) { if s.lastChequeFunc != nil { - return s.lastChequeFunc(beneficiary) + return s.lastChequeFunc(beneficiary, token) } return nil, errors.New("vaultMock.lastChequeFunc not implemented") } -func (s *Service) LastCheques() (map[common.Address]*vault.SignedCheque, error) { +func (s *Service) LastCheques(token common.Address) (map[common.Address]*vault.SignedCheque, error) { if s.lastChequesFunc != nil { - return s.lastChequesFunc() + return s.lastChequesFunc(token) } return nil, errors.New("vaultMock.lastChequesFunc not implemented") } -func (s *Service) Withdraw(ctx context.Context, amount *big.Int) (hash common.Hash, err error) { +func (s *Service) Withdraw(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) { if s.vaultWithdrawFunc != nil { - return s.vaultWithdrawFunc(ctx, amount) + return s.vaultWithdrawFunc(ctx, amount, token) } return common.Hash{}, errors.New("vaultMock.vaultWithdrawFunc not implemented") } -func (s *Service) TotalIssued() (*big.Int, error) { +func (s *Service) TotalIssued(token common.Address) (*big.Int, error) { if s.totalIssuedFunc != nil { - return s.totalIssuedFunc() + return s.totalIssuedFunc(token) } return nil, errors.New("vaultMock.totalIssuedFunc not implemented") } -func (s *Service) TotalReceived() (*big.Int, error) { +func (s *Service) TotalReceived(token common.Address) (*big.Int, error) { if s.totalReceivedFunc != nil { - return s.totalReceivedFunc() + return s.totalReceivedFunc(token) } return nil, errors.New("vaultMock.totalReceivedFunc not implemented") } -func (s *Service) TotalReceivedCount() (int, error) { +func (s *Service) TotalReceivedCount(token common.Address) (int, error) { if s.totalReceivedCountFunc != nil { - return s.totalReceivedCountFunc() + return s.totalReceivedCountFunc(token) } return 0, errors.New("vaultMock.totalReceivedCountFunc not implemented") } -func (s *Service) TotalReceivedCashedCount() (int, error) { +func (s *Service) TotalReceivedCashedCount(token common.Address) (int, error) { if s.totalReceivedCashedCountFunc != nil { - return s.totalReceivedCashedCountFunc() + return s.totalReceivedCashedCountFunc(token) } return 0, errors.New("vaultMock.totalReceivedCashedCountFunc not implemented") } -func (s *Service) TotalReceivedCashed() (*big.Int, error) { +func (s *Service) TotalReceivedCashed(token common.Address) (*big.Int, error) { if s.totalReceivedCashedFunc != nil { - return s.totalReceivedCashedFunc() + return s.totalReceivedCashedFunc(token) } return nil, errors.New("vaultMock.totalReceivedCashedFunc not implemented") } -func (s *Service) TotalDailyReceived() (*big.Int, error) { +func (s *Service) TotalDailyReceived(token common.Address) (*big.Int, error) { if s.totalDailyReceivedFunc != nil { - return s.totalDailyReceivedFunc() + return s.totalDailyReceivedFunc(token) } return nil, errors.New("vaultMock.totalDailyReceivedFunc not implemented") } -func (s *Service) TotalDailyReceivedCashed() (*big.Int, error) { +func (s *Service) TotalDailyReceivedCashed(token common.Address) (*big.Int, error) { if s.totalDailyReceivedCashedFunc != nil { - return s.totalDailyReceivedCashedFunc() + return s.totalDailyReceivedCashedFunc(token) } return nil, errors.New("vaultMock.totalDailyReceivedCashedFunc not implemented") } diff --git a/settlement/swap/vault/vault.go b/settlement/swap/vault/vault.go index af2601fa0..ce3a74991 100644 --- a/settlement/swap/vault/vault.go +++ b/settlement/swap/vault/vault.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "math/big" "strings" "sync" @@ -13,7 +14,6 @@ import ( "github.com/bittorrent/go-btfs/statestore" "github.com/bittorrent/go-btfs/transaction" "github.com/bittorrent/go-btfs/transaction/storage" - "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" ) @@ -32,50 +32,53 @@ var ( // ErrInsufficientFunds is the error when the vault has not enough free funds for a user action ErrInsufficientFunds = errors.New("insufficient token balance") - vaultABI = transaction.ParseABIUnchecked(conabi.VaultABI) - chequeCashedEventType = vaultABI.Events["ChequeCashed"] - chequeBouncedEventType = vaultABI.Events["ChequeBounced"] + vaultABI = transaction.ParseABIUnchecked(conabi.VaultABI) + vaultABINew = transaction.ParseABIUnchecked(conabi.MutiVaultABI2) + chequeCashedEventType = vaultABI.Events["ChequeCashed"] + mutiChequeCashedEventType = vaultABINew.Events["MultiTokenChequeCashed"] + chequeBouncedEventType = vaultABI.Events["ChequeBounced"] + mutiChequeBouncedEventType = vaultABINew.Events["MultiTokenChequeBounced"] ) // Service is the main interface for interacting with the nodes vault. type Service interface { // Deposit starts depositing erc20 token into the vault. This returns once the transactions has been broadcast. - Deposit(ctx context.Context, amount *big.Int) (hash common.Hash, err error) + Deposit(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) // Withdraw starts withdrawing erc20 token from the vault. This returns once the transactions has been broadcast. - Withdraw(ctx context.Context, amount *big.Int) (hash common.Hash, err error) + Withdraw(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) // WaitForDeposit waits for the deposit transaction to confirm and verifies the result. WaitForDeposit(ctx context.Context, txHash common.Hash) error // TotalBalance returns the token balance of the vault. - TotalBalance(ctx context.Context) (*big.Int, error) + TotalBalance(ctx context.Context, token common.Address) (*big.Int, error) // TotalIssuedCount returns total issued count of the vault. - TotalIssuedCount() (int, error) - TotalIssued() (*big.Int, error) - TotalReceivedCount() (int, error) - TotalReceivedCashedCount() (int, error) - TotalReceived() (*big.Int, error) - TotalReceivedCashed() (*big.Int, error) - TotalDailyReceived() (*big.Int, error) - TotalDailyReceivedCashed() (*big.Int, error) - // LiquidBalance returns the token balance of the vault sub stake amount. + TotalIssuedCount(token common.Address) (int, error) + TotalIssued(token common.Address) (*big.Int, error) + TotalReceivedCount(token common.Address) (int, error) + TotalReceivedCashedCount(token common.Address) (int, error) + TotalReceived(token common.Address) (*big.Int, error) + TotalReceivedCashed(token common.Address) (*big.Int, error) + TotalDailyReceived(token common.Address) (*big.Int, error) + TotalDailyReceivedCashed(token common.Address) (*big.Int, error) + // LiquidBalance returns the token balance of the vault sub stake amount. (not use) LiquidBalance(ctx context.Context) (*big.Int, error) // AvailableBalance returns the token balance of the vault which is not yet used for uncashed cheques. - AvailableBalance(ctx context.Context) (*big.Int, error) + AvailableBalance(ctx context.Context, token common.Address) (*big.Int, error) // Address returns the address of the used vault contract. Address() common.Address // Issue a new cheque for the beneficiary with an cumulativePayout amount higher than the last. - Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc SendChequeFunc) (*big.Int, error) + Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc SendChequeFunc) (*big.Int, error) // LastCheque returns the last cheque we issued for the beneficiary. - LastCheque(beneficiary common.Address) (*SignedCheque, error) + LastCheque(beneficiary common.Address, token common.Address) (*SignedCheque, error) // LastCheques returns the last cheques we issued for all beneficiaries. - LastCheques() (map[common.Address]*SignedCheque, error) - // GetWithdrawTime returns the time can withdraw - GetWithdrawTime(ctx context.Context) (*big.Int, error) + LastCheques(token common.Address) (map[common.Address]*SignedCheque, error) // WbttBalanceOf retrieve the addr balance WBTTBalanceOf(ctx context.Context, addr common.Address) (*big.Int, error) + // TokenBalanceOf retrieve the addr balance + TokenBalanceOf(ctx context.Context, addr common.Address, tokenStr string) (*big.Int, error) // BTTBalanceOf retrieve the btt balance of addr BTTBalanceOf(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error) // TotalPaidOut return total pay out of the vault - TotalPaidOut(ctx context.Context) (*big.Int, error) + TotalPaidOut(ctx context.Context, token common.Address) (*big.Int, error) // CheckBalance CheckBalance(amount *big.Int) (err error) // UpgradeTo will upgrade vault implementation to `newVaultImpl` @@ -87,30 +90,34 @@ type service struct { transactionService transaction.Service address common.Address - contract *vaultContract + contract *vaultContractMuti ownerAddress common.Address - erc20Service erc20.Service + erc20Service erc20.Service + mpErc20Service map[string]erc20.Service - store storage.StateStorer - chequeSigner ChequeSigner - totalIssuedReserved *big.Int - chequeStore ChequeStore + store storage.StateStorer + chequeSigner ChequeSigner + //totalIssuedReserved *big.Int // replace it with mpTotalIssuedReserved + mpTotalIssuedReserved map[string]*big.Int + chequeStore ChequeStore } // New creates a new vault service for the provided vault contract. func New(transactionService transaction.Service, address, ownerAddress common.Address, store storage.StateStorer, - chequeSigner ChequeSigner, erc20Service erc20.Service, chequeStore ChequeStore) (Service, error) { + chequeSigner ChequeSigner, erc20Service erc20.Service, mpErc20Service map[string]erc20.Service, chequeStore ChequeStore) (Service, error) { return &service{ - transactionService: transactionService, - address: address, - contract: newVaultContract(address, transactionService), - ownerAddress: ownerAddress, - erc20Service: erc20Service, - store: store, - chequeSigner: chequeSigner, - totalIssuedReserved: big.NewInt(0), - chequeStore: chequeStore, + transactionService: transactionService, + address: address, + contract: newVaultContractMuti(address, transactionService), + ownerAddress: ownerAddress, + erc20Service: erc20Service, + mpErc20Service: mpErc20Service, + store: store, + chequeSigner: chequeSigner, + //totalIssuedReserved: big.NewInt(0), + mpTotalIssuedReserved: map[string]*big.Int{}, + chequeStore: chequeStore, }, nil } @@ -120,18 +127,19 @@ func (s *service) Address() common.Address { } // Deposit starts depositing erc20 token into the vault. This returns once the transactions has been broadcast. -func (s *service) Deposit(ctx context.Context, amount *big.Int) (hash common.Hash, err error) { - balance, err := s.erc20Service.BalanceOf(ctx, s.ownerAddress) - if err != nil { - return common.Hash{}, err - } - - // check we can afford this so we don't waste gas - if balance.Cmp(amount) < 0 { - return common.Hash{}, ErrInsufficientFunds - } +func (s *service) Deposit(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) { + //balance, err := s.erc20Service.BalanceOf(ctx, s.ownerAddress) + //if err != nil { + // return common.Hash{}, err + //} + // + //fmt.Println("Deposit ", balance.String(), amount.String()) + //// check we can afford this so we don't waste gas + //if balance.Cmp(amount) < 0 { + // return common.Hash{}, ErrInsufficientFunds + //} - return s.contract.Deposit(ctx, amount) + return s.contract.Deposit(ctx, amount, token) } // Deposit starts depositing erc20 token into the vault. This returns once the transactions has been broadcast. @@ -150,28 +158,28 @@ func (s *service) CheckBalance(amount *big.Int) (err error) { } // Balance returns the token balance of the vault. -func (s *service) TotalBalance(ctx context.Context) (*big.Int, error) { - return s.contract.TotalBalance(ctx) +func (s *service) TotalBalance(ctx context.Context, token common.Address) (*big.Int, error) { + return s.contract.TotalBalance(ctx, token) } -// LiquidBalance returns the token balance of the vault sub stake amount. +// LiquidBalance returns the token balance of the vault sub stake amount.(not use) func (s *service) LiquidBalance(ctx context.Context) (*big.Int, error) { return s.contract.LiquidBalance(ctx) } // AvailableBalance returns the token balance of the vault which is not yet used for uncashed cheques. -func (s *service) AvailableBalance(ctx context.Context) (*big.Int, error) { - totalIssued, err := s.totalIssued() +func (s *service) AvailableBalance(ctx context.Context, token common.Address) (*big.Int, error) { + totalIssued, err := s.totalIssued(token) if err != nil { return nil, err } - balance, err := s.TotalBalance(ctx) + balance, err := s.TotalBalance(ctx, token) if err != nil { return nil, err } - totalPaidOut, err := s.contract.TotalPaidOut(ctx) + totalPaidOut, err := s.contract.TotalPaidOut(ctx, token) if err != nil { return nil, err } @@ -184,8 +192,8 @@ func (s *service) AvailableBalance(ctx context.Context) (*big.Int, error) { } // total send cheque count. returns the token balance of the vault which is not yet used for uncashed cheques. -func (s *service) TotalIssuedCount() (int, error) { - totalIssuedCount, err := s.totalIssuedCount() +func (s *service) TotalIssuedCount(token common.Address) (int, error) { + totalIssuedCount, err := s.totalIssuedCount(token) if err != nil { return 0, err } @@ -193,33 +201,33 @@ func (s *service) TotalIssuedCount() (int, error) { return totalIssuedCount, nil } -func (s *service) TotalIssued() (*big.Int, error) { - return s.totalIssued() +func (s *service) TotalIssued(token common.Address) (*big.Int, error) { + return s.totalIssued(token) } // total recevied cheque count. -func (s *service) TotalReceivedCount() (int, error) { - return s.totalReceivedCount() +func (s *service) TotalReceivedCount(token common.Address) (int, error) { + return s.totalReceivedCount(token) } -func (s *service) TotalReceivedCashedCount() (int, error) { - return s.totalReceivedCashedCount() +func (s *service) TotalReceivedCashedCount(token common.Address) (int, error) { + return s.totalReceivedCashedCount(token) } -func (s *service) TotalReceived() (*big.Int, error) { - return s.totalReceived() +func (s *service) TotalReceived(token common.Address) (*big.Int, error) { + return s.totalReceived(token) } -func (s *service) TotalReceivedCashed() (*big.Int, error) { - return s.totalReceivedCashed() +func (s *service) TotalReceivedCashed(token common.Address) (*big.Int, error) { + return s.totalReceivedCashed(token) } -func (s *service) TotalDailyReceived() (*big.Int, error) { - return s.totalDailyReceived() +func (s *service) TotalDailyReceived(token common.Address) (*big.Int, error) { + return s.totalDailyReceived(token) } -func (s *service) TotalDailyReceivedCashed() (*big.Int, error) { - return s.totalDailyReceivedCashed() +func (s *service) TotalDailyReceivedCashed(token common.Address) (*big.Int, error) { + return s.totalDailyReceivedCashed(token) } // WaitForDeposit waits for the deposit transaction to confirm and verifies the result. @@ -237,44 +245,57 @@ func (s *service) WaitForDeposit(ctx context.Context, txHash common.Hash) error } // lastIssuedChequeKey computes the key where to store the last cheque for a beneficiary. -func lastIssuedChequeKey(beneficiary common.Address) string { - return fmt.Sprintf("%s%x", lastIssuedChequeKeyPrefix, beneficiary) +func lastIssuedChequeKey(beneficiary common.Address, token common.Address) string { + return fmt.Sprintf("%s%x", tokencfg.AddToken(lastIssuedChequeKeyPrefix, token), beneficiary) } -func (s *service) reserveTotalIssued(ctx context.Context, amount *big.Int) (*big.Int, error) { - availableBalance, err := s.AvailableBalance(ctx) +func (s *service) reserveTotalIssued(ctx context.Context, amount *big.Int, token common.Address) (*big.Int, error) { + availableBalance, err := s.AvailableBalance(ctx, token) if err != nil { return nil, err } - if amount.Cmp(big.NewInt(0).Sub(availableBalance, s.totalIssuedReserved)) > 0 { + tokenString := token.String() + _, ok := s.mpTotalIssuedReserved[tokenString] + if !ok { + s.mpTotalIssuedReserved[tokenString] = big.NewInt(0) + } + + if amount.Cmp(big.NewInt(0).Sub(availableBalance, s.mpTotalIssuedReserved[tokenString])) > 0 { return nil, ErrOutOfFunds } - s.totalIssuedReserved = s.totalIssuedReserved.Add(s.totalIssuedReserved, amount) + s.mpTotalIssuedReserved[tokenString] = s.mpTotalIssuedReserved[tokenString].Add(s.mpTotalIssuedReserved[tokenString], amount) return big.NewInt(0).Sub(availableBalance, amount), nil } -func (s *service) unreserveTotalIssued(amount *big.Int) { - s.totalIssuedReserved = s.totalIssuedReserved.Sub(s.totalIssuedReserved, amount) +func (s *service) unreserveTotalIssued(amount *big.Int, token common.Address) { + tokenString := token.String() + _, ok := s.mpTotalIssuedReserved[tokenString] + if !ok { + s.mpTotalIssuedReserved[tokenString] = big.NewInt(0) + } + s.mpTotalIssuedReserved[tokenString] = s.mpTotalIssuedReserved[tokenString].Sub(s.mpTotalIssuedReserved[tokenString], amount) } // Issue issues a new cheque and passes it to sendChequeFunc. // The cheque is considered sent and saved when sendChequeFunc succeeds. // The available balance which is available after sending the cheque is passed // to the caller for it to be communicated over metrics. -func (s *service) Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, sendChequeFunc SendChequeFunc) (*big.Int, error) { +func (s *service) Issue(ctx context.Context, beneficiary common.Address, amount *big.Int, token common.Address, sendChequeFunc SendChequeFunc) (*big.Int, error) { s.lock.Lock() defer s.lock.Unlock() - availableBalance, err := s.reserveTotalIssued(ctx, amount) + fmt.Println("begin send cheque: Issue ... 1") + + availableBalance, err := s.reserveTotalIssued(ctx, amount, token) if err != nil { return nil, err } - defer s.unreserveTotalIssued(amount) + defer s.unreserveTotalIssued(amount, token) var cumulativePayout *big.Int - lastCheque, err := s.LastCheque(beneficiary) + lastCheque, err := s.LastCheque(beneficiary, token) if err != nil { if err != ErrNoCheque { return nil, err @@ -283,22 +304,25 @@ func (s *service) Issue(ctx context.Context, beneficiary common.Address, amount } else { cumulativePayout = lastCheque.CumulativePayout } - + fmt.Println("begin send cheque: Issue ... 2") // increase cumulativePayout by amount cumulativePayout = cumulativePayout.Add(cumulativePayout, amount) // create and sign the new cheque cheque := Cheque{ + Token: token, Vault: s.address, CumulativePayout: cumulativePayout, Beneficiary: beneficiary, } sig, err := s.chequeSigner.Sign(&Cheque{ + Token: token, Vault: s.address, CumulativePayout: cumulativePayout, Beneficiary: beneficiary, }) + fmt.Println("begin send cheque: Issue ... 2.1", sig, err) if err != nil { return nil, err } @@ -308,44 +332,45 @@ func (s *service) Issue(ctx context.Context, beneficiary common.Address, amount Cheque: cheque, Signature: sig, }) + fmt.Println("begin send cheque: Issue ... 2.2", err) if err != nil { return nil, err } - - err = s.store.Put(lastIssuedChequeKey(beneficiary), cheque) + fmt.Println("begin send cheque: Issue ... 3") + err = s.store.Put(lastIssuedChequeKey(beneficiary, token), cheque) if err != nil { return nil, err } // store the history issued cheque - err = s.chequeStore.StoreSendChequeRecord(s.address, beneficiary, amount) + err = s.chequeStore.StoreSendChequeRecord(s.address, beneficiary, amount, token) if err != nil { return nil, err } // total issued count - totalIssuedCount, err := s.totalIssuedCount() + totalIssuedCount, err := s.totalIssuedCount(token) if err != nil { return nil, err } totalIssuedCount = totalIssuedCount + 1 - err = s.store.Put(totalIssuedCountKey, totalIssuedCount) + err = s.store.Put(tokencfg.AddToken(totalIssuedCountKey, token), totalIssuedCount) if err != nil { return nil, err } - + fmt.Println("begin send cheque: Issue ... 4") // totalIssued - totalIssued, err := s.totalIssued() + totalIssued, err := s.totalIssued(token) if err != nil { return nil, err } totalIssued = totalIssued.Add(totalIssued, amount) - return availableBalance, s.store.Put(totalIssuedKey, totalIssued) + return availableBalance, s.store.Put(tokencfg.AddToken(totalIssuedKey, token), totalIssued) } // returns the total amount in cheques issued so far -func (s *service) totalIssued() (totalIssued *big.Int, err error) { - err = s.store.Get(totalIssuedKey, &totalIssued) +func (s *service) totalIssued(token common.Address) (totalIssued *big.Int, err error) { + err = s.store.Get(tokencfg.AddToken(totalIssuedKey, token), &totalIssued) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -356,8 +381,8 @@ func (s *service) totalIssued() (totalIssued *big.Int, err error) { } // returns the total count in cheques issued so far -func (s *service) totalIssuedCount() (totalIssuedCount int, err error) { - err = s.store.Get(totalIssuedCountKey, &totalIssuedCount) +func (s *service) totalIssuedCount(token common.Address) (totalIssuedCount int, err error) { + err = s.store.Get(tokencfg.AddToken(totalIssuedCountKey, token), &totalIssuedCount) if err != nil { if err != storage.ErrNotFound { return 0, err @@ -368,8 +393,8 @@ func (s *service) totalIssuedCount() (totalIssuedCount int, err error) { } // returns the total amount in cheques recieved so far -func (s *service) totalReceived() (totalReceived *big.Int, err error) { - err = s.store.Get(statestore.TotalReceivedKey, &totalReceived) +func (s *service) totalReceived(token common.Address) (totalReceived *big.Int, err error) { + err = s.store.Get(tokencfg.AddToken(statestore.TotalReceivedKey, token), &totalReceived) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -379,8 +404,8 @@ func (s *service) totalReceived() (totalReceived *big.Int, err error) { return totalReceived, nil } -func (s *service) totalReceivedCashed() (totalReceived *big.Int, err error) { - err = s.store.Get(statestore.TotalReceivedCashedKey, &totalReceived) +func (s *service) totalReceivedCashed(token common.Address) (totalReceived *big.Int, err error) { + err = s.store.Get(tokencfg.AddToken(statestore.TotalReceivedCashedKey, token), &totalReceived) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -391,9 +416,9 @@ func (s *service) totalReceivedCashed() (totalReceived *big.Int, err error) { } // returns the total amount in cheques recieved so far -func (s *service) totalDailyReceived() (totalReceived *big.Int, err error) { +func (s *service) totalDailyReceived(token common.Address) (totalReceived *big.Int, err error) { var stat DailyReceivedStats - err = s.store.Get(statestore.GetTodayTotalDailyReceivedKey(), &stat) + err = s.store.Get(statestore.GetTodayTotalDailyReceivedKey(token), &stat) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -403,8 +428,8 @@ func (s *service) totalDailyReceived() (totalReceived *big.Int, err error) { return stat.Amount, nil } -func (s *service) totalDailyReceivedCashed() (totalReceived *big.Int, err error) { - err = s.store.Get(statestore.GetTodayTotalDailyReceivedCashedKey(), &totalReceived) +func (s *service) totalDailyReceivedCashed(token common.Address) (totalReceived *big.Int, err error) { + err = s.store.Get(statestore.GetTodayTotalDailyReceivedCashedKey(token), &totalReceived) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -415,8 +440,8 @@ func (s *service) totalDailyReceivedCashed() (totalReceived *big.Int, err error) } // returns the total count in cheques recieved so far -func (s *service) totalReceivedCount() (totalReceivedCount int, err error) { - err = s.store.Get(statestore.TotalReceivedCountKey, &totalReceivedCount) +func (s *service) totalReceivedCount(token common.Address) (totalReceivedCount int, err error) { + err = s.store.Get(tokencfg.AddToken(statestore.TotalReceivedCountKey, token), &totalReceivedCount) if err != nil { if err != storage.ErrNotFound { return 0, err @@ -426,8 +451,8 @@ func (s *service) totalReceivedCount() (totalReceivedCount int, err error) { return totalReceivedCount, nil } -func (s *service) totalReceivedCashedCount() (totalReceivedCount int, err error) { - err = s.store.Get(statestore.TotalReceivedCashedCountKey, &totalReceivedCount) +func (s *service) totalReceivedCashedCount(token common.Address) (totalReceivedCount int, err error) { + err = s.store.Get(tokencfg.AddToken(statestore.TotalReceivedCashedCountKey, token), &totalReceivedCount) if err != nil { if err != storage.ErrNotFound { return 0, err @@ -438,9 +463,9 @@ func (s *service) totalReceivedCashedCount() (totalReceivedCount int, err error) } // LastCheque returns the last cheque we issued for the beneficiary. -func (s *service) LastCheque(beneficiary common.Address) (*SignedCheque, error) { +func (s *service) LastCheque(beneficiary common.Address, token common.Address) (*SignedCheque, error) { var lastCheque *SignedCheque - err := s.store.Get(lastIssuedChequeKey(beneficiary), &lastCheque) + err := s.store.Get(lastIssuedChequeKey(beneficiary, token), &lastCheque) if err != nil { if err != storage.ErrNotFound { return nil, err @@ -460,18 +485,21 @@ func keyBeneficiary(key []byte, prefix string) (beneficiary common.Address, err return common.HexToAddress(split[1]), nil } -// LastCheque returns the last cheques for all beneficiaries. -func (s *service) LastCheques() (map[common.Address]*SignedCheque, error) { +// LastCheques returns the last cheques for all beneficiaries. +func (s *service) LastCheques(token common.Address) (map[common.Address]*SignedCheque, error) { result := make(map[common.Address]*SignedCheque) - err := s.store.Iterate(lastIssuedChequeKeyPrefix, func(key, val []byte) (stop bool, err error) { - addr, err := keyBeneficiary(key, lastIssuedChequeKeyPrefix) + err := s.store.Iterate(tokencfg.AddToken(lastIssuedChequeKeyPrefix, token), func(key, val []byte) (stop bool, err error) { + addr, err := keyBeneficiary(key, tokencfg.AddToken(lastIssuedChequeKeyPrefix, token)) + fmt.Println("LastCheques, iterate ", addr, err, tokencfg.AddToken(lastIssuedChequeKeyPrefix, token)) + fmt.Println("LastCheques, iterate ", key, val, string(key), string(val)) + if err != nil { return false, fmt.Errorf("parse address from key: %s: %w", string(key), err) } if _, ok := result[addr]; !ok { - lastCheque, err := s.LastCheque(addr) + lastCheque, err := s.LastCheque(addr, token) if err != nil { return false, err } @@ -486,8 +514,41 @@ func (s *service) LastCheques() (map[common.Address]*SignedCheque, error) { return result, nil } -func (s *service) Withdraw(ctx context.Context, amount *big.Int) (hash common.Hash, err error) { - availableBalance, err := s.AvailableBalance(ctx) +// OLD +//func (s *service) Withdraw(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) { +// availableBalance, err := s.AvailableBalance(ctx, token) +// if err != nil { +// return common.Hash{}, err +// } +// +// // check we can afford this so we don't waste gas and don't risk bouncing cheques +// if availableBalance.Cmp(amount) < 0 { +// return common.Hash{}, ErrInsufficientFunds +// } +// +// callData, err := vaultABINew.Pack("withdraw", amount) +// if err != nil { +// return common.Hash{}, err +// } +// +// request := &transaction.TxRequest{ +// To: &s.address, +// Data: callData, +// Value: big.NewInt(0), +// Description: fmt.Sprintf("vault withdrawal of %d WBTT", amount), +// } +// +// txHash, err := s.transactionService.Send(ctx, request) +// if err != nil { +// return common.Hash{}, err +// } +// +// return txHash, nil +//} + +// Withdraw (2.3.0) +func (s *service) Withdraw(ctx context.Context, amount *big.Int, token common.Address) (hash common.Hash, err error) { + availableBalance, err := s.AvailableBalance(ctx, token) if err != nil { return common.Hash{}, err } @@ -497,66 +558,22 @@ func (s *service) Withdraw(ctx context.Context, amount *big.Int) (hash common.Ha return common.Hash{}, ErrInsufficientFunds } - callData, err := vaultABI.Pack("withdraw", amount) - if err != nil { - return common.Hash{}, err - } - - request := &transaction.TxRequest{ - To: &s.address, - Data: callData, - Value: big.NewInt(0), - Description: fmt.Sprintf("vault withdrawal of %d WBTT", amount), - } - - txHash, err := s.transactionService.Send(ctx, request) - if err != nil { - return common.Hash{}, err - } - - return txHash, nil -} - -func (s *service) GetWithdrawTime(ctx context.Context) (*big.Int, error) { - callData, err := vaultABI.Pack("withdrawTime") - if err != nil { - return nil, err - } - - output, err := s.transactionService.Call(ctx, &transaction.TxRequest{ - To: &s.address, - Data: callData, - }) - if err != nil { - return nil, err - } - - results, err := vaultABI.Unpack("withdrawTime", output) - if err != nil { - return nil, err - } - - if len(results) != 1 { - return nil, errDecodeABI - } - - time, ok := abi.ConvertType(results[0], new(big.Int)).(*big.Int) - if !ok || time == nil { - return nil, errDecodeABI - } - - return time, nil + return s.contract.Withdraw(ctx, amount, token) } func (s *service) WBTTBalanceOf(ctx context.Context, addr common.Address) (*big.Int, error) { return s.erc20Service.BalanceOf(ctx, addr) } +func (s *service) TokenBalanceOf(ctx context.Context, addr common.Address, tokenStr string) (*big.Int, error) { + return s.mpErc20Service[tokenStr].BalanceOf(ctx, addr) +} + func (s *service) BTTBalanceOf(ctx context.Context, address common.Address, block *big.Int) (*big.Int, error) { return s.transactionService.BttBalanceAt(ctx, address, block) } -func (s *service) TotalPaidOut(ctx context.Context) (*big.Int, error) { - return s.contract.TotalPaidOut(ctx) +func (s *service) TotalPaidOut(ctx context.Context, token common.Address) (*big.Int, error) { + return s.contract.TotalPaidOut(ctx, token) } // UpgradeTo will upgrade vault implementation to `newVaultImpl` diff --git a/settlement/swap/vault/vault_test.go b/settlement/swap/vault/vault_test.go index 40eb6a095..136ffb8c7 100644 --- a/settlement/swap/vault/vault_test.go +++ b/settlement/swap/vault/vault_test.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/bittorrent/go-btfs/settlement/swap/erc20" "math/big" "testing" @@ -16,6 +17,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" ) +var TOKEN = common.HexToAddress("0x000") + func TestVaultAddress(t *testing.T) { address := common.HexToAddress("0xabcd") ownerAdress := common.HexToAddress("0xfff") @@ -26,6 +29,7 @@ func TestVaultAddress(t *testing.T) { nil, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { @@ -50,13 +54,14 @@ func TestVaultBalance(t *testing.T) { nil, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { t.Fatal(err) } - returnedBalance, err := vaultService.TotalBalance(context.Background()) + returnedBalance, err := vaultService.TotalBalance(context.Background(), TOKEN) if err != nil { t.Fatal(err) } @@ -103,13 +108,14 @@ func TestVaultDeposit(t *testing.T) { return txHash, nil }), ), + make(map[string]erc20.Service), nil, ) if err != nil { t.Fatal(err) } - returnedTxHash, err := vaultService.Deposit(context.Background(), depositAmount) + returnedTxHash, err := vaultService.Deposit(context.Background(), depositAmount, TOKEN) if err != nil { t.Fatal(err) } @@ -139,6 +145,7 @@ func TestVaultWaitForDeposit(t *testing.T) { nil, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { @@ -171,6 +178,7 @@ func TestVaultWaitForDepositReverted(t *testing.T) { nil, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { @@ -200,15 +208,15 @@ func TestVaultWaitForDepositReverted(t *testing.T) { // vaultService, err := vault.New( // transactionmock.New( // transactionmock.WithABICallSequence( -// transactionmock.ABICall(&vaultABI, address, big.NewInt(100).FillBytes(make([]byte, 32)), "totalbalance"), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(0).FillBytes(make([]byte, 32)), "totalPaidOut"), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(0).FillBytes(make([]byte, 32)), "paidOut", beneficiary), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(100).FillBytes(make([]byte, 32)), "totalbalance"), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(0).FillBytes(make([]byte, 32)), "totalPaidOut"), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(0).FillBytes(make([]byte, 32)), "paidOut", beneficiary), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(100).FillBytes(make([]byte, 32)), "totalbalance"), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(0).FillBytes(make([]byte, 32)), "totalPaidOut"), -// transactionmock.ABICall(&vaultABI, address, big.NewInt(0).FillBytes(make([]byte, 32)), "paidOut", ownerAdress), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(100).FillBytes(make([]byte, 32)), "totalbalance"), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(0).FillBytes(make([]byte, 32)), "totalPaidOut"), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(0).FillBytes(make([]byte, 32)), "paidOut", beneficiary), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(100).FillBytes(make([]byte, 32)), "totalbalance"), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(0).FillBytes(make([]byte, 32)), "totalPaidOut"), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(0).FillBytes(make([]byte, 32)), "paidOut", beneficiary), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(100).FillBytes(make([]byte, 32)), "totalbalance"), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(0).FillBytes(make([]byte, 32)), "totalPaidOut"), +// transactionmock.ABICall(&vaultABINew, address, big.NewInt(0).FillBytes(make([]byte, 32)), "paidOut", ownerAdress), // ), // ), // address, @@ -361,6 +369,7 @@ func TestVaultIssueErrorSend(t *testing.T) { store, chequeSigner, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { @@ -371,7 +380,7 @@ func TestVaultIssueErrorSend(t *testing.T) { return sig, nil } - _, err = vaultService.Issue(context.Background(), beneficiary, amount, func(cheque *vault.SignedCheque) error { + _, err = vaultService.Issue(context.Background(), beneficiary, amount, TOKEN, func(cheque *vault.SignedCheque) error { return errors.New("err") }) if err == nil { @@ -379,7 +388,7 @@ func TestVaultIssueErrorSend(t *testing.T) { } // verify the cheque was not saved - _, err = vaultService.LastCheque(beneficiary) + _, err = vaultService.LastCheque(beneficiary, TOKEN) if !errors.Is(err, vault.ErrNoCheque) { t.Fatalf("wrong error. wanted %v, got %v", vault.ErrNoCheque, err) } @@ -404,13 +413,14 @@ func TestVaultIssueOutOfFunds(t *testing.T) { store, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { t.Fatal(err) } - _, err = vaultService.Issue(context.Background(), beneficiary, amount, func(cheque *vault.SignedCheque) error { + _, err = vaultService.Issue(context.Background(), beneficiary, amount, TOKEN, func(cheque *vault.SignedCheque) error { return nil }) if !errors.Is(err, vault.ErrOutOfFunds) { @@ -418,7 +428,7 @@ func TestVaultIssueOutOfFunds(t *testing.T) { } // verify the cheque was not saved - _, err = vaultService.LastCheque(beneficiary) + _, err = vaultService.LastCheque(beneficiary, TOKEN) if !errors.Is(err, vault.ErrNoCheque) { t.Fatalf("wrong error. wanted %v, got %v", vault.ErrNoCheque, err) @@ -445,13 +455,14 @@ func TestVaultWithdraw(t *testing.T) { store, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { t.Fatal(err) } - returnedTxHash, err := vaultService.Withdraw(context.Background(), withdrawAmount) + returnedTxHash, err := vaultService.Withdraw(context.Background(), withdrawAmount, TOKEN) if err != nil { t.Fatal(err) } @@ -480,13 +491,14 @@ func TestVaultWithdrawInsufficientFunds(t *testing.T) { store, &chequeSignerMock{}, erc20mock.New(), + make(map[string]erc20.Service), nil, ) if err != nil { t.Fatal(err) } - _, err = vaultService.Withdraw(context.Background(), withdrawAmount) + _, err = vaultService.Withdraw(context.Background(), withdrawAmount, TOKEN) if !errors.Is(err, vault.ErrInsufficientFunds) { t.Fatalf("got wrong error. wanted %v, got %v", vault.ErrInsufficientFunds, err) } @@ -496,17 +508,17 @@ func TestStateStoreKeys(t *testing.T) { address := common.HexToAddress("0xabcd") expected := "swap_cashout_000000000000000000000000000000000000abcd" - if vault.CashoutActionKey(address) != expected { - t.Fatalf("wrong cashout action key. wanted %s, got %s", expected, vault.CashoutActionKey(address)) + if vault.CashoutActionKey(address, TOKEN) != expected { + t.Fatalf("wrong cashout action key. wanted %s, got %s", expected, vault.CashoutActionKey(address, TOKEN)) } expected = "swap_vault_last_issued_cheque_000000000000000000000000000000000000abcd" - if vault.LastIssuedChequeKey(address) != expected { - t.Fatalf("wrong last issued cheque key. wanted %s, got %s", expected, vault.LastIssuedChequeKey(address)) + if vault.LastIssuedChequeKey(address, TOKEN) != expected { + t.Fatalf("wrong last issued cheque key. wanted %s, got %s", expected, vault.LastIssuedChequeKey(address, TOKEN)) } expected = "swap_vault_last_received_cheque_000000000000000000000000000000000000abcd" - if vault.LastReceivedChequeKey(address) != expected { - t.Fatalf("wrong last received cheque key. wanted %s, got %s", expected, vault.LastReceivedChequeKey(address)) + if vault.LastReceivedChequeKey(address, TOKEN) != expected { + t.Fatalf("wrong last received cheque key. wanted %s, got %s", expected, vault.LastReceivedChequeKey(address, TOKEN)) } } diff --git a/statestore/keys.go b/statestore/keys.go index feb56503d..86ac26865 100644 --- a/statestore/keys.go +++ b/statestore/keys.go @@ -2,6 +2,7 @@ package statestore import ( "fmt" + "github.com/bittorrent/go-btfs/chain/tokencfg" "time" "github.com/bittorrent/go-btfs/utils" @@ -22,32 +23,32 @@ var ( PeerReceivedUncashRecordsCountKeyPrefix = "swap_vault_peer_received_uncashed_records_count_" // 每个peer收到支票未兑现数量 ) -func PeerReceivedUncashRecordsCountKey(vault common.Address) string { - return fmt.Sprintf("%s%s", PeerReceivedUncashRecordsCountKeyPrefix, vault.String()) +func PeerReceivedUncashRecordsCountKey(vault common.Address, token common.Address) string { + return fmt.Sprintf("%s%s", tokencfg.AddToken(PeerReceivedUncashRecordsCountKeyPrefix, token), vault.String()) } -func GetTodayTotalDailyReceivedKey() string { - return fmt.Sprintf("%s%d", TotalDailyReceivedKey, utils.TodayUnix()) +func GetTodayTotalDailyReceivedKey(token common.Address) string { + return fmt.Sprintf("%s%d", tokencfg.AddToken(TotalDailyReceivedKey, token), utils.TodayUnix()) } -func GetTotalDailyReceivedKeyByTime(timestamp int64) string { - return fmt.Sprintf("%s%d", TotalDailyReceivedKey, timestamp) +func GetTotalDailyReceivedKeyByTime(timestamp int64, token common.Address) string { + return fmt.Sprintf("%s%d", tokencfg.AddToken(TotalDailyReceivedKey, token), timestamp) } -func GetTodayTotalDailyReceivedCashedKey() string { - return fmt.Sprintf("%s%d", TotalDailyReceivedCashedKey, utils.TodayUnix()) +func GetTodayTotalDailyReceivedCashedKey(token common.Address) string { + return fmt.Sprintf("%s%d", tokencfg.AddToken(TotalDailyReceivedCashedKey, token), utils.TodayUnix()) } -func GetTotalDailyReceivedCashedKeyByTime(timestamp int64) string { - return fmt.Sprintf("%s%d", TotalDailyReceivedCashedKey, timestamp) +func GetTotalDailyReceivedCashedKeyByTime(timestamp int64, token common.Address) string { + return fmt.Sprintf("%s%d", tokencfg.AddToken(TotalDailyReceivedCashedKey, token), timestamp) } -func GetTodayTotalDailySentKey() string { - return GetTotalDailySentKeyByTime(utils.TodayUnix()) +func GetTodayTotalDailySentKey(token common.Address) string { + return GetTotalDailySentKeyByTime(utils.TodayUnix(), token) } -func GetTotalDailySentKeyByTime(timestamp int64) string { - return fmt.Sprintf("%s%d", TotalDailySentKey, timestamp) +func GetTotalDailySentKeyByTime(timestamp int64, token common.Address) string { + return fmt.Sprintf("%s%d", tokencfg.AddToken(TotalDailySentKey, token), timestamp) } func CashoutResultPrefixKey() string { @@ -57,3 +58,7 @@ func CashoutResultPrefixKey() string { func CashoutResultKey(vault common.Address) string { return fmt.Sprintf("%s%x_%d", CashoutResultPrefixKey(), vault, time.Now().Unix()) } + +func CashoutResultPrefixAllKey() string { + return "swap_cashout_result_" +} diff --git a/test/dependencies/dependencies.go b/test/dependencies/dependencies.go index 9dc489698..0d56cd5a7 100644 --- a/test/dependencies/dependencies.go +++ b/test/dependencies/dependencies.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools package tools diff --git a/utils/token.go b/utils/token.go new file mode 100644 index 000000000..8808351fe --- /dev/null +++ b/utils/token.go @@ -0,0 +1,25 @@ +package utils + +import "github.com/ethereum/go-ethereum/common" + +const ( + WBTTHex = "0x111" + TRXHex = "0x222" +) + +var MpTokenAddr map[string]common.Address +var MpTokenStr map[common.Address]string + +func init() { + MpTokenAddr = make(map[string]common.Address) + MpTokenAddr["WBTT"] = common.HexToAddress(WBTTHex) + MpTokenAddr["TRX"] = common.HexToAddress(TRXHex) + + MpTokenStr = make(map[common.Address]string) + MpTokenStr[common.HexToAddress(WBTTHex)] = "WBTT" + MpTokenStr[common.HexToAddress(TRXHex)] = "TRX" +} + +func IsWBTT(addr common.Address) bool { + return addr == MpTokenAddr["WBTT"] +}