contractmanifest¶
- class ContractManifest¶
Bases:
object
Represents the manifest of a smart contract 1.
When a smart contract is deployed, it must explicitly declare the features and permissions it will use.
When it is running, it will be limited by its declared list of features and permissions, and cannot make any behavior beyond the scope of the list.
- 1
For more details, see NEP-15.
- Variables
name (str) – The name of the contract.
groups (List[ContractGroup]) – The groups of the contract.
supported_standards (List[str]) – Indicates which standards the contract supports. It can be a list of NEPs.
abi (ContractAbi) – The ABI of the contract.
permissions (List[ContractPermission]) – The permissions of the contract.
trusts (List[ContractPermissionDescriptor] or None) –
The trusted contracts and groups of the contract.
If a contract is trusted, the user interface will not give any warnings when called by the contract.
extras (str) – Custom user data as a json string.
- class ContractPermission¶
Bases:
object
Represents a permission of a contract. It describes which contracts may be invoked and which methods are called.
If a contract invokes a contract or method that is not declared in the manifest at runtime, the invocation will fail.
- Variables
contract (ContractPermissionDescriptor or None) –
Indicates which contract to be invoked.
It can be a hash of a contract, a public key of a group, or a wildcard *.
If it specifies a hash of a contract, then the contract will be invoked; If it specifies a public key of a group, then any contract in this group may be invoked; If it specifies a wildcard *, then any contract may be invoked.
Indicates which methods to be called.
It can also be assigned with a wildcard *. If it is a wildcard *, then it means that any method can be called.
- class ContractPermissionDescriptor¶
Bases:
object
Indicates which contracts are authorized to be called.
- class ContractGroup¶
Bases:
object
Represents a set of mutually trusted contracts.
A contract will trust and allow any contract in the same group to invoke it, and the user interface will not give any warnings.
A group is identified by a public key and must be accompanied by a signature for the contract hash to prove that the contract is indeed included in the group.
- class ContractAbi¶
Bases:
object
Represents the ABI of a smart contract 2.
- 2
For more details, see NEP-14.
- Variables
methods (List[ContractMethodDescriptor]) – Gets the methods in the ABI.
events (List[ContractEventDescriptor]) – Gets the events in the ABI.
- class ContractMethodDescriptor¶
Bases:
object
Represents a method in a smart contract ABI.
- Variables
name (str) – The name of the method.
parameters (List[ContractParameterDefinition]) – The parameters of the method.
return_type (ContractParameterType) – Indicates the return type of the method.
offset (int) – The position of the method in the contract script.
safe (bool) –
Indicates whether the method is a safe method.
If a method is marked as safe, the user interface will not give any warnings when it is called by other contracts.
- class ContractEventDescriptor¶
Bases:
object
Represents an event in a smart contract ABI.
- Variables
name (str) – The name of the event.
parameters (List[ContractParameterDefinition]) – The parameters of the event.
- class ContractParameterDefinition¶
Bases:
object
Represents a parameter of an event or method in ABI.
- Variables
name (str) – The name of the parameter.
type (ContractParameterType) – The type of the parameter.