Documentation ¶
Index ¶
- Constants
- func BurnLockEventToCosmosMsg(claimType types.Event, attributes []tmKv.Pair) types.CosmosMsg
- func CreateCosmosMsgAttributes(t *testing.T, claimType types.Event) []tmKv.Pair
- func CreateTestCosmosMsg(t *testing.T, claimType types.Event) types.CosmosMsg
- func CreateTestLogEthereumEvent(t *testing.T) types.EthereumEvent
- func CreateTestProphecyClaimEvent(t *testing.T) types.ProphecyClaimEvent
- func EthereumEventToEthBridgeClaim(valAddr sdk.ValAddress, event *types.EthereumEvent) (ethbridge.EthBridgeClaim, error)
- func GenerateClaimMessage(event types.ProphecyClaimEvent) []byte
- func GetAddressFromBridgeRegistry(client *ethclient.Client, registry common.Address, target ContractRegistry) (common.Address, error)
- func LoadPrivateKey() (key *ecdsa.PrivateKey, err error)
- func LoadSender() (address common.Address, err error)
- func PrefixMsg(msg []byte) []byte
- func RelayOracleClaimToEthereum(provider string, contractAddress common.Address, event types.Event, ...) error
- func RelayProphecyClaimToEthereum(provider string, contractAddress common.Address, event types.Event, ...) error
- func RelayToCosmos(cdc *codec.Codec, moniker string, claim *types.EthBridgeClaim, ...) error
- func SignClaim(msg []byte, key *ecdsa.PrivateKey) ([]byte, error)
- type ContractRegistry
- type OracleClaim
- type ProphecyClaim
Constants ¶
const ( // EthereumPrivateKey config field which holds the user's private key EthereumPrivateKey = "ETHEREUM_PRIVATE_KEY" TestEthereumChainID = 3 TestBridgeContractAddress = "0xd88159878c50e4B2b03BB701DD436e4A98D6fBe2" TestLockClaimType = 0 TestBurnClaimType = 1 TestProphecyID = 20 TestNonce = 19 TestEthTokenAddress = "0x0000000000000000000000000000000000000000" TestSymbol = "PEGGYETH" TestAmount = 5 TestEthereumAddress1 = "0x7B95B6EC7EbD73572298cEf32Bb54FA408207359" TestEthereumAddress2 = "0xc230f38FF05860753840e0d7cbC66128ad308B67" TestCosmosAddress1 = "cosmos1gn8409qq9hnrxde37kuxwx5hrxpfpv8426szuv" TestCosmosAddress2 = "cosmos1l5h2x255pvdy9l4z0hf9tr8zw7k657s97wyz7y" TestExpectedMessage = "d39d3a837b322ea6355a4de856bb88e0a1a33a1a9655767df2fa947f42ebcda6" TestExpectedSignature = "" //nolint:lll /* 130-byte string literal not displayed */ TestAddrHex = "970e8128ab834e8eac17ab8e3812f010678cf791" TestPrivHex = "289c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032" TestNullAddress = "0x0000000000000000000000000000000000000000" TestOtherAddress = "0x1000000000000000000000000000000000000000" )
const ( // GasLimit the gas limit in Gwei used for transactions sent with TransactOpts GasLimit = uint64(3000000) )
Variables ¶
This section is empty.
Functions ¶
func BurnLockEventToCosmosMsg ¶
BurnLockEventToCosmosMsg parses data from a Burn/Lock event witnessed on Cosmos into a CosmosMsg struct
func CreateCosmosMsgAttributes ¶
CreateCosmosMsgAttributes creates expected attributes for a MsgBurn/MsgLock for testing purposes
func CreateTestCosmosMsg ¶
CreateTestCosmosMsg creates a sample Cosmos Msg for testing purposes
func CreateTestLogEthereumEvent ¶
func CreateTestLogEthereumEvent(t *testing.T) types.EthereumEvent
CreateTestLogEthereumEvent creates a sample EthereumEvent event for testing purposes
func CreateTestProphecyClaimEvent ¶
func CreateTestProphecyClaimEvent(t *testing.T) types.ProphecyClaimEvent
CreateTestProphecyClaimEvent creates a sample ProphecyClaimEvent for testing purposes
func EthereumEventToEthBridgeClaim ¶
func EthereumEventToEthBridgeClaim(valAddr sdk.ValAddress, event *types.EthereumEvent) (ethbridge.EthBridgeClaim, error)
EthereumEventToEthBridgeClaim parses and packages an Ethereum event struct with a validator address in an EthBridgeClaim msg
func GenerateClaimMessage ¶
func GenerateClaimMessage(event types.ProphecyClaimEvent) []byte
GenerateClaimMessage Generates a hashed message containing a ProphecyClaim event's data
func GetAddressFromBridgeRegistry ¶
func GetAddressFromBridgeRegistry(client *ethclient.Client, registry common.Address, target ContractRegistry, ) (common.Address, error)
GetAddressFromBridgeRegistry queries the requested contract address from the BridgeRegistry contract
func LoadPrivateKey ¶
func LoadPrivateKey() (key *ecdsa.PrivateKey, err error)
LoadPrivateKey loads the validator's private key from environment variables
func LoadSender ¶
LoadSender uses the validator's private key to load the validator's address
func RelayOracleClaimToEthereum ¶
func RelayOracleClaimToEthereum(provider string, contractAddress common.Address, event types.Event, claim OracleClaim, key *ecdsa.PrivateKey) error
RelayOracleClaimToEthereum relays the provided OracleClaim to Oracle contract on the Ethereum network
func RelayProphecyClaimToEthereum ¶
func RelayProphecyClaimToEthereum(provider string, contractAddress common.Address, event types.Event, claim ProphecyClaim, key *ecdsa.PrivateKey) error
RelayProphecyClaimToEthereum relays the provided ProphecyClaim to CosmosBridge contract on the Ethereum network
func RelayToCosmos ¶
func RelayToCosmos(cdc *codec.Codec, moniker string, claim *types.EthBridgeClaim, cliCtx context.CLIContext, txBldr authtypes.TxBuilder) error
RelayToCosmos applies validator's signature to an EthBridgeClaim message containing information about an event on the Ethereum blockchain before relaying to the Bridge
Types ¶
type ContractRegistry ¶
type ContractRegistry byte
ContractRegistry is an enum for the bridge contract types
const ( // Valset valset contract Valset ContractRegistry = iota + 1 // Oracle oracle contract Oracle // BridgeBank bridgeBank contract BridgeBank // CosmosBridge cosmosBridge contract CosmosBridge )
func (ContractRegistry) String ¶
func (d ContractRegistry) String() string
String returns the event type as a string
type OracleClaim ¶
OracleClaim contains data required to make an OracleClaim
func ProphecyClaimToSignedOracleClaim ¶
func ProphecyClaimToSignedOracleClaim(event types.ProphecyClaimEvent, key *ecdsa.PrivateKey) (OracleClaim, error)
ProphecyClaimToSignedOracleClaim packages and signs a prophecy claim's data, returning a new oracle claim
type ProphecyClaim ¶
type ProphecyClaim struct { ClaimType types.Event CosmosSender []byte EthereumReceiver common.Address Symbol string Amount *big.Int }
ProphecyClaim contains data required to make an ProphecyClaim
func CosmosMsgToProphecyClaim ¶
func CosmosMsgToProphecyClaim(event types.CosmosMsg) ProphecyClaim
CosmosMsgToProphecyClaim parses event data from a CosmosMsg, packaging it as a ProphecyClaim