10. Lucid Post-Deployment Integration
Final Step: Adding Mint Rights to Asset Controller Post-Deployment
After completing the organisation creation flow and deploying all contracts, the final step is to configure minting rights for the Asset Controller. This step involves using the OpenZeppelin AccessControl library to grant the necessary permissions. Below is a step-by-step guide to complete this process:
Step 1: Understand the AccessControl Library
The AccessControl library from OpenZeppelin is used to manage roles and permissions for smart contract functions. For more details, refer to the OpenZeppelin AccessControl Documentation.
Step 2: Use the grantRole() Function
The grantRole() function is used to assign a specific role to an address. In this context, the role grants the Message Controller contract permission to interact with functions related to minting.
The function syntax is as follows:
grantRole(bytes32 role, address account)
role: The role hash (determined by the project when deploying the contract).
account: The address of the Message Controller contract deployed by Lucid (on the same chain).
Step 3: Determine the Role Hash
When your project deployed the contract, a specific role hash would have been configured for minting permissions. This role hash must be provided as the first argument in the grantRole() function.
Step 4: Locate the Address of the Message Controller
Identify the address of the Message Controller contract deployed by Lucid. Ensure this address corresponds to the same chain as the organisation’s deployment.
Step 5: Execute the grantRole() Function
Call the grantRole() function with the appropriate arguments:
1. Role Hash: Use the specific role hash for minting permissions.
2. Message Controller Address: Provide the address of the Message Controller deployed by Lucid.
Example:
grantRole(0x<role-hash>, 0x<message-controller-address>)
Replace <role-hash>
and <message-controller-address>
with the actual values for your project.
Step 6: Verify the Role Assignment
After executing the grantRole() function, confirm that the Message Controller has been granted the correct role. This can be verified by calling the hasRole() function:
hasRole(bytes32 role, address account)
Ensure the function returns true for the given role and Message Controller address.
Important Notes
Ensure that the Message Controller address corresponds to the same chain as the Asset Controller deployment.
Be cautious when granting roles to prevent unintended access to critical functions.
This configuration step is crucial to enable seamless interaction with the multi-bridge functionality.
By following these steps, you will successfully add minting rights to the Asset Controller, ensuring proper functionality for your organisation’s setup.
Last updated