StorageBeacon
Main storage contract for the subsystem in L1 and first version of it. More StorageBeacons with more variables can be added by upgrading it using upgradeStorageBeacon() from ozUpgradeableBeacon (a diagram of this upgrade technique can be seen here).
This contract gets queried for storage from ProxyFactory, ozPayMe, each ozAccountProxy ever created, and Emitter; and goes hand-in-hand with ozUpgradeableBeacon as the pivot point for calls.
Open methods
getAccountsByUser
function getAccountsByUser(
address user_
) external view returns(address[] memory, string[] memory);Gets all the Accounts that an user has.
Parameters:
user_
address
User to query
Return values:
address[]
Accounts user_ has
string[]
Account's names in same order as above
getTaskID
function getTaskID(address account_) external view returns(bytes32);Gets the Gelato task ID that was created for an Account. This is the task that allows the autonomous call on each Account.
Parameters:
account_
address
Account to get the task from
Return values
bytes32
Gelato's task ID
getTokenDatabase
function getTokenDatabase() external view returns(address[] memory);Gets the group of stablecoins an user can choose as a final coin destination in L2.
Return values:
address[]
Tokens available to be chosen by user
isUser
function isUser(address user_) external view returns(bool);Queries if an user has ever created an Account.
Parameters:
user_
address
User to query
Return values:
boolean
If the user has created an Account before
queryTokenDatabase
Gets if a token exist in the group of tokens an user can choose as the final coin to have in L2.
function queryTokenDatabase(address token_) public view returns(bool);Parameters:
token_
address
Token to query in database
Return values:
boolean
If the token exist in the database or not
verify
function verify(address user_, bytes32 acc_user_) external view returns(bool);Verifies if an Account was created in Özel.
Parameters:
user_
address
Owner of the Account
acc_user_
bytes32
Full Account address (in bytes -20) plus the first 12 bytes of the owner's address
Return values:
boolean
If the Account was created in Özel or not
Owner methods
addAuthorizedSelector
function addAuthorizedSelector(bytes4 selector_) external onlyOwner;Adds a selector to the group of authorized functions which calldata is untampered when calling them through the implementation of the beacon (ozPayMe in this case).
Parameters:
selector_
bytes4
Selector of function to be authorized
addTokenToDatabase
function addTokenToDatabase(address newToken_) external onlyOwner;Adds a token -in L1- to the group of stablecoins from where an user can choose as the final coin to receive in L2 when creating an Account.
Parameters:
newToken_
address
New token to be added
changeEmergencyMode
function changeEmergencyMode(
struct EmergencyMode calldata newEmode_
) external onlyOwner;The EmergencyMode configuration is the parameter used for the Uniswap emergency swap -in ozPayMe - that would be done in case it's not possible to submit a retryable ticket.
Parameters:
Struct:
struct EmergencyMode {
ISwapRouter swapRouter;
AggregatorV3Interface priceFeed;
uint24 poolFee;
address tokenIn;
address tokenOut;
}swapRouter
ISwapRouter
Instance of the Uniswap V3 router
priceFeed
AggregatorV3Interface
Instance of Chainlink's data feeds' methods
poolFee
uint24
Fee of the Uniswap pool
tokenIn
address
Token coming in for the swap
tokenOut
address
Token that the user will receive
Function:
newEmode_
struct EmergencyMode
New EmergencyMode configuration
changeEmitterStatus
function changeEmitterStatus(bool newStatus_) external onlyOwner;The status of the Emitter is what allows the Akash deployments to review transactions for manual redeems. If it's off, no transactions would be checked.
The idea of this function is to disable this action once the ETH transfer flow is fully migrated to L2, and the bridging mechanism is completely removed from the system.
Parameters:
newStatus_
boolean
Is the Emitter forwarding txs or not
changeGasPriceBid
function changeGasPriceBid(uint newGasPriceBid_) external onlyOwner;Changes the hard-coded value for the L2 gasPrice. This is what the retryable ticket uses as a reference when executing the transaction on L2.
It's hard-coded since it's not possible to get the gas price of Arbitrum on Ethereum onchain, and it's the biggest vulnerability of the system, and the reason why Akash is needed in the first place.
Undersubmitting the gasPrice would cause the retryable ticket to be created in L1, but not auto-redeemed in L2. Meaning that the transaction wouldn't get automatically executed, and a manual redeem (in L2) would be necessary for executing the second leg of the bridging. More info about it in Arbitrum's docs here.
Parameters:
newGasPriceBid
uint256
New L2 gas price expressed in gwei
removeTokenFromDatabase
function removeTokenFromDatabase(address toRemove_) external onlyOwner;Removes a token -in L2- from the group of stablecoins in L2 that an user can choose when creating an Account.
Parameters:
toRemove_
address
Token to be removed from group.
System methods
multiSave
function multiSave(
bytes20 account_,
struct AccountConfig calldata acc_,
bytes32 taskId_
) external hasRole(0x0854b85f);Saves and associates the details of an Account with itself and its Gelato's task id.
Parameters:
Struct:
struct AccountConfig {
address user;
address token;
uint slippage;
string name;
}user
address
Owner of the Account
token
address
Token of the Account
slippage
uint256
Slippage of the Account
name
string
Name of the Account
Function:
account_
bytes20
The Account represented in bytes
acc_
struct AccountConfig
Details of the Account
taskId_
bytes32
Gelato's task ID of the Account
Last updated