WIP: Chain138 deployment scripts, flash receivers, HYBX OMNL recovery
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {AaveUniV2CwStableRebalanceFlashReceiver} from "../../contracts/flash/AaveUniV2CwStableRebalanceFlashReceiver.sol";
|
||||
|
||||
/**
|
||||
* @title DeployAaveUniV2CwStableRebalanceFlashReceiver
|
||||
* @notice Deploy the UniV2 rebalance + remove Aave flash receiver.
|
||||
*
|
||||
* Env:
|
||||
* PRIVATE_KEY
|
||||
* AAVE_POOL_ADDRESS optional; default Aave V3 mainnet Pool
|
||||
* UNIV2_FLASH_REBALANCE_OWNER optional; default deployer
|
||||
*/
|
||||
contract DeployAaveUniV2CwStableRebalanceFlashReceiver is Script {
|
||||
address internal constant DEFAULT_AAVE_POOL_MAINNET = 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address pool = vm.envOr("AAVE_POOL_ADDRESS", DEFAULT_AAVE_POOL_MAINNET);
|
||||
address deployer = vm.addr(pk);
|
||||
address owner = vm.envOr("UNIV2_FLASH_REBALANCE_OWNER", deployer);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
AaveUniV2CwStableRebalanceFlashReceiver receiver =
|
||||
new AaveUniV2CwStableRebalanceFlashReceiver(pool, owner);
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("AaveUniV2CwStableRebalanceFlashReceiver", address(receiver));
|
||||
console.log("owner", owner);
|
||||
console.log("aavePool", pool);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import "../../../contracts/bridge/adapters/evm/ZedxionAdapter.sol";
|
||||
|
||||
/**
|
||||
* @notice Deploy ZedxionAdapter on Chain 138.
|
||||
* Env: PRIVATE_KEY, ADMIN (optional), ZEDXION_TRANSPORT (optional — call setZedxionTransport after)
|
||||
*/
|
||||
contract DeployZedxionAdapter is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address admin = vm.envOr("ADMIN", vm.addr(pk));
|
||||
vm.startBroadcast(pk);
|
||||
ZedxionAdapter adapter = new ZedxionAdapter(admin);
|
||||
vm.stopBroadcast();
|
||||
console2.log("ZedxionAdapter", address(adapter));
|
||||
address transport = vm.envOr("ZEDXION_TRANSPORT", address(0));
|
||||
if (transport != address(0)) {
|
||||
vm.startBroadcast(pk);
|
||||
adapter.setZedxionTransport(transport);
|
||||
vm.stopBroadcast();
|
||||
console2.log("ZedxionTransport wired", transport);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import "../../../contracts/bridge/ZedxionCustomBridge.sol";
|
||||
|
||||
/**
|
||||
* @notice Deploy ZedxionCustomBridge on Chain 138 and/or ZEDXION (83872).
|
||||
* @dev For CREATE2 same-address deploy, use DeployDeterministicCore pattern with salt keccak256("ZedxionCustomBridge").
|
||||
* Env: PRIVATE_KEY, ADMIN (defaults msg.sender)
|
||||
*/
|
||||
contract DeployZedxionCustomBridge is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address admin = vm.envOr("ADMIN", vm.addr(pk));
|
||||
vm.startBroadcast(pk);
|
||||
ZedxionCustomBridge bridge = new ZedxionCustomBridge(admin);
|
||||
vm.stopBroadcast();
|
||||
console2.log("ZedxionCustomBridge", address(bridge));
|
||||
console2.log("Admin", admin);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import {UniversalAssetRegistry} from "../../../contracts/registry/UniversalAssetRegistry.sol";
|
||||
|
||||
/**
|
||||
* @title GrantUarRegistrarRWA138
|
||||
* @notice Grant REGISTRAR_ROLE on UAR to broadcaster (for RegisterRWAIndicesInUAR138).
|
||||
* @dev Broadcaster must hold DEFAULT_ADMIN_ROLE on UAR.
|
||||
*/
|
||||
contract GrantUarRegistrarRWA138 is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address grantee = vm.envOr("UAR_REGISTRAR_GRANTEE", vm.addr(pk));
|
||||
address uarAddr = vm.envAddress("UNIVERSAL_ASSET_REGISTRY");
|
||||
|
||||
UniversalAssetRegistry uar = UniversalAssetRegistry(uarAddr);
|
||||
bytes32 role = uar.REGISTRAR_ROLE();
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
uar.grantRole(role, grantee);
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("REGISTRAR_ROLE granted to", grantee, "on UAR", uarAddr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import {RWATokenRegistry} from "../../../contracts/rwa/RWATokenRegistry.sol";
|
||||
import {RWATokenFactory} from "../../../contracts/rwa/RWATokenFactory.sol";
|
||||
import {IRWATokenFactory} from "../../../contracts/rwa/IRWATokenFactory.sol";
|
||||
import {RWAToken} from "../../../contracts/rwa/RWAToken.sol";
|
||||
|
||||
/**
|
||||
* @title RedeployLiIndexPublisher138
|
||||
* @notice Operator recovery when Gnosis Safe co-signer keys are unavailable:
|
||||
* deactivate Li* in registry, redeploy with deployer as INDEX_PUBLISHER, publish index level.
|
||||
*
|
||||
* Env: LI_TICKER (LiXAU|LiPMG|LiBMG1|LiBMG2|LiBMG3), PRIVATE_KEY, RWA_TOKEN_REGISTRY, RWA_TOKEN_FACTORY
|
||||
* REBASE_INDEX_VALUE (optional), OWNER, COMPLIANCE_ADMIN, INDEX_PUBLISHER, RWA_METHODOLOGY_HASH
|
||||
*/
|
||||
contract RedeployLiIndexPublisher138 is Script {
|
||||
struct LiProduct {
|
||||
string indexTicker;
|
||||
string name;
|
||||
string symbol;
|
||||
string assetGroup;
|
||||
string instrumentType;
|
||||
string underlyingAsset;
|
||||
uint256 defaultIndexValue;
|
||||
}
|
||||
|
||||
function run() external {
|
||||
string memory ticker = vm.envString("LI_TICKER");
|
||||
LiProduct memory p = _product(ticker);
|
||||
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address deployer = vm.addr(pk);
|
||||
address registryAddr = vm.envAddress("RWA_TOKEN_REGISTRY");
|
||||
address factoryAddr = vm.envAddress("RWA_TOKEN_FACTORY");
|
||||
address owner = vm.envOr("OWNER", vm.envOr("OMNL_COMPLIANCE_MULTISIG", deployer));
|
||||
address compliance = vm.envOr("COMPLIANCE_ADMIN", vm.envOr("OMNL_GNOSIS_SAFE_ADMIN", deployer));
|
||||
address publisher = vm.envOr("INDEX_PUBLISHER", deployer);
|
||||
uint256 rebaseValue = vm.envOr("REBASE_INDEX_VALUE", p.defaultIndexValue);
|
||||
bytes32 methodologyHash = vm.parseBytes32(
|
||||
vm.envOr("RWA_METHODOLOGY_HASH", string("0x6b6e599d0ba31d048b49302e263a12f0c59502f67a35100ad5c65b503b1d4b82"))
|
||||
);
|
||||
|
||||
RWATokenRegistry registry = RWATokenRegistry(registryAddr);
|
||||
RWATokenFactory factory = RWATokenFactory(factoryAddr);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
|
||||
if (registry.isRegistered(p.indexTicker)) {
|
||||
registry.deactivateIndex(p.indexTicker);
|
||||
console.log("Deactivated", p.indexTicker, "in registry");
|
||||
}
|
||||
|
||||
address token = factory.deployRWAIndex(
|
||||
IRWATokenFactory.RWAProductConfig({
|
||||
indexTicker: p.indexTicker,
|
||||
name: p.name,
|
||||
symbol: p.symbol,
|
||||
decimals: 6,
|
||||
assetClass: "Commodities",
|
||||
assetGroup: p.assetGroup,
|
||||
instrumentType: p.instrumentType,
|
||||
underlyingAsset: p.underlyingAsset,
|
||||
gruLayer: "M00",
|
||||
jurisdiction: "International",
|
||||
initialOwner: owner,
|
||||
complianceAdmin: compliance,
|
||||
indexPublisher: publisher,
|
||||
initialIndexValue: p.defaultIndexValue,
|
||||
initialSupply: 0,
|
||||
methodologyDocumentHash: methodologyHash,
|
||||
registerInUniversalAssetRegistry: false
|
||||
})
|
||||
);
|
||||
|
||||
if (rebaseValue != p.defaultIndexValue) {
|
||||
RWAToken(token).updateIndexValue(rebaseValue);
|
||||
}
|
||||
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("Li* redeployed", p.indexTicker, token);
|
||||
console.log("indexValue", RWAToken(token).indexValue());
|
||||
console.log("indexPublisher", publisher);
|
||||
}
|
||||
|
||||
function _product(string memory ticker) internal pure returns (LiProduct memory p) {
|
||||
bytes32 h = keccak256(bytes(ticker));
|
||||
if (h == keccak256("LiXAU")) {
|
||||
return LiProduct({
|
||||
indexTicker: "LiXAU",
|
||||
name: "XAU Liquidity Index (M00)",
|
||||
symbol: "LiXAU",
|
||||
assetGroup: "Precious Metals",
|
||||
instrumentType: "Commodity Index",
|
||||
underlyingAsset: "Gold",
|
||||
defaultIndexValue: 1_000_000
|
||||
});
|
||||
}
|
||||
if (h == keccak256("LiPMG")) {
|
||||
return LiProduct({
|
||||
indexTicker: "LiPMG",
|
||||
name: "Precious Metals Group Index (M00)",
|
||||
symbol: "LiPMG",
|
||||
assetGroup: "Precious Metals",
|
||||
instrumentType: "Basket Index",
|
||||
underlyingAsset: "Precious Metals",
|
||||
defaultIndexValue: 1_000_000
|
||||
});
|
||||
}
|
||||
if (h == keccak256("LiBMG1")) {
|
||||
return LiProduct({
|
||||
indexTicker: "LiBMG1",
|
||||
name: "Base Metals Group Index 1 (M00)",
|
||||
symbol: "LiBMG1",
|
||||
assetGroup: "Industrial Metals",
|
||||
instrumentType: "Basket Index",
|
||||
underlyingAsset: "Base Metals",
|
||||
defaultIndexValue: 1_000_000
|
||||
});
|
||||
}
|
||||
if (h == keccak256("LiBMG2")) {
|
||||
return LiProduct({
|
||||
indexTicker: "LiBMG2",
|
||||
name: "Base Metals Group Index 2 (M00)",
|
||||
symbol: "LiBMG2",
|
||||
assetGroup: "Industrial Metals",
|
||||
instrumentType: "Basket Index",
|
||||
underlyingAsset: "Battery Metals",
|
||||
defaultIndexValue: 1_000_000
|
||||
});
|
||||
}
|
||||
if (h == keccak256("LiBMG3")) {
|
||||
return LiProduct({
|
||||
indexTicker: "LiBMG3",
|
||||
name: "Base Metals Group Index 3 (M00)",
|
||||
symbol: "LiBMG3",
|
||||
assetGroup: "Industrial Metals",
|
||||
instrumentType: "Basket Index",
|
||||
underlyingAsset: "Building Metals",
|
||||
defaultIndexValue: 1_000_000
|
||||
});
|
||||
}
|
||||
revert("RedeployLiIndexPublisher138: unsupported LI_TICKER");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
import {RWATokenRegistry} from "../../../contracts/rwa/RWATokenRegistry.sol";
|
||||
import {RWATokenFactory} from "../../../contracts/rwa/RWATokenFactory.sol";
|
||||
import {IRWATokenFactory} from "../../../contracts/rwa/IRWATokenFactory.sol";
|
||||
import {RWAToken} from "../../../contracts/rwa/RWAToken.sol";
|
||||
|
||||
/**
|
||||
* @title RedeployLiXauPublisher138
|
||||
* @notice Operator recovery when Gnosis Safe co-signer keys are unavailable:
|
||||
* deactivate LiXAU in registry, redeploy with deployer as INDEX_PUBLISHER, publish rebase level.
|
||||
*
|
||||
* Env: PRIVATE_KEY, RWA_TOKEN_REGISTRY, RWA_TOKEN_FACTORY, REBASE_INDEX_VALUE (default 1885856)
|
||||
* OWNER (default OMNL multisig), COMPLIANCE_ADMIN (default Gnosis Safe admin)
|
||||
* INDEX_PUBLISHER (default deployer), RWA_METHODOLOGY_HASH
|
||||
*/
|
||||
contract RedeployLiXauPublisher138 is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address deployer = vm.addr(pk);
|
||||
address registryAddr = vm.envAddress("RWA_TOKEN_REGISTRY");
|
||||
address factoryAddr = vm.envAddress("RWA_TOKEN_FACTORY");
|
||||
address owner = vm.envOr("OWNER", vm.envOr("OMNL_COMPLIANCE_MULTISIG", deployer));
|
||||
address compliance = vm.envOr("COMPLIANCE_ADMIN", vm.envOr("OMNL_GNOSIS_SAFE_ADMIN", deployer));
|
||||
address publisher = vm.envOr("INDEX_PUBLISHER", deployer);
|
||||
uint256 rebaseValue = vm.envOr("REBASE_INDEX_VALUE", uint256(1_885_856));
|
||||
bytes32 methodologyHash = vm.parseBytes32(vm.envOr("RWA_METHODOLOGY_HASH", string("0x6b6e599d0ba31d048b49302e263a12f0c59502f67a35100ad5c65b503b1d4b82")));
|
||||
|
||||
RWATokenRegistry registry = RWATokenRegistry(registryAddr);
|
||||
RWATokenFactory factory = RWATokenFactory(factoryAddr);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
|
||||
if (registry.isRegistered("LiXAU")) {
|
||||
registry.deactivateIndex("LiXAU");
|
||||
console.log("Deactivated LiXAU in registry");
|
||||
}
|
||||
|
||||
address token = factory.deployRWAIndex(
|
||||
IRWATokenFactory.RWAProductConfig({
|
||||
indexTicker: "LiXAU",
|
||||
name: "XAU Liquidity Index (M00)",
|
||||
symbol: "LiXAU",
|
||||
decimals: 6,
|
||||
assetClass: "Commodities",
|
||||
assetGroup: "Precious Metals",
|
||||
instrumentType: "Commodity Index",
|
||||
underlyingAsset: "Gold",
|
||||
gruLayer: "M00",
|
||||
jurisdiction: "International",
|
||||
initialOwner: owner,
|
||||
complianceAdmin: compliance,
|
||||
indexPublisher: publisher,
|
||||
initialIndexValue: 1_000_000,
|
||||
initialSupply: 0,
|
||||
methodologyDocumentHash: methodologyHash,
|
||||
registerInUniversalAssetRegistry: false
|
||||
})
|
||||
);
|
||||
|
||||
RWAToken(token).updateIndexValue(rebaseValue);
|
||||
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("LiXAU redeployed", token);
|
||||
console.log("indexValue", RWAToken(token).indexValue());
|
||||
console.log("indexPublisher", publisher);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user