# Call Header

## Typed Struct (EIP712)

{% code overflow="wrap" %}

```solidity
Call(uint16 call_index,uint16 payer_index,string call_type,address from,address to,string to_ens,uint256 value,uint32 gas_limit,uint16 permissions,uint16 validation,string flow_control,bool returned_false_means_fail,uint16 jump_on_success,uint16 jump_on_fail,uint32 variable_arguments_start,uint32 variable_arguments_end,string method_interface)
```

{% endcode %}

## Params

| Name                        | Type    |
| --------------------------- | ------- |
| `call_index`                | uint16  |
| `payer_index`               | uint16  |
| `call_type`                 | string  |
| `from`                      | address |
| `to`                        | address |
| `to_ens`                    | string  |
| `value`                     | uint256 |
| `gas_limit`                 | uint32  |
| `permissions`               | uint16  |
| `validation`                | uint16  |
| `flow_control`              | string  |
| `returned_false_means_fail` | bool    |
| `jump_on_success`           | uint16  |
| `jump_on_fail`              | uint16  |
| `variable_arguments_start`  | uint32  |
| `variable_arguments_end`    | uint32  |
| `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.

{% hint style="info" %}
Call index param helps the user to identify the call from which a returned data s used when signing an EIP-712 FCT message&#x20;
{% endhint %}

### 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.

{% hint style="info" %}
If all payer indexes on an FCT are 0, the activator will pay for this FCT
{% endhint %}

### 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.

<table><thead><tr><th width="219">EIP712 String</th><th width="89">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>"action"</td><td>0</td><td>Executing the call using the low level "call" function.<br>The contract being called can change blockchain state and sees the FCT_Runner as the calling entity. </td></tr><tr><td>"view only"</td><td>1</td><td>Executing the call using the low level "staticcall" function.<br>The contract being called is not allowed to change the blockchain state and sees the FCT_Runner as the calling entity.</td></tr><tr><td>"library"</td><td>2</td><td>Executing the call using the low level "delegatecall" function.<br>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.</td></tr></tbody></table>

{% hint style="warning" %}
"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)
{% endhint %}

### 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.

### value

The native token 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.&#x20;

### permissions

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

{% hint style="info" %}
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. &#x20;
{% endhint %}

{% hint style="success" %}
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.&#x20;
{% endhint %}

### validation

Validation is used in order to run a [validation](https://kirobo.gitbook.io/fct-platform/engines/fct_batchmultisig/validation-optional) at the end of the call, by setting the entry point index.

{% hint style="info" %}
Set to 0, in order to disable validation for this call.
{% endhint %}

### 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.

<table><thead><tr><th width="219">EIP712 String</th><th width="89">Value</th><th>Meaning</th></tr></thead><tbody><tr><td>"continue on success, revert on fail"</td><td>0</td><td>If call reverts, revert the whole FCT, otherwise, continue to the next call according to the jump_on_success field</td></tr><tr><td>"continue on success, stop on fail"</td><td>1</td><td>If call reverts, stop FCT execution (previous calls are not reverted), otherwise, continue to the next call according to the jump_on_success field</td></tr><tr><td>"continue on success, continue on fail"</td><td>2</td><td>Whether call reverts or not, continue to the next call according to the jump_on_success and  jump_on_fail fields respectively </td></tr><tr><td>"revert on success, continue on fail"</td><td>3</td><td>If call reverts, continue to the next call according to the jump_on_fail field, otherwise, revert the whole FCT</td></tr><tr><td>"revert on success, stop on fail"</td><td>4</td><td>If call reverts, stop FCT execution (previous calls are not reverted), otherwise, revert the whole FCT</td></tr><tr><td>"stop on success, continue on fail"</td><td>5</td><td>If call reverts, continue to the next call according to the jump_on_fail field, otherwise, stop FCT execution (previous calls are not reverted)</td></tr><tr><td>"stop on success, revert on fail"</td><td>6</td><td>If call reverts, revert the whole FCT, otherwise, stop FCT execution (previous calls are not reverted)</td></tr><tr><td>"stop on success, stop on fail"</td><td>7</td><td>Whether call reverts or not, stop FCT execution (previous calls are not reverted)</td></tr></tbody></table>

{% hint style="info" %}
if/then blocks can be achieved by using one of the "cont" flow controls and setting the "jump\_on" values&#x20;
{% endhint %}

### 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.  &#x20;

{% hint style="info" %}
This value is ignored when "stop on success" or "revert on success" is being used
{% endhint %}

### 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.  &#x20;

{% hint style="info" %}
This value is ignored when "stop on fail" or "revert on fail" is being used
{% endhint %}

### variable\_arguments\_start

Specify the staring point, in bytes, for the FCT engine's variables searcher.&#x20;

{% hint style="info" %}
Both variable\_arguments start and end, gives a hint to the FCT engine where, in method's call data, variable values might be used.
{% endhint %}

{% hint style="success" %}
Set both to 0, if no variables are being used in method's call data, in order to save gas.
{% endhint %}

### variable\_arguments\_end

Specify the ending point (not including), in bytes, for the FCT engine's variables searcher.

{% hint style="info" %}
When using a [solver call](https://kirobo.gitbook.io/fct-platform/engines/fct_batchmultisig/solver-call), both values should be 0
{% endhint %}

### 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](https://ethereum.stackexchange.com/questions/135205/what-is-a-function-signature-and-function-selector-in-solidity-and-evm-language)

{% hint style="info" %}
ERC20 transfer method interface looks like this:  "transfer(address,uint256)"
{% endhint %}
