2026-03-02 12:14:09 -08:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
|
|
|
|
|
|
import {Script, console} from "forge-std/Script.sol";
|
|
|
|
|
import {VaultFactory} from "../../../contracts/vault/VaultFactory.sol";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title DeployAcVdcSdcVaults
|
|
|
|
|
* @notice Single script to create all ac* / vdc* / sdc* vaults via VaultFactory.createVaultWithDecimals.
|
|
|
|
|
* @dev Run after DeployVaultSystem. Uses same owner/entity and base token addresses per chain for consistency.
|
|
|
|
|
* See docs/runbooks/MULTI_CHAIN_EXECUTION_DETERMINISTIC_DEPLOYMENT.md (DepositToken/DebtToken).
|
|
|
|
|
*
|
|
|
|
|
* Env:
|
|
|
|
|
* PRIVATE_KEY - Deployer (must have VAULT_DEPLOYER_ROLE on VaultFactory).
|
|
|
|
|
* VAULT_FACTORY_ADDRESS - VaultFactory contract address.
|
|
|
|
|
* OWNER - (optional) Vault owner; default deployer.
|
|
|
|
|
* ENTITY - (optional) Regulated entity; default deployer.
|
|
|
|
|
* CUSDC_ADDRESS_138 - (optional) Compliant USDC; if set, creates vault → acUSDC + vdcUSDC.
|
|
|
|
|
* CUSDT_ADDRESS_138 - (optional) Compliant USDT; if set, creates vault → acUSDT + vdcUSDT.
|
|
|
|
|
* COMPLIANT_USDC_ADDRESS, COMPLIANT_USDT_ADDRESS - Fallback env names if CUSDC/CUSDT_138 unset.
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
* cEURC_ADDRESS_138, cEURT_ADDRESS_138, cGBPC_ADDRESS_138, cGBPT_ADDRESS_138,
|
|
|
|
|
* cAUDC_ADDRESS_138, cJPYC_ADDRESS_138, cCHFC_ADDRESS_138, cCADC_ADDRESS_138,
|
|
|
|
|
* cXAUC_ADDRESS_138, cXAUT_ADDRESS_138 - Optional additional base tokens (6 decimals).
|
2026-03-02 12:14:09 -08:00
|
|
|
*/
|
|
|
|
|
contract DeployAcVdcSdcVaults is Script {
|
|
|
|
|
uint8 constant DECIMALS = 6;
|
|
|
|
|
bool constant DEBT_TRANSFERABLE = true;
|
|
|
|
|
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
struct TokenSpec {
|
|
|
|
|
string envPrimary;
|
|
|
|
|
string envAlt;
|
|
|
|
|
string label;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TokenSpec[] internal tokens;
|
|
|
|
|
|
|
|
|
|
function _initTokens() internal {
|
|
|
|
|
tokens.push(TokenSpec("CUSDC_ADDRESS_138", "COMPLIANT_USDC_ADDRESS", "USDC"));
|
|
|
|
|
tokens.push(TokenSpec("CUSDT_ADDRESS_138", "COMPLIANT_USDT_ADDRESS", "USDT"));
|
|
|
|
|
tokens.push(TokenSpec("cEURC_ADDRESS_138", "", "EURC"));
|
|
|
|
|
tokens.push(TokenSpec("cEURT_ADDRESS_138", "", "EURT"));
|
|
|
|
|
tokens.push(TokenSpec("cGBPC_ADDRESS_138", "", "GBPC"));
|
|
|
|
|
tokens.push(TokenSpec("cGBPT_ADDRESS_138", "", "GBPT"));
|
|
|
|
|
tokens.push(TokenSpec("cAUDC_ADDRESS_138", "", "AUDC"));
|
|
|
|
|
tokens.push(TokenSpec("cJPYC_ADDRESS_138", "", "JPYC"));
|
|
|
|
|
tokens.push(TokenSpec("cCHFC_ADDRESS_138", "", "CHFC"));
|
|
|
|
|
tokens.push(TokenSpec("cCADC_ADDRESS_138", "", "CADC"));
|
|
|
|
|
tokens.push(TokenSpec("cXAUC_ADDRESS_138", "", "XAUC"));
|
|
|
|
|
tokens.push(TokenSpec("cXAUT_ADDRESS_138", "", "XAUT"));
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 12:14:09 -08:00
|
|
|
function run() external {
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
_initTokens();
|
2026-03-02 12:14:09 -08:00
|
|
|
uint256 pk = vm.envUint("PRIVATE_KEY");
|
|
|
|
|
address deployer = vm.addr(pk);
|
|
|
|
|
address owner = vm.envOr("OWNER", deployer);
|
|
|
|
|
address entity = vm.envOr("ENTITY", deployer);
|
|
|
|
|
|
|
|
|
|
address factoryAddr = vm.envAddress("VAULT_FACTORY_ADDRESS");
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
if (factoryAddr == address(0)) {
|
|
|
|
|
factoryAddr = vm.envOr("VAULT_FACTORY", address(0));
|
|
|
|
|
}
|
2026-03-02 12:14:09 -08:00
|
|
|
require(factoryAddr != address(0), "VAULT_FACTORY_ADDRESS required");
|
|
|
|
|
VaultFactory factory = VaultFactory(factoryAddr);
|
|
|
|
|
|
|
|
|
|
vm.startBroadcast(pk);
|
|
|
|
|
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
for (uint256 i = 0; i < tokens.length; i++) {
|
|
|
|
|
address base = _getToken(tokens[i].envPrimary, tokens[i].envAlt);
|
|
|
|
|
if (base == address(0)) continue;
|
2026-03-02 12:14:09 -08:00
|
|
|
(address vault, address depositToken, address debtToken) = factory.createVaultWithDecimals(
|
|
|
|
|
owner,
|
|
|
|
|
entity,
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
base,
|
|
|
|
|
base,
|
2026-03-02 12:14:09 -08:00
|
|
|
DECIMALS,
|
|
|
|
|
DECIMALS,
|
|
|
|
|
DEBT_TRANSFERABLE
|
|
|
|
|
);
|
Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00
|
|
|
console.log(string.concat(tokens[i].label, " vault:"), vault);
|
|
|
|
|
console.log(string.concat("ac", tokens[i].label, " (deposit):"), depositToken);
|
|
|
|
|
console.log(string.concat("vdc", tokens[i].label, " (debt):"), debtToken);
|
2026-03-02 12:14:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vm.stopBroadcast();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _getToken(string memory primary, string memory altKey) internal view returns (address) {
|
|
|
|
|
address a = vm.envOr(primary, address(0));
|
|
|
|
|
if (a != address(0)) return a;
|
|
|
|
|
return vm.envOr(altKey, address(0));
|
|
|
|
|
}
|
|
|
|
|
}
|