Skip to main content

Solidity API

Permit69

Permit69 manages ERC20 approvals and transfers between Atlas and Execution Environment contracts during metacall transactions.

constructor

constructor(uint256 escrowDuration, address verification, address simulator, address initialSurchargeRecipient, address l2GasCalculator) internal

_verifyUserControlExecutionEnv

function _verifyUserControlExecutionEnv(address environment, address user, address control, uint32 callConfig) internal virtual returns (bool)

Verifies that the caller is an authorized Execution Environment contract.

This function is called internally to ensure that the caller is a legitimate Execution Environment contract controlled by the current DAppControl contract. It helps prevent unauthorized access and ensures that token transfers are performed within the context of Atlas's controlled environment. The implementation of this function can be found in Atlas.sol

Parameters

NameTypeDescription
environmentaddressExecutionEnvironment address
useraddressThe address of the user invoking the function.
controladdressThe address of the current DAppControl contract.
callConfiguint32The CallConfig of the DAppControl contract of the current transaction.

transferUserERC20

function transferUserERC20(address token, address destination, uint256 amount, address user, address control) external

Transfers ERC20 tokens from a user to a destination address, only callable by the expected Execution Environment.

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token contract.
destinationaddressThe address to which the tokens will be transferred.
amountuint256The amount of tokens to transfer.
useraddressThe address of the user invoking the function.
controladdressThe address of the current DAppControl contract.

transferDAppERC20

function transferDAppERC20(address token, address destination, uint256 amount, address user, address control) external

Transfers ERC20 tokens from the DAppControl contract to a destination address, only callable by the expected Execution Environment.

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token contract.
destinationaddressThe address to which the tokens will be transferred.
amountuint256The amount of tokens to transfer.
useraddressThe address of the user invoking the function.
controladdressThe address of the current DAppControl contract.

_validateTransfer

function _validateTransfer(address user, address control, uint8 safeExecutionPhaseSet) internal

Verifies whether the lock state allows execution in the specified safe execution phase.

Parameters

NameTypeDescription
useraddressThe address of the user invoking the function.
controladdressThe address of the current DAppControl contract.
safeExecutionPhaseSetuint8The set of safe execution phases.