ozPayMe

Main implementation on L1 that starts the bridging process, possess all Account modification methods.

Since the beginning of the flow doesn't necesserily starts with the user's knowledge nor attention (the user can't be sleeping for example when they receive a transfer), it is mandatory to implement different mechanisms that will allow the user's funds to be either in constant movement or held in their position (aka not stuck).

As last resort, there's a function that would allow the user to retrieve their ETH from the Account in case the stuck scenario does occur.

Github repo here.

System methods

sendToArb

function sendToArb( 
        uint gasPriceBid_,
        struct StorageBeacon.AccountConfig calldata acc_,
        uint amountToSend_ 
) external payable onlyOps filterDetails(acc_);
  • Bridge the ETH received in the Account from L1 to L2.

  • Pays to Gelato the fee for the autonomous call.

  • In case it's not possible to bridge the funds, it runs _runEmergencyMode()

  • Forwards the Account address to the Emitter contract which will forward it to the Akask deployments for manual review.

Parameters:

Struct:

struct AccountConfig {
        address user;
        address token;
        uint slippage; 
        string name;
}
Name
Type
Description

user

address

User who created the Account

token

address

Coin the user will receive in L2

slippage

uint256

Slippage used on swaps from ETH to token

name

string

Name of the Account

Function:

Name
Type
Description

gasPriceBid_

uint256

Gas price used on L2 execution

acc_

struct StorageBeacon.AccountConfig

Configuration of the Account being transacted on

amountToSend_

uint256

Gross ETH amount being sent to L2

Account methods

changeAccountSlippage

function changeAccountSlippage(
        uint16 newSlippage_
) external onlyUser checkSlippage(newSlippage_);

Changes the slippage of the Account that will be used in all user swaps.

Parameters:

Name
Type
Description

newSlippage_

uint16

New Slippage of the Account expressed in basis points.

changeAccountToken

function changeAccountToken(
        address newToken_
) external onlyUser checkToken(newToken_);

Change the stablecoin of the Account (token that the user will receive in L2).

Parameters:

Name
Type
Description

newToken_

address

New stablecoin of the Account

changeAccountTokenNSlippage

function changeAccountTokenNSlippage(
        address newToken_, 
        uint16 newSlippage_
) external onlyUser checkToken(newToken_) checkSlippage(newSlippage_);

Changes the Account's token and slippage at the same time in one call.

Parameters:

Name
Type
Description

newToken_

address

New token for the Account

newSlippage_

uint16

New slippage for the Account (in basis points)

getAccountDetails

function getAccountDetails() external view returns (
        address user, 
        address token, 
        uint16 slippage
);

Gets the configuration of an Account (except for the name).

Return values:

Name
Type
Description

user

address

Owner of the Account

token

address

Token of the Account

slippage

uint16

Slippage of the Account

withdrawETH_lastResort

function withdrawETH_lastResort() external onlyUser;

In case of catastrophic failure of the entire bridging mechanism, this function would allow the user to withdraw the ETH from their Account.

Last updated