- Complete MeridianToken standard with compliance & reserve checks - Multi-custodian ReserveAggregator supporting bank/crypto/fund admin - Comprehensive Compliance engine with KYC/AML/sanctions - Full interface definitions and deployment scripts - Test suite for core functionality - Ready for GBP launch with Anchorage custody integration
114 lines
4.5 KiB
JavaScript
114 lines
4.5 KiB
JavaScript
const { ethers } = require("hardhat");
|
|
|
|
async function main() {
|
|
console.log("Deploying Meridian Protocol contracts...");
|
|
|
|
const [deployer] = await ethers.getSigners();
|
|
console.log("Deploying with account:", deployer.address);
|
|
console.log("Account balance:", (await deployer.getBalance()).toString());
|
|
|
|
// 1. Deploy Compliance contract
|
|
console.log("\n1. Deploying Compliance contract...");
|
|
const Compliance = await ethers.getContractFactory("Compliance");
|
|
const compliance = await Compliance.deploy(deployer.address);
|
|
await compliance.deployed();
|
|
console.log("Compliance deployed to:", compliance.address);
|
|
|
|
// 2. Deploy ReserveAggregator contract
|
|
console.log("\n2. Deploying ReserveAggregator contract...");
|
|
const ReserveAggregator = await ethers.getContractFactory("ReserveAggregator");
|
|
const reserveAggregator = await ReserveAggregator.deploy(deployer.address);
|
|
await reserveAggregator.deployed();
|
|
console.log("ReserveAggregator deployed to:", reserveAggregator.address);
|
|
|
|
// 3. Deploy MeridianToken for GBP
|
|
console.log("\n3. Deploying MeridianToken (MGBP)...");
|
|
const MeridianToken = await ethers.getContractFactory("MeridianToken");
|
|
const mgbp = await MeridianToken.deploy(
|
|
"Meridian GBP", // name
|
|
"MGBP", // symbol
|
|
"GBP", // currency
|
|
"Meridian LLC", // issuer name
|
|
reserveAggregator.address,
|
|
compliance.address,
|
|
deployer.address // admin
|
|
);
|
|
await mgbp.deployed();
|
|
console.log("MGBP Token deployed to:", mgbp.address);
|
|
|
|
// 4. Configure initial settings
|
|
console.log("\n4. Configuring initial settings...");
|
|
|
|
// Set up KYC levels in compliance contract
|
|
await compliance.updateKYCLevelLimits(1, ethers.utils.parseEther("1000"), ethers.utils.parseEther("10000"));
|
|
await compliance.updateKYCLevelLimits(2, ethers.utils.parseEther("10000"), ethers.utils.parseEther("100000"));
|
|
await compliance.updateKYCLevelLimits(3, ethers.utils.parseEther("100000"), ethers.utils.parseEther("1000000"));
|
|
|
|
// Add deployer to KYC whitelist for testing
|
|
await compliance.whitelistAddress(deployer.address, 3, "UK", 0);
|
|
console.log("Deployer whitelisted for testing");
|
|
|
|
// 5. Add initial custodian (placeholder for Anchorage)
|
|
console.log("\n5. Adding initial custodian...");
|
|
const custodianId = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("anchorage-gbp"));
|
|
await reserveAggregator.addCustodian(
|
|
custodianId,
|
|
"Anchorage Digital GBP",
|
|
deployer.address, // placeholder oracle address
|
|
3600, // 1 hour heartbeat
|
|
2 // fund admin type for manual attestation
|
|
);
|
|
console.log("Initial custodian added");
|
|
|
|
// 6. Display deployment summary
|
|
console.log("\n=== DEPLOYMENT SUMMARY ===");
|
|
console.log("Network:", network.name);
|
|
console.log("Deployer:", deployer.address);
|
|
console.log("");
|
|
console.log("Contract Addresses:");
|
|
console.log("- Compliance:", compliance.address);
|
|
console.log("- ReserveAggregator:", reserveAggregator.address);
|
|
console.log("- MGBP Token:", mgbp.address);
|
|
console.log("");
|
|
console.log("Token Details:");
|
|
console.log("- Name:", await mgbp.name());
|
|
console.log("- Symbol:", await mgbp.symbol());
|
|
console.log("- Currency:", await mgbp.currency());
|
|
console.log("- Issuer:", await mgbp.issuerName());
|
|
console.log("- Min Collateral Ratio:", (await mgbp.minimumCollateralRatio()).toString() + " (basis points * 100)");
|
|
console.log("");
|
|
console.log("Next Steps:");
|
|
console.log("1. Add real custodian oracles to ReserveAggregator");
|
|
console.log("2. Attest initial reserves");
|
|
console.log("3. Set up Chainlink PoR feeds");
|
|
console.log("4. Configure production KYC whitelist");
|
|
console.log("5. Verify contracts on Etherscan");
|
|
|
|
// Save deployment addresses to file
|
|
const fs = require('fs');
|
|
const deploymentInfo = {
|
|
network: network.name,
|
|
timestamp: new Date().toISOString(),
|
|
deployer: deployer.address,
|
|
contracts: {
|
|
Compliance: compliance.address,
|
|
ReserveAggregator: reserveAggregator.address,
|
|
MGBP: mgbp.address
|
|
},
|
|
custodianId: custodianId
|
|
};
|
|
|
|
fs.writeFileSync(
|
|
`deployment-${network.name}.json`,
|
|
JSON.stringify(deploymentInfo, null, 2)
|
|
);
|
|
console.log(`\nDeployment info saved to deployment-${network.name}.json`);
|
|
}
|
|
|
|
main()
|
|
.then(() => process.exit(0))
|
|
.catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|