lib

package
v0.0.0-...-7071582 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ERC20TokenABI = "" /* 2603-byte string literal not displayed */

ERC20TokenABI is the input ABI used to generate the binding from.

Variables

View Source
var EtherscanBaseURl = "https://api.etherscan.io/api?module=account&action=tokentx"

Base URL used for querying Etherscan API token tx

View Source
var IgnoreZeroBalance = false

Indicates whether the csv file should contain zero balances

View Source
var TotalMintedAmount = ""

Used to indicate the total amount of minted tokens ie. total supply cases for valid ERC20

View Source
var TotalSupply = big.NewInt(0)

Total supply of Snapshot

View Source
var Verbose = false

Indicates whether to print verbose msgs

Functions

func BuildSnapshot

func BuildSnapshot(tokenAddress string, provider string, block int64)

Used to build a ERC20 token balance snapshot at a given token address, block number, using a specified Geth provider

func CheckGethValues

func CheckGethValues(arrayOfWallets *[]string, block int64, token *ERC20Token)

Responsible for going through a list of wallet addresses and checking their balance against a Geth node

func GetBalanceAtBlock

func GetBalanceAtBlock(walletAddress string, block int64, token *ERC20Token, wg *sync.WaitGroup, channel chan string)

Takes in a given wallet address, a block number, and a ERC20Token contract Then the Geth node provider set upon instantiation is used to query the Ethereum Blockchain at the specific block for the amount of tokens held by that wallet

func GetKeys

func GetKeys(mapping map[string]string) []string

Consume a mapping of addresses and returns a slice of strings representing an array of the key values

func GetTokenWallets

func GetTokenWallets(tokenAddress string, endBlock int64) []string

We will use Etherscan to build a list of all wallets holding tokens at a given block. We can verify these numbers as total all the holders should equal the total supply. By using two different sources, Etherscan and the chosen Geth Node Provider, you can ensure your data is credible, versus relying on one source for both pieces of information

func ProcessTransfer

func ProcessTransfer(fromAddress, toAddress, amount, blockNumber string)

Take in a transaction and updates the ledger balances This assumes transactions Are parsed chronologically

func WriteToCsv

func WriteToCsv(arrayOfWallets []string, tokenName string, blockNumber string)

Takes in an array of wallet addresses and writes the corresponding values into a csv

Types

type ERC20Ledger

type ERC20Ledger struct {
	Wallets map[string]Wallet `json:"wallets,omitempty"`
}

type ERC20Token

type ERC20Token struct {
	ERC20TokenCaller     // Read-only binding to the contract
	ERC20TokenTransactor // Write-only binding to the contract
	ERC20TokenFilterer   // Log filterer for contract events
}

ERC20Token is an auto generated Go binding around an Ethereum contract.

func NewERC20Token

func NewERC20Token(address common.Address, backend bind.ContractBackend) (*ERC20Token, error)

NewERC20Token creates a new instance of ERC20Token, bound to a specific deployed contract.

type ERC20TokenApproval

type ERC20TokenApproval struct {
	Owner   common.Address
	Spender common.Address
	Value   *big.Int
	Raw     types.Log // Blockchain specific contextual infos
}

ERC20TokenApproval represents a Approval event raised by the ERC20Token contract.

type ERC20TokenApprovalIterator

