Utility

Utility Actions

The Utility Layer adds a handful of useful actions that can be applied for various development use cases.

Action Name

Description

logevent

Log various contract events as inline actions.

paybwbill

Pay transaction bandwidth bill.

Log an Event

Certain actions can be designed to trigger Marble'slogevent() action.

Supported Events

Event Name

Description

newserial

The new serial number created from a newnft() action.

Required Authority: self

Action Parameters

  • name event_name: The name of the event to log.

  • int64_t event_value: The value of the new event.

  • time_point_sec: The time point of the event.

  • string memo: A memo field for extra info.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} logevent '[ {params} ]' -p {manager}
Marble CLI
marble log ...

Pay Bandwidth Bill

Marble contracts can optionally pay the bandwidth (CPU and NET) charges for a transaction by front-loading the paybwbill() action into a transaction. If the Marble contract account signs the transaction, it will automatically be listed as the first authorizer of the transaction. On chains with the BILL_FIRST_AUTHORIZER protocol feature enabled, this will allow the contract to pay for the all bandwidth charges for the entire transaction.

Note that while still useful as a standalone feature, the paybwbill() action works best when paired with middleware that can screen transactions before choosing to pay bandwidth charges, instead of just signing them blindly.

Required Authority: self

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} paybwbill '[ {params} ]' -p {admin}
Marble CLI
marble hopper frontload paybwbill