Documentation
¶
Index ¶
Constants ¶
const EVMModuleName = "evm"
TODO: can we move this to oasis-sdk/client-sdk/go/modules/evm?
const NativeRuntimeTokenAddress = "oasis1runt1menat1vet0ken0000000000000000000000"
A fake address that is used to represent the native runtime token in contexts that are primarily intended for tracking EVM tokens (= contract-based tokens).
Variables ¶
var ( // https://github.com/oasisprotocol/oasis-sdk/blob/runtime-sdk/v0.2.0/runtime-sdk/modules/evm/src/lib.rs#L123 ErrEVMExecutionFailed = errors.New(EVMModuleName, 2, "execution failed") // https://github.com/oasisprotocol/oasis-sdk/blob/runtime-sdk/v0.2.0/runtime-sdk/modules/evm/src/lib.rs#L147 ErrEVMReverted = errors.New(EVMModuleName, 8, "reverted") )
Functions ¶
This section is empty.
Types ¶
type EVMContractData ¶
type EVMDeterministicError ¶
type EVMDeterministicError struct {
// contains filtered or unexported fields
}
func (EVMDeterministicError) Is ¶
func (err EVMDeterministicError) Is(target error) bool
type EVMEncryptedData ¶
type EVMEncryptedData struct { Format common.CallFormat PublicKey []byte DataNonce []byte DataData []byte ResultNonce []byte ResultData []byte }
func EVMMaybeUnmarshalEncryptedData ¶
func EVMMaybeUnmarshalEncryptedData(data []byte, result *[]byte) (*EVMEncryptedData, error)
EVMMaybeUnmarshalEncryptedData breaks down a possibly encrypted data + result into their encryption envelope fields. If the data is not encrypted, it returns nil with no error.
type EVMPossibleToken ¶
type EVMPossibleToken struct {
Mutated bool
}
type EVMTokenBalanceData ¶
type EVMTokenBalanceData struct { // Balance... if you're here to ask about why there's a "balance" struct // with a Balance field, it's because the struct is really a little // document that the EVMDownloadTokenBalance function can optionally give // you about an account. (And we didn't name the struct "account" because // the only thing inside it is the balance.) We let that function return a // *EVMTokenBalanceData so that it can return nil if it can determine that // the contract is not supported. Plus, Go's idea of an arbitrary size // integer is *big.Int, and we don't want anyone fainting if they see a // ** in the codebase. Balance *big.Int }
func EVMDownloadTokenBalance ¶
func EVMDownloadTokenBalance(ctx context.Context, logger *log.Logger, source nodeapi.RuntimeApiLite, round uint64, tokenEthAddr []byte, accountEthAddr []byte, tokenType EVMTokenType) (*EVMTokenBalanceData, error)
EVMDownloadTokenBalance tries to download the balance of a given account for a given token. If it transiently fails to download the balance, it returns with a non-nil error. If it deterministically cannot download the balance, it returns nil with nil error as well. Note that this latter case is not considered an error!
type EVMTokenData ¶
type EVMTokenData struct { Type EVMTokenType Name string Symbol string Decimals uint8 *EVMTokenMutableData }
func EVMDownloadNewToken ¶
func EVMDownloadNewToken(ctx context.Context, logger *log.Logger, source nodeapi.RuntimeApiLite, round uint64, tokenEthAddr []byte) (*EVMTokenData, error)
EVMDownloadNewToken tries to download the data of a given token. If it transiently fails to download the data, it returns with a non-nil error. If it deterministically cannot download the data, it returns a struct with the `Type` field set to `EVMTokenTypeUnsupported`.
type EVMTokenMutableData ¶
func EVMDownloadMutatedToken ¶
func EVMDownloadMutatedToken(ctx context.Context, logger *log.Logger, source nodeapi.RuntimeApiLite, round uint64, tokenEthAddr []byte, tokenType EVMTokenType) (*EVMTokenMutableData, error)
EVMDownloadMutatedToken tries to download the mutable data of a given token. If it transiently fails to download the data, it returns with a non-nil error. If it deterministically cannot download the data, it returns nil with nil error as well. Note that this latter case is not considered an error!
type EVMTokenType ¶
type EVMTokenType int
const ( EVMTokenTypeNative EVMTokenType = -1 // A placeholder type to represent the runtime's native token. No contract should be assigned this type. EVMTokenTypeUnsupported EVMTokenType = 0 // A smart contract for which we're confident it's not a supported token kind. EVMTokenTypeERC20 EVMTokenType = 20 )