Documentation ¶
Index ¶
- Constants
- Variables
- func CreateOracleClaimFromEthClaim(cdc *codec.Codec, ethClaim EthBridgeClaim) (oracle.Claim, error)
- func ErrInvalidEthAddress(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidEthNonce(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidEthSymbol(codespace sdk.CodespaceType) sdk.Error
- func ErrJSONMarshalling(codespace sdk.CodespaceType) sdk.Error
- func RegisterCodec(cdc *codec.Codec)
- type CodeType
- type EthBridgeClaim
- func CreateEthClaimFromOracleString(ethereumChainID int, bridgeContract EthereumAddress, nonce int, symbol string, ...) (EthBridgeClaim, sdk.Error)
- func CreateTestEthClaim(t *testing.T, testContractAddress EthereumAddress, ...) EthBridgeClaim
- func MapOracleClaimsToEthBridgeClaims(ethereumChainID int, bridgeContract EthereumAddress, nonce int, symbol string, ...) ([]EthBridgeClaim, sdk.Error)
- func NewEthBridgeClaim(ethereumChainID int, bridgeContract EthereumAddress, nonce int, symbol string, ...) EthBridgeClaim
- type EthereumAddress
- type MsgCreateEthBridgeClaim
- type OracleClaimContent
- type QueryEthProphecyParams
- type QueryEthProphecyResponse
Constants ¶
const ( // ModuleName is the name of the ethereum bridge module ModuleName = "ethbridge" // StoreKey is the string store representation StoreKey = ModuleName // QuerierRoute is the querier route for the ethereum bridge module QuerierRoute = ModuleName // RouterKey is the msg router key for the ethereum bridge module RouterKey = ModuleName )
const ( TestEthereumChainID = 3 TestBridgeContractAddress = "0xC4cE93a5699c68241fc2fB503Fb0f21724A624BB" TestAddress = "cosmos1gn8409qq9hnrxde37kuxwx5hrxpfpv8426szuv" TestValidator = "cosmos1xdp5tvt7lxh8rf9xx07wy2xlagzhq24ha48xtq" TestNonce = 0 TestSymbol = "eth" TestTokenContractAddress = "0x0000000000000000000000000000000000000000" TestEthereumAddress = "0x7B95B6EC7EbD73572298cEf32Bb54FA408207359" AltTestEthereumAddress = "0x7B95B6EC7EbD73572298cEf32Bb54FA408207344" TestCoins = "10ethereum" AltTestCoins = "12ethereum" )
Variables ¶
var ( EventTypeCreateClaim = "create_claim" EventTypeProphecyStatus = "prophecy_status" AttributeKeyEthereumSender = "ethereum_sender" AttributeKeyCosmosReceiver = "cosmos_receiver" AttributeKeyAmount = "amount" AttributeKeyStatus = "status" AttributeValueCategory = ModuleName )
Ethbridge module event types
Functions ¶
func CreateOracleClaimFromEthClaim ¶
CreateOracleClaimFromEthClaim converts a specific ethereum bridge claim to a general oracle claim to be used by the oracle module. The oracle module expects every claim for a particular prophecy to have the same id, so this id must be created in a deterministic way that all validators can follow. For this, we use the Nonce an Ethereum Sender provided, as all validators will see this same data from the smart contract.
func ErrInvalidEthAddress ¶
func ErrInvalidEthAddress(codespace sdk.CodespaceType) sdk.Error
ErrInvalidEthAddress implements sdk.Error.
func ErrInvalidEthNonce ¶
func ErrInvalidEthNonce(codespace sdk.CodespaceType) sdk.Error
ErrInvalidEthNonce implements sdk.Error.
func ErrInvalidEthSymbol ¶
func ErrInvalidEthSymbol(codespace sdk.CodespaceType) sdk.Error
ErrInvalidEthSymbol implements sdk.Error.
func ErrJSONMarshalling ¶
func ErrJSONMarshalling(codespace sdk.CodespaceType) sdk.Error
ErrJSONMarshalling implements sdk.Error.
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
Types ¶
type CodeType ¶
CodeType local code type
const ( DefaultCodespace sdk.CodespaceType = ModuleName CodeInvalidEthNonce CodeType = 1 CodeInvalidEthAddress CodeType = 2 CodeErrJSONMarshalling CodeType = 3 CodeInvalidEthSymbol CodeType = 4 )
Exported code type numbers
type EthBridgeClaim ¶
type EthBridgeClaim struct { EthereumChainID int `json:"ethereum_chain_id"` BridgeContractAddress EthereumAddress `json:"bridge_contract_address"` Nonce int `json:"nonce"` Symbol string `json:"symbol"` TokenContractAddress EthereumAddress `json:"token_contract_address"` EthereumSender EthereumAddress `json:"ethereum_sender"` CosmosReceiver sdk.AccAddress `json:"cosmos_receiver"` ValidatorAddress sdk.ValAddress `json:"validator_address"` Amount sdk.Coins `json:"amount"` }
func CreateEthClaimFromOracleString ¶
func CreateEthClaimFromOracleString(ethereumChainID int, bridgeContract EthereumAddress, nonce int, symbol string, tokenContract EthereumAddress, ethereumAddress EthereumAddress, validator sdk.ValAddress, oracleClaimString string) (EthBridgeClaim, sdk.Error)
CreateEthClaimFromOracleString converts a string from any generic claim from the oracle module into an ethereum bridge specific claim.
func CreateTestEthClaim ¶
func CreateTestEthClaim(t *testing.T, testContractAddress EthereumAddress, testTokenAddress EthereumAddress, validatorAddress sdk.ValAddress, testEthereumAddress EthereumAddress, coins string) EthBridgeClaim
func MapOracleClaimsToEthBridgeClaims ¶
func MapOracleClaimsToEthBridgeClaims(ethereumChainID int, bridgeContract EthereumAddress, nonce int, symbol string, tokenContract EthereumAddress, ethereumSender EthereumAddress, oracleValidatorClaims map[string]string, f func(int, EthereumAddress, int, string, EthereumAddress, EthereumAddress, sdk.ValAddress, string) (EthBridgeClaim, sdk.Error)) ([]EthBridgeClaim, sdk.Error)
MapOracleClaimsToEthBridgeClaims maps a set of generic oracle claim data into EthBridgeClaim objects
func NewEthBridgeClaim ¶
func NewEthBridgeClaim(ethereumChainID int, bridgeContract EthereumAddress, nonce int, symbol string, tokenContact EthereumAddress, ethereumSender EthereumAddress, cosmosReceiver sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coins) EthBridgeClaim
NewEthBridgeClaim is a constructor function for NewEthBridgeClaim
type EthereumAddress ¶
type EthereumAddress gethCommon.Address
EthereumAddress defines a standard ethereum address
func NewEthereumAddress ¶
func NewEthereumAddress(address string) EthereumAddress
NewEthereumAddress is a constructor function for EthereumAddress
func (EthereumAddress) MarshalJSON ¶
func (ethAddr EthereumAddress) MarshalJSON() ([]byte, error)
MarshalJSON marshals the etherum address to JSON
func (EthereumAddress) String ¶
func (ethAddr EthereumAddress) String() string
Route should return the name of the module
func (*EthereumAddress) UnmarshalJSON ¶
func (ethAddr *EthereumAddress) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals an ethereum address
type MsgCreateEthBridgeClaim ¶
type MsgCreateEthBridgeClaim EthBridgeClaim
MsgCreateEthBridgeClaim defines a message for creating claims on the ethereum bridge
func CreateTestEthMsg ¶
func CreateTestEthMsg(t *testing.T, validatorAddress sdk.ValAddress) MsgCreateEthBridgeClaim
Ethereum-bridge specific stuff
func NewMsgCreateEthBridgeClaim ¶
func NewMsgCreateEthBridgeClaim(ethBridgeClaim EthBridgeClaim) MsgCreateEthBridgeClaim
NewMsgCreateEthBridgeClaim is a constructor function for MsgCreateBridgeClaim
func (MsgCreateEthBridgeClaim) GetSignBytes ¶
func (msg MsgCreateEthBridgeClaim) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateEthBridgeClaim) GetSigners ¶
func (msg MsgCreateEthBridgeClaim) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateEthBridgeClaim) Route ¶
func (msg MsgCreateEthBridgeClaim) Route() string
Route should return the name of the module
func (MsgCreateEthBridgeClaim) Type ¶
func (msg MsgCreateEthBridgeClaim) Type() string
Type should return the action
func (MsgCreateEthBridgeClaim) ValidateBasic ¶
func (msg MsgCreateEthBridgeClaim) ValidateBasic() sdk.Error
ValidateBasic runs stateless checks on the message
type OracleClaimContent ¶
type OracleClaimContent struct { CosmosReceiver sdk.AccAddress `json:"cosmos_receiver"` Amount sdk.Coins `json:"amount"` }
OracleClaimContent is the details of how the content of the claim for each validator will be stored in the oracle
func CreateOracleClaimFromOracleString ¶
func CreateOracleClaimFromOracleString(oracleClaimString string) (OracleClaimContent, sdk.Error)
CreateOracleClaimFromOracleString converts a JSON string into an OracleClaimContent struct used by this module. In general, it is expected that the oracle module will store claims in this JSON format and so this should be used to convert oracle claims.
func NewOracleClaimContent ¶
func NewOracleClaimContent(cosmosReceiver sdk.AccAddress, amount sdk.Coins) OracleClaimContent
NewOracleClaimContent is a constructor function for OracleClaim
type QueryEthProphecyParams ¶
type QueryEthProphecyParams struct { EthereumChainID int `json:"ethereum_chain_id"` BridgeContractAddress EthereumAddress `json:"bridge_contract_address"` Nonce int `json:"nonce"` Symbol string `json:"symbol"` TokenContractAddress EthereumAddress `json:"token_contract_address"` EthereumSender EthereumAddress `json:"ethereum_sender"` }
QueryEthProphecyParams defines the params for the following queries: - 'custom/ethbridge/prophecies/'
func NewQueryEthProphecyParams ¶
func NewQueryEthProphecyParams(ethereumChainID int, bridgeContractAddress EthereumAddress, nonce int, symbol string, tokenContractAddress EthereumAddress, ethereumSender EthereumAddress) QueryEthProphecyParams
QueryEthProphecyParams creates a new QueryEthProphecyParams
type QueryEthProphecyResponse ¶
type QueryEthProphecyResponse struct { ID string `json:"id"` Status oracle.Status `json:"status"` Claims []EthBridgeClaim `json:"claims"` }
Query Result Payload for an eth prophecy query
func CreateTestQueryEthProphecyResponse ¶
func CreateTestQueryEthProphecyResponse(cdc *codec.Codec, t *testing.T, validatorAddress sdk.ValAddress) QueryEthProphecyResponse
func NewQueryEthProphecyResponse ¶
func NewQueryEthProphecyResponse(id string, status oracle.Status, claims []EthBridgeClaim) QueryEthProphecyResponse
func (QueryEthProphecyResponse) String ¶
func (response QueryEthProphecyResponse) String() string