Documentation ¶
Index ¶
- Variables
- type Balance
- type BlockchainLifecycle
- type ContractAddresses
- type ECSignature
- type ETHWatcher
- func (e *ETHWatcher) Add(addresses []common.Address) (addressToBalance map[common.Address]*big.Int, failedAddresses []common.Address)
- func (e *ETHWatcher) GetBalance(address common.Address) (*big.Int, error)
- func (e *ETHWatcher) Receive() <-chan Balance
- func (e *ETHWatcher) Remove(address common.Address)
- func (e *ETHWatcher) Start() error
- func (e *ETHWatcher) Stop()
- type EthRPCSigner
- type LocalSigner
- type Signer
- type TestSigner
Constants ¶
This section is empty.
Variables ¶
var GanacheEthBalanceCheckerAddress = common.HexToAddress("0xaa86dda78e9434aca114b6676fc742a18d15a1cc")
GanacheEthBalanceCheckerAddress is the ganache snapshot EthBalanceChecker contract address
var MainnetEthBalanceCheckerAddress = common.HexToAddress("0x9bc2c6ae8b1a8e3c375b6ccb55eb4273b2c3fbde")
MainnetEthBalanceCheckerAddress is the mainnet EthBalanceChecker contract address
var NetworkIDToContractAddresses = map[int]ContractAddresses{ 1: ContractAddresses{ ERC20Proxy: common.HexToAddress("0x2240dab907db71e64d3e0dba4800c83b5c502d4e"), ERC721Proxy: common.HexToAddress("0x208e41fb445f1bb1b6780d58356e81405f3e6127"), Exchange: common.HexToAddress("0x4f833a24e1f95d70f028921e27040ca56e09ab0b"), OrderValidationUtils: common.HexToAddress("0xaccc650ae2669b9a48c525c40f28c497ff88d839"), EthBalanceChecker: common.HexToAddress("0x9bc2c6ae8b1a8e3c375b6ccb55eb4273b2c3fbde"), Coordinator: common.HexToAddress("0x25aae5b981ce6683cc5aeea1855d927e0b59066f"), CoordinatorRegistry: common.HexToAddress("0x45797531b873fd5e519477a070a955764c1a5b07"), }, 3: ContractAddresses{ ERC20Proxy: common.HexToAddress("0xb1408f4c245a23c31b98d2c626777d4c0d766caa"), ERC721Proxy: common.HexToAddress("0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4"), Exchange: common.HexToAddress("0x4530c0483a1633c7a1c97d2c53721caff2caaaaf"), OrderValidationUtils: common.HexToAddress("0x078b18930c5c16f73b3d9e8e4911d1720c98e292"), EthBalanceChecker: common.HexToAddress("0xd5d960219af544b6f2f3e14a8bfd03dec12292fa"), Coordinator: common.HexToAddress("0x25aae5b981ce6683cc5aeea1855d927e0b59066f"), CoordinatorRegistry: common.HexToAddress("0x403cc23e88c17c4652fb904784d1af640a6722d9"), }, 4: ContractAddresses{ ERC20Proxy: common.HexToAddress("0x3e809c563c15a295e832e37053798ddc8d6c8dab"), ERC721Proxy: common.HexToAddress("0x8e1ff02637cb5e39f2fa36c14706aa348b065b09"), Exchange: common.HexToAddress("0x22ebc052f43a88efa06379426120718170f2204e"), OrderValidationUtils: common.HexToAddress("0x2d645bce387b25bdd807be48e57f374226eadff9"), EthBalanceChecker: common.HexToAddress("0x08b71282431009022eda2dda8af0fbee535e1507"), Coordinator: common.HexToAddress("0x25aae5b981ce6683cc5aeea1855d927e0b59066f"), CoordinatorRegistry: common.HexToAddress("0x1084b6a398e47907bae43fec3ff4b677db6e4fee"), }, 42: ContractAddresses{ ERC20Proxy: common.HexToAddress("0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e"), ERC721Proxy: common.HexToAddress("0x2a9127c745688a165106c11cd4d647d2220af821"), Exchange: common.HexToAddress("0x35dd2932454449b14cee11a94d3674a936d5d7b2"), OrderValidationUtils: common.HexToAddress("0x98cafab5518485d84fe3c2c495f0fcc807f1a7c0"), EthBalanceChecker: common.HexToAddress("0x505aa534485bf80ee919339717cff90eb2e3364c"), Coordinator: common.HexToAddress("0x25aae5b981ce6683cc5aeea1855d927e0b59066f"), CoordinatorRegistry: common.HexToAddress("0x09fb99968c016a3ff537bf58fb3d9fe55a7975d5"), }, 50: ContractAddresses{ ERC20Proxy: common.HexToAddress("0x1dc4c1cefef38a777b15aa20260a54e584b16c48"), ERC721Proxy: common.HexToAddress("0x1d7022f5b17d2f8b695918fb48fa1089c9f85401"), Exchange: common.HexToAddress("0x48bacb9266a570d521063ef5dd96e61686dbe788"), OrderValidationUtils: common.HexToAddress("0x8d42e38980ce74736c21c059b2240df09958d3c8"), EthBalanceChecker: common.HexToAddress("0xa31e64ea55b9b6bbb9d6a676738e9a5b23149f84"), Coordinator: common.HexToAddress("0x4d3d5c850dd5bd9d6f4adda3dd039a3c8054ca29"), CoordinatorRegistry: common.HexToAddress("0xaa86dda78e9434aca114b6676fc742a18d15a1cc"), }, }
NetworkIDToContractAddresses maps networkId to a mapping of contract name to Ethereum address on that given network
Functions ¶
This section is empty.
Types ¶
type BlockchainLifecycle ¶
type BlockchainLifecycle struct {
// contains filtered or unexported fields
}
BlockchainLifecycle is a testing utility for taking snapshots of the blockchain state on Ganache and reverting those snapshots at a later point in time. Ganache supports performing multiple snapshots that can then be reverted in LIFO order.
func NewBlockchainLifecycle ¶
func NewBlockchainLifecycle(rpcURL string) (*BlockchainLifecycle, error)
NewBlockchainLifecycle instantiates a new blockchainLifecycle instance
func (*BlockchainLifecycle) Revert ¶
func (b *BlockchainLifecycle) Revert(t *testing.T)
Revert reverts the latest snapshot of blockchain state created
func (*BlockchainLifecycle) Start ¶
func (b *BlockchainLifecycle) Start(t *testing.T)
Start creates a snapshot of the blockchain state at that point in time and adds it's snapshotId to a stack
type ContractAddresses ¶
type ContractAddresses struct { ERC20Proxy common.Address ERC721Proxy common.Address OrderValidationUtils common.Address Exchange common.Address EthBalanceChecker common.Address Coordinator common.Address CoordinatorRegistry common.Address }
ContractAddresses maps a contract's name to it's Ethereum address
func GetContractAddressesForNetworkID ¶
func GetContractAddressesForNetworkID(networkID int) (ContractAddresses, error)
GetContractAddressesForNetworkID returns the contract name mapping for the given network. It returns an error if the network doesn't exist.
type ECSignature ¶
ECSignature contains the parameters of an elliptic curve signature
type ETHWatcher ¶
type ETHWatcher struct {
// contains filtered or unexported fields
}
ETHWatcher allows for watching a set of Ethereum addresses for ETH balance changes
func NewETHWatcher ¶
func NewETHWatcher(minPollingInterval time.Duration, ethClient *ethclient.Client, networkID int) (*ETHWatcher, error)
NewETHWatcher creates a new instance of ETHWatcher
func (*ETHWatcher) Add ¶
func (e *ETHWatcher) Add(addresses []common.Address) (addressToBalance map[common.Address]*big.Int, failedAddresses []common.Address)
Add adds new Ethereum addresses we'd like to track for balance changes and returns a map of added address to balance, and an array of addresses that it failed to add due to failed network requests
func (*ETHWatcher) GetBalance ¶
GetBalance returns the Ether balance for a particular Ethereum address
func (*ETHWatcher) Receive ¶
func (e *ETHWatcher) Receive() <-chan Balance
Receive returns a read-only channel that can be used to listen for modified ETH balances
func (*ETHWatcher) Remove ¶
func (e *ETHWatcher) Remove(address common.Address)
Remove removes a new Ethereum address we no longer want to track for balance changes
type EthRPCSigner ¶
type EthRPCSigner struct {
// contains filtered or unexported fields
}
EthRPCSigner is a signer that uses a call to Ethereum JSON-RPC method `eth_call` to produce a signature
func (*EthRPCSigner) EthSign ¶
func (e *EthRPCSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)
EthSign signs a message via the `eth_sign` Ethereum JSON-RPC call
type LocalSigner ¶
type LocalSigner struct {
// contains filtered or unexported fields
}
LocalSigner is a signer that produces an `eth_sign`-compatible signature locally using a private key
func (*LocalSigner) EthSign ¶
func (l *LocalSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)
EthSign mimicks the signing of `eth_sign` locally its supplied private key
func (*LocalSigner) GetSignerAddress ¶
func (l *LocalSigner) GetSignerAddress() common.Address
GetSignerAddress returns the signerAddress corresponding to LocalSigner's private key
type Signer ¶
type Signer interface {
EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)
}
Signer defines the methods needed to act as a elliptic curve signer
func NewEthRPCSigner ¶
NewEthRPCSigner instantiates a new EthRPCSigner
func NewLocalSigner ¶
func NewLocalSigner(privateKey *ecdsa.PrivateKey) Signer
NewLocalSigner instantiates a new LocalSigner
type TestSigner ¶
type TestSigner struct{}
TestSigner generates `eth_sign` signatures for test accounts available on the test Ethereum node Ganache
func (*TestSigner) EthSign ¶
func (t *TestSigner) EthSign(message []byte, signerAddress common.Address) (*ECSignature, error)
EthSign generates an `eth_sign` equivalent signature using an public/private key pair hard-coded in the constants package.