Skip to content

Predicate System

As part of Ultra’s larger strategy to enable friction-less transactions on the network, we provide a predicate system that allows developers to cover their user’s resource costs.

Developers may now allow certain actions to be performed by other accounts at the cost of their own POWER resources using the allowpred action. Resources may be revoked using the revokepred action. Developers may also specify a predicate action to call to verify if this action should be paid or not (e.g. check that a user is a premium user or is whitelisted).

Predicate API

OptionalTypeNameDescription
NonamepayerThe account that adds a predicate.
Nonamepaid_contractThe contract that account will allow paying for
Nonamepaid_actionThe action from the contract that account will allow paying for
Nouint64_tmax power usageThe limit for POWER usage in UOS for paid action
Yesnamepredicate_contractThe predicate contract that will be used for inline action call
Yesnamepredicate_actionThe action that will be used to create inline action call

Example

ts
cleos push action eosio allowpred '["<payer_account>", "<paid_contract>", "<paid_action>", <max_allowed_cpu_usage>, <predicate_contract (optional)>, <predicate_action (optional)>]' -p <payer_account>@active
ts
cleos push action eosio allowpred '["alice", "eosio", "buyram", 2000, "ubisoft", "buyrampred"]' -p alice

A unique @payer permission of the developer account must be specified to utilize this system. An account with the @payer permission provided will be the one to pay for the whole transaction but only if all actions in the transaction are allowed by the payer, and all predicate actions are successfully executed. If @payer is present in the transaction then he will be ranked in the transaction queue described above instead of the first authorizer.