runtime¶
- class TriggerType(value)¶
Bases:
enum.IntFlag
Represents the triggers for running smart contracts. Triggers enable the contract to execute different logic under different usage scenarios.
- ON_PERSIST¶
Indicate that the contract is triggered by the system to execute the OnPersist method of the native contracts.
- POST_PERSIST¶
Indicate that the contract is triggered by the system to execute the PostPersist method of the native contracts.
- SYSTEM¶
The combination of all system triggers.
- VERIFICATION¶
Indicates that the contract is triggered by the verification of a IVerifiable.
- APPLICATION¶
Indicates that the contract is triggered by the execution of transactions.
- ALL¶
The combination of all triggers.
- check_witness(hash_or_pubkey: Union[boa3.builtin.type.UInt160, boa3.builtin.type.ECPoint]) → bool¶
Verifies that the transactions or block of the calling contract has validated the required script hash.
- notify(state: Any, notification_name: Optional[str] = None)¶
Notifies the client from the executing smart contract.
- Parameters
state (Any) – the notification message
notification_name (str) – name that’ll be linked to the notification
- log(message: str)¶
Show log messages to the client from the executing smart contract.
- Parameters
message (str) – the log message
- get_trigger() → boa3.internal.neo3.contracts.contracttypes.TriggerType¶
Return the smart contract trigger type.
- Returns
a value that represents the contract trigger type
- Return type
- get_notifications(script_hash: boa3.builtin.type.UInt160 = b'') → List[boa3.builtin.interop.runtime.notification.Notification]¶
This method gets current invocation notifications from specific ‘script_hash’.
- Parameters
script_hash (UInt160) – must have 20 bytes, but if it’s all zero 0000…0000 it refers to all existing notifications (like a * wildcard)
- Returns
It will return an array of all matched notifications
- Return type
List[Notification]
- get_network() → int¶
Gets the magic number of the current network.
- Returns
the magic number of the current network
- Return type
- load_script(script: bytes, args: Sequence = (), flags: boa3.internal.neo3.contracts.contracttypes.CallFlags = <CallFlags.NONE: 0>) → Any¶
Loads a script at runtime.
- executing_script_hash: boa3.builtin.type.UInt160¶
Gets the script hash of the current context.
- calling_script_hash: boa3.builtin.type.UInt160¶
Gets the script hash of the calling contract.
- invocation_counter: int¶
Gets the number of times the current contract has been called during the execution.
- entry_script_hash: boa3.builtin.type.UInt160¶
Gets the script hash of the entry context.
- script_container: Any¶
Gets the current script container.
Notification¶
Trigger¶
- class TriggerType(value)¶
Bases:
enum.IntFlag
Represents the triggers for running smart contracts. Triggers enable the contract to execute different logic under different usage scenarios.
- ON_PERSIST¶
Indicate that the contract is triggered by the system to execute the OnPersist method of the native contracts.
- POST_PERSIST¶
Indicate that the contract is triggered by the system to execute the PostPersist method of the native contracts.
- SYSTEM¶
The combination of all system triggers.
- VERIFICATION¶
Indicates that the contract is triggered by the verification of a IVerifiable.
- APPLICATION¶
Indicates that the contract is triggered by the execution of transactions.
- ALL¶
The combination of all triggers.