Files
smom-dbis-138/script/deploy/DeployCWTransportFiatTokensV2ForChain.s.sol
defiQUG 55912d1143
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m14s
CI/CD Pipeline / Security Scanning (push) Successful in 2m20s
CI/CD Pipeline / Lint and Format (push) Failing after 44s
CI/CD Pipeline / Terraform Validation (push) Failing after 23s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 24s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 25s
Validation / validate-genesis (push) Successful in 26s
Validation / validate-terraform (push) Failing after 23s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 9s
Validation / validate-security (push) Failing after 1m13s
Validation / validate-documentation (push) Failing after 17s
Verify Deployment / Verify Deployment (push) Failing after 11m56s
feat(chain138): ISO20022 gateway, swift-listener, and address inventory sync.
Update checkpoint-core ISO20022 types/hashes, swift-listener canonical mapping, and chain138 address inventory.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 16:17:18 -07:00

68 lines
2.9 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Script, console} from "forge-std/Script.sol";
import {CompliantCWUSDCTokenV2} from "../../contracts/tokens/CompliantCWUSDCTokenV2.sol";
import {CompliantCWUSDTTokenV2} from "../../contracts/tokens/CompliantCWUSDTTokenV2.sol";
import {CompliantFiatTokenV2} from "../../contracts/tokens/CompliantFiatTokenV2.sol";
/**
* @title DeployCWTransportFiatTokensV2ForChain
* @notice Deploy ERC-3009-capable cWUSDC / cWUSDT transport on a public EVM chain (Base, Polygon, …).
*
* Env:
* PRIVATE_KEY (required)
* CW_BRIDGE_ADDRESS (required) — L2 bridge receiver with MINTER/BURNER
* INITIAL_OPERATOR (optional; default deployer)
* ADMIN / OWNER (optional; default deployer)
* INITIAL_SUPPLY (optional; default 0 — bridge mints)
* FORWARD_CANONICAL (optional; default false for transport)
* CW_TRANSPORT_STRICT_MODE (optional; default 1 — revoke deployer mint/burn after bridge grant)
* DEPLOY_CWUSDT_V2=1 / DEPLOY_CWUSDC_V2=1 (default both 1)
*/
contract DeployCWTransportFiatTokensV2ForChain is Script {
function run() external {
uint256 pk = vm.envUint("PRIVATE_KEY");
address deployer = vm.addr(pk);
address bridge = vm.envAddress("CW_BRIDGE_ADDRESS");
address initialOperator = vm.envOr("INITIAL_OPERATOR", deployer);
address ownerAlias = vm.envOr("OWNER", deployer);
address admin = vm.envOr("ADMIN", ownerAlias);
uint256 initialSupply = vm.envOr("INITIAL_SUPPLY", uint256(0));
bool forwardCanonical = vm.envOr("FORWARD_CANONICAL", false);
bool strictMode = vm.envOr("CW_TRANSPORT_STRICT_MODE", uint256(1)) != 0;
require(bridge != address(0), "CW_BRIDGE_ADDRESS required");
vm.startBroadcast(pk);
if (vm.envOr("DEPLOY_CWUSDT_V2", uint256(1)) != 0) {
CompliantCWUSDTTokenV2 token =
new CompliantCWUSDTTokenV2(initialOperator, admin, initialSupply, forwardCanonical);
_wireBridge(address(token), bridge, admin, strictMode);
console.log("cWUSDT_V2", address(token));
console.log("cWUSDT_V2_bridge", bridge);
}
if (vm.envOr("DEPLOY_CWUSDC_V2", uint256(1)) != 0) {
CompliantCWUSDCTokenV2 token =
new CompliantCWUSDCTokenV2(initialOperator, admin, initialSupply, forwardCanonical);
_wireBridge(address(token), bridge, admin, strictMode);
console.log("cWUSDC_V2", address(token));
console.log("cWUSDC_V2_bridge", bridge);
}
vm.stopBroadcast();
}
function _wireBridge(address token, address bridge, address admin, bool strictMode) internal {
CompliantFiatTokenV2 t = CompliantFiatTokenV2(token);
t.grantRole(t.MINTER_ROLE(), bridge);
t.grantRole(t.BURNER_ROLE(), bridge);
if (strictMode) {
t.revokeRole(t.MINTER_ROLE(), admin);
t.revokeRole(t.BURNER_ROLE(), admin);
}
}
}