Authorization
The Boost V2 Docs are under active development and will be subject to changes.
A budget has two types of roles that can be granted: ADMIN
and MANAGER
. These roles can be accessed through the Roles
enum:
- The
MANAGER
role allows an address to manage funds within the budget and deploy boosts using available funds. - The
ADMIN
role allows an address to grant and revoke roles on the budget as well as manage available funds.
Accounts authorized with the MANAGER
role are allowed to disburse available funds from the budget, so make sure you trust the address before granting permissions.
API
grantRoles
Grants access control roles to an address.
You can grant both ADMIN
and MANAGER
roles at once:
Parameters
The address to grant the roles to.
The roles to grant, accessed via the Roles
enum.
Optional parameters to pass to the underlying writeContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
grantManyRoles
Grants access control roles to multiple addresses. The roles array must match the addresses array in length and order.
Parameters
Array of addresses to grant roles to.
Array of roles to grant, accessed via the Roles
enum.
Optional parameters to pass to the underlying writeContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
revokeRoles
Revokes access control roles from an address.
You can revoke both ADMIN
and MANAGER
roles at once:
Parameters
The address to revoke roles from.
The roles to revoke, accessed via the Roles
enum.
Optional parameters to pass to the underlying writeContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
revokeManyRoles
Revokes access control roles from multiple addresses. The roles array must match the addresses array in length and order.
Parameters
Array of addresses to revoke roles from.
Array of roles to revoke, accessed via the Roles
enum.
Optional parameters to pass to the underlying writeContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
setAuthorized
Grants or revokes the MANAGER
role for multiple addresses. The authorized values array must match the addresses array in length and order.
Parameters
Array of addresses to set authorization for.
Array of boolean values where true
grants and false
revokes the MANAGER
role.
Optional parameters to pass to the underlying writeContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
isAuthorized
Checks if an address is authorized to manage the budget. Returns true
if the address is authorized, otherwise false
.
Parameters
The address to check authorization for.
Optional parameters to pass to the underlying readContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
Returns true
if the address is authorized, otherwise false
.
hasAllRoles
Checks if an address has all the roles specified. Returns true
if the address has all the roles, otherwise false
.
Parameters
The address to check roles for.
The roles to check for, accessed via the Roles
enum.
Optional parameters to pass to the underlying readContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
Returns true
if the address has all the specified roles, otherwise false
.
hasAnyRole
Checks if an address has at least one of the roles specified. Returns true
if the address has at least one of the roles, otherwise false
.
Parameters
The address to check roles for.
The roles to check for, accessed via the Roles
enum.
Optional parameters to pass to the underlying readContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
Returns true
if the address has at least one of the specified roles, otherwise false
.
rolesOf
Returns the an array of roles for a given address. Returns an empty array if the address has no roles.
1n
= Roles.MANAGER
, 2n
= Roles.ADMIN
Parameters
The address to check roles for.
Optional parameters to pass to the underlying readContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
Returns an array of roles for the address.
owner
Returns the budget owner’s address.
Parameters
Optional parameters to pass to the underlying readContract
method. Checkout wagmi’s documentation for more information. address
, args
, functionName
, abi
are handled for you under the hood.
Returns
The budget owners address.