Documentation ¶
Index ¶
- Constants
- 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 ErrJSONMarshalling(codespace sdk.CodespaceType) sdk.Error
- func RegisterCodec(cdc *codec.Codec)
- type CodeType
- type EthBridgeClaim
- func CreateEthClaimFromOracleString(nonce int, ethereumAddress EthereumAddress, validator sdk.ValAddress, ...) (EthBridgeClaim, sdk.Error)
- func CreateTestEthClaim(t *testing.T, validatorAddress sdk.ValAddress, ...) EthBridgeClaim
- func MapOracleClaimsToEthBridgeClaims(nonce int, ethereumSender EthereumAddress, ...) ([]EthBridgeClaim, sdk.Error)
- func NewEthBridgeClaim(nonce int, ethereumSender EthereumAddress, cosmosReceiver sdk.AccAddress, ...) 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 ( TestAddress = "cosmos1gn8409qq9hnrxde37kuxwx5hrxpfpv8426szuv" TestValidator = "cosmos1xdp5tvt7lxh8rf9xx07wy2xlagzhq24ha48xtq" TestNonce = 0 TestEthereumAddress = "0x7B95B6EC7EbD73572298cEf32Bb54FA408207359" AltTestEthereumAddress = "0x7B95B6EC7EbD73572298cEf32Bb54FA408207344" TestCoins = "10ethereum" AltTestCoins = "12ethereum" )
Variables ¶
This section is empty.
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
func ErrInvalidEthNonce ¶
func ErrInvalidEthNonce(codespace sdk.CodespaceType) sdk.Error
func ErrJSONMarshalling ¶
func ErrJSONMarshalling(codespace sdk.CodespaceType) sdk.Error
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
Types ¶
type CodeType ¶
Local code type
const ( DefaultCodespace sdk.CodespaceType = ModuleName CodeInvalidEthNonce CodeType = 1 CodeInvalidEthAddress CodeType = 2 CodeErrJSONMarshalling CodeType = 3 )
Exported code type numbers
type EthBridgeClaim ¶
type EthBridgeClaim struct { Nonce int `json:"nonce"` 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(nonce int, 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, validatorAddress sdk.ValAddress, testEthereumAddress EthereumAddress, coins string) EthBridgeClaim
func MapOracleClaimsToEthBridgeClaims ¶
func MapOracleClaimsToEthBridgeClaims(nonce int, ethereumSender EthereumAddress, oracleValidatorClaims map[string]string, f func(int, 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(nonce int, 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
func NewEthereumAddress ¶
func NewEthereumAddress(address string) EthereumAddress
NewEthereumAddress is a constructor function for EthereumAddress
func (EthereumAddress) MarshalJSON ¶
func (ethereumAddress EthereumAddress) MarshalJSON() ([]byte, error)
Route should return the name of the module
func (EthereumAddress) String ¶
func (ethereumAddress EthereumAddress) String() string
Route should return the name of the module
func (*EthereumAddress) UnmarshalJSON ¶
func (a *EthereumAddress) UnmarshalJSON(input []byte) error
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
NewOracleClaim is a constructor function for OracleClaim
type QueryEthProphecyParams ¶
type QueryEthProphecyParams struct { Nonce int `json:"nonce"` EthereumSender EthereumAddress `json:"ethereum_sender"` }
defines the params for the following queries: - 'custom/ethbridge/prophecies/'
func NewQueryEthProphecyParams ¶
func NewQueryEthProphecyParams(nonce int, ethereumSender EthereumAddress) 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