|
| 1 | +import { Step, Steps, DocImage, OpenSourceCard, Callout } from "@doc"; |
| 2 | +import RestrictTransfer from './assets/restrict-transfers.png'; |
| 3 | +import ApproveFunction from './assets/approve-function.png'; |
| 4 | +import AgglayerModule from './assets/agglayer-module.png'; |
| 5 | +import GrantMinter from './assets/grant-minter.png'; |
| 6 | +import MintTokens from './assets/mint-tokens.png'; |
| 7 | + |
| 8 | +# Agglayer Module Contract |
| 9 | + |
| 10 | +We created a module which leverages Agglayer, an interoperability protocol. This module may be added to any ERC-20 modular contract to construct a cross-chain |
| 11 | +interoperable smart contract for trustless and secure transfers across any chain. [Learn more about Agglayer.](https://github.com/AggLayer) |
| 12 | + |
| 13 | +<OpenSourceCard title="Agglayer Module Contract" href="https://thirdweb.com/thirdweb.eth/AgglayerCrossChain" /> |
| 14 | + |
| 15 | +## Get Started |
| 16 | + |
| 17 | +Learn how to add the Agglayer module to your modular contract and enable cross-chain transfers. |
| 18 | + |
| 19 | +### Prerequisites |
| 20 | + |
| 21 | +- [Deployed ERC-20 Base Contract](/contracts/modular-contracts/tutorials/deploy-erc20-core) |
| 22 | + |
| 23 | +<Steps> |
| 24 | + |
| 25 | +<Step title="Add Agglayer module"> |
| 26 | + |
| 27 | +On your deployed contract dashboard, navigate to the Modules section to add the Agglayer module. Paste the following parameters then select Install. |
| 28 | +1. Publisher: `0xdd99b75f095d0c4d5112aCe938e4e6ed962fb024` |
| 29 | +2. Module Name: `AgglayerCrossChain` |
| 30 | +3. Module Version: `Latest` |
| 31 | +4. Router: `0x2311BFA86Ae27FC10E1ad3f805A2F9d22Fc8a6a1` |
| 32 | + |
| 33 | +<DocImage src={AgglayerModule} alt="Agglayer Module" /> |
| 34 | + |
| 35 | +When completed, you will see your module under the installed modules section. |
| 36 | + |
| 37 | +</Step> |
| 38 | + |
| 39 | +<Step title="Grant minter role"> |
| 40 | +Next, navigate to the Explorer tab and locate grantRoles under the Write functions to grant your wallet the minter role then select Execute. |
| 41 | +1. User: `your-wallet-address` |
| 42 | +2. Roles: `1` |
| 43 | +3. Native Token Value: `0` |
| 44 | +<DocImage src={GrantMinter} alt="Grant Minter Role" /> |
| 45 | + |
| 46 | +<Callout variant="info" title="Modular Contract Roles"> |
| 47 | +Non-admin roles are disabled by default on modular contracts and must be enabled through the contract. |
| 48 | +</Callout> |
| 49 | +</Step> |
| 50 | + |
| 51 | +<Step title="Mint tokens"> |
| 52 | +Navigate back to the modules section and mint tokens to your wallet or a recipient's wallet using the mintable module. |
| 53 | + |
| 54 | +<DocImage src={MintTokens} alt="Mint Tokens" /> |
| 55 | +</Step> |
| 56 | + |
| 57 | +<Step title="Approve transfers on contract"> |
| 58 | +Navigate back to Explorer and find the Approve write function. Paste in the following parameters and select Execute. |
| 59 | +1. Spender: `your-contract-address` |
| 60 | +2. Amount: `your-desired-amount` |
| 61 | + |
| 62 | +<DocImage src={ApproveFunction} alt="Approve Function" /> |
| 63 | + |
| 64 | +<Callout variant="info" title="Modular Contract Approvals"> |
| 65 | +This step enables the contract to have approval to transfer user's tokens to the bridge. |
| 66 | +</Callout> |
| 67 | +</Step> |
| 68 | + |
| 69 | +<Step title="Approve transfers on module"> |
| 70 | +Navigate back to the modules view and disable Restrict Transfers on the TransferableERC20 module to allow any token holders to transfer tokens. Select Update to confirm. |
| 71 | + |
| 72 | +<DocImage src={RestrictTransfer} alt="Restrict Transfer" /> |
| 73 | +</Step> |
| 74 | + |
| 75 | +<Step title="Bridge tokens"> |
| 76 | +Navigate back to Explorer and locate the `bridgeTokens` function. Select Execute to confirm the transaction. |
| 77 | +1. Destination Network: `chain-to-send` |
| 78 | +2. Call Address: `your-wallet-address` |
| 79 | +3. Amount: `amount-of-tokens` |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +</Step> |
| 84 | + |
| 85 | +</Steps> |
| 86 | + |
0 commit comments