TokenSender

package
v0.0.0-...-2cf1f94 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NativeTokenAddress = "0x0000000000000000000000000000000000000000"
)

Variables

View Source
var ErrNoRPCURL error = errors.New("no RPC URL provided -- please pass an RPC URL from the command line or set the TOKEN_SENDER_RPC_URL environment variable")
View Source
var TokenSenderABI = TokenSenderMetaData.ABI

TokenSenderABI is the input ABI used to generate the binding from. Deprecated: Use TokenSenderMetaData.ABI instead.

View Source
var TokenSenderBin = TokenSenderMetaData.Bin

TokenSenderBin is the compiled bytecode used for deploying new contracts. Deprecated: Use TokenSenderMetaData.Bin instead.

View Source
var TokenSenderMetaData = &bind.MetaData{
	ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_faucetTimeInterval\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"TokenSenderClaimIntervalNotPassed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokensSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"faucetTimeInterval\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"lastSentTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"send\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]",
	Bin: "0x608060405234801561001057600080fd5b506040516102de3803806102de83398101604081905261002f91610037565b600055610050565b60006020828403121561004957600080fd5b5051919050565b61027f8061005f6000396000f3fe6080604052600436106100345760003560e01c80631aa23f48146100395780633e58c58c14610078578063a42532ad1461008d575b600080fd5b34801561004557600080fd5b506100666100543660046101cc565b60016020526000908152604090205481565b60405190815260200160405180910390f35b61008b6100863660046101cc565b6100a3565b005b34801561009957600080fd5b5061006660005481565b6000805473ffffffffffffffffffffffffffffffffffffffff8316825260016020526040909120546100d59190610209565b4211610129576040517f12bf079900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260240160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020526040808220429055513480156108fc0292909190818181858888f1935050505015801561017b573d6000803e3d6000fd5b5060405134815273ffffffffffffffffffffffffffffffffffffffff82169033907fe607861baff3d292b19188affe88c1a72bdcb69d3015f18bb2cd0bf5349cc3e19060200160405180910390a350565b6000602082840312156101de57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461020257600080fd5b9392505050565b80820180821115610243577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212202c8bf25323906e8a2b8dd1f13fcd30df1067f7bd8257d3144b3dcba23a5b83b964736f6c63430008180033",
}

Functions

func CalculateSafeTxHash

func CalculateSafeTxHash(safeAddress common.Address, txData SafeTransactionData, chainID *big.Int) (common.Hash, error)

func CreateFaucetTimeIntervalCommand

func CreateFaucetTimeIntervalCommand() *cobra.Command

func CreateLastSentTimestampCommand

func CreateLastSentTimestampCommand() *cobra.Command

func CreateSafeProposal

func CreateSafeProposal(client *ethclient.Client, key *keystore.Key, safeAddress common.Address, to common.Address, data []byte, value *big.Int, safeApi string, safeOperationType SafeOperationType, safeNonce *big.Int) error

func CreateSendCommand

func CreateSendCommand() *cobra.Command

func CreateTokenSenderCommand

func CreateTokenSenderCommand() *cobra.Command

func CreateTokenSenderDeploymentCommand

func CreateTokenSenderDeploymentCommand() *cobra.Command

func DeployWithSafe

func DeployWithSafe(client *ethclient.Client, key *keystore.Key, safeAddress common.Address, factoryAddress common.Address, value *big.Int, safeApi string, deployBytecode []byte, safeOperationType SafeOperationType, salt [32]byte, safeNonce *big.Int) error

func KeyFromFile

func KeyFromFile(keystoreFile string, password string) (*keystore.Key, error)

Loads a key from file, prompting the user for the password if it is not provided as a function argument.

func NewChainContext

func NewChainContext(timeout uint) (context.Context, context.CancelFunc)

Creates a new context to be used when interacting with the chain client.

func NewClient

func NewClient(rpcURL string) (*ethclient.Client, error)

Generates an Ethereum client to the JSONRPC API at the given URL. If rpcURL is empty, then it attempts to read the RPC URL from the TOKEN_SENDER_RPC_URL environment variable. If that is empty, too, then it returns an error.

func PredictDeploymentAddressSafe

func PredictDeploymentAddressSafe(from common.Address, salt [32]byte, deployBytecode []byte) (common.Address, error)

func SetCallParametersFromArgs

func SetCallParametersFromArgs(opts *bind.CallOpts, pending bool, fromAddress, blockNumber string)

This method is used to set the parameters on a view call from command line arguments (represented mostly as strings).