type ERC20TokenApprovalIterator struct {
	Event *ERC20TokenApproval // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ERC20TokenApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20Token contract.

func (*ERC20TokenApprovalIterator) Close

func (it *ERC20TokenApprovalIterator) Close() error

Close terminates the iteration process, releasing any pending underlying resources.

func (*ERC20TokenApprovalIterator) Error

func (it *ERC20TokenApprovalIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*ERC20TokenApprovalIterator) Next

func (it *ERC20TokenApprovalIterator) Next() bool

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type ERC20TokenCaller

type ERC20TokenCaller struct {
	// contains filtered or unexported fields
}

ERC20TokenCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewERC20TokenCaller

func NewERC20TokenCaller(address common.Address, caller bind.ContractCaller) (*ERC20TokenCaller, error)

NewERC20TokenCaller creates a new read-only instance of ERC20Token, bound to a specific deployed contract.

func (*ERC20TokenCaller) Allowance

func (_ERC20Token *ERC20TokenCaller) Allowance(opts *bind.CallOpts, _owner common.Address, _spender common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance(_owner address, _spender address) constant returns(uint256)

func (*ERC20TokenCaller) BalanceOf

func (_ERC20Token *ERC20TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0x70a08231.

Solidity: function balanceOf(_owner address) constant returns(balance uint256)

func (*ERC20TokenCaller) Decimals

func (_ERC20Token *ERC20TokenCaller) Decimals(opts *bind.CallOpts) (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() constant returns(uint8)

func (*ERC20TokenCaller) Name

func (_ERC20Token *ERC20TokenCaller) Name(opts *bind.CallOpts) (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() constant returns(string)

func (*ERC20TokenCaller) Symbol

func (_ERC20Token *ERC20TokenCaller) Symbol(opts *bind.CallOpts) (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() constant returns(string)

func (*ERC20TokenCaller) TotalSupply

func (_ERC20Token *ERC20TokenCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error)

TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.

Solidity: function totalSupply() constant returns(uint256)

type ERC20TokenCallerRaw

type ERC20TokenCallerRaw struct {
	Contract *ERC20TokenCaller // Generic read-only contract binding to access the raw methods on
}

ERC20TokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*ERC20TokenCallerRaw) Call

func (_ERC20Token *ERC20TokenCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type ERC20TokenCallerSession

type ERC20TokenCallerSession struct {
	Contract *ERC20TokenCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts     // Call options to use throughout this session
}

ERC20TokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*ERC20TokenCallerSession) Allowance

func (_ERC20Token *ERC20TokenCallerSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance(_owner address, _spender address) constant returns(uint256)

func (*ERC20TokenCallerSession) BalanceOf

func (_ERC20Token *ERC20TokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0x70a08231.

Solidity: function balanceOf(_owner address) constant returns(balance uint256)

func (*ERC20TokenCallerSession) Decimals

func (_ERC20Token *ERC20TokenCallerSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() constant returns(uint8)

func (*ERC20TokenCallerSession) Name

func (_ERC20Token *ERC20TokenCallerSession) Name() (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() constant returns(string)

func (*ERC20TokenCallerSession) Symbol

func (_ERC20Token *ERC20TokenCallerSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() constant returns(string)

func (*ERC20TokenCallerSession) TotalSupply

func (_ERC20Token *ERC20TokenCallerSession) TotalSupply() (*big.Int, error)

TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.

Solidity: function totalSupply() constant returns(uint256)

type ERC20TokenFilterer

type ERC20TokenFilterer struct {
	// contains filtered or unexported fields
}

ERC20TokenFilterer is an auto generated log filtering Go binding around an Ethereum contract events.

func NewERC20TokenFilterer

func NewERC20TokenFilterer(address common.Address, filterer bind.ContractFilterer) (*ERC20TokenFilterer, error)

NewERC20TokenFilterer creates a new log filterer instance of ERC20Token, bound to a specific deployed contract.

func (*ERC20TokenFilterer) FilterApproval

func (_ERC20Token *ERC20TokenFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20TokenApprovalIterator, error)

FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.

Solidity: e Approval(owner indexed address, spender indexed address, value uint256)

func (*ERC20TokenFilterer) FilterTransfer

func (_ERC20Token *ERC20TokenFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20TokenTransferIterator, error)

FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

Solidity: e Transfer(from indexed address, to indexed address, value uint256)

func (*ERC20TokenFilterer) WatchApproval

func (_ERC20Token *ERC20TokenFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20TokenApproval, owner []common.Address, spender []common.Address) (event.Subscription, error)

WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.

Solidity: e Approval(owner indexed address, spender indexed address, value uint256)

func (*ERC20TokenFilterer) WatchTransfer

func (_ERC20Token *ERC20TokenFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20TokenTransfer, from []common.Address, to []common.Address) (event.Subscription, error)

WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

Solidity: e Transfer(from indexed address, to indexed address, value uint256)

type ERC20TokenRaw

type ERC20TokenRaw struct {
	Contract *ERC20Token // Generic contract binding to access the raw methods on
}

ERC20TokenRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*ERC20TokenRaw) Call

func (_ERC20Token *ERC20TokenRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*ERC20TokenRaw) Transact

func (_ERC20Token *ERC20TokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*ERC20TokenRaw) Transfer

func (_ERC20Token *ERC20TokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ERC20TokenSession

type ERC20TokenSession struct {
	Contract     *ERC20Token       // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

ERC20TokenSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*ERC20TokenSession) Allowance

func (_ERC20Token *ERC20TokenSession) Allowance(_owner common.Address, _spender common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance(_owner address, _spender address) constant returns(uint256)

func (*ERC20TokenSession) Approve

func (_ERC20Token *ERC20TokenSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0x095ea7b3.

Solidity: function approve(_spender address, _value uint256) returns(bool)

func (*ERC20TokenSession) BalanceOf

func (_ERC20Token *ERC20TokenSession) BalanceOf(_owner common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0x70a08231.

Solidity: function balanceOf(_owner address) constant returns(balance uint256)

func (*ERC20TokenSession) Decimals

func (_ERC20Token *ERC20TokenSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() constant returns(uint8)

func (*ERC20TokenSession) Name

func (_ERC20Token *ERC20TokenSession) Name() (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() constant returns(string)

func (*ERC20TokenSession) Symbol

func (_ERC20Token *ERC20TokenSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() constant returns(string)

func (*ERC20TokenSession) TotalSupply

func (_ERC20Token *ERC20TokenSession) TotalSupply() (*big.Int, error)

TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.

Solidity: function totalSupply() constant returns(uint256)

func (*ERC20TokenSession) Transfer

func (_ERC20Token *ERC20TokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(_to address, _value uint256) returns(bool)

func (*ERC20TokenSession) TransferFrom

func (_ERC20Token *ERC20TokenSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(_from address, _to address, _value uint256) returns(bool)

type ERC20TokenTransactor

type ERC20TokenTransactor struct {
	// contains filtered or unexported fields
}

ERC20TokenTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewERC20TokenTransactor

func NewERC20TokenTransactor(address common.Address, transactor bind.ContractTransactor) (*ERC20TokenTransactor, error)

NewERC20TokenTransactor creates a new write-only instance of ERC20Token, bound to a specific deployed contract.

func (*ERC20TokenTransactor) Approve

func (_ERC20Token *ERC20TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0x095ea7b3.

Solidity: function approve(_spender address, _value uint256) returns(bool)

func (*ERC20TokenTransactor) Transfer

func (_ERC20Token *ERC20TokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(_to address, _value uint256) returns(bool)

func (*ERC20TokenTransactor) TransferFrom

func (_ERC20Token *ERC20TokenTransactor) TransferFrom(opts *bind.TransactOpts, _from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(_from address, _to address, _value uint256) returns(bool)

type ERC20TokenTransactorRaw

type ERC20TokenTransactorRaw struct {
	Contract *ERC20TokenTransactor // Generic write-only contract binding to access the raw methods on
}

ERC20TokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*ERC20TokenTransactorRaw) Transact

func (_ERC20Token *ERC20TokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*ERC20TokenTransactorRaw) Transfer

func (_ERC20Token *ERC20TokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type ERC20TokenTransactorSession

type ERC20TokenTransactorSession struct {
	Contract     *ERC20TokenTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts     // Transaction auth options to use throughout this session
}

ERC20TokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

func (*ERC20TokenTransactorSession) Approve

func (_ERC20Token *ERC20TokenTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error)

Approve is a paid mutator transaction binding the contract method 0x095ea7b3.

Solidity: function approve(_spender address, _value uint256) returns(bool)

func (*ERC20TokenTransactorSession) Transfer

func (_ERC20Token *ERC20TokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(_to address, _value uint256) returns(bool)

func (*ERC20TokenTransactorSession) TransferFrom

func (_ERC20Token *ERC20TokenTransactorSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(_from address, _to address, _value uint256) returns(bool)

type ERC20TokenTransfer

type ERC20TokenTransfer struct {
	From  common.Address
	To    common.Address
	Value *big.Int
	Raw   types.Log // Blockchain specific contextual infos
}

ERC20TokenTransfer represents a Transfer event raised by the ERC20Token contract.

type ERC20TokenTransferIterator

type ERC20TokenTransferIterator struct {
	Event *ERC20TokenTransfer // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

ERC20TokenTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20Token contract.

func (*ERC20TokenTransferIterator) Close

func (it *ERC20TokenTransferIterator) Close() error

Close terminates the iteration process, releasing any pending underlying resources.

func (*ERC20TokenTransferIterator) Error

func (it *ERC20TokenTransferIterator) Error() error

Error returns any retrieval or parsing error occurred during filtering.

func (*ERC20TokenTransferIterator) Next

func (it *ERC20TokenTransferIterator) Next() bool

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type GetTxResponse

type GetTxResponse struct {
	Jsonrpc string       `json:"jsonrpc,omitempty"`
	ID      int          `json:"id,omitempty"`
	Result  []TxResponse `json:"result,omitempty"`
}

type Snapshot

type Snapshot struct {
	TokenAddress string          `json:"tokenAddress,omitempty"`
	StartBlock   string          `json:"startBlock,omitempty"`
	EndBlock     string          `json:"endBlock,omitempty"`
	Balances     []WalletAddress `json:"balances,omitempty"`
}

type TxResponse

type TxResponse struct {
	BlockHash        string `json:"blockHash,omitempty"`
	BlockNumber      string `json:"blockNumber,omitempty"`
	From             string `json:"from,omitempty"`
	Gas              string `json:"gas,omitempty"`
	GasPrice         string `json:"gasPrice,omitempty"`
	Hash             string `json:"hash,omitempty"`
	Input            string `json:"input,omitempty"`
	Nonce            string `json:"nonce,omitempty"`
	To               string `json:"to,omitempty"`
	TransactionIndex string `json:"transactionIndex,omitempty"`
	Value            string `json:"value,omitempty"`
	V                string `json:"v,omitempty"`
	R                string `json:"r,omitempty"`
	S                string `json:"s,omitempty"`
}

type Wallet

type Wallet struct {
	Balance string `json:"balance,omitempty"`
}

type WalletAddress

type WalletAddress struct {
	Address       string `json:"address,omitempty"`
	WalletDetails Wallet `json:"walletDetails,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL