Call Header

Typed Struct (EIP712)

Call(uint16 call_index,uint16 payer_index,string call_type,address from,address to,string to_ens,uint256 eth_value,uint32 gas_limit,uint16 permissions,string flow_control,uint16 jump_on_success,uint16 jump_on_fail,string method_interface)

Params

NameType

call_index

uint16

payer_index

uint16

call_type

string

from

address

to

address

to_ens

string

eth_value

uint256

gas_limit

uint32

permissions

uint16

flow_control

string

jump_on_success

uint16

jump_on_fail

uint16

method_interface

string

call_index

Call index is the call position, stating from 1. The value must be equal to position of the call in the list of calls inside the FCT.

Call index param helps the user to identify the call from which a returned data s used when signing an EIP-712 FCT message

payer_index

The index of the "from" address that will pay for the call, starting from 1. Usually it will be the same value as the call_index. If the payer is 0, the payment of the call will be equally divided by the other payers of the FCT.

If all payer indexes on an FCT are 0, the activator will pay for this FCT

call_type

FCT supports three types of calls: call, staticcall and delegatecall

flow_control is defined using human readable string, so the user can easily see the call type.

EIP712 StringValueMeaning

"action"

0

Executing the call using the low level "call" function. The contract being called can change blockchain state and sees the FCT_Runner as the calling entity.

"view only"

1

Executing the call using the low level "staticcall" function. The contract being called is not allowed to change the blockchain state and sees the FCT_Runner as the calling entity.

"library"

2

Executing the call using the low level "delegatecall" function. The contract being called runs in the context of the FCT_Runner, has access the FCT_Runner storage variables and any calls from it to an external contracts will be looked as being called directly from the FCT_Runner address.

"library" is extremely powerful, yet dangerous. It is recommended to use only trusted contracts for "library" calls and protect the calling address by forcing to use both "to" address and "to_ens" (Preferred LocalENS of type: library)

from

From is the contract that executes the call, usually an on-chain-wallet like the vault. This contract must implement the IFCT_Runner interface.

to

Destination of the call. A smart contract address in case of calling a contract, or any address in case of sending ETH.

to_ens (optional)

ENS is also supported.

eth_value

The ETH value that will be sent with the call.

gas_limit

There is possibly to limit the gas usage per call. When set to 0, no limit is enforced.

permissions

permissions are 16 bits that can be used to define security groups for FCTs

The permissions are just passed transparently, by the FCT_Engine, to the FCT Runner. The FCT Runner can implement any logic regarding the permissions bits enabling an extendable execution model for FCTs.

For example, FCT Runner can allow a specific address (child account) to run only FCTs that has 0x0001 permission, while limiting execution of FCTs with 0x0001 permissions in terms of protocols, amounts and rate.

flow_control

FCT supports if/then functionality via the flow_control field combined with the "jump on" fields.

flow_control is defined using human readable string, so the user can easily see the flow condition.

EIP712 StringValueMeaning

"continue on success, revert on fail"

0

If call reverts, revert the whole FCT, otherwise, continue to the next call according to the jump_on_success field

"continue on success, stop on fail"

1

If call reverts, stop FCT execution (previous calls are not reverted), otherwise, continue to the next call according to the jump_on_success field

"continue on success, continue on fail"

2

Whether call reverts or not, continue to the next call according to the jump_on_success and jump_on_fail fields respectively

"revert on success, continue on fail"

3

If call reverts, continue to the next call according to the jump_on_fail field, otherwise, revert the whole FCT

"revert on success, stop on fail"

4

If call reverts, stop FCT execution (previous calls are not reverted), otherwise, revert the whole FCT

"stop on success, continue on fail"

5

If call reverts, continue to the next call according to the jump_on_fail field, otherwise, stop FCT execution (previous calls are not reverted)

"stop on success, revert on fail"

6

If call reverts, revert the whole FCT, otherwise, stop FCT execution (previous calls are not reverted)

"stop on success, stop on fail"

7

Whether call reverts or not, stop FCT execution (previous calls are not reverted)

if/then blocks can be achieved by using one of the "cont" flow controls and setting the "jump_on" values

jump_on_success

Part of the flow control. Specify the amount of calls to jump over when current call succeed. When setting to 0 and the current call succeed, the adjacent call will be executed.

This value is ignored when "stop on success" or "revert on success" is being used

jump_on_fail

Part of the flow control. Specify the amount of calls to jump over when current call fails. When setting to 0 and the current call fails, the adjacent call will be executed.

This value is ignored when "stop on fail" or "revert on fail" is being used

method_interface

The name of the function to be called followed by type-names, in parentheses, without any spaces. This is used in order to calculate the function signature and selector. See more info here

ERC20 transfer method interface looks like this: "transfer(address,uint256)"

Last updated