From 434cb91cbdd17e0e58265d1687286c3a0ea35886 Mon Sep 17 00:00:00 2001 From: GitGuru7 Date: Tue, 17 Feb 2026 17:24:59 +0530 Subject: [PATCH 1/3] feat: add vip to configure relative-position-manager on testnet --- .../vip-610/abi/AccessControlManager.json | 157 ++ simulations/vip-610/abi/FlashLoanFacet.json | 1218 ++++++++++++ .../abi/LeverageStrategiesManager.json | 722 +++++++ .../vip-610/abi/RelativePositionManager.json | 1692 +++++++++++++++++ simulations/vip-610/abi/Swaphelper.json | 444 +++++ simulations/vip-610/bsctestnet.ts | 111 ++ vips/vip-610/bsctestnet.ts | 74 + 7 files changed, 4418 insertions(+) create mode 100644 simulations/vip-610/abi/AccessControlManager.json create mode 100644 simulations/vip-610/abi/FlashLoanFacet.json create mode 100644 simulations/vip-610/abi/LeverageStrategiesManager.json create mode 100644 simulations/vip-610/abi/RelativePositionManager.json create mode 100644 simulations/vip-610/abi/Swaphelper.json create mode 100644 simulations/vip-610/bsctestnet.ts create mode 100644 vips/vip-610/bsctestnet.ts diff --git a/simulations/vip-610/abi/AccessControlManager.json b/simulations/vip-610/abi/AccessControlManager.json new file mode 100644 index 000000000..2ef119947 --- /dev/null +++ b/simulations/vip-610/abi/AccessControlManager.json @@ -0,0 +1,157 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "contractAddress", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "functionSig", "type": "string" } + ], + "name": "PermissionGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "contractAddress", "type": "address" }, + { "indexed": false, "internalType": "string", "name": "functionSig", "type": "string" } + ], + "name": "PermissionRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "contractAddress", "type": "address" }, + { "internalType": "string", "name": "functionSig", "type": "string" }, + { "internalType": "address", "name": "accountToPermit", "type": "address" } + ], + "name": "giveCallPermission", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "contractAddress", "type": "address" }, + { "internalType": "string", "name": "functionSig", "type": "string" } + ], + "name": "hasPermission", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "string", "name": "functionSig", "type": "string" } + ], + "name": "isAllowedToCall", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "contractAddress", "type": "address" }, + { "internalType": "string", "name": "functionSig", "type": "string" }, + { "internalType": "address", "name": "accountToRevoke", "type": "address" } + ], + "name": "revokeCallPermission", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-610/abi/FlashLoanFacet.json b/simulations/vip-610/abi/FlashLoanFacet.json new file mode 100644 index 000000000..2adc7e8fa --- /dev/null +++ b/simulations/vip-610/abi/FlashLoanFacet.json @@ -0,0 +1,1218 @@ +[ + { + "inputs": [], + "name": "AlreadyInSelectedPool", + "type": "error" + }, + { + "inputs": [], + "name": "ArrayLengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowNotAllowedInPool", + "type": "error" + }, + { + "inputs": [], + "name": "EmptyPoolLabel", + "type": "error" + }, + { + "inputs": [], + "name": "ExecuteFlashLoanFailed", + "type": "error" + }, + { + "inputs": [], + "name": "FailedToCreateDebtPosition", + "type": "error" + }, + { + "inputs": [], + "name": "FlashLoanNotEnabled", + "type": "error" + }, + { + "inputs": [], + "name": "FlashLoanPausedSystemWide", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "poolId", + "type": "uint96" + } + ], + "name": "InactivePool", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleBorrowedAssets", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidFlashLoanParams", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOperationForCorePool", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum WeightFunction", + "name": "strategy", + "type": "uint8" + } + ], + "name": "InvalidWeightingStrategy", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortfall", + "type": "uint256" + } + ], + "name": "LiquidityCheckFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "poolId", + "type": "uint96" + }, + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketAlreadyListed", + "type": "error" + }, + { + "inputs": [], + "name": "MarketConfigNotFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [], + "name": "MarketNotListedInCorePool", + "type": "error" + }, + { + "inputs": [], + "name": "NoAssetsRequested", + "type": "error" + }, + { + "inputs": [], + "name": "NotAnApprovedDelegate", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "repaid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "required", + "type": "uint256" + } + ], + "name": "NotEnoughRepayment", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "poolId", + "type": "uint96" + } + ], + "name": "PoolDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "poolId", + "type": "uint96" + }, + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "PoolMarketNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "SenderNotAuthorizedForFlashLoan", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requested", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximum", + "type": "uint256" + } + ], + "name": "TooManyAssetsRequested", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DistributedVAIVaultVenus", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract VToken[]", + "name": "assets", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "FlashLoanExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "onBehalf", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "repaidAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "remainingDebt", + "type": "uint256" + } + ], + "name": "FlashLoanRepaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract VToken", + "name": "vToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + } + ], + "name": "IsAccountFlashLoanWhitelisted", + "type": "event" + }, + { + "inputs": [], + "name": "MAX_FLASHLOAN_ASSETS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "internalType": "enum Action", + "name": "action", + "type": "uint8" + } + ], + "name": "actionPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "internalType": "contract VToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedDelegates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "authorizedFlashLoan", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowCapGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "comptrollerLens", + "outputs": [ + { + "internalType": "contract ComptrollerLensInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "corePoolId", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "onBehalf", + "type": "address" + }, + { + "internalType": "address payable", + "name": "receiver", + "type": "address" + }, + { + "internalType": "contract VToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "underlyingAmounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "param", + "type": "bytes" + } + ], + "name": "executeFlashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "flashLoanPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "poolId", + "type": "uint96" + }, + { + "internalType": "address", + "name": "vToken", + "type": "address" + } + ], + "name": "getPoolMarketIndex", + "outputs": [ + { + "internalType": "PoolMarketId", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getXVSAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "isForcedLiquidationEnabledForUser", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastPoolId", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidatorContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minReleaseAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "mintedVAIs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract ResilientOracleInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pauseGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingComptrollerImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "name": "pools", + "outputs": [ + { + "internalType": "string", + "name": "label", + "type": "string" + }, + { + "internalType": "bool", + "name": "isActive", + "type": "bool" + }, + { + "internalType": "bool", + "name": "allowCorePoolFallback", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "prime", + "outputs": [ + { + "internalType": "contract IPrime", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "releaseStartBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "repayVAIGuardianPaused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "supplyCaps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "treasuryPercent", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userPoolId", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaiController", + "outputs": [ + { + "internalType": "contract VAIControllerInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaiMintRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaiVaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowSpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusBorrowerIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "venusInitialIndex", + "outputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplierIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplySpeeds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "venusSupplyState", + "outputs": [ + { + "internalType": "uint224", + "name": "index", + "type": "uint224" + }, + { + "internalType": "uint32", + "name": "block", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "venusVAIVaultRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-610/abi/LeverageStrategiesManager.json b/simulations/vip-610/abi/LeverageStrategiesManager.json new file mode 100644 index 000000000..cb36e91f7 --- /dev/null +++ b/simulations/vip-610/abi/LeverageStrategiesManager.json @@ -0,0 +1,722 @@ +[ + { + "inputs": [ + { + "internalType": "contract IComptroller", + "name": "_comptroller", + "type": "address" + }, + { + "internalType": "contract SwapHelper", + "name": "_swapHelper", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "_vBNB", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "AccrueInterestFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "BorrowBehalfFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "err", + "type": "uint256" + } + ], + "name": "EnterMarketFailed", + "type": "error" + }, + { + "inputs": [], + "name": "FlashLoanAssetOrAmountMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "IdenticalMarkets", + "type": "error" + }, + { + "inputs": [], + "name": "InitiatorMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientFundsToRepayFlashloan", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidExecuteOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "MintBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "NotAnApprovedDelegate", + "type": "error" + }, + { + "inputs": [], + "name": "OnBehalfMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "OperationCausesLiquidation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "RedeemBehalfFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "RepayBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SlippageExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "TokenSwapCallFailed", + "type": "error" + }, + { + "inputs": [], + "name": "UnauthorizedExecutor", + "type": "error" + }, + { + "inputs": [], + "name": "VBNBNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroFlashLoanAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DustTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountSeed", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "borrowedMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "LeverageEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "borrowedMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountSeed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "LeverageEnteredFromBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountToRedeemForSwap", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "borrowedMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "LeverageExited", + "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": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountSeed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "SingleAssetLeverageEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "SingleAssetLeverageExited", + "type": "event" + }, + { + "inputs": [], + "name": "COMPTROLLER", + "outputs": [ + { + "internalType": "contract IComptroller", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountSeed", + "type": "uint256" + }, + { + "internalType": "contract IVToken", + "name": "_borrowedMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountToFlashLoan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOutAfterSwap", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_swapData", + "type": "bytes" + } + ], + "name": "enterLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "_borrowedMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountSeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountToFlashLoan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOutAfterSwap", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_swapData", + "type": "bytes" + } + ], + "name": "enterLeverageFromBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountSeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "enterSingleAssetLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "premiums", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "internalType": "address", + "name": "onBehalf", + "type": "address" + }, + { + "internalType": "bytes", + "name": "param", + "type": "bytes" + } + ], + "name": "executeOperation", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "uint256[]", + "name": "repayAmounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountToRedeemForSwap", + "type": "uint256" + }, + { + "internalType": "contract IVToken", + "name": "_borrowedMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountToFlashLoan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOutAfterSwap", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_swapData", + "type": "bytes" + } + ], + "name": "exitLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "exitSingleAssetLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "swapHelper", + "outputs": [ + { + "internalType": "contract SwapHelper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "contract IVToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ] \ No newline at end of file diff --git a/simulations/vip-610/abi/RelativePositionManager.json b/simulations/vip-610/abi/RelativePositionManager.json new file mode 100644 index 000000000..192c7a216 --- /dev/null +++ b/simulations/vip-610/abi/RelativePositionManager.json @@ -0,0 +1,1692 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "leverageManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AssetNotListed", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowAmountExceedsMaximum", + "type": "error" + }, + { + "inputs": [], + "name": "DSAInactive", + "type": "error" + }, + { + "inputs": [], + "name": "DSAVTokenAlreadyAdded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "EnterMarketFailed", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientPrincipal", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientWithdrawableAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCloseFractionBps", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCollateralFactor", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDSA", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLeverage", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLongAmountToRedeem", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOraclePrice", + "type": "error" + }, + { + "inputs": [], + "name": "MinAmountOutRepayBelowDebt", + "type": "error" + }, + { + "inputs": [], + "name": "MinAmountOutSecondBelowDebt", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "MintBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "PositionAccountImplementationNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "PositionAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "PositionNotActive", + "type": "error" + }, + { + "inputs": [], + "name": "PositionNotFullyClosed", + "type": "error" + }, + { + "inputs": [], + "name": "ProportionalCloseAmountOutOfTolerance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "RedeemBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SameDSAActiveStatus", + "type": "error" + }, + { + "inputs": [], + "name": "SameMarketNotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "SamePositionAccountImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "SlippageExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "TokenSwapCallFailed", + "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": "VBNBNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroDebt", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroShortAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "index", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "DSAVTokenActiveUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "DSAVTokenAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "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": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "longAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "shortAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "positionAccount", + "type": "address" + } + ], + "name": "PositionAccountDeployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "PositionAccountImplementationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "longAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "shortAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "initialPrincipal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + } + ], + "name": "PositionActivated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "closeFractionBps", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRepaid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRedeemed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRedeemedDsa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "longDustRedeemed", + "type": "uint256" + } + ], + "name": "PositionClosed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountWithdrawn", + "type": "uint256" + } + ], + "name": "PositionDeactivated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "longAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "shortAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shortAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "additionalPrincipal", + "type": "uint256" + } + ], + "name": "PositionOpened", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalPrincipal", + "type": "uint256" + } + ], + "name": "PrincipalSupplied", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "remainingPrincipal", + "type": "uint256" + } + ], + "name": "PrincipalWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountConvertedToProfit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalPrincipal", + "type": "uint256" + } + ], + "name": "ProfitConverted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldSuppliedPrincipal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSuppliedPrincipal", + "type": "uint256" + } + ], + "name": "RefreshedSuppliedPrincipal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "UnderlyingTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "COMPTROLLER", + "outputs": [ + { + "internalType": "contract IComptroller", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LEVERAGE_MANAGER", + "outputs": [ + { + "internalType": "contract LeverageStrategiesManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POSITION_ACCOUNT_IMPLEMENTATION", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "initialPrincipal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minLongAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapData", + "type": "bytes" + } + ], + "name": "activateAndOpenPosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "initialPrincipal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + } + ], + "name": "activatePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dsaVToken", + "type": "address" + } + ], + "name": "addDSAVToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "calculateMaxBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "maxBorrowAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "closeFractionBps", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longAmountToRedeemForFirstSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortAmountToRepayForFirstSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutFirst", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataFirst", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "dsaAmountToRedeemForSecondSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutSecond", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataSecond", + "type": "bytes" + } + ], + "name": "closeWithLoss", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "closeFractionBps", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longAmountToRedeemForRepay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutRepay", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataRepay", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "longAmountToRedeemForProfit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutProfit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataProfit", + "type": "bytes" + } + ], + "name": "closeWithProfit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "deactivatePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "dsaVTokenIndexCounter", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "dsaVTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "executePositionAccountCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDsaVTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "dsaVTokensList", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getLongCollateralBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "longBalance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getPosition", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "internalType": "bool", + "name": "isActive", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "suppliedPrincipalVTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + } + ], + "internalType": "struct IRelativePositionManager.Position", + "name": "position", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getPositionAccountAddress", + "outputs": [ + { + "internalType": "address", + "name": "predicted", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getSuppliedPrincipalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getUtilizationInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "actualCapitalUtilized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nominalCapitalUtilized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "finalCapitalUtilized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "availableCapitalUSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableAmount", + "type": "uint256" + } + ], + "internalType": "struct IRelativePositionManager.UtilizationInfo", + "name": "utilization", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isDsaVTokenActive", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "additionalPrincipal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minLongAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapData", + "type": "bytes" + } + ], + "name": "openPosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "internalType": "bool", + "name": "isActive", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "suppliedPrincipalVTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setDSAVTokenActive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "positionAccountImpl", + "type": "address" + } + ], + "name": "setPositionAccountImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "supplyPrincipal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawPrincipal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] \ No newline at end of file diff --git a/simulations/vip-610/abi/Swaphelper.json b/simulations/vip-610/abi/Swaphelper.json new file mode 100644 index 000000000..fb92e0573 --- /dev/null +++ b/simulations/vip-610/abi/Swaphelper.json @@ -0,0 +1,444 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "backendSigner_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "CallerNotAuthorized", + "type": "error" + }, + { + "inputs": [], + "name": "DeadlineReached", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [], + "name": "MissingSignature", + "type": "error" + }, + { + "inputs": [], + "name": "NoCallsProvided", + "type": "error" + }, + { + "inputs": [], + "name": "SaltAlreadyUsed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "inputs": [], + "name": "Unauthorized", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "ApprovedMax", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldSigner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newSigner", + "type": "address" + } + ], + "name": "BackendSignerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "GenericCallExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "callsCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "MulticallExecuted", + "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": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Swept", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "approveMax", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "backendSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "genericCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "calls", + "type": "bytes[]" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "multicall", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newSigner", + "type": "address" + } + ], + "name": "setBackendSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "sweep", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "usedSalts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-610/bsctestnet.ts b/simulations/vip-610/bsctestnet.ts new file mode 100644 index 000000000..51b14d84d --- /dev/null +++ b/simulations/vip-610/bsctestnet.ts @@ -0,0 +1,111 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { forking, testVip } from "src/vip-framework"; + +import { + LEVERAGE_STRATEGIES_MANAGER, + POSITION_ACCOUNT, + RELATIVE_POSITION_MANAGER, + SWAP_HELPER, + TIMELOCKS_AND_GURDIAN, + vip589 as vip610Testnet, +} from "../../vips/vip-610/bsctestnet"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; +import FLASHLOAN_FACET_ABI from "./abi/FlashLoanFacet.json"; +import LEVERAGE_MANAGER_ABI from "./abi/LeverageStrategiesManager.json"; +import RELATIVE_POSITION_MANAGER_ABI from "./abi/RelativePositionManager.json"; +import SWAP_HELPER_ABI from "./abi/SwapHelper.json"; + +const { bsctestnet } = NETWORK_ADDRESSES; + +const ACM_FUNCTION_SIGNATURES = [ + "pause()", + "unpause()", + "setPositionAccountImplementation(address)", + "addDSAVToken(address)", + "setDSAVTokenActive(uint8,bool)", + "executePositionAccountCall(address,address[],bytes[])", +] as const; + +forking(90876709, async () => { + let comptroller: Contract; + let accessControlManager: Contract; + let leverageStrategiesManager: Contract; + let swapHelper: Contract; + let relativePositionManager: Contract; + + before(async () => { + comptroller = await ethers.getContractAt(FLASHLOAN_FACET_ABI, bsctestnet.UNITROLLER); + accessControlManager = await ethers.getContractAt(ACCESS_CONTROL_MANAGER_ABI, bsctestnet.ACCESS_CONTROL_MANAGER); + leverageStrategiesManager = await ethers.getContractAt(LEVERAGE_MANAGER_ABI, LEVERAGE_STRATEGIES_MANAGER); + swapHelper = await ethers.getContractAt(SWAP_HELPER_ABI, SWAP_HELPER); + relativePositionManager = await ethers.getContractAt(RELATIVE_POSITION_MANAGER_ABI, RELATIVE_POSITION_MANAGER); + }); + + describe("Pre-VIP behavior", () => { + it("LeverageStrategiesManager should not be whitelisted for flash loans", async () => { + expect(await comptroller.authorizedFlashLoan(LEVERAGE_STRATEGIES_MANAGER)).to.equal(false); + }); + + it("SwapHelper should have NORMAL_TIMELOCK as owner", async () => { + expect(await swapHelper.owner()).not.equal(bsctestnet.NORMAL_TIMELOCK); + }); + + it("LeverageStrategiesManager should have NORMAL_TIMELOCK as pending owner", async () => { + expect(await leverageStrategiesManager.owner()).not.equal(bsctestnet.NORMAL_TIMELOCK); + }); + + it("RelativePositionManager should have NORMAL_TIMELOCK as pending owner", async () => { + expect(await relativePositionManager.owner()).not.equal(bsctestnet.NORMAL_TIMELOCK); + }); + + it("Timelocks/Guardian should not have ACM permissions on RelativePositionManager", async () => { + for (const timelockOrGuardian of TIMELOCKS_AND_GURDIAN) { + for (const fnSignature of ACM_FUNCTION_SIGNATURES) { + expect( + await accessControlManager.hasPermission(timelockOrGuardian, RELATIVE_POSITION_MANAGER, fnSignature), + ).to.equal(false); + } + } + }); + }); + + testVip("VIP-610 [BNB Chain] Testnet", await vip610Testnet()); + + describe("Post-VIP behavior", () => { + it("LeverageStrategiesManager should be whitelisted for flash loans", async () => { + expect(await comptroller.authorizedFlashLoan(LEVERAGE_STRATEGIES_MANAGER)).to.equal(true); + }); + + it("SwapHelper should have NORMAL_TIMELOCK as owner and no pending owner", async () => { + expect(await swapHelper.owner()).to.equal(bsctestnet.NORMAL_TIMELOCK); + expect(await swapHelper.pendingOwner()).to.equal(ethers.constants.AddressZero); + }); + + it("LeverageStrategiesManager should have NORMAL_TIMELOCK as owner and no pending owner", async () => { + expect(await leverageStrategiesManager.owner()).to.equal(bsctestnet.NORMAL_TIMELOCK); + expect(await leverageStrategiesManager.pendingOwner()).to.equal(ethers.constants.AddressZero); + }); + + it("RelativePositionManager should have NORMAL_TIMELOCK as owner and no pending owner", async () => { + expect(await relativePositionManager.owner()).to.equal(bsctestnet.NORMAL_TIMELOCK); + expect(await relativePositionManager.pendingOwner()).to.equal(ethers.constants.AddressZero); + }); + + it("Timelocks/Guardian should have ACM permissions on RelativePositionManager", async () => { + for (const timelockOrGuardian of TIMELOCKS_AND_GURDIAN) { + for (const fnSignature of ACM_FUNCTION_SIGNATURES) { + expect( + await accessControlManager.hasPermission(timelockOrGuardian, RELATIVE_POSITION_MANAGER, fnSignature), + ).to.equal(true); + } + } + }); + + it("RPM should have Position account implementation stored in the state", async () => { + expect(await relativePositionManager.POSITION_ACCOUNT_IMPLEMENTATION()).to.equals(POSITION_ACCOUNT); + }); + }); +}); diff --git a/vips/vip-610/bsctestnet.ts b/vips/vip-610/bsctestnet.ts new file mode 100644 index 000000000..cb6454b7a --- /dev/null +++ b/vips/vip-610/bsctestnet.ts @@ -0,0 +1,74 @@ +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +const { bsctestnet } = NETWORK_ADDRESSES; +export const SWAP_HELPER = "0xf7Cfd0eDfAC7AA473813559b372297332EdEbB8B"; +export const LEVERAGE_STRATEGIES_MANAGER = "0xE852204A757A3Ee9Dfc5d608b7038f962f393706"; +export const RELATIVE_POSITION_MANAGER = "0xcB84425698B9426b5Edd9Ed25eA0116aA0c2Ce7F"; +export const POSITION_ACCOUNT = "0x599B79742AB82700Bc828cc44e0Ae22FBbB88e7c"; + +export const TIMELOCKS_AND_GURDIAN = [ + bsctestnet.NORMAL_TIMELOCK, + bsctestnet.FAST_TRACK_TIMELOCK, + bsctestnet.CRITICAL_TIMELOCK, + bsctestnet.GUARDIAN, +]; + +const giveAcmPermissions = (fnSignature: string, timelocks = TIMELOCKS_AND_GURDIAN) => + timelocks.map(timelock => ({ + target: bsctestnet.ACCESS_CONTROL_MANAGER, + signature: "giveCallPermission(address,string,address)", + params: [RELATIVE_POSITION_MANAGER, fnSignature, timelock], + })); + +export const vip589 = () => { + const meta = { + version: "v2", + title: "VIP-589 [BNB Chain] Add U market to the stablecoin Emode pool", + description: "VIP-589 [BNB Chain] Add U market to the stablecoin Emode pool", + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds or not", + }; + + return makeProposal( + [ + { + target: SWAP_HELPER, + signature: "acceptOwnership()", + params: [], + }, + { + target: LEVERAGE_STRATEGIES_MANAGER, + signature: "acceptOwnership()", + params: [], + }, + { + target: RELATIVE_POSITION_MANAGER, + signature: "acceptOwnership()", + params: [], + }, + { + target: bsctestnet.UNITROLLER, + signature: "setWhiteListFlashLoanAccount(address,bool)", + params: [LEVERAGE_STRATEGIES_MANAGER, true], + }, + // Already set in this contract + // { + // target: RELATIVE_POSITION_MANAGER, + // signature: "setPositionAccountImplementation(address)", + // params: [POSITION_ACCOUNT], + // }, + // ACM permissions + ...giveAcmPermissions("pause()"), + ...giveAcmPermissions("unpause()"), + ...giveAcmPermissions("setPositionAccountImplementation(address)"), + ...giveAcmPermissions("addDSAVToken(address)"), + ...giveAcmPermissions("setDSAVTokenActive(uint8,bool)"), + ...giveAcmPermissions("executePositionAccountCall(address,address[],bytes[])"), + ], + meta, + ProposalType.REGULAR, + ); +}; From 323d3ba015df194d4ce73b4d3e4e62baa7ba3323 Mon Sep 17 00:00:00 2001 From: GitGuru7 Date: Tue, 17 Feb 2026 17:32:19 +0530 Subject: [PATCH 2/3] feat: improve simulation pre checks --- .../abi/LeverageStrategiesManager.json | 1442 +++---- .../vip-610/abi/RelativePositionManager.json | 3382 ++++++++--------- simulations/vip-610/bsctestnet.ts | 9 +- 3 files changed, 2418 insertions(+), 2415 deletions(-) diff --git a/simulations/vip-610/abi/LeverageStrategiesManager.json b/simulations/vip-610/abi/LeverageStrategiesManager.json index cb36e91f7..72ef420b4 100644 --- a/simulations/vip-610/abi/LeverageStrategiesManager.json +++ b/simulations/vip-610/abi/LeverageStrategiesManager.json @@ -1,722 +1,722 @@ [ - { - "inputs": [ - { - "internalType": "contract IComptroller", - "name": "_comptroller", - "type": "address" - }, - { - "internalType": "contract SwapHelper", - "name": "_swapHelper", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "_vBNB", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "AccrueInterestFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "BorrowBehalfFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "err", - "type": "uint256" - } - ], - "name": "EnterMarketFailed", - "type": "error" - }, - { - "inputs": [], - "name": "FlashLoanAssetOrAmountMismatch", - "type": "error" - }, - { - "inputs": [], - "name": "IdenticalMarkets", - "type": "error" - }, - { - "inputs": [], - "name": "InitiatorMismatch", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientFundsToRepayFlashloan", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidExecuteOperation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "market", - "type": "address" - } - ], - "name": "MarketNotListed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "MintBehalfFailed", - "type": "error" - }, - { - "inputs": [], - "name": "NotAnApprovedDelegate", - "type": "error" - }, - { - "inputs": [], - "name": "OnBehalfMismatch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "OperationCausesLiquidation", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "RedeemBehalfFailed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "RepayBehalfFailed", - "type": "error" - }, - { - "inputs": [], - "name": "SlippageExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "TokenSwapCallFailed", - "type": "error" - }, - { - "inputs": [], - "name": "UnauthorizedExecutor", - "type": "error" - }, - { - "inputs": [], - "name": "VBNBNotSupported", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroFlashLoanAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DustTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "collateralMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralAmountSeed", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "borrowedMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "borrowedAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "LeverageEntered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "collateralMarket", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "borrowedMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "borrowedAmountSeed", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "borrowedAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "LeverageEnteredFromBorrow", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "collateralMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralAmountToRedeemForSwap", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "borrowedMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "borrowedAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "LeverageExited", - "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": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "collateralMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralAmountSeed", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "SingleAssetLeverageEntered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "contract IVToken", - "name": "collateralMarket", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "collateralAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "SingleAssetLeverageExited", - "type": "event" - }, - { - "inputs": [], - "name": "COMPTROLLER", - "outputs": [ - { - "internalType": "contract IComptroller", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "_collateralMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralAmountSeed", - "type": "uint256" - }, - { - "internalType": "contract IVToken", - "name": "_borrowedMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_borrowedAmountToFlashLoan", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minAmountOutAfterSwap", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_swapData", - "type": "bytes" - } - ], - "name": "enterLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "_collateralMarket", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "_borrowedMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_borrowedAmountSeed", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_borrowedAmountToFlashLoan", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minAmountOutAfterSwap", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_swapData", - "type": "bytes" - } - ], - "name": "enterLeverageFromBorrow", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "_collateralMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralAmountSeed", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_collateralAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "enterSingleAssetLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken[]", - "name": "vTokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "premiums", - "type": "uint256[]" - }, - { - "internalType": "address", - "name": "initiator", - "type": "address" - }, - { - "internalType": "address", - "name": "onBehalf", - "type": "address" - }, - { - "internalType": "bytes", - "name": "param", - "type": "bytes" - } - ], - "name": "executeOperation", - "outputs": [ - { - "internalType": "bool", - "name": "success", - "type": "bool" - }, - { - "internalType": "uint256[]", - "name": "repayAmounts", - "type": "uint256[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "_collateralMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralAmountToRedeemForSwap", - "type": "uint256" - }, - { - "internalType": "contract IVToken", - "name": "_borrowedMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_borrowedAmountToFlashLoan", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_minAmountOutAfterSwap", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_swapData", - "type": "bytes" - } - ], - "name": "exitLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "_collateralMarket", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_collateralAmountToFlashLoan", - "type": "uint256" - } - ], - "name": "exitSingleAssetLeverage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "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": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapHelper", - "outputs": [ - { - "internalType": "contract SwapHelper", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "vBNB", - "outputs": [ - { - "internalType": "contract IVToken", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ] \ No newline at end of file + { + "inputs": [ + { + "internalType": "contract IComptroller", + "name": "_comptroller", + "type": "address" + }, + { + "internalType": "contract SwapHelper", + "name": "_swapHelper", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "_vBNB", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "AccrueInterestFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "BorrowBehalfFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "err", + "type": "uint256" + } + ], + "name": "EnterMarketFailed", + "type": "error" + }, + { + "inputs": [], + "name": "FlashLoanAssetOrAmountMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "IdenticalMarkets", + "type": "error" + }, + { + "inputs": [], + "name": "InitiatorMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientFundsToRepayFlashloan", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidExecuteOperation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketNotListed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "MintBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "NotAnApprovedDelegate", + "type": "error" + }, + { + "inputs": [], + "name": "OnBehalfMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "OperationCausesLiquidation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "RedeemBehalfFailed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "RepayBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SlippageExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "TokenSwapCallFailed", + "type": "error" + }, + { + "inputs": [], + "name": "UnauthorizedExecutor", + "type": "error" + }, + { + "inputs": [], + "name": "VBNBNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroFlashLoanAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DustTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountSeed", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "borrowedMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "LeverageEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "borrowedMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountSeed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "LeverageEnteredFromBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountToRedeemForSwap", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "borrowedMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "borrowedAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "LeverageExited", + "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": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountSeed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "SingleAssetLeverageEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "contract IVToken", + "name": "collateralMarket", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "SingleAssetLeverageExited", + "type": "event" + }, + { + "inputs": [], + "name": "COMPTROLLER", + "outputs": [ + { + "internalType": "contract IComptroller", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountSeed", + "type": "uint256" + }, + { + "internalType": "contract IVToken", + "name": "_borrowedMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountToFlashLoan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOutAfterSwap", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_swapData", + "type": "bytes" + } + ], + "name": "enterLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "_borrowedMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountSeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountToFlashLoan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOutAfterSwap", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_swapData", + "type": "bytes" + } + ], + "name": "enterLeverageFromBorrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountSeed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "enterSingleAssetLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken[]", + "name": "vTokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "premiums", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "initiator", + "type": "address" + }, + { + "internalType": "address", + "name": "onBehalf", + "type": "address" + }, + { + "internalType": "bytes", + "name": "param", + "type": "bytes" + } + ], + "name": "executeOperation", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "uint256[]", + "name": "repayAmounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountToRedeemForSwap", + "type": "uint256" + }, + { + "internalType": "contract IVToken", + "name": "_borrowedMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_borrowedAmountToFlashLoan", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOutAfterSwap", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_swapData", + "type": "bytes" + } + ], + "name": "exitLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "_collateralMarket", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralAmountToFlashLoan", + "type": "uint256" + } + ], + "name": "exitSingleAssetLeverage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "swapHelper", + "outputs": [ + { + "internalType": "contract SwapHelper", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vBNB", + "outputs": [ + { + "internalType": "contract IVToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-610/abi/RelativePositionManager.json b/simulations/vip-610/abi/RelativePositionManager.json index 192c7a216..ed0ce022f 100644 --- a/simulations/vip-610/abi/RelativePositionManager.json +++ b/simulations/vip-610/abi/RelativePositionManager.json @@ -1,1692 +1,1692 @@ [ - { - "inputs": [ - { - "internalType": "address", - "name": "comptroller", - "type": "address" - }, - { - "internalType": "address", - "name": "leverageManager", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AssetNotListed", - "type": "error" - }, - { - "inputs": [], - "name": "BorrowAmountExceedsMaximum", - "type": "error" - }, - { - "inputs": [], - "name": "DSAInactive", - "type": "error" - }, - { - "inputs": [], - "name": "DSAVTokenAlreadyAdded", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "EnterMarketFailed", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientPrincipal", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientWithdrawableAmount", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidCloseFractionBps", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidCollateralFactor", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidDSA", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidLeverage", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidLongAmountToRedeem", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidOraclePrice", - "type": "error" - }, - { - "inputs": [], - "name": "MinAmountOutRepayBelowDebt", - "type": "error" - }, - { - "inputs": [], - "name": "MinAmountOutSecondBelowDebt", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "MintBehalfFailed", - "type": "error" - }, - { - "inputs": [], - "name": "PositionAccountImplementationNotSet", - "type": "error" - }, - { - "inputs": [], - "name": "PositionAlreadyExists", - "type": "error" - }, - { - "inputs": [], - "name": "PositionNotActive", - "type": "error" - }, - { - "inputs": [], - "name": "PositionNotFullyClosed", - "type": "error" - }, - { - "inputs": [], - "name": "ProportionalCloseAmountOutOfTolerance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "errorCode", - "type": "uint256" - } - ], - "name": "RedeemBehalfFailed", - "type": "error" - }, - { - "inputs": [], - "name": "SameDSAActiveStatus", - "type": "error" - }, - { - "inputs": [], - "name": "SameMarketNotAllowed", - "type": "error" - }, - { - "inputs": [], - "name": "SamePositionAccountImplementation", - "type": "error" - }, - { - "inputs": [], - "name": "SlippageExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "TokenSwapCallFailed", - "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": "VBNBNotSupported", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroDebt", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroShortAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dsaVToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "index", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "bool", - "name": "active", - "type": "bool" - } - ], - "name": "DSAVTokenActiveUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "dsaVToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "index", - "type": "uint8" - } - ], - "name": "DSAVTokenAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "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": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "longAsset", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "shortAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "positionAccount", - "type": "address" - } - ], - "name": "PositionAccountDeployed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldImplementation", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "PositionAccountImplementationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "longAsset", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "shortAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dsaAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "initialPrincipal", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "effectiveLeverage", - "type": "uint256" - } - ], - "name": "PositionActivated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "closeFractionBps", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountRepaid", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountRedeemed", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountRedeemedDsa", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "longDustRedeemed", - "type": "uint256" - } - ], - "name": "PositionClosed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "dsaAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountWithdrawn", - "type": "uint256" - } - ], - "name": "PositionDeactivated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "longAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "shortAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dsaAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "shortAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "additionalPrincipal", - "type": "uint256" - } - ], - "name": "PositionOpened", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "dsaAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newTotalPrincipal", - "type": "uint256" - } - ], - "name": "PrincipalSupplied", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "dsaAsset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remainingPrincipal", - "type": "uint256" - } - ], - "name": "PrincipalWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountConvertedToProfit", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newTotalPrincipal", - "type": "uint256" - } - ], - "name": "ProfitConverted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "oldSuppliedPrincipal", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newSuppliedPrincipal", - "type": "uint256" - } - ], - "name": "RefreshedSuppliedPrincipal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "UnderlyingTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "COMPTROLLER", - "outputs": [ - { - "internalType": "contract IComptroller", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LEVERAGE_MANAGER", - "outputs": [ - { - "internalType": "contract LeverageStrategiesManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "POSITION_ACCOUNT_IMPLEMENTATION", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "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": "longVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint8", - "name": "dsaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "initialPrincipal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "effectiveLeverage", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongAmount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "swapData", - "type": "bytes" - } - ], - "name": "activateAndOpenPosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint8", - "name": "dsaIndex", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "initialPrincipal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "effectiveLeverage", - "type": "uint256" - } - ], - "name": "activatePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "dsaVToken", - "type": "address" - } - ], - "name": "addDSAVToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "calculateMaxBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "maxBorrowAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "closeFractionBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longAmountToRedeemForFirstSwap", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortAmountToRepayForFirstSwap", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOutFirst", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "swapDataFirst", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "dsaAmountToRedeemForSecondSwap", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOutSecond", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "swapDataSecond", - "type": "bytes" - } - ], - "name": "closeWithLoss", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "closeFractionBps", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "longAmountToRedeemForRepay", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOutRepay", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "swapDataRepay", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "longAmountToRedeemForProfit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmountOutProfit", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "swapDataProfit", - "type": "bytes" - } - ], - "name": "closeWithProfit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "deactivatePosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "dsaVTokenIndexCounter", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "dsaVTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "internalType": "address[]", - "name": "targets", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "executePositionAccountCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getDsaVTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "dsaVTokensList", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "getLongCollateralBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "longBalance", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "getPosition", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "address", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - }, - { - "internalType": "uint8", - "name": "dsaIndex", - "type": "uint8" - }, - { - "internalType": "address", - "name": "dsaVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "suppliedPrincipalVTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "effectiveLeverage", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - } - ], - "internalType": "struct IRelativePositionManager.Position", - "name": "position", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "getPositionAccountAddress", - "outputs": [ - { - "internalType": "address", - "name": "predicted", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "getSuppliedPrincipalBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - } - ], - "name": "getUtilizationInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "actualCapitalUtilized", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nominalCapitalUtilized", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "finalCapitalUtilized", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableCapitalUSD", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawableAmount", - "type": "uint256" - } - ], - "internalType": "struct IRelativePositionManager.UtilizationInfo", - "name": "utilization", - "type": "tuple" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "accessControlManager_", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isDsaVTokenActive", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "additionalPrincipal", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minLongAmount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "swapData", - "type": "bytes" - } - ], - "name": "openPosition", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "address", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "positionAccount", - "type": "address" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - }, - { - "internalType": "uint8", - "name": "dsaIndex", - "type": "uint8" - }, - { - "internalType": "address", - "name": "dsaVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "suppliedPrincipalVTokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "effectiveLeverage", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "cycleId", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "accessControlManager_", - "type": "address" - } - ], - "name": "setAccessControlManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "dsaIndex", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "active", - "type": "bool" - } - ], - "name": "setDSAVTokenActive", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "positionAccountImpl", - "type": "address" - } - ], - "name": "setPositionAccountImplementation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "address", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "supplyPrincipal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IVToken", - "name": "longVToken", - "type": "address" - }, - { - "internalType": "contract IVToken", - "name": "shortVToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawPrincipal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file + { + "inputs": [ + { + "internalType": "address", + "name": "comptroller", + "type": "address" + }, + { + "internalType": "address", + "name": "leverageManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AssetNotListed", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowAmountExceedsMaximum", + "type": "error" + }, + { + "inputs": [], + "name": "DSAInactive", + "type": "error" + }, + { + "inputs": [], + "name": "DSAVTokenAlreadyAdded", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "EnterMarketFailed", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientPrincipal", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientWithdrawableAmount", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCloseFractionBps", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCollateralFactor", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDSA", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLeverage", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLongAmountToRedeem", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOraclePrice", + "type": "error" + }, + { + "inputs": [], + "name": "MinAmountOutRepayBelowDebt", + "type": "error" + }, + { + "inputs": [], + "name": "MinAmountOutSecondBelowDebt", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "MintBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "PositionAccountImplementationNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "PositionAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "PositionNotActive", + "type": "error" + }, + { + "inputs": [], + "name": "PositionNotFullyClosed", + "type": "error" + }, + { + "inputs": [], + "name": "ProportionalCloseAmountOutOfTolerance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "errorCode", + "type": "uint256" + } + ], + "name": "RedeemBehalfFailed", + "type": "error" + }, + { + "inputs": [], + "name": "SameDSAActiveStatus", + "type": "error" + }, + { + "inputs": [], + "name": "SameMarketNotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "SamePositionAccountImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "SlippageExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "TokenSwapCallFailed", + "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": "VBNBNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroDebt", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroShortAmount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "index", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "DSAVTokenActiveUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "DSAVTokenAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "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": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "longAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "shortAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "positionAccount", + "type": "address" + } + ], + "name": "PositionAccountDeployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "PositionAccountImplementationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "longAsset", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "shortAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "initialPrincipal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + } + ], + "name": "PositionActivated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "closeFractionBps", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRepaid", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRedeemed", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountRedeemedDsa", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "longDustRedeemed", + "type": "uint256" + } + ], + "name": "PositionClosed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountWithdrawn", + "type": "uint256" + } + ], + "name": "PositionDeactivated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "longAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "shortAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shortAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "additionalPrincipal", + "type": "uint256" + } + ], + "name": "PositionOpened", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalPrincipal", + "type": "uint256" + } + ], + "name": "PrincipalSupplied", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "dsaAsset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "remainingPrincipal", + "type": "uint256" + } + ], + "name": "PrincipalWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountConvertedToProfit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTotalPrincipal", + "type": "uint256" + } + ], + "name": "ProfitConverted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldSuppliedPrincipal", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newSuppliedPrincipal", + "type": "uint256" + } + ], + "name": "RefreshedSuppliedPrincipal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "UnderlyingTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "COMPTROLLER", + "outputs": [ + { + "internalType": "contract IComptroller", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LEVERAGE_MANAGER", + "outputs": [ + { + "internalType": "contract LeverageStrategiesManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "POSITION_ACCOUNT_IMPLEMENTATION", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "initialPrincipal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minLongAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapData", + "type": "bytes" + } + ], + "name": "activateAndOpenPosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "initialPrincipal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + } + ], + "name": "activatePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dsaVToken", + "type": "address" + } + ], + "name": "addDSAVToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "calculateMaxBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "maxBorrowAmount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "closeFractionBps", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longAmountToRedeemForFirstSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortAmountToRepayForFirstSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutFirst", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataFirst", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "dsaAmountToRedeemForSecondSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutSecond", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataSecond", + "type": "bytes" + } + ], + "name": "closeWithLoss", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "closeFractionBps", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "longAmountToRedeemForRepay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutRepay", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataRepay", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "longAmountToRedeemForProfit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minAmountOutProfit", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapDataProfit", + "type": "bytes" + } + ], + "name": "closeWithProfit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "deactivatePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "dsaVTokenIndexCounter", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "dsaVTokens", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "internalType": "address[]", + "name": "targets", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "executePositionAccountCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDsaVTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "dsaVTokensList", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getLongCollateralBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "longBalance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getPosition", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "internalType": "bool", + "name": "isActive", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "suppliedPrincipalVTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + } + ], + "internalType": "struct IRelativePositionManager.Position", + "name": "position", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getPositionAccountAddress", + "outputs": [ + { + "internalType": "address", + "name": "predicted", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getSuppliedPrincipalBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + } + ], + "name": "getUtilizationInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "actualCapitalUtilized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nominalCapitalUtilized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "finalCapitalUtilized", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "availableCapitalUSD", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "withdrawableAmount", + "type": "uint256" + } + ], + "internalType": "struct IRelativePositionManager.UtilizationInfo", + "name": "utilization", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isDsaVTokenActive", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "additionalPrincipal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shortAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minLongAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "swapData", + "type": "bytes" + } + ], + "name": "openPosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "positions", + "outputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "positionAccount", + "type": "address" + }, + { + "internalType": "bool", + "name": "isActive", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "address", + "name": "dsaVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "suppliedPrincipalVTokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "effectiveLeverage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "cycleId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "accessControlManager_", + "type": "address" + } + ], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "dsaIndex", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "active", + "type": "bool" + } + ], + "name": "setDSAVTokenActive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "positionAccountImpl", + "type": "address" + } + ], + "name": "setPositionAccountImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "address", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "supplyPrincipal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IVToken", + "name": "longVToken", + "type": "address" + }, + { + "internalType": "contract IVToken", + "name": "shortVToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawPrincipal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-610/bsctestnet.ts b/simulations/vip-610/bsctestnet.ts index 51b14d84d..4b7840c11 100644 --- a/simulations/vip-610/bsctestnet.ts +++ b/simulations/vip-610/bsctestnet.ts @@ -49,16 +49,19 @@ forking(90876709, async () => { expect(await comptroller.authorizedFlashLoan(LEVERAGE_STRATEGIES_MANAGER)).to.equal(false); }); - it("SwapHelper should have NORMAL_TIMELOCK as owner", async () => { + it("SwapHelper should have NORMAL_TIMELOCK as pending owner and not yet as owner", async () => { expect(await swapHelper.owner()).not.equal(bsctestnet.NORMAL_TIMELOCK); + expect(await swapHelper.pendingOwner()).to.equal(bsctestnet.NORMAL_TIMELOCK); }); - it("LeverageStrategiesManager should have NORMAL_TIMELOCK as pending owner", async () => { + it("LeverageStrategiesManager should have NORMAL_TIMELOCK as pending owner and not yet as owner", async () => { expect(await leverageStrategiesManager.owner()).not.equal(bsctestnet.NORMAL_TIMELOCK); + expect(await leverageStrategiesManager.pendingOwner()).to.equal(bsctestnet.NORMAL_TIMELOCK); }); - it("RelativePositionManager should have NORMAL_TIMELOCK as pending owner", async () => { + it("RelativePositionManager should have NORMAL_TIMELOCK as pending owner and not yet as owner", async () => { expect(await relativePositionManager.owner()).not.equal(bsctestnet.NORMAL_TIMELOCK); + expect(await relativePositionManager.pendingOwner()).to.equal(bsctestnet.NORMAL_TIMELOCK); }); it("Timelocks/Guardian should not have ACM permissions on RelativePositionManager", async () => { From a22e962b44a60d11e9f9f64198b721c105689eb6 Mon Sep 17 00:00:00 2001 From: GitGuru7 Date: Tue, 17 Feb 2026 17:42:26 +0530 Subject: [PATCH 3/3] fix: lint error --- simulations/vip-610/abi/{Swaphelper.json => SwapHelperAbi.json} | 0 simulations/vip-610/bsctestnet.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename simulations/vip-610/abi/{Swaphelper.json => SwapHelperAbi.json} (100%) diff --git a/simulations/vip-610/abi/Swaphelper.json b/simulations/vip-610/abi/SwapHelperAbi.json similarity index 100% rename from simulations/vip-610/abi/Swaphelper.json rename to simulations/vip-610/abi/SwapHelperAbi.json diff --git a/simulations/vip-610/bsctestnet.ts b/simulations/vip-610/bsctestnet.ts index 4b7840c11..d4ee145f0 100644 --- a/simulations/vip-610/bsctestnet.ts +++ b/simulations/vip-610/bsctestnet.ts @@ -16,7 +16,7 @@ import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json"; import FLASHLOAN_FACET_ABI from "./abi/FlashLoanFacet.json"; import LEVERAGE_MANAGER_ABI from "./abi/LeverageStrategiesManager.json"; import RELATIVE_POSITION_MANAGER_ABI from "./abi/RelativePositionManager.json"; -import SWAP_HELPER_ABI from "./abi/SwapHelper.json"; +import SWAP_HELPER_ABI from "./abi/SwapHelperAbi.json"; const { bsctestnet } = NETWORK_ADDRESSES;