1/5
## Token and Pool Deployer Script We will deploy our token and pool contracts. We will use the Chainlink documentation and deploy the tokens. We'll create a function called `run` which is public and returns both the rebase token and the pool: ```javascript function run(address rebaseToken, address pool) public returns (Vault vault) { CCIPLocalSimulatorFork ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); register.networkDetails networkDetails = ccipLocalSimulatorFork.getNetworkDetails({ block: chainId }); vm.startBroadcast(); token = new rebaseToken(); pool = new rebaseTokenPool( IERC20(address(token)), new address[](0), networkDetails.rmnProxyAddress, networkDetails.routerAddress ); RegistryModuleOwnerCustom(address(pool)).registerAdminViaOwner(address(token)); tokenAdminRegistry(networkDetails.tokenAdminRegistryAddress).acceptAdminRole(address(token), address(pool)); vm.stopBroadcast(); } ``` We will use the `vm.startBroadcast` and `vm.stopBroadcast` functions to deploy our contracts. We will import our rebaseToken and rebaseTokenPool: ```javascript import "forge-std/Script.sol"; import "./CCIPLocalSimulatorFork.sol"; import "@chainlink/contracts/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import "./RebaseToken.sol"; import "./RebaseTokenPool.sol"; import "./Vault.sol"; import "./Interfaces/RebaseToken.sol"; contract TokenAndPoolDeployer is Script { ``` We will deploy the token and pool contracts using the constructor arguments of the `rebaseTokenPool` contract: ```javascript function run(address rebaseToken, address pool) public returns (Vault vault) { CCIPLocalSimulatorFork ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); register.networkDetails networkDetails = ccipLocalSimulatorFork.getNetworkDetails({ block: chainId }); vm.startBroadcast(); token = new rebaseToken(); pool = new rebaseTokenPool( IERC20(address(token)), new address[](0), networkDetails.rmnProxyAddress, networkDetails.routerAddress ); RegistryModuleOwnerCustom(address(pool)).registerAdminViaOwner(address(token)); tokenAdminRegistry(networkDetails.tokenAdminRegistryAddress).acceptAdminRole(address(token), address(pool)); vm.stopBroadcast(); vault = new Vault(rebaseToken, grantMintAndBurnRole(address(vault))); vm.stopBroadcast(); } } ``` We will also deploy the Vault contract and grant the mint and burn role to the vault. ```javascript import "forge-std/Script.sol"; import "./CCIPLocalSimulatorFork.sol"; import "@chainlink/contracts/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import "./RebaseToken.sol"; import "./RebaseTokenPool.sol"; import "./Vault.sol"; import "./Interfaces/RebaseToken.sol"; contract TokenAndPoolDeployer is Script { function run(address rebaseToken, address pool) public returns (Vault vault) { CCIPLocalSimulatorFork ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); register.networkDetails networkDetails = ccipLocalSimulatorFork.getNetworkDetails({ block: chainId }); vm.startBroadcast(); token = new rebaseToken(); pool = new rebaseTokenPool( IERC20(address(token)), new address[](0), networkDetails.rmnProxyAddress, networkDetails.routerAddress ); RegistryModuleOwnerCustom(address(pool)).registerAdminViaOwner(address(token)); tokenAdminRegistry(networkDetails.tokenAdminRegistryAddress).acceptAdminRole(address(token), address(pool)); vm.stopBroadcast(); vault = new Vault(rebaseToken, grantMintAndBurnRole(address(vault))); vm.stopBroadcast(); } } ``` We will then use `forge build` to check if we haven't done anything incorrectly. ```bash forge build ```
A comprehensive guide to deploying a rebase token and a rebase token pool using Chainlink CCIP on a local simulator fork. This lesson covers creating a Solidity script that first deploys a rebase token, then deploys a rebase token pool, then configures the Chainlink CCIP network, and finally grants the newly deployed token pool the mint and burn role.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Advanced smart contract development
How to develop a stablecoin
How to develop a DeFi protocol
How to develop a DAO
Advanced smart contracts testing
Fuzz testing
Manual verification
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Security researcher
$49,999 - $120,000 (avg. salary)
Guest lecturers:
Juliette Chevalier
Lead Developer relations at Aragon
Nader Dabit
Director of developer relations at Avara
Ally Haire
Developer relations at Protocol Labs
Harrison
Founder at GasliteGG
Last updated on March 11, 2025
Solidity Developer
Advanced FoundryDuration: 36min
Duration: 3h 06min
Duration: 5h 02min
Duration: 6h 02min
Duration: 2h 47min
Duration: 1h 23min
Duration: 4h 28min
Duration: 1h 19min
Duration: 1h 10min
Course Overview
About the course
Advanced smart contract development
How to develop a stablecoin
How to develop a DeFi protocol
How to develop a DAO
Advanced smart contracts testing
Fuzz testing
Manual verification
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Security researcher
$49,999 - $120,000 (avg. salary)
Guest lecturers:
Juliette Chevalier
Lead Developer relations at Aragon
Nader Dabit
Director of developer relations at Avara
Ally Haire
Developer relations at Protocol Labs
Harrison
Founder at GasliteGG
Last updated on March 11, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar