shell.contract

class eosfactory.shell.contract.Contract(account, contract_dir=None, abi_file=None, wasm_file=None, permission=None, expiration_sec=None, skip_sign=0, dont_broadcast=0, force_unique=0, max_cpu_usage=0, max_net_usage=0, ref_block=None, delay_sec=0)[source]

Bases: eosfactory.shell.contract.ContractBuilder

Add a contract to the given account.

Parameters:
  • account (shell.Account) – The Account object to be fitted with a contract.
  • contract_dir (str) – The path to a directory.
  • wasm_file (str) – The WASM file relative to the contract_dir.
  • abi_file (str) – The ABI file for the contract relative to the contract-dir.

See definitions of the remaining parameters: cleos.common_parameters().

clear()[source]

Remove contract on an account

code(code=None, abi=None, wasm=False)[source]

Retrieve the code and ABI

Parameters:
  • code (str) – If set, the name of the file to save the contract WAST/WASM to.
  • abi (str) – If set, the name of the file to save the contract ABI to.
  • wasm (bool) – Save contract as wasm.
deploy(permission=None, dont_broadcast=None, payer=None)[source]

Deploy the contract.

path()[source]

Return the path to the contract.

push_action(action, data, permission=None, expiration_sec=None, skip_sign=0, dont_broadcast=0, force_unique=0, max_cpu_usage=0, max_net_usage=0, ref_block=None, json=False)[source]

Push a transaction with a single action.

Call EOSIO cleos with the push action command. Store the result, which is an object of the class cleos.PushAction, as the value of the action attribute.

Parameters:
  • action (str or json or filename) – Definition of the action to execute on the contract.
  • data (str) – The arguments to the contract.

See definitions of the remaining parameters: cleos.common_parameters().

show_action(action, data, permission=None)[source]

Implements the push action command without broadcasting.

table(table_name, scope='', binary=False, limit=10, key='', lower='', upper='')[source]

Retrieve the contents of a database table

Parameters:
  • scope (str or interface.Account) – The scope within the account in which the table is found.
  • table (str) – The name of the table as specified by the contract abi.
  • binary (bool) – Return the value as BINARY rather than using abi to interpret as JSON. Default is False.
  • limit (int) – The maximum number of rows to return. Default is 10.
  • lower (str) – JSON representation of lower bound value of key, defaults to first.
  • upper (str) – JSON representation of upper bound value value of key, defaults to last.
Returns:

cleos_set.SetTable object

class eosfactory.shell.contract.ContractBuilder(contract_dir=None, c_cpp_properties_path=None, abi_file=None, wasm_file=None)[source]

Bases: object

Build or delete a contract project.

Parameters:
  • contract_dir (str) – If set, a hint to the root directory of a contract project, otherwise the current working directory.
  • c_cpp_properties_path (str) – If set, the directory of a C/CPP VSCode extension configuration file.
  • abi_file (str) – If set, the path to the ABI file, absolute, or relative to contract_dir.
  • wasm_file (str) – If set, the path to the WASM file, absolute, or relative to contract_dir.
build(force=True)[source]

Make both, ABI and WASM files.

delete()[source]

Delete the project.

is_built()[source]

Check whether both the ABI and WASM files exist.

path()[source]

Return the path to the contract.