AllowlistV1
Alluvial Finance Inc.
Allowlist (v1)
This contract handles the list of allowed recipients.All accounts have an uint256 value associated with their addresses where each bit represents a right in the system. The DENY_MASK defined the mask used to identify if the denied bit is on, preventing users from interacting with the system
Methods
acceptAdmin
function acceptAdmin() external nonpayable
Accept the transfer of ownership
Only callable by the pending admin. Resets the pending admin if successful.
getAdmin
function getAdmin() external view returns (address)
Retrieves the current admin address
Returns
_0
address
The admin address
getAllower
function getAllower() external view returns (address)
Retrieves the allower address
Returns
_0
address
The address of the allower
getDenier
function getDenier() external view returns (address)
Retrieves the denier address
Returns
_0
address
The address of the denier
getPendingAdmin
function getPendingAdmin() external view returns (address)
Retrieve the current pending admin address
Returns
_0
address
The pending admin address
getPermissions
function getPermissions(address _account) external view returns (uint256)
This method retrieves the raw permission value
Parameters
_account
address
Recipient to verify
Returns
_0
uint256
The raw permissions value of the account
hasPermission
function hasPermission(address _account, uint256 _mask) external view returns (bool)
This method returns true if the user has the expected permission ignoring any deny list membership
Parameters
_account
address
Recipient to verify
_mask
uint256
Combination of permissions to verify
Returns
_0
bool
True if mask is respected
initAllowlistV1
function initAllowlistV1(address _admin, address _allower) external nonpayable
Initializes the allowlist
Parameters
_admin
address
Address of the Allowlist administrator
_allower
address
Address of the allower
initAllowlistV1_1
function initAllowlistV1_1(address _denier) external nonpayable
Initializes the allowlist denier
Parameters
_denier
address
Address of the denier
isAllowed
function isAllowed(address _account, uint256 _mask) external view returns (bool)
This method returns true if the user has the expected permission and is not in the deny list
Parameters
_account
address
Recipient to verify
_mask
uint256
Combination of permissions to verify
Returns
_0
bool
True if mask is respected and user is allowed
isDenied
function isDenied(address _account) external view returns (bool)
This method returns true if the user is in the deny list
Parameters
_account
address
Recipient to verify
Returns
_0
bool
True if user is denied access
onlyAllowed
function onlyAllowed(address _account, uint256 _mask) external view
This method should be used as a modifier and is expected to revert if the user hasn't got the required permission or if the user is in the deny list.
Parameters
_account
address
Recipient to verify
_mask
uint256
Combination of permissions to verify
proposeAdmin
function proposeAdmin(address _newAdmin) external nonpayable
Proposes a new address as admin
This security prevents setting an invalid address as an admin. The pending admin has to claim its ownership of the contract, and prove that the new address is able to perform regular transactions.
Parameters
_newAdmin
address
New admin address
setAllowPermissions
function setAllowPermissions(address[] _accounts, uint256[] _permissions) external nonpayable
Sets the allow permissions for one or more accounts
This function is for allocating or removing deposit, redeem or donate permissions. This function could be used to give any permissions that we come up with in the future. An address which was denied has to be undenied first before they could be given any permission(s).
Parameters
_accounts
address[]
Accounts to update
_permissions
uint256[]
New permission values
setAllower
function setAllower(address _newAllowerAddress) external nonpayable
Changes the allower address
Parameters
_newAllowerAddress
address
New address allowed to edit the allowlist
setDenier
function setDenier(address _newDenierAddress) external nonpayable
Changes the denier address
Parameters
_newDenierAddress
address
New address allowed to edit the allowlist
setDenyPermissions
function setDenyPermissions(address[] _accounts, uint256[] _permissions) external nonpayable
Sets the deny permissions for one or more accounts
This function is for allocating or removing deny permissions. An address which is undenied has to be given permissions again for them to be able to deposit, donate or redeem.
Parameters
_accounts
address[]
Accounts to update
_permissions
uint256[]
New permission values
version
function version() external pure returns (string)
Retrieves the version of the contract
Returns
_0
string
Version of the contract
Events
Initialize
event Initialize(uint256 version, bytes cdata)
Emitted when the contract is properly initialized
Parameters
version
uint256
New version of the contracts
cdata
bytes
Complete calldata that was used during the initialization
SetAdmin
event SetAdmin(address indexed admin)
The admin address changed
Parameters
admin indexed
address
New admin address
SetAllower
event SetAllower(address indexed allower)
The stored allower address has been changed
Parameters
allower indexed
address
The new allower address
SetAllowlistPermissions
event SetAllowlistPermissions(address[] accounts, uint256[] permissions)
The permissions of several accounts have changed
Parameters
accounts
address[]
List of accounts
permissions
uint256[]
New permissions for each account at the same index
SetDenier
event SetDenier(address indexed denier)
The stored denier address has been changed
Parameters
denier indexed
address
The new denier address
SetPendingAdmin
event SetPendingAdmin(address indexed pendingAdmin)
The pending admin address changed
Parameters
pendingAdmin indexed
address
New pending admin address
Errors
AttemptToRemoveDenyPermission
error AttemptToRemoveDenyPermission()
Allower can't remove deny permission
AttemptToSetDenyPermission
error AttemptToSetDenyPermission()
Allower can't set deny permission
Denied
error Denied(address _account)
The account is denied access
Parameters
_account
address
The denied account
InvalidCount
error InvalidCount()
The provided accounts list is empty
InvalidInitialization
error InvalidInitialization(uint256 version, uint256 expectedVersion)
An error occurred during the initialization
Parameters
version
uint256
The version that was attempting to be initialized
expectedVersion
uint256
The version that was expected
InvalidZeroAddress
error InvalidZeroAddress()
The address is zero
MismatchedArrayLengths
error MismatchedArrayLengths()
The provided accounts and permissions list have different lengths
Unauthorized
error Unauthorized(address caller)
The operator is unauthorized for the caller
Parameters
caller
address
Address performing the call
Last updated