diff --git a/config/address-inventory.chain138.json b/config/address-inventory.chain138.json index 532246f..adf8418 100644 --- a/config/address-inventory.chain138.json +++ b/config/address-inventory.chain138.json @@ -1,6 +1,6 @@ { "description": "Reference inventory moved out of smom-dbis-138/.env during dotenv cleanup. These are deployed/inventory addresses, not the minimal runtime env surface.", - "updated": "2026-05-19", + "updated": "2026-06-18", "chain138Inventory": { "COMPLIANCE_REGISTRY": "0xbc54fe2b6fda157c59d59826bcfdbcc654ec9ea1", "COMPLIANCE_REGISTRY_ADDRESS": "0xbc54fe2b6fda157c59d59826bcfdbcc654ec9ea1", @@ -119,7 +119,7 @@ "UNISWAP_V3_ROUTER_CHAIN138_DODO": "0xde9cD8ee2811E6E64a41D5F68Be315d33995975E", "DODO_TEAM_MULTISIG": "0x4A666F96fC8764181194447A7dFdb7d471b301C8", "DODO_VENDING_MACHINE_ADDRESS": "0xB16c3D48A111714B1795E58341FeFDd643Ab01ab", - "DODO_VENDING_MACHINE_NOTE": "Legacy DBIS route-executor stub (~1kB), not DODOV2Proxy02 \u2014 run deploy-dodo-full-stack-chain138.sh for native proxy", + "DODO_VENDING_MACHINE_NOTE": "Legacy DBIS route-executor stub (~1kB), not DODOV2Proxy02 — run deploy-dodo-full-stack-chain138.sh for native proxy", "DODO_PMM_INTEGRATION": "0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895", "DODO_PMM_PROVIDER": "0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e", "CAUSDT_ADDRESS_138": "0x5fdDF65733e3d590463F68f93Cf16E8c04081271", @@ -187,7 +187,7 @@ "DODO_D3_MM_FACTORY": "0xca01e43290D57Af7B371209f73D0c0c9456bA891", "DODO_D3_PROXY": "0x20d030e6F0270859cbA04886333f6B83D9Ad6f1a", "DODO_D3_FEE_RATE_MODEL": "0x8b1FeC1cf6f492E109d8a27Fd2A41a6F6C604cCa", - "DODO_OPTIONAL_NOT_DEFERRED": "none \u2014 see dodoDeferredChecklist upstream items", + "DODO_OPTIONAL_NOT_DEFERRED": "none — see dodoDeferredChecklist upstream items", "DODO_GSP_CUSDT_CUSDC": "0xc8a9b51983364d2753B09ad6eA07a8232f5d45c7", "DODO_D3_ORACLE_FEEDS": { "cUSDT": "0x9386FCF39962A3c6e2fF69e03b792b8cEb5Cae88", @@ -198,7 +198,17 @@ "DODO_FEE_ROUTE_PROXY1": "0xD6840208B7B3A1edc2C619d3db454c15CF10dB91", "DODO_FEE_ROUTE_PROXY2": "0x1B138C77d92eC81fA8e7E60f4f67febeFD845E4B", "DODO_LIMIT_ORDER": "0x7d0205F888170B1769e91b6A187c8F9a33b42cA5", - "DODO_LIMIT_ORDER_BOT": "0xf5babe17f7A7b2209f4816C517084fd54FC1f5b5" + "DODO_LIMIT_ORDER_BOT": "0xf5babe17f7A7b2209f4816C517084fd54FC1f5b5", + "DBIS_RAIL_DBIS_RootRegistry": "0xce43c88ef4a9c8a771b3341bc19cd81b184e9022", + "DBIS_RAIL_DBIS_ParticipantRegistry": "0x5c52d4146e69f235e48e9eb7efe20d382afb5ea6", + "DBIS_RAIL_DBIS_SignerRegistry": "0x2294a5a8909d98072d361cff8685d7ffee3ac6d8", + "DBIS_RAIL_DBIS_GRU_MintController": "0xff264465c61bb933805b4ef952826cc9efbd3f4a", + "DBIS_RAIL_DBIS_SettlementRouter": "0x828594b3d4998c5594e18c707bc90adbcd5b1165", + "DBIS_RAIL_STABLECOINREFERENCEREGISTRY": "0x08e930046acfbddc945f5fd5dede9ba58631f03f", + "DBIS_RAIL_DBIS_ConversionRouter": "0x5e867cab9c9c2290bc44717410fb789010741a12", + "DBIS_RAIL_DBIS_EIP712Helper": "0x94f9549bd050eb494494e939c827f59c342c6b36", + "DBIS_RAIL_CUSDT": "0x93E66202A11B1772E55407B32B44e5Cd8eda7f22", + "DBIS_RAIL_CUSDC": "0xf22258f57794CC8E06237084b353Ab30fFfa640b" }, "mainnetAttestation": { "CHAIN138_MAINNET_CHECKPOINT_PROXY": "0xe2D6B908FE2535C39C79257FAAa2A52457673ba9", diff --git a/config/chain138-pmm-pools.json b/config/chain138-pmm-pools.json index f66f27d..9724592 100644 --- a/config/chain138-pmm-pools.json +++ b/config/chain138-pmm-pools.json @@ -2,7 +2,7 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "Desired-state pool spec for Chain 138 DODO PMM. Scripts should create and register only missing pools from this file, not redeploy contracts.", "version": "1.1.0", - "updated": "2026-05-09", + "updated": "2026-06-18", "chainId": 138, "defaults": { "lpFeeRate": 3, diff --git a/script/deploy/WireDBISRailPostDeploy.s.sol b/script/deploy/WireDBISRailPostDeploy.s.sol new file mode 100644 index 0000000..2ad59cc --- /dev/null +++ b/script/deploy/WireDBISRailPostDeploy.s.sol @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "forge-std/Script.sol"; +import "../../contracts/dbis/DBIS_ParticipantRegistry.sol"; +import "../../contracts/dbis/DBIS_GRU_MintController.sol"; +import "../../contracts/dbis/StablecoinReferenceRegistry.sol"; + +/** + * @title WireDBISRailPostDeploy + * @notice Post-deploy wiring: stablecoin registry, optional GRU token, seed participants. + * @dev Env: PRIVATE_KEY; contract addresses from deploy report or env DBIS_* vars. + */ +contract WireDBISRailPostDeploy is Script { + function run() external { + uint256 pk = vm.envUint("PRIVATE_KEY"); + address admin = vm.envOr("ADMIN_ADDRESS", vm.addr(pk)); + + address stableRegAddr = vm.envAddress("DBIS_STABLECOIN_REGISTRY"); + address mintCtrlAddr = vm.envAddress("DBIS_GRU_MINT_CONTROLLER"); + address participantRegAddr = vm.envAddress("DBIS_PARTICIPANT_REGISTRY"); + + StablecoinReferenceRegistry stableReg = StablecoinReferenceRegistry(stableRegAddr); + DBIS_GRU_MintController mintController = DBIS_GRU_MintController(mintCtrlAddr); + DBIS_ParticipantRegistry participantReg = DBIS_ParticipantRegistry(participantRegAddr); + + vm.startBroadcast(pk); + + _registerStablecoin( + stableReg, + vm.envAddress("CUSDT_ADDRESS"), + "cUSDT", + admin + ); + _registerStablecoin( + stableReg, + vm.envAddress("CUSDC_ADDRESS"), + "cUSDC", + admin + ); + + address gruToken = vm.envOr("DBIS_GRU_MINTABLE_TOKEN", address(0)); + if (gruToken != address(0)) { + mintController.setGruToken(gruToken); + } + + bytes32 participantId = keccak256("OMNL-OPERATOR"); + DBIS_ParticipantRegistry.Participant memory existing = participantReg.getParticipant(participantId); + if (existing.participantId == bytes32(0)) { + address[] memory wallets = new address[](1); + wallets[0] = admin; + bytes32[] memory tags = new bytes32[](0); + participantReg.registerParticipant( + DBIS_ParticipantRegistry.Participant({ + participantId: participantId, + legalName: "OMNL Fineract Operator", + jurisdiction: "MULTI", + entityType: DBIS_ParticipantRegistry.EntityType.OPERATOR, + status: DBIS_ParticipantRegistry.Status.ACTIVE, + policyTags: tags, + operationalWallets: wallets + }) + ); + } + + vm.stopBroadcast(); + } + + function _registerStablecoin( + StablecoinReferenceRegistry reg, + address token, + string memory symbol, + address pauseAuthority + ) private { + if (token == address(0)) return; + StablecoinReferenceRegistry.StablecoinEntry memory existing = reg.getEntry(token); + if (existing.exists) return; + reg.register( + token, + symbol, + "DBIS", + "compliant_stable", + "omnl_redeem", + "EXPLORER_TOKEN_LIST_CROSSCHECK", + 1, + pauseAuthority + ); + } +} diff --git a/script/deploy/WireDBISRailSigners.s.sol b/script/deploy/WireDBISRailSigners.s.sol new file mode 100644 index 0000000..829e873 --- /dev/null +++ b/script/deploy/WireDBISRailSigners.s.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "forge-std/Script.sol"; +import "../../contracts/dbis/DBIS_SignerRegistry.sol"; + +/// @notice Pilot quorum: single compliance signer for MintAuth E2E on Chain 138. +contract WireDBISRailSigners is Script { + function run() external { + uint256 pk = vm.envUint("PRIVATE_KEY"); + address admin = vm.envOr("ADMIN_ADDRESS", vm.addr(pk)); + address signerRegAddr = vm.envAddress("DBIS_SIGNER_REGISTRY"); + DBIS_SignerRegistry signerReg = DBIS_SignerRegistry(signerRegAddr); + + vm.startBroadcast(pk); + + if (signerReg.getSignerCount() == 0) { + signerReg.addSigner(admin, signerReg.CATEGORY_COMPLIANCE()); + } + + signerReg.setQuorum(1, 1 << signerReg.CATEGORY_COMPLIANCE(), signerReg.categoryMaskAllowed()); + + vm.stopBroadcast(); + } +} diff --git a/scripts/deployment/verify-all-networks-explorers.sh b/scripts/deployment/verify-all-networks-explorers.sh index b5c97c3..637eedf 100755 --- a/scripts/deployment/verify-all-networks-explorers.sh +++ b/scripts/deployment/verify-all-networks-explorers.sh @@ -37,6 +37,9 @@ fi if [[ -f "$PROXMOX/scripts/verify/run-contract-verification-with-proxy.sh" ]]; then step "Chain 138 Blockscout (forge proxy)" bash "$PROXMOX/scripts/verify/run-contract-verification-with-proxy.sh" || true + if [[ -f "$PROXMOX/scripts/verify/verify-dbis-rail-blockscout.sh" ]]; then + step "Chain 138 DBIS Rail Blockscout" bash "$PROXMOX/scripts/verify/verify-dbis-rail-blockscout.sh" || true + fi else echo "WARN: Proxmox verify proxy not found at $PROXMOX/scripts/verify/" >&2 fi diff --git a/scripts/mint-all-c-star-138.sh b/scripts/mint-all-c-star-138.sh index e4a4dee..c3d6d8a 100755 --- a/scripts/mint-all-c-star-138.sh +++ b/scripts/mint-all-c-star-138.sh @@ -1,9 +1,13 @@ #!/usr/bin/env bash # Mint all 12 c* tokens on Chain 138 to the deployer. +# V1 tokens owned by MultiSig are minted via submitTransaction + executeTransaction. +# # Usage: ./scripts/mint-all-c-star-138.sh [amount_human] # amount_human = 1000000 (default = 1M each). 6 decimals. # For cXAUC/cXAUT, amount_human is troy ounces (1 token = 1 troy oz Au), not USD. # Requires: PRIVATE_KEY, RPC_URL_138 in .env. +# +# Exit: 0 all OK/skipped; 1 one or more mint failures. set -euo pipefail @@ -13,20 +17,146 @@ cd "$PROJECT_ROOT" [ -f .env ] && set -a && source .env && set +a RPC="${RPC_URL_138:-${RPC_URL:-http://192.168.11.211:8545}}" +GAS_PRICE="${GAS_PRICE_138:-1000000000}" +GAS_LIMIT_MINT="${GAS_LIMIT_MINT:-450000}" +GAS_LIMIT_MULTISIG="${GAS_LIMIT_MULTISIG:-600000}" +MULTISIG="${ADDR_MULTISIG:-0xb9E29cFa1f89d369671E640d0BB3aD94Cab43965}" AMOUNT_HUMAN="${1:-1000000}" BASE_UNITS=$((AMOUNT_HUMAN * 1000000)) +MINT_XAU_OZ="${MINT_XAU_OZ:-50}" +XAU_BASE_UNITS=$((MINT_XAU_OZ * 1000000)) [ -n "${PRIVATE_KEY:-}" ] || { echo "PRIVATE_KEY not set"; exit 1; } DEPLOYER=$(cast wallet address "$PRIVATE_KEY" 2>/dev/null) || exit 1 +FAILURES=0 + +extract_tx_hash() { + local out="$1" + echo "$out" | awk '/^transactionHash[[:space:]]/ {print $2; exit}' +} + +tx_status_ok() { + local txhash="$1" + [[ -n "$txhash" && "$txhash" == 0x* ]] || return 1 + local st + st=$(cast receipt "$txhash" status --rpc-url "$RPC" 2>/dev/null | awk '{print $1}' || echo "") + [[ "$st" == "1" || "$st" == "true" ]] +} + +mint_via_multisig() { + local token="$1" sym="$2" amount="$3" + local data txhash txid + data=$(cast calldata "mint(address,uint256)" "$DEPLOYER" "$amount") + echo -n " multisig mint $sym... " + txhash=$(cast send "$MULTISIG" \ + "submitTransaction(address,uint256,bytes)" "$token" 0 "$data" \ + --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy \ + --gas-limit "$GAS_LIMIT_MULTISIG" --gas-price "$GAS_PRICE" 2>&1) || { + echo "FAIL (submit)" + echo "$txhash" | tail -3 + return 1 + } + local count txid exec_out + count=$(cast call "$MULTISIG" "getTransactionCount()(uint256)" --rpc-url "$RPC" 2>/dev/null | awk '{print $1}' || echo "0") + if [[ "$count" =~ ^[0-9]+$ && "$count" -gt 0 ]]; then + txid=$((count - 1)) + else + echo "FAIL (txid)" + return 1 + fi + exec_out=$(cast send "$MULTISIG" "executeTransaction(uint256)" "$txid" \ + --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy \ + --gas-limit "$GAS_LIMIT_MULTISIG" --gas-price "$GAS_PRICE" 2>&1) || { + echo "FAIL (execute)" + echo "$exec_out" | tail -3 + return 1 + } + txhash=$(extract_tx_hash "$exec_out") + if tx_status_ok "$txhash"; then + echo "OK (tx $txhash)" + return 0 + fi + echo "FAIL (receipt status 0: $txhash)" + return 1 +} + +mint_direct() { + local token="$1" sym="$2" amount="$3" + local out txhash + echo -n " direct mint $sym... " + out=$(cast send "$token" "mint(address,uint256)" "$DEPLOYER" "$amount" \ + --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy \ + --gas-limit "$GAS_LIMIT_MINT" --gas-price "$GAS_PRICE" 2>&1) || { + echo "FAIL (send)" + echo "$out" | tail -3 + return 1 + } + txhash=$(extract_tx_hash "$out") + if tx_status_ok "$txhash"; then + echo "OK (tx $txhash)" + return 0 + fi + echo "FAIL (receipt status 0: $txhash)" + return 1 +} + +mint_one() { + local sym="$1" token="$2" amount="$3" + local owner lc_dep lc_own + owner=$(cast call "$token" "owner()(address)" --rpc-url "$RPC" 2>/dev/null || echo "") + lc_dep=$(echo "$DEPLOYER" | tr '[:upper:]' '[:lower:]') + lc_own=$(echo "$owner" | tr '[:upper:]' '[:lower:]') + lc_ms=$(echo "$MULTISIG" | tr '[:upper:]' '[:lower:]') + + if [[ "$lc_own" == "$lc_dep" ]]; then + mint_direct "$token" "$sym" "$amount" || return 1 + elif [[ "$lc_own" == "$lc_ms" ]]; then + mint_via_multisig "$token" "$sym" "$amount" || return 1 + else + echo " SKIP $sym: owner=$owner (not deployer or multisig)" + return 0 + fi +} + echo "=== Mint all c* on Chain 138 ===" -echo " Deployer: $DEPLOYER Amount: $AMOUNT_HUMAN tokens each ($BASE_UNITS base)" +echo " Deployer: $DEPLOYER" +echo " MultiSig: $MULTISIG" +echo " Amount: $AMOUNT_HUMAN tokens each ($BASE_UNITS base)" +echo " XAU: $MINT_XAU_OZ troy oz each ($XAU_BASE_UNITS base)" +echo " Gas: mint=$GAS_LIMIT_MINT multisig=$GAS_LIMIT_MULTISIG" echo "" -for pair in "cUSDT:0x93E66202A11B1772E55407B32B44e5Cd8eda7f22" "cUSDC:0xf22258f57794CC8E06237084b353Ab30fFfa640b" "cEURC:0x8085961F9cF02b4d800A3c6d386D31da4B34266a" "cEURT:0xdf4b71c61E5912712C1Bdd451416B9aC26949d72" "cGBPC:0x003960f16D9d34F2e98d62723B6721Fb92074aD2" "cGBPT:0x350f54e4D23795f86A9c03988c7135357CCaD97c" "cAUDC:0xD51482e567c03899eecE3CAe8a058161FD56069D" "cJPYC:0xEe269e1226a334182aace90056EE4ee5Cc8A6770" "cCHFC:0x873990849DDa5117d7C644f0aF24370797C03885" "cCADC:0x54dBd40cF05e15906A2C21f600937e96787f5679" "cXAUC:0x290E52a8819A4fbD0714E517225429aA2B70EC6b" "cXAUT:0x94e408E26c6FD8F4ee00b54dF19082FDA07dC96E"; do +for pair in \ + "cUSDT:0x93E66202A11B1772E55407B32B44e5Cd8eda7f22" \ + "cUSDC:0xf22258f57794CC8E06237084b353Ab30fFfa640b" \ + "cEURC:0x8085961F9cF02b4d800A3c6d386D31da4B34266a" \ + "cEURT:0xdf4b71c61E5912712C1Bdd451416B9aC26949d72" \ + "cGBPC:0x003960f16D9d34F2e98d62723B6721Fb92074aD2" \ + "cGBPT:0x350f54e4D23795f86A9c03988c7135357CCaD97c" \ + "cAUDC:0xD51482e567c03899eecE3CAe8a058161FD56069D" \ + "cJPYC:0xEe269e1226a334182aace90056EE4ee5Cc8A6770" \ + "cCHFC:0x873990849DDa5117d7C644f0aF24370797C03885" \ + "cCADC:0x54dBd40cF05e15906A2C21f600937e96787f5679"; do sym="${pair%%:*}" addr="${pair#*:}" - echo -n "Minting $sym... " - if cast send "$addr" "mint(address,uint256)" "$DEPLOYER" "$BASE_UNITS" --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit 100000 2>/dev/null; then echo "OK"; else echo "FAIL"; fi + echo "Minting $sym..." + mint_one "$sym" "$addr" "$BASE_UNITS" || FAILURES=$((FAILURES + 1)) done -echo "Done." + +for pair in \ + "cXAUC:0x290E52a8819A4fbD0714E517225429aA2B70EC6b" \ + "cXAUT:0x94e408E26c6FD8F4ee00b54dF19082FDA07dC96E"; do + sym="${pair%%:*}" + addr="${pair#*:}" + echo "Minting $sym ($MINT_XAU_OZ oz)..." + mint_one "$sym" "$addr" "$XAU_BASE_UNITS" || FAILURES=$((FAILURES + 1)) +done + +echo "" +if [[ "$FAILURES" -gt 0 ]]; then + echo "Done with $FAILURES failure(s)." + exit 1 +fi +echo "Done — all mints succeeded." +exit 0