[][src]Module casperlabs_contract_ffi::contract_api

Modules

argsparser
pointers

Enums

PurseTransferResult
TransferResult

Functions

add

Add the given value to the one currently under the key in the global state

add_associated_key

Adds a public key with associated weight to an account.

add_uref

Add the given key to the known_urefs map under the given name

call_contract

Call the given contract, passing the given (serialized) arguments to the host in order to have them available to the called contract during its execution. The value returned from the contract call (see ret above) is returned from this function.

create_purse
fn_by_name

Returns the serialized bytes of a function which is exported in the current module. Note that the function is wrapped up in a new module and re-exported under the name "call". fn_bytes_by_name is meant to be used when storing a contract on-chain at an unforgable reference.

get_arg

Return the i-th argument passed to the host for the current module invocation. Note that this is only relevant to contracts stored on-chain since a contract deployed directly is not invoked with any arguments.

get_balance

Gets the balance of a given purse

get_blocktime
get_caller

Returns caller of current context. When in root context (not in the sub call) - returns None. When in the sub call - returns public key of the account that made the deploy.

get_phase
get_uref

Return the unforgable reference known by the current module under the given name. This either comes from the known_urefs of the account or contract, depending on whether the current module is a sub-call or not.

has_uref

Check if the given name corresponds to a known unforgable reference

is_valid

Checks if all the keys contained in the given Value (rather, thing that can be turned into a Value) are valid, in the sense that all of the urefs (and their access rights) are known in the current context.

list_known_urefs
main_purse
new_uref

Returns a new unforgable pointer, where value is initialized to init

read

Read value under the key in the global state

read_local

Reads the value at the given key in the context-local partition of global state

remove_associated_key

Removes a public key from associated keys on an account

remove_uref

Removes Key persisted under [name] in the current context's map.

ret

Return t to the host, terminating the currently running module. Note this function is only relevant to contracts stored on chain which return a value to their caller. The return value of a directly deployed contract is never looked at.

revert

Stops execution of a contract and reverts execution effects with a given reason.

set_action_threshold
store_function

Gets the serialized bytes of an exported function (see fn_by_name), then computes gets the address from the host to produce a key where the contract is then stored in the global state. This key is returned.

store_function_at

Finds function by the name and stores it at the unforgable name.

transfer_from_purse_to_account

Transfers amount of motes from source purse to target account. If target does not exist it will create it.

transfer_from_purse_to_purse

Transfers amount of motes from source purse to target purse.

transfer_to_account

Transfers amount of motes from default purse of the account to target account. If target does not exist it will create it.

update_associated_key

Updates the value stored under a public key associated with an account

write

Write the value under the key in the global state

write_local

Writes the given value at the given key in the context-local partition of global state