From c5685fe3bb2eb2b926548831a3791b605bc8b341 Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Thu, 22 Aug 2024 15:53:02 +0400 Subject: [PATCH] fix: added addendum vip --- .../proposals/sepolia/vip-052/addendum.ts | 48 ++ .../ethereum/vip-055/abi/PrimeConverter.json | 2 +- .../ethereum/vip-055/abi/erc20.json | 2 +- .../simulations/ethereum/vip-055/index.ts | 8 +- .../sepolia/vip-052/abi/PrimeConverter.json | 587 ++++++++++++++++++ .../simulations/sepolia/vip-052/addendum.ts | 66 ++ 6 files changed, 707 insertions(+), 6 deletions(-) create mode 100644 multisig/proposals/sepolia/vip-052/addendum.ts create mode 100644 multisig/simulations/sepolia/vip-052/abi/PrimeConverter.json create mode 100644 multisig/simulations/sepolia/vip-052/addendum.ts diff --git a/multisig/proposals/sepolia/vip-052/addendum.ts b/multisig/proposals/sepolia/vip-052/addendum.ts new file mode 100644 index 000000000..6042d5f84 --- /dev/null +++ b/multisig/proposals/sepolia/vip-052/addendum.ts @@ -0,0 +1,48 @@ +import { makeProposal } from "src/utils"; + +export const weETHs = "0xE233527306c2fa1E159e251a2E5893334505A5E0"; +export const USDT_PRIME_CONVERTER = "0x3716C24EA86A67cAf890d7C9e4C4505cDDC2F8A2"; +export const USDC_PRIME_CONVERTER = "0x511a559a699cBd665546a1F75908f7E9454Bfc67"; +export const WBTC_PRIME_CONVERTER = "0x8a3937F27921e859db3FDA05729CbCea8cfd82AE"; +export const WETH_PRIME_CONVERTER = "0x274a834eFFA8D5479502dD6e78925Bc04ae82B46"; +export const XVS_VAULT_CONVERTER = "0xc203bfA9dCB0B5fEC510Db644A494Ff7f4968ed2"; +export const BaseAssets = [ + "0x8d412FD0bc5d826615065B931171Eed10F5AF266", // USDT USDTPrimeConverter BaseAsset + "0x772d68929655ce7234C8C94256526ddA66Ef641E", // USDC USDCPrimeConverter BaseAsset + "0x92A2928f5634BEa89A195e7BeCF0f0FEEDAB885b", // WBTC WBTCPrimeConverter BaseAsset + "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", // WETH WETHPrimeConverter BaseAsset + "0x66ebd019E86e0af5f228a0439EBB33f045CBe63E", // XVS XVSPrimeConverter BaseAsset +]; + +export const vip052 = () => { + return makeProposal([ + // Conversion config + { + target: USDT_PRIME_CONVERTER, + signature: "setConversionConfigs(address,address[],(uint256,uint8)[])", + params: [BaseAssets[0], [weETHs], [[0, 1]]], + }, + { + target: USDC_PRIME_CONVERTER, + signature: "setConversionConfigs(address,address[],(uint256,uint8)[])", + params: [BaseAssets[1], [weETHs], [[0, 1]]], + }, + { + target: WBTC_PRIME_CONVERTER, + signature: "setConversionConfigs(address,address[],(uint256,uint8)[])", + params: [BaseAssets[2], [weETHs], [[0, 1]]], + }, + { + target: WETH_PRIME_CONVERTER, + signature: "setConversionConfigs(address,address[],(uint256,uint8)[])", + params: [BaseAssets[3], [weETHs], [[0, 1]]], + }, + { + target: XVS_VAULT_CONVERTER, + signature: "setConversionConfigs(address,address[],(uint256,uint8)[])", + params: [BaseAssets[4], [weETHs], [[0, 1]]], + }, + ]); +}; + +export default vip052; diff --git a/multisig/simulations/ethereum/vip-055/abi/PrimeConverter.json b/multisig/simulations/ethereum/vip-055/abi/PrimeConverter.json index cb4a3fc03..8ea10cc8d 100644 --- a/multisig/simulations/ethereum/vip-055/abi/PrimeConverter.json +++ b/multisig/simulations/ethereum/vip-055/abi/PrimeConverter.json @@ -584,4 +584,4 @@ "stateMutability": "nonpayable", "type": "function" } -] \ No newline at end of file +] diff --git a/multisig/simulations/ethereum/vip-055/abi/erc20.json b/multisig/simulations/ethereum/vip-055/abi/erc20.json index 19f45adca..374b04c75 100644 --- a/multisig/simulations/ethereum/vip-055/abi/erc20.json +++ b/multisig/simulations/ethereum/vip-055/abi/erc20.json @@ -292,4 +292,4 @@ "stateMutability": "nonpayable", "type": "function" } -] \ No newline at end of file +] diff --git a/multisig/simulations/ethereum/vip-055/index.ts b/multisig/simulations/ethereum/vip-055/index.ts index 2eafa4317..7fb2315ff 100644 --- a/multisig/simulations/ethereum/vip-055/index.ts +++ b/multisig/simulations/ethereum/vip-055/index.ts @@ -11,21 +11,21 @@ import { forking, pretendExecutingVip } from "src/vip-framework/index"; import { BORROW_CAP, + BaseAssets, LIQUID_STAKED_COMPTROLLER, SUPPLY_CAP, + USDT_PRIME_CONVERTER, VTOKEN_RECEIVER, vip055, vweETHs, weETHs, - BaseAssets, - USDT_PRIME_CONVERTER } from "../../../proposals/ethereum/vip-055"; import POOL_REGISTRY_ABI from "./abi/PoolRegistry.json"; +import PRIME_CONVERTER_ABI from "./abi/PrimeConverter.json"; import RESILIENT_ORACLE_ABI from "./abi/ResilientOracle.json"; import COMPTROLLER_ABI from "./abi/comptroller.json"; -import VTOKEN_ABI from "./abi/vToken.json"; import ERC20_ABI from "./abi/erc20.json"; -import PRIME_CONVERTER_ABI from "./abi/PrimeConverter.json"; +import VTOKEN_ABI from "./abi/vToken.json"; const { ethereum } = NETWORK_ADDRESSES; const PROTOCOL_SHARE_RESERVE = "0x8c8c8530464f7D95552A11eC31Adbd4dC4AC4d3E"; diff --git a/multisig/simulations/sepolia/vip-052/abi/PrimeConverter.json b/multisig/simulations/sepolia/vip-052/abi/PrimeConverter.json new file mode 100644 index 000000000..8ea10cc8d --- /dev/null +++ b/multisig/simulations/sepolia/vip-052/abi/PrimeConverter.json @@ -0,0 +1,587 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMaxMantissa", "type": "uint256" } + ], + "name": "AmountInHigherThanMax", + "type": "error" + }, + { "inputs": [], "name": "AmountInMismatched", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMinMantissa", "type": "uint256" } + ], + "name": "AmountOutLowerThanMinRequired", + "type": "error" + }, + { "inputs": [], "name": "AmountOutMismatched", "type": "error" }, + { "inputs": [], "name": "ConversionConfigNotEnabled", "type": "error" }, + { "inputs": [], "name": "ConversionEnabledOnlyForPrivateConversions", "type": "error" }, + { "inputs": [], "name": "ConversionTokensActive", "type": "error" }, + { "inputs": [], "name": "ConversionTokensPaused", "type": "error" }, + { "inputs": [], "name": "DeflationaryTokenNotSupported", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "incentive", "type": "uint256" }, + { "internalType": "uint256", "name": "maxIncentive", "type": "uint256" } + ], + "name": "IncentiveTooHigh", + "type": "error" + }, + { "inputs": [], "name": "InputLengthMisMatch", "type": "error" }, + { "inputs": [], "name": "InsufficientInputAmount", "type": "error" }, + { "inputs": [], "name": "InsufficientOutputAmount", "type": "error" }, + { "inputs": [], "name": "InsufficientPoolLiquidity", "type": "error" }, + { "inputs": [], "name": "InvalidConverterNetwork", "type": "error" }, + { "inputs": [], "name": "InvalidMinimumAmountToConvert", "type": "error" }, + { "inputs": [], "name": "InvalidToAddress", "type": "error" }, + { "inputs": [], "name": "InvalidTokenConfigAddresses", "type": "error" }, + { "inputs": [], "name": "NonZeroIncentiveForPrivateConversion", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "calledContract", "type": "address" }, + { "internalType": "string", "name": "methodSignature", "type": "string" } + ], + "name": "Unauthorized", + "type": "error" + }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { "inputs": [], "name": "ZeroValueNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "comptroller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "AssetTransferredToDestination", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldBaseAsset", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newBaseAsset", "type": "address" } + ], + "name": "BaseAssetUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "oldIncentive", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newIncentive", "type": "uint256" }, + { + "indexed": false, + "internalType": "enum IAbstractTokenConverter.ConversionAccessibility", + "name": "oldAccess", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum IAbstractTokenConverter.ConversionAccessibility", + "name": "newAccess", + "type": "uint8" + } + ], + "name": "ConversionConfigUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], + "name": "ConversionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], + "name": "ConversionResumed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amountOut", "type": "uint256" } + ], + "name": "ConvertedExactTokens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amountOut", "type": "uint256" } + ], + "name": "ConvertedExactTokensSupportingFeeOnTransferTokens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amountOut", "type": "uint256" } + ], + "name": "ConvertedForExactTokens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amountOut", "type": "uint256" } + ], + "name": "ConvertedForExactTokensSupportingFeeOnTransferTokens", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldConverterNetwork", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "converterNetwork", "type": "address" } + ], + "name": "ConverterNetworkAddressUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldDestinationAddress", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "destinationAddress", "type": "address" } + ], + "name": "DestinationAddressUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "oldMinAmountToConvert", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMinAmountToConvert", "type": "uint256" } + ], + "name": "MinAmountToConvertUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAccessControlManager", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAccessControlManager", "type": "address" } + ], + "name": "NewAccessControlManager", + "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": true, "internalType": "contract ResilientOracle", "name": "oldPriceOracle", "type": "address" }, + { "indexed": true, "internalType": "contract ResilientOracle", "name": "priceOracle", "type": "address" } + ], + "name": "PriceOracleUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "token", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "SweepToken", + "type": "event" + }, + { + "inputs": [], + "name": "MAX_INCENTIVE", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [{ "internalType": "contract IAccessControlManagerV8", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "tokenAddress", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "tokenBalance", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseAsset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "conversionConfigurations", + "outputs": [ + { "internalType": "uint256", "name": "incentive", "type": "uint256" }, + { + "internalType": "enum IAbstractTokenConverter.ConversionAccessibility", + "name": "conversionAccess", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "conversionPaused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMinMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "convertExactTokens", + "outputs": [ + { "internalType": "uint256", "name": "actualAmountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "actualAmountOut", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMinMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "convertExactTokensSupportingFeeOnTransferTokens", + "outputs": [ + { "internalType": "uint256", "name": "actualAmountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "actualAmountOut", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMaxMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "convertForExactTokens", + "outputs": [ + { "internalType": "uint256", "name": "actualAmountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "actualAmountOut", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMaxMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "convertForExactTokensSupportingFeeOnTransferTokens", + "outputs": [ + { "internalType": "uint256", "name": "actualAmountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "actualAmountOut", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "converterNetwork", + "outputs": [{ "internalType": "contract IConverterNetwork", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "destinationAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" } + ], + "name": "getAmountIn", + "outputs": [ + { "internalType": "uint256", "name": "amountConvertedMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" } + ], + "name": "getAmountOut", + "outputs": [ + { "internalType": "uint256", "name": "amountConvertedMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" } + ], + "name": "getUpdatedAmountIn", + "outputs": [ + { "internalType": "uint256", "name": "amountConvertedMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountInMantissa", "type": "uint256" }, + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" } + ], + "name": "getUpdatedAmountOut", + "outputs": [ + { "internalType": "uint256", "name": "amountConvertedMantissa", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMantissa", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "accessControlManager_", "type": "address" }, + { "internalType": "contract ResilientOracle", "name": "priceOracle_", "type": "address" }, + { "internalType": "address", "name": "destinationAddress_", "type": "address" }, + { "internalType": "address", "name": "baseAsset_", "type": "address" }, + { "internalType": "uint256", "name": "minAmountToConvert_", "type": "uint256" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minAmountToConvert", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "pauseConversion", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "priceOracle", + "outputs": [{ "internalType": "contract ResilientOracle", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "resumeConversion", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "baseAsset_", "type": "address" }], + "name": "setBaseAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address", "name": "tokenAddressOut", "type": "address" }, + { + "components": [ + { "internalType": "uint256", "name": "incentive", "type": "uint256" }, + { + "internalType": "enum IAbstractTokenConverter.ConversionAccessibility", + "name": "conversionAccess", + "type": "uint8" + } + ], + "internalType": "struct IAbstractTokenConverter.ConversionConfig", + "name": "conversionConfig", + "type": "tuple" + } + ], + "name": "setConversionConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddressIn", "type": "address" }, + { "internalType": "address[]", "name": "tokenAddressesOut", "type": "address[]" }, + { + "components": [ + { "internalType": "uint256", "name": "incentive", "type": "uint256" }, + { + "internalType": "enum IAbstractTokenConverter.ConversionAccessibility", + "name": "conversionAccess", + "type": "uint8" + } + ], + "internalType": "struct IAbstractTokenConverter.ConversionConfig[]", + "name": "conversionConfigs", + "type": "tuple[]" + } + ], + "name": "setConversionConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract IConverterNetwork", "name": "converterNetwork_", "type": "address" }], + "name": "setConverterNetwork", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "destinationAddress_", "type": "address" }], + "name": "setDestination", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "minAmountToConvert_", "type": "uint256" }], + "name": "setMinAmountToConvert", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract ResilientOracle", "name": "priceOracle_", "type": "address" }], + "name": "setPriceOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "sweepToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "comptroller", "type": "address" }, + { "internalType": "address", "name": "asset", "type": "address" } + ], + "name": "updateAssetsState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/multisig/simulations/sepolia/vip-052/addendum.ts b/multisig/simulations/sepolia/vip-052/addendum.ts new file mode 100644 index 000000000..1933f3e0a --- /dev/null +++ b/multisig/simulations/sepolia/vip-052/addendum.ts @@ -0,0 +1,66 @@ +import { impersonateAccount, setBalance } from "@nomicfoundation/hardhat-network-helpers"; +import { expect } from "chai"; +import { Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { forking, pretendExecutingVip } from "src/vip-framework/index"; + +import { BaseAssets, USDT_PRIME_CONVERTER, vip052, weETHs } from "../../../proposals/sepolia/vip-052/addendum"; +import PRIME_CONVERTER_ABI from "./abi/PrimeConverter.json"; +import ERC20_ABI from "./abi/erc20.json"; + +const { sepolia } = NETWORK_ADDRESSES; +const USDT_USER = "0x02EB950C215D12d723b44a18CfF098C6E166C531"; +const weETHs_USER = "0xB3A201887396F57bad3fF50DFd02022fE1Fd1774"; + +forking(6549281, async () => { + let weETHsContract: Contract; + let usdtPrimeConverter: Contract; + let usdt: Contract; + + before(async () => { + await impersonateAccount(sepolia.NORMAL_TIMELOCK); + await setBalance(sepolia.NORMAL_TIMELOCK, parseUnits("1000", 18)); + + await impersonateAccount(USDT_USER); + await impersonateAccount(weETHs_USER); + await impersonateAccount(sepolia.GUARDIAN); + await impersonateAccount(USDT_PRIME_CONVERTER); + await setBalance(USDT_USER, parseUnits("1000", 18)); + await setBalance(weETHs_USER, parseUnits("1000", 18)); + await setBalance(USDT_PRIME_CONVERTER, parseUnits("1000", 18)); + + weETHsContract = await ethers.getContractAt(ERC20_ABI, weETHs, await ethers.getSigner(sepolia.NORMAL_TIMELOCK)); + usdtPrimeConverter = await ethers.getContractAt(PRIME_CONVERTER_ABI, USDT_PRIME_CONVERTER); + usdt = await ethers.getContractAt(ERC20_ABI, BaseAssets[0], await ethers.provider.getSigner(USDT_USER)); + }); + + describe("Post-VIP behavior", async () => { + before(async () => { + await pretendExecutingVip(await vip052()); + }); + + it("weETHs conversion", async () => { + const usdtAmount = parseUnits("10", 6); + await usdt.connect(await ethers.getSigner(sepolia.GUARDIAN)).faucet(usdtAmount); + await usdt.connect(await ethers.getSigner(sepolia.GUARDIAN)).approve(usdtPrimeConverter.address, usdtAmount); + + const weETHsAmount = parseUnits("0.001", 18); + await weETHsContract.connect(await ethers.getSigner(usdtPrimeConverter.address)).faucet(weETHsAmount); + + const usdtBalanceBefore = await usdt.balanceOf(sepolia.GUARDIAN); + const weETHsBalanceBefore = await weETHsContract.balanceOf(sepolia.GUARDIAN); + + await usdtPrimeConverter + .connect(await ethers.getSigner(sepolia.GUARDIAN)) + .convertForExactTokens(usdtAmount, weETHsAmount, usdt.address, weETHsContract.address, sepolia.GUARDIAN); + + const usdtBalanceAfter = await usdt.balanceOf(sepolia.GUARDIAN); + const weETHsBalanceAfter = await weETHsContract.balanceOf(sepolia.GUARDIAN); + + expect(usdtBalanceBefore.sub(usdtBalanceAfter)).to.be.equal(parseUnits("2.647829", 6)); + expect(weETHsBalanceAfter.sub(weETHsBalanceBefore)).to.be.equal(weETHsAmount); + }); + }); +});