func SetTransactionParametersFromArgs

func SetTransactionParametersFromArgs(opts *bind.TransactOpts, nonce, value, gasPrice, maxFeePerGas, maxPriorityFeePerGas string, gasLimit uint64, noSend bool)

This method is used to set the parameters on a transaction from command line arguments (represented mostly as strings).

func UnlockKeystore

func UnlockKeystore(keystoreData []byte, password string) (*keystore.Key, error)

Unlocks a key from a keystore (byte contents of a keystore file) with the given password.

Types

type SafeOperationType

type SafeOperationType uint8

SafeOperationType represents the type of operation for a Safe transaction

const (
	Call         SafeOperationType = 0
	DelegateCall SafeOperationType = 1
)

func (SafeOperationType) String

func (o SafeOperationType) String() string

String returns the string representation of the SafeOperationType

type SafeTransactionData

type SafeTransactionData struct {
	To             string            `json:"to"`
	Value          string            `json:"value"`
	Data           string            `json:"data"`
	Operation      SafeOperationType `json:"operation"`
	SafeTxGas      uint64            `json:"safeTxGas"`
	BaseGas        uint64            `json:"baseGas"`
	GasPrice       string            `json:"gasPrice"`
	GasToken       string            `json:"gasToken"`
	RefundReceiver string            `json:"refundReceiver"`
	Nonce          *big.Int          `json:"nonce"`
	SafeTxHash     string            `json:"safeTxHash"`
	Sender         string            `json:"sender"`
	Signature      string            `json:"signature"`
	Origin         string            `json:"origin"`
}

SafeTransactionData represents the data for a Safe transaction

type TokenSender

type TokenSender struct {
	TokenSenderCaller     // Read-only binding to the contract
	TokenSenderTransactor // Write-only binding to the contract
	TokenSenderFilterer   // Log filterer for contract events
}

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

func DeployTokenSender

func DeployTokenSender(auth *bind.TransactOpts, backend bind.ContractBackend, _faucetTimeInterval *big.Int) (common.Address, *types.Transaction, *TokenSender, error)

DeployTokenSender deploys a new Ethereum contract, binding an instance of TokenSender to it.

func NewTokenSender

func NewTokenSender(address common.Address, backend bind.ContractBackend) (*TokenSender, error)

NewTokenSender creates a new instance of TokenSender, bound to a specific deployed contract.

type TokenSenderCaller

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

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

func NewTokenSenderCaller

func NewTokenSenderCaller(address common.Address, caller bind.ContractCaller) (*TokenSenderCaller, error)

NewTokenSenderCaller creates a new read-only instance of TokenSender, bound to a specific deployed contract.

func (*TokenSenderCaller) FaucetTimeInterval

func (_TokenSender *TokenSenderCaller) FaucetTimeInterval(opts *bind.CallOpts) (*big.Int, error)

FaucetTimeInterval is a free data retrieval call binding the contract method 0xa42532ad.

Solidity: function faucetTimeInterval() view returns(uint256)

func (*TokenSenderCaller) LastSentTimestamp

func (_TokenSender *TokenSenderCaller) LastSentTimestamp(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error)

LastSentTimestamp is a free data retrieval call binding the contract method 0x1aa23f48.

Solidity: function lastSentTimestamp(address ) view returns(uint256)

type TokenSenderCallerRaw

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

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

func (*TokenSenderCallerRaw) Call

func (_TokenSender *TokenSenderCallerRaw) 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 TokenSenderCallerSession

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

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

func (*TokenSenderCallerSession) FaucetTimeInterval

func (_TokenSender *TokenSenderCallerSession) FaucetTimeInterval() (*big.Int, error)

FaucetTimeInterval is a free data retrieval call binding the contract method 0xa42532ad.

Solidity: function faucetTimeInterval() view returns(uint256)

func (*TokenSenderCallerSession) LastSentTimestamp

func (_TokenSender *TokenSenderCallerSession) LastSentTimestamp(arg0 common.Address) (*big.Int, error)

LastSentTimestamp is a free data retrieval call binding the contract method 0x1aa23f48.

Solidity: function lastSentTimestamp(address ) view returns(uint256)

type TokenSenderFilterer

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

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

func NewTokenSenderFilterer

func NewTokenSenderFilterer(address common.Address, filterer bind.ContractFilterer) (*TokenSenderFilterer, error)

NewTokenSenderFilterer creates a new log filterer instance of TokenSender, bound to a specific deployed contract.

func (*TokenSenderFilterer) FilterTokensSent

