ozMiddleware

Contract in charge of forwarding the call from ozPayMe to ozDiamond in L2. The main reason of its implementation is to change the msg.sender on each call, and produce a unique sender for all Accounts of the system, in order to have an unified caller to check in L2, and in this way, avoid unauthorized calls to the main entry function (exchangeToAccountToken()).

It contains the bridging and emergency mechanism, in case, for whatever reason, it's not possible to bridge the ETH to L2.

Github repo here.

System methods

forwardCall

function forwardCall(
        uint gasPriceBid_,
        bytes memory dataForL2_,
        uint amountToSend_,
        address account_
) external payable returns(bool, bool, address);

Forwards the call from ozPayMe to Arbitrum's Delayed Inbox, which finished with ozDiamond in L2.

Parameters:

Name
Type
Description

gasPriceBid_

uint256

L2's gas price

dataForL2_

bytes

Details of the Account (except for the name)

account_

address

The Account

Return values:

Type
Description

boolean

If _runEmergencyMode was called

boolean

If forwarding to Emitter is enabled

address

Owner of the Account

_runEmergencyMode

function _runEmergencyMode(address user_, uint16 slippage_) private nonReentrant;

It executes an emergency swap on Uniswap for the token specified as tokenOut in the EmergencyMode struct, and send this to the user.

Last updated