Add initial project structure and documentation files
- Created .gitignore to exclude sensitive files and directories. - Added API documentation in API_DOCUMENTATION.md. - Included deployment instructions in DEPLOYMENT.md. - Established project structure documentation in PROJECT_STRUCTURE.md. - Updated README.md with project status and team information. - Added recommendations and status tracking documents. - Introduced testing guidelines in TESTING.md. - Set up CI workflow in .github/workflows/ci.yml. - Created Dockerfile for backend and frontend setups. - Added various service and utility files for backend functionality. - Implemented frontend components and pages for user interface. - Included mobile app structure and services. - Established scripts for deployment across multiple chains.
This commit is contained in:
86
scripts/deploy-base.ts
Normal file
86
scripts/deploy-base.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import { ethers } from "hardhat";
|
||||
import * as fs from "fs";
|
||||
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
console.log("Deploying to Base with account:", deployer.address);
|
||||
|
||||
const chainId = 8453;
|
||||
const rpcUrl = process.env.BASE_RPC_URL || "https://mainnet.base.org";
|
||||
const ccipRouter = process.env.BASE_CCIP_ROUTER || "0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D";
|
||||
const chainSelector = BigInt('15971525489660198786');
|
||||
|
||||
console.log(`\n=== Deploying to Base (Chain ID: ${chainId}) ===`);
|
||||
|
||||
try {
|
||||
// Deploy Diamond
|
||||
const Diamond = await ethers.getContractFactory("Diamond");
|
||||
const diamond = await Diamond.deploy();
|
||||
await diamond.waitForDeployment();
|
||||
const diamondAddress = await diamond.getAddress();
|
||||
console.log(`Diamond deployed to: ${diamondAddress}`);
|
||||
|
||||
// Deploy Facets
|
||||
const facets = {
|
||||
DiamondCutFacet: await (await ethers.getContractFactory("DiamondCutFacet")).deploy(),
|
||||
LiquidityFacet: await (await ethers.getContractFactory("LiquidityFacet")).deploy(),
|
||||
VaultFacet: await (await ethers.getContractFactory("VaultFacet")).deploy(),
|
||||
ComplianceFacet: await (await ethers.getContractFactory("ComplianceFacet")).deploy(),
|
||||
CCIPFacet: await (await ethers.getContractFactory("CCIPFacet")).deploy(),
|
||||
GovernanceFacet: await (await ethers.getContractFactory("GovernanceFacet")).deploy(),
|
||||
SecurityFacet: await (await ethers.getContractFactory("SecurityFacet")).deploy(),
|
||||
ChainConfigFacet: await (await ethers.getContractFactory("ChainConfigFacet")).deploy(),
|
||||
};
|
||||
|
||||
console.log("Facets deployed");
|
||||
|
||||
// Configure CCIP
|
||||
const ccipFacet = await ethers.getContractAt("CCIPFacet", diamondAddress);
|
||||
await ccipFacet.setCCIPRouter(ccipRouter);
|
||||
await ccipFacet.setChainSelector(chainId, chainSelector);
|
||||
console.log(`CCIP Router configured: ${ccipRouter}`);
|
||||
|
||||
// Configure ChainConfig
|
||||
const chainConfigFacet = await ethers.getContractAt("ChainConfigFacet", diamondAddress);
|
||||
await chainConfigFacet.setChainConfig(
|
||||
chainId,
|
||||
"Base",
|
||||
ethers.ZeroAddress,
|
||||
"https://basescan.org",
|
||||
BigInt(3000000),
|
||||
BigInt(300)
|
||||
);
|
||||
await chainConfigFacet.setChainActive(chainId, true);
|
||||
|
||||
const deployment = {
|
||||
diamond: diamondAddress,
|
||||
facets: Object.fromEntries(
|
||||
Object.entries(facets).map(([name, contract]) => [name, await contract.getAddress()])
|
||||
),
|
||||
chainId: chainId,
|
||||
chainName: "Base",
|
||||
ccipRouter,
|
||||
chainSelector: chainSelector.toString(),
|
||||
};
|
||||
|
||||
console.log(`✓ Base deployment complete`);
|
||||
console.log(JSON.stringify(deployment, null, 2));
|
||||
|
||||
// Write to file
|
||||
fs.writeFileSync(
|
||||
`deployments-base-${chainId}.json`,
|
||||
JSON.stringify(deployment, null, 2)
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`✗ Failed to deploy to Base:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user