| 3 | const { CRYPTO_DEV_TOKEN_CONTRACT_ADDRESS } = require("../constants"); |
| 4 | |
| 5 | async function main() { |
| 6 | const cryptoDevTokenAddress = CRYPTO_DEV_TOKEN_CONTRACT_ADDRESS; |
| 7 | /* |
| 8 | A ContractFactory in ethers.js is an abstraction used to deploy new smart contracts, |
| 9 | so exchangeContract here is a factory for instances of our Exchange contract. |
| 10 | */ |
| 11 | const exchangeContract = await ethers.getContractFactory("Exchange"); |
| 12 | |
| 13 | // here we deploy the contract |
| 14 | const deployedExhangeContract = await exchangeContract.deploy( |
| 15 | cryptoDevTokenAddress |
| 16 | ); |
| 17 | |
| 18 | // print the address of the deployed contract |
| 19 | console.log("Exchange Contract Address:", deployedExhangeContract.address); |
| 20 | } |
| 21 | |
| 22 | // Call the main function and catch if there is any error |
| 23 | main() |