Skip to content

Commit

Permalink
Add IAllowList interface
Browse files Browse the repository at this point in the history
  • Loading branch information
juan518munoz committed Jan 25, 2024
1 parent 177f18e commit b91d35b
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions l1-contracts/contracts/bridge/interfaces/IAllowList.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.20;

interface IAllowList {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/

/// @notice Access mode of target contract is changed
event UpdateAccessMode(address indexed target, AccessMode previousMode, AccessMode newMode);

/// @notice Permission to call is changed
event UpdateCallPermission(address indexed caller, address indexed target, bytes4 indexed functionSig, bool status);

/// @notice Deposit limit of a token is changed
event UpdateDepositLimit(address indexed l1Token, bool depositLimitation, uint256 depositCap);

/// @notice Type of access to a specific contract includes three different modes
/// @param Closed No one has access to the contract
/// @param SpecialAccessOnly Any address with granted special access can interact with a contract (see `hasSpecialAccessToCall`)
/// @param Public Everyone can interact with a contract
enum AccessMode {
Closed,
SpecialAccessOnly,
Public
}

/// @dev A struct that contains deposit limit data of a token
/// @param depositLimitation Whether any deposit limitation is placed or not
/// @param depositCap The maximum amount that can be deposited.
struct Deposit {
bool depositLimitation;
uint256 depositCap;
}

/*//////////////////////////////////////////////////////////////
GETTERS
//////////////////////////////////////////////////////////////*/

function getAccessMode(address _target) external view returns (AccessMode);

function hasSpecialAccessToCall(address _caller, address _target, bytes4 _functionSig) external view returns (bool);

function canCall(address _caller, address _target, bytes4 _functionSig) external view returns (bool);

function getTokenDepositLimitData(address _l1Token) external view returns (Deposit memory);

/*//////////////////////////////////////////////////////////////
ALLOW LIST LOGIC
//////////////////////////////////////////////////////////////*/

function setBatchAccessMode(address[] calldata _targets, AccessMode[] calldata _accessMode) external;

function setAccessMode(address _target, AccessMode _accessMode) external;

function setBatchPermissionToCall(
address[] calldata _callers,
address[] calldata _targets,
bytes4[] calldata _functionSigs,
bool[] calldata _enables
) external;

function setPermissionToCall(address _caller, address _target, bytes4 _functionSig, bool _enable) external;

/*//////////////////////////////////////////////////////////////
DEPOSIT LIMIT LOGIC
//////////////////////////////////////////////////////////////*/

function setDepositLimit(address _l1Token, bool _depositLimitation, uint256 _depositCap) external;
}

0 comments on commit b91d35b

Please sign in to comment.