Enforced transactions

The Enforced Transaction contract enables sending transactions from L1 to L2 with the sendTransaction function. This contract shares similarities with the Scroll Messenger contract as it allows sending arbitrary data from one layer to the other. However, it distinguishes itself by enabling the relaying of signed transactions and the ability to set the sender (CALLER or msg.sender) on the receiving transaction on Scroll.

For enforced transactions, the L2 sender will be the same as the L1 sender. This means a user can initiate an L2 transaction directly from their wallet via L1, allowing them to withdraw tokens or call other contracts on L2 even if the sequencer is unresponsive.

Enforced Transactions API

Please visit the npm library for the complete Scroll contract API documentation.

sendTransaction

function sendTransaction(address _target, uint256 _value, uint256 _gasLimit, bytes calldata _data) public payable;

Add an enforced transaction to L2 from an EOA account sender.

ParameterDescription
_targetThe address of the target contract to call in L2.
_valueThe value passed.
_gasLimitThe maximum gas should be used for this transaction in L2.
_dataThe calldata passed to the target contract.

sendTransaction

function sendTransaction(
address _sender,
address _target,
uint256 _value,
uint256 _gasLimit,
bytes calldata _data,
bytes memory _signature,
address _refundAddress
) public payable;

Add an enforced transaction to L2 by relaying a signature from the sender.

ParameterDescription
_senderThe address of sender who will initiate this transaction in L2.
_targetThe address of target contract to call in L2.
_valueThe value passed
_gasLimitThe maximum gas should be used for this transaction in L2.
_dataThe calldata passed to target contract.
_signatureThe signature for the transaction.
_refundAddressThe address to refund exceeded fee.

Resources

Follow Us