Categorygithub.com/resdk/multicall-go
modulepackage
0.0.8
Repository: https://github.com/resdk/multicall-go.git
Documentation: pkg.go.dev

# README

multicall-go

Minimal golang ethereum multicall implementation, inspired by https://github.com/trayvox/go-eth-multicall, add some features:

  • Support eth like chains, like polygon
  • Support batch size, split big requests into small ones

Example

client, err := ethclient.Dial("https://polygon-rpc.com/")
if err != nil {
	log.Fatal(err)
}

caller := New(client)

erc20Abi, _ := GetErc20Abi()

callData, _ := erc20Abi.Pack("symbol")

// response will keep the UserData from call
calls := []*Call{
	{
		Target:   common.HexToAddress("0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"),
		CallData: callData,
		UserData: "WBTC",
	},
	{
		Target:   common.HexToAddress("0x2791bca1f2de4661ed88a30c99a7a9449aa84174"),
		CallData: callData,
		UserData: "USDC",
	},
}

results, _ := caller.Execute(calls, 10)
for _, v := range results {
	out, _ := erc20Abi.Unpack("symbol", v.ReturnData)
	assert.Equal(t, v.UserData.(string), out[0])
}

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
NewErc20 creates a new instance of Erc20, bound to a specific deployed contract.
NewErc20Caller creates a new read-only instance of Erc20, bound to a specific deployed contract.
NewErc20Filterer creates a new log filterer instance of Erc20, bound to a specific deployed contract.
NewErc20Transactor creates a new write-only instance of Erc20, bound to a specific deployed contract.
NewMultiCall2 creates a new instance of MultiCall2, bound to a specific deployed contract.
NewMultiCall2Caller creates a new read-only instance of MultiCall2, bound to a specific deployed contract.
NewMultiCall2Filterer creates a new log filterer instance of MultiCall2, bound to a specific deployed contract.
NewMultiCall2Transactor creates a new write-only instance of MultiCall2, bound to a specific deployed contract.

# Constants

No description provided by the author
Erc20ABI is the input ABI used to generate the binding from.
No description provided by the author
MultiCall2ABI is the input ABI used to generate the binding from.
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Erc20 is an auto generated Go binding around an Ethereum contract.
Erc20Approval represents a Approval event raised by the Erc20 contract.
Erc20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Erc20 contract.
Erc20Caller is an auto generated read-only Go binding around an Ethereum contract.
Erc20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
Erc20CallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.
Erc20Filterer is an auto generated log filtering Go binding around an Ethereum contract events.
Erc20OwnershipTransferred represents a OwnershipTransferred event raised by the Erc20 contract.
Erc20OwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Erc20 contract.
Erc20Raw is an auto generated low-level Go binding around an Ethereum contract.
Erc20Session is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.
Erc20Transactor is an auto generated write-only Go binding around an Ethereum contract.
Erc20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
Erc20TransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.
Erc20Transfer represents a Transfer event raised by the Erc20 contract.
Erc20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Erc20 contract.
MultiCall2 is an auto generated Go binding around an Ethereum contract.
Multicall2Call is an auto generated low-level Go binding around an user-defined struct.
MultiCall2Caller is an auto generated read-only Go binding around an Ethereum contract.
MultiCall2CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
MultiCall2CallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.
MultiCall2Filterer is an auto generated log filtering Go binding around an Ethereum contract events.
MultiCall2Raw is an auto generated low-level Go binding around an Ethereum contract.
Multicall2Result is an auto generated low-level Go binding around an user-defined struct.
MultiCall2Session is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.
MultiCall2Transactor is an auto generated write-only Go binding around an Ethereum contract.
MultiCall2TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
MultiCall2TransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.
No description provided by the author