Documentation ¶
Index ¶
- Constants
- func BuildContract(arg types.InitiaCompilerArgument) ([]byte, error)
- func CleanContractPackage(arg types.InitiaCompilerArgument, cleanCache, cleanByproduct, force bool) ([]byte, error)
- func CreateContractPackage(arg types.InitiaCompilerArgument, name string) ([]byte, error)
- func DecodeModuleBytes(moduleBytes []byte) ([]byte, error)
- func DecodeMoveResource(store KVStore, structTag []byte, resourceBytes []byte) ([]byte, error)
- func DecodeScriptBytes(scriptBytes []byte) ([]byte, error)
- func ExecuteContract(vm VM, store KVStore, api GoAPI, verbose bool, gasLimit uint64, ...) ([]byte, error)
- func ExecuteScript(vm VM, store KVStore, api GoAPI, verbose bool, gasLimit uint64, ...) ([]byte, error)
- func Initialize(vm VM, store KVStore, api GoAPI, verbose bool, moduleBundle []byte) error
- func LibinitiaVersion() (string, error)
- func PublishModuleBundle(vm VM, store KVStore, api GoAPI, isVerbose bool, gasLimit uint64, ...) ([]byte, error)
- func QueryContract(vm VM, store KVStore, api GoAPI, verbose bool, gasLimit uint64, message []byte) ([]byte, error)
- func ReleaseVM(vm VM)
- func TestContract(arg types.InitiaCompilerArgument, testConfig types.TestConfig) ([]byte, error)
- type DBState
- type Gas
- type GasMeter
- type GoAPI
- type KVStore
- type Lookup
- type MockAPI
- type MockBlockAPI
- type MockStakingAPI
- type ShareAmountRatio
- type VM
Constants ¶
const CanonicalLength = 32
const (
CostTransfer uint64 = 100
)
Variables ¶
This section is empty.
Functions ¶
func BuildContract ¶
func BuildContract(arg types.InitiaCompilerArgument) ([]byte, error)
func CleanContractPackage ¶
func CleanContractPackage(arg types.InitiaCompilerArgument, cleanCache, cleanByproduct, force bool) ([]byte, error)
func CreateContractPackage ¶
func CreateContractPackage(arg types.InitiaCompilerArgument, name string) ([]byte, error)
func DecodeModuleBytes ¶
DecodeModuleBytes decode module bytes to MoveModule instance and return as jSON string
func DecodeMoveResource ¶
DecodeMoveResource decode resource bytes to move resource instance and return as jSON string
func DecodeScriptBytes ¶
DecodeScriptBytes decode script bytes to MoveFunction instance and return as jSON string
func ExecuteContract ¶
func ExecuteContract( vm VM, store KVStore, api GoAPI, verbose bool, gasLimit uint64, sessionID []byte, sender []byte, message []byte, ) ([]byte, error)
ExecuteContract call ffi(`execute_contract`) to execute script with write_op reflection
func ExecuteScript ¶
func ExecuteScript( vm VM, store KVStore, api GoAPI, verbose bool, gasLimit uint64, sessionID []byte, sender []byte, message []byte, ) ([]byte, error)
ExecuteScript call ffi(`execute_script`) to execute entry function with write_op reflection
func Initialize ¶
Initialize call ffi(`initialize`) to initialize vm and publish standard libraries CONTRACT: should be executed at chain genesis
func LibinitiaVersion ¶
func PublishModuleBundle ¶
func PublishModuleBundle( vm VM, store KVStore, api GoAPI, isVerbose bool, gasLimit uint64, sessionID []byte, sender []byte, moduleBundle []byte, ) ([]byte, error)
PublishModuleBundle call ffi(`publish_module_bundle`) to store module bundle
func QueryContract ¶
func QueryContract( vm VM, store KVStore, api GoAPI, verbose bool, gasLimit uint64, message []byte, ) ([]byte, error)
QueryContract call ffi(`query_contract`) to get entry function execution result without write_op reflection
func TestContract ¶
func TestContract(arg types.InitiaCompilerArgument, testConfig types.TestConfig) ([]byte, error)
Types ¶
type GasMeter ¶
type GasMeter interface {
GasConsumed() Gas
}
GasMeter is a copy of an interface declaration from cosmos-sdk https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34
type KVStore ¶
type KVStore interface { Get(key []byte) []byte Set(key, value []byte) Delete(key []byte) // Iterator over a domain of keys in ascending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. // Iterator must be closed by caller. // To iterate over entire domain, use store.Iterator(nil, nil) Iterator(start, end []byte) dbm.Iterator // Iterator over a domain of keys in descending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. // Iterator must be closed by caller. ReverseIterator(start, end []byte) dbm.Iterator }
KVStore copies a subset of types from cosmos-sdk We may wish to make this more generic sometime in the future, but not now https://github.com/cosmos/cosmos-sdk/blob/bef3689245bab591d7d169abd6bea52db97a70c7/store/types/store.go#L170
type Lookup ¶
type Lookup struct {
// contains filtered or unexported fields
}
func (Lookup) ReverseIterator ¶
ReverseIterator wraps the underlying DB's ReverseIterator method panicing on error.
type MockAPI ¶
type MockAPI struct { BlockAPI *MockBlockAPI StakingAPI *MockStakingAPI }
func NewMockAPI ¶
func NewMockAPI(blockAPI *MockBlockAPI, stakingAPI *MockStakingAPI) *MockAPI
func (MockAPI) AmountToShare ¶
func (MockAPI) GetBlockInfo ¶
func (MockAPI) ShareToAmount ¶
func (MockAPI) UnbondTimestamp ¶
type MockBlockAPI ¶
type MockBlockAPI struct {
// contains filtered or unexported fields
}
func NewMockBlockAPI ¶
func NewMockBlockAPI(height uint64, timestamp uint64) MockBlockAPI
NewMockBlockAPI return MockBlockAPI instance
func (MockBlockAPI) GetBlockInfo ¶
func (m MockBlockAPI) GetBlockInfo() (uint64, uint64)
type MockStakingAPI ¶
type MockStakingAPI struct {
// contains filtered or unexported fields
}
func NewMockStakingAPI ¶
func NewMockStakingAPI() MockStakingAPI
NewMockStakingAPI return MockStakingAPI instance
func (MockStakingAPI) AmountToShare ¶
func (m MockStakingAPI) AmountToShare(validator []byte, amount uint64) (uint64, error)
func (MockStakingAPI) SetShareRatio ¶
func (m MockStakingAPI) SetShareRatio(validator []byte, share uint64, amount uint64)
func (MockStakingAPI) ShareToAmount ¶
func (m MockStakingAPI) ShareToAmount(validator []byte, share uint64) (uint64, error)
type ShareAmountRatio ¶
type ShareAmountRatio struct {
// contains filtered or unexported fields
}