func (_TokenSender *TokenSenderFilterer) FilterTokensSent(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*TokenSenderTokensSentIterator, error)

FilterTokensSent is a free log retrieval operation binding the contract event 0xe607861baff3d292b19188affe88c1a72bdcb69d3015f18bb2cd0bf5349cc3e1.

Solidity: event TokensSent(address indexed sender, address indexed recipient, uint256 amount)

func (*TokenSenderFilterer) ParseTokensSent

func (_TokenSender *TokenSenderFilterer) ParseTokensSent(log types.Log) (*TokenSenderTokensSent, error)

ParseTokensSent is a log parse operation binding the contract event 0xe607861baff3d292b19188affe88c1a72bdcb69d3015f18bb2cd0bf5349cc3e1.

Solidity: event TokensSent(address indexed sender, address indexed recipient, uint256 amount)

func (*TokenSenderFilterer) WatchTokensSent

func (_TokenSender *TokenSenderFilterer) WatchTokensSent(opts *bind.WatchOpts, sink chan<- *TokenSenderTokensSent, sender []common.Address, recipient []common.Address) (event.Subscription, error)

WatchTokensSent is a free log subscription operation binding the contract event 0xe607861baff3d292b19188affe88c1a72bdcb69d3015f18bb2cd0bf5349cc3e1.

Solidity: event TokensSent(address indexed sender, address indexed recipient, uint256 amount)

type TokenSenderRaw

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

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

func (*TokenSenderRaw) Call

func (_TokenSender *TokenSenderRaw) 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 (*TokenSenderRaw) Transact

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

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

func (*TokenSenderRaw) Transfer

func (_TokenSender *TokenSenderRaw) 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 TokenSenderSession

type TokenSenderSession struct {
	Contract     *TokenSender      // 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
}

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

func (*TokenSenderSession) FaucetTimeInterval

func (_TokenSender *TokenSenderSession) FaucetTimeInterval() (*big.Int, error)

FaucetTimeInterval is a free data retrieval call binding the contract method 0xa42532ad.

Solidity: function faucetTimeInterval() view returns(uint256)

func (*TokenSenderSession) LastSentTimestamp

func (_TokenSender *TokenSenderSession) LastSentTimestamp(arg0 common.Address) (*big.Int, error)

LastSentTimestamp is a free data retrieval call binding the contract method 0x1aa23f48.

Solidity: function lastSentTimestamp(address ) view returns(uint256)

func (*TokenSenderSession) Send

func (_TokenSender *TokenSenderSession) Send(recipient common.Address) (*types.Transaction, error)

Send is a paid mutator transaction binding the contract method 0x3e58c58c.

Solidity: function send(address recipient) payable returns()

type TokenSenderTokensSent

type TokenSenderTokensSent struct {
	Sender    common.Address
	Recipient common.Address
	Amount    *big.Int
	Raw       types.Log // Blockchain specific contextual infos
}

TokenSenderTokensSent represents a TokensSent event raised by the TokenSender contract.

type TokenSenderTokensSentIterator

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

TokenSenderTokensSentIterator is returned from FilterTokensSent and is used to iterate over the raw logs and unpacked data for TokensSent events raised by the TokenSender contract.

func (*TokenSenderTokensSentIterator) Close

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

func (*TokenSenderTokensSentIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*TokenSenderTokensSentIterator) Next

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 TokenSenderTransactor

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

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

func NewTokenSenderTransactor

func NewTokenSenderTransactor(address common.Address, transactor bind.ContractTransactor) (*TokenSenderTransactor, error)

NewTokenSenderTransactor creates a new write-only instance of TokenSender, bound to a specific deployed contract.

func (*TokenSenderTransactor) Send

func (_TokenSender *TokenSenderTransactor) Send(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error)

Send is a paid mutator transaction binding the contract method 0x3e58c58c.

Solidity: function send(address recipient) payable returns()

type TokenSenderTransactorRaw

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

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

func (*TokenSenderTransactorRaw) Transact

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

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

func (*TokenSenderTransactorRaw) Transfer

func (_TokenSender *TokenSenderTransactorRaw) 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 TokenSenderTransactorSession

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

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

func (*TokenSenderTransactorSession) Send

func (_TokenSender *TokenSenderTransactorSession) Send(recipient common.Address) (*types.Transaction, error)

Send is a paid mutator transaction binding the contract method 0x3e58c58c.

Solidity: function send(address recipient) payable returns()

Jump to

Keyboard shortcuts

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