From b853c1d7b1c389657c075e80b8848998273c104e Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Tue, 15 Oct 2024 16:00:44 +0200 Subject: [PATCH 1/7] Artifacts for AcreMultiAssetVault deployed to mainnet --- solidity/.openzeppelin/mainnet.json | 206 ++++++ .../mainnet/AcreMultiAssetVault.json | 607 ++++++++++++++++++ 2 files changed, 813 insertions(+) create mode 100644 solidity/deployments/mainnet/AcreMultiAssetVault.json diff --git a/solidity/.openzeppelin/mainnet.json b/solidity/.openzeppelin/mainnet.json index 22afde212..7960279d2 100644 --- a/solidity/.openzeppelin/mainnet.json +++ b/solidity/.openzeppelin/mainnet.json @@ -20,6 +20,11 @@ "address": "0x7e184B0cC12572D12Db6dA248322A0e3618fc756", "txHash": "0xcb293d8d2fd76e198a0fe23c1bf6ab0618bfbff145d4c90b6b72a3b3b16b35e9", "kind": "transparent" + }, + { + "address": "0xB33D938616C328eda0370CDBdb4b02dD78E2cb19", + "txHash": "0x2ae30e59643e70aa074bdef089b2cd76dc2a4bf5ee5fa671c8fca9d5f37e022f", + "kind": "transparent" } ], "impls": { @@ -1473,6 +1478,207 @@ ] } } + }, + "cb94562b5192a6a2623a8d24d266afc20b387221d2c5b246cb90e369399d219a": { + "address": "0xa0E1f0290c5aB6Aa80E1881431b2fe35d8852Fb7", + "txHash": "0xf5313f8dc59464de8ab341a07893ffeed9bfca2a4456c4bb0f0a35614dc17fe3", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "mezoPortal", + "offset": 0, + "slot": "0", + "type": "t_contract(IMezoPortal)5767", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:20" + }, + { + "label": "depositCount", + "offset": 0, + "slot": "1", + "type": "t_uint256", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:87" + }, + { + "label": "supportedAssets", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_bool)", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:89" + }, + { + "label": "deposits", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_struct(DepositInfo)4475_storage)))", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:95" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)107_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)14_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)56_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(ReentrancyGuardStorage)473_storage": { + "label": "struct ReentrancyGuardUpgradeable.ReentrancyGuardStorage", + "members": [ + { + "label": "_status", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_contract(IMezoPortal)5767": { + "label": "contract IMezoPortal", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_struct(DepositInfo)4475_storage)))": { + "label": "mapping(address => mapping(address => mapping(uint256 => struct AcreMultiAssetVault.DepositInfo)))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(DepositInfo)4475_storage))": { + "label": "mapping(address => mapping(uint256 => struct AcreMultiAssetVault.DepositInfo))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_struct(DepositInfo)4475_storage)": { + "label": "mapping(uint256 => struct AcreMultiAssetVault.DepositInfo)", + "numberOfBytes": "32" + }, + "t_struct(DepositInfo)4475_storage": { + "label": "struct AcreMultiAssetVault.DepositInfo", + "members": [ + { + "label": "balance", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "mezoDepositId", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.ReentrancyGuard": [ + { + "contract": "ReentrancyGuardUpgradeable", + "label": "_status", + "type": "t_uint256", + "src": "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol:40", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } } } } diff --git a/solidity/deployments/mainnet/AcreMultiAssetVault.json b/solidity/deployments/mainnet/AcreMultiAssetVault.json new file mode 100644 index 000000000..3ce3642fe --- /dev/null +++ b/solidity/deployments/mainnet/AcreMultiAssetVault.json @@ -0,0 +1,607 @@ +{ + "address": "0xB33D938616C328eda0370CDBdb4b02dD78E2cb19", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "AssetAlreadySupported", + "type": "error" + }, + { + "inputs": [], + "name": "AssetNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "DepositNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositOwner", + "type": "address" + } + ], + "name": "InvalidDepositOwner", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "InvalidReceiver", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "withdrawnAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositedAmount", + "type": "uint256" + } + ], + "name": "UnexpectedWithdrawnAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "depositOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "depositOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "DepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "SupportedAssetAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "SupportedAssetRemoved", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "addSupportedAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "depositOwner", + "type": "address" + } + ], + "name": "depositFor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mezoDepositId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "getDeposit", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mezoDepositId", + "type": "uint256" + } + ], + "internalType": "struct AcreMultiAssetVault.DepositInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_mezoPortal", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_supportedAssets", + "type": "address[]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "mezoPortal", + "outputs": [ + { + "internalType": "contract IMezoPortal", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "removeSupportedAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supportedAssets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x2ae30e59643e70aa074bdef089b2cd76dc2a4bf5ee5fa671c8fca9d5f37e022f", + "numDeployments": 1, + "implementation": "0xa0E1f0290c5aB6Aa80E1881431b2fe35d8852Fb7", + "devdoc": "Contract deployed as upgradable proxy" +} \ No newline at end of file From a6ab4f67d7cfcceef9ba7baed46490928772ed6c Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Mon, 21 Oct 2024 14:43:59 +0200 Subject: [PATCH 2/7] Set addresses of SolvBTC assets for Sepolia On Sepolia Mezo Portal uses mocked erc20 contracts for SolvBTC and SolvBTC.BBN, as specified in artifacts: https://github.com/thesis/mezo-portal/tree/main/solidity/deployments/sepolia Here we use the same addresses. --- solidity/deploy/41_deploy_multi_asset_vault.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/solidity/deploy/41_deploy_multi_asset_vault.ts b/solidity/deploy/41_deploy_multi_asset_vault.ts index cb099ee5a..30fbe1a3f 100644 --- a/solidity/deploy/41_deploy_multi_asset_vault.ts +++ b/solidity/deploy/41_deploy_multi_asset_vault.ts @@ -10,7 +10,15 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const mezoPortal = await deployments.get("MezoPortal") - const initialSupportedAssets = [ + const initialSupportedAssets = + // On Sepolia we set addresses to mocked ERC20 contracts used by Mezo Portal: + // https://github.com/thesis/mezo-portal/tree/main/solidity/deployments/sepolia + hre.network.name === "sepolia" + ? [ + "0x39AB795D11FCC6CE1c340fbDc308cF1D42ca8f86", // Mocked SolvBTC + "0x64d92C98793C4a55B9a88c2BB9E356650D0d83F5", // Mocked SolvBTC.BBN + ] + : [ "0x7A56E1C57C7475CCf742a1832B028F0456652F97", // SolvBTC "0xd9D920AA40f578ab794426F5C90F6C731D159DEf", // SolvBTC.BBN ] From 40b112610539a47d4056a706f2275950a7934548 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Mon, 21 Oct 2024 14:49:02 +0200 Subject: [PATCH 3/7] Sepolia artifacts of AcreMultiAssetVault deployment --- solidity/.openzeppelin/sepolia.json | 206 ++++++ .../sepolia/AcreMultiAssetVault.json | 607 ++++++++++++++++++ 2 files changed, 813 insertions(+) create mode 100644 solidity/deployments/sepolia/AcreMultiAssetVault.json diff --git a/solidity/.openzeppelin/sepolia.json b/solidity/.openzeppelin/sepolia.json index c952ee25f..33bb8822d 100644 --- a/solidity/.openzeppelin/sepolia.json +++ b/solidity/.openzeppelin/sepolia.json @@ -65,6 +65,11 @@ "address": "0xF4011FD0C77Bd4d909Ae05c7390b88455294dAeA", "txHash": "0x81f450c76b0d124122e82e915a16e5ac4479299e224f74884481c1387643fb6a", "kind": "transparent" + }, + { + "address": "0xfC05e41AEB975148e2fD551aA06A46D37B012D4E", + "txHash": "0x6c6ddacdc78c18bca03e31ad185fd04a5beb802b519ffd725be19aecfcd8dbfd", + "kind": "transparent" } ], "impls": { @@ -2914,6 +2919,207 @@ ] } } + }, + "cb94562b5192a6a2623a8d24d266afc20b387221d2c5b246cb90e369399d219a": { + "address": "0x0E3898286380557235419644f88CaB828d88F495", + "txHash": "0x7fef34e65e71cc3bf041be5bb1277b34ad95cd959d76888b67265386f6d7e1c5", + "layout": { + "solcVersion": "0.8.24", + "storage": [ + { + "label": "mezoPortal", + "offset": 0, + "slot": "0", + "type": "t_contract(IMezoPortal)5767", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:20" + }, + { + "label": "depositCount", + "offset": 0, + "slot": "1", + "type": "t_uint256", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:87" + }, + { + "label": "supportedAssets", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_bool)", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:89" + }, + { + "label": "deposits", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_struct(DepositInfo)4475_storage)))", + "contract": "AcreMultiAssetVault", + "src": "contracts/AcreMultiAssetVault.sol:95" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_struct(InitializableStorage)107_storage": { + "label": "struct Initializable.InitializableStorage", + "members": [ + { + "label": "_initialized", + "type": "t_uint64", + "offset": 0, + "slot": "0" + }, + { + "label": "_initializing", + "type": "t_bool", + "offset": 8, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Ownable2StepStorage)14_storage": { + "label": "struct Ownable2StepUpgradeable.Ownable2StepStorage", + "members": [ + { + "label": "_pendingOwner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(OwnableStorage)56_storage": { + "label": "struct OwnableUpgradeable.OwnableStorage", + "members": [ + { + "label": "_owner", + "type": "t_address", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_struct(ReentrancyGuardStorage)473_storage": { + "label": "struct ReentrancyGuardUpgradeable.ReentrancyGuardStorage", + "members": [ + { + "label": "_status", + "type": "t_uint256", + "offset": 0, + "slot": "0" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint64": { + "label": "uint64", + "numberOfBytes": "8" + }, + "t_contract(IMezoPortal)5767": { + "label": "contract IMezoPortal", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_mapping(t_uint256,t_struct(DepositInfo)4475_storage)))": { + "label": "mapping(address => mapping(address => mapping(uint256 => struct AcreMultiAssetVault.DepositInfo)))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_struct(DepositInfo)4475_storage))": { + "label": "mapping(address => mapping(uint256 => struct AcreMultiAssetVault.DepositInfo))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_struct(DepositInfo)4475_storage)": { + "label": "mapping(uint256 => struct AcreMultiAssetVault.DepositInfo)", + "numberOfBytes": "32" + }, + "t_struct(DepositInfo)4475_storage": { + "label": "struct AcreMultiAssetVault.DepositInfo", + "members": [ + { + "label": "balance", + "type": "t_uint256", + "offset": 0, + "slot": "0" + }, + { + "label": "mezoDepositId", + "type": "t_uint256", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + } + }, + "namespaces": { + "erc7201:openzeppelin.storage.ReentrancyGuard": [ + { + "contract": "ReentrancyGuardUpgradeable", + "label": "_status", + "type": "t_uint256", + "src": "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol:40", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable2Step": [ + { + "contract": "Ownable2StepUpgradeable", + "label": "_pendingOwner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:23", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Ownable": [ + { + "contract": "OwnableUpgradeable", + "label": "_owner", + "type": "t_address", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", + "offset": 0, + "slot": "0" + } + ], + "erc7201:openzeppelin.storage.Initializable": [ + { + "contract": "Initializable", + "label": "_initialized", + "type": "t_uint64", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", + "offset": 0, + "slot": "0" + }, + { + "contract": "Initializable", + "label": "_initializing", + "type": "t_bool", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", + "offset": 8, + "slot": "0" + } + ] + } + } } } } diff --git a/solidity/deployments/sepolia/AcreMultiAssetVault.json b/solidity/deployments/sepolia/AcreMultiAssetVault.json new file mode 100644 index 000000000..b76ae4a16 --- /dev/null +++ b/solidity/deployments/sepolia/AcreMultiAssetVault.json @@ -0,0 +1,607 @@ +{ + "address": "0xfC05e41AEB975148e2fD551aA06A46D37B012D4E", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "AssetAlreadySupported", + "type": "error" + }, + { + "inputs": [], + "name": "AssetNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "DepositNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositOwner", + "type": "address" + } + ], + "name": "InvalidDepositOwner", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "InvalidReceiver", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "withdrawnAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "depositedAmount", + "type": "uint256" + } + ], + "name": "UnexpectedWithdrawnAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "depositOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "depositOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "DepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "SupportedAssetAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "SupportedAssetRemoved", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "addSupportedAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "depositOwner", + "type": "address" + } + ], + "name": "depositFor", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mezoDepositId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + } + ], + "name": "getDeposit", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mezoDepositId", + "type": "uint256" + } + ], + "internalType": "struct AcreMultiAssetVault.DepositInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_mezoPortal", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_supportedAssets", + "type": "address[]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "mezoPortal", + "outputs": [ + { + "internalType": "contract IMezoPortal", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "removeSupportedAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supportedAssets", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "depositId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x6c6ddacdc78c18bca03e31ad185fd04a5beb802b519ffd725be19aecfcd8dbfd", + "numDeployments": 1, + "implementation": "0x0E3898286380557235419644f88CaB828d88F495", + "devdoc": "Contract deployed as upgradable proxy" +} \ No newline at end of file From b435b3894686bc6a7e3a0709226ee3dd3eadc890 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Mon, 21 Oct 2024 14:53:43 +0200 Subject: [PATCH 4/7] Fix code formatting --- solidity/deploy/41_deploy_multi_asset_vault.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solidity/deploy/41_deploy_multi_asset_vault.ts b/solidity/deploy/41_deploy_multi_asset_vault.ts index 30fbe1a3f..b75784ace 100644 --- a/solidity/deploy/41_deploy_multi_asset_vault.ts +++ b/solidity/deploy/41_deploy_multi_asset_vault.ts @@ -19,9 +19,9 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { "0x64d92C98793C4a55B9a88c2BB9E356650D0d83F5", // Mocked SolvBTC.BBN ] : [ - "0x7A56E1C57C7475CCf742a1832B028F0456652F97", // SolvBTC - "0xd9D920AA40f578ab794426F5C90F6C731D159DEf", // SolvBTC.BBN - ] + "0x7A56E1C57C7475CCf742a1832B028F0456652F97", // SolvBTC + "0xd9D920AA40f578ab794426F5C90F6C731D159DEf", // SolvBTC.BBN + ] let deployment = await deployments.getOrNull("AcreMultiAssetVault") if (deployment && helpers.address.isValid(deployment.address)) { From 73419fa62e2e16e0ad5a13e7d1ac8c3fce55fe9e Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Mon, 21 Oct 2024 14:54:00 +0200 Subject: [PATCH 5/7] Update integration tests for AcreMultiAssetVault --- solidity/hardhat.config.ts | 8 +++--- solidity/test/integration/Deployment.test.ts | 30 ++++++++++++++++++++ solidity/test/integration/helpers.ts | 9 +++++- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/solidity/hardhat.config.ts b/solidity/hardhat.config.ts index 17d2ab7bb..f1ce95242 100644 --- a/solidity/hardhat.config.ts +++ b/solidity/hardhat.config.ts @@ -59,10 +59,10 @@ const config: HardhatUserConfig = { url: MAINNET_RPC_URL, // Points to the mainnet block that has a state important for the // integration tests: - // 20941745 - the block where BitcoinRedeemer's ProxyAdmin ownership - // has been transferred to the governance account in transaction: - // https://etherscan.io/address/0x989cE5eD1ab7d0cb85450599D165E17bD86D93CA - blockNumber: 20941745, + // 20971177 - the block where AcreMultiAssetVault was deployed in + // transaction: + // https://etherscan.io/tx/0x2ae30e59643e70aa074bdef089b2cd76dc2a4bf5ee5fa671c8fca9d5f37e022f + blockNumber: 20971177, } : undefined, }, diff --git a/solidity/test/integration/Deployment.test.ts b/solidity/test/integration/Deployment.test.ts index 9939182ac..352dfd64e 100644 --- a/solidity/test/integration/Deployment.test.ts +++ b/solidity/test/integration/Deployment.test.ts @@ -90,6 +90,12 @@ describe("Deployment", () => { describe("stBTC", () => { testUpgradeableInitialization("stBTC", ZeroAddress, ZeroAddress) + it("should get contract deployed at address", async () => { + expect(await stbtc.getAddress()).to.be.equal( + expectedMainnetAddresses.stbtc, + ) + }) + describe("initializer", () => { it("should set asset", async () => { expect(await stbtc.asset()).to.be.equal(expectedMainnetAddresses.tbtc) @@ -156,6 +162,12 @@ describe("Deployment", () => { ZeroAddress, ) + it("should get contract deployed at address", async () => { + expect(await mezoAllocator.getAddress()).to.be.equal( + expectedMainnetAddresses.mezoAllocator, + ) + }) + it("should set mezoPortal", async () => { expect(await mezoAllocator.mezoPortal()).to.be.equal( expectedMainnetAddresses.mezoPortal, @@ -194,6 +206,12 @@ describe("Deployment", () => { ZeroAddress, ) + it("should get contract deployed at address", async () => { + expect(await bitcoinDepositor.getAddress()).to.be.equal( + expectedMainnetAddresses.bitcoinDepositor, + ) + }) + it("should set bridge", async () => { expect(await bitcoinDepositor.bridge()).to.be.equal( expectedMainnetAddresses.bridge, @@ -233,6 +251,12 @@ describe("Deployment", () => { ZeroAddress, ) + it("should get contract deployed at address", async () => { + expect(await bitcoinRedeemer.getAddress()).to.be.equal( + expectedMainnetAddresses.bitcoinRedeemer, + ) + }) + it("should set tbtcVault", async () => { expect(await bitcoinRedeemer.tbtcVault()).to.be.equal( expectedMainnetAddresses.tbtcVault, @@ -266,6 +290,12 @@ describe("Deployment", () => { [ZeroAddress], ) + it("should get contract deployed at address", async () => { + expect(await multiAssetVault.getAddress()).to.be.equal( + expectedMainnetAddresses.multiAssetVault, + ) + }) + it("should set mezoPortal", async () => { expect(await multiAssetVault.mezoPortal()).to.be.equal( expectedMainnetAddresses.mezoPortal, diff --git a/solidity/test/integration/helpers.ts b/solidity/test/integration/helpers.ts index ba2cf0d3d..5a773badc 100644 --- a/solidity/test/integration/helpers.ts +++ b/solidity/test/integration/helpers.ts @@ -50,7 +50,14 @@ export const expectedMainnetAddresses = { pauseAdmin: "0x1299C7432034d1B85e148a2033d571a9B578292B", maintainer: "0x373C177845cEfaB4Ed85666b99c9fDB40ae7Cd19", - // Contracts + // Acre Contracts + stbtc: "0xdF217EFD8f3ecb5E837aedF203C28c1f06854017", + mezoAllocator: "0xb90fdAd3DFD180458D62Cc6acedc983D78E20122", + bitcoinDepositor: "0x2Ba614a598Cffa5a19d683cDCA97bac3a49313d1", + bitcoinRedeemer: "0x7e184B0cC12572D12Db6dA248322A0e3618fc756", + multiAssetVault: "0xB33D938616C328eda0370CDBdb4b02dD78E2cb19", + + // External Contracts mezoPortal: "0xAB13B8eecf5AA2460841d75da5d5D861fD5B8A39", tbtc: "0x18084fbA666a33d37592fA2633fD49a74DD93a88", bridge: "0x5e4861a80B55f035D899f66772117F00FA0E8e7B", From 0f33f92adc1ac61f72e8843b17977007b1026af5 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Mon, 21 Oct 2024 14:54:34 +0200 Subject: [PATCH 6/7] Release Solidity contracts v1.2.0 This release contains artifacts for the AcreMultiAssetVault contract deployed on Mainnet and Sepolia. The contract was initialized to accept the following tokens: - SolvBTC - SolvBTC.BBN The deposits are routed to the Mezo Portal. The contract was deployed under the following addresses: - Mainnet: 0xB33D938616C328eda0370CDBdb4b02dD78E2cb19 - Sepolia: 0xfC05e41AEB975148e2fD551aA06A46D37B012D4E --- solidity/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solidity/package.json b/solidity/package.json index 3874ffcee..6a8140c73 100644 --- a/solidity/package.json +++ b/solidity/package.json @@ -1,6 +1,6 @@ { "name": "@acre-btc/contracts", - "version": "1.1.0", + "version": "1.2.0", "description": "Bitcoin Liquid Staking", "license": "GPL-3.0-only", "files": [ From f7ab2f78578ae666e77d34df7374afcff062ae7f Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Mon, 21 Oct 2024 14:55:02 +0200 Subject: [PATCH 7/7] Start Solidity contracts v1.3.0-dev --- solidity/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solidity/package.json b/solidity/package.json index 6a8140c73..b51e61c2d 100644 --- a/solidity/package.json +++ b/solidity/package.json @@ -1,6 +1,6 @@ { "name": "@acre-btc/contracts", - "version": "1.2.0", + "version": "1.3.0-dev", "description": "Bitcoin Liquid Staking", "license": "GPL-3.0-only", "files": [