diff --git a/simulations/vip-572/abi/ERC20.json b/simulations/vip-572/abi/ERC20.json new file mode 100644 index 000000000..3a509c9c4 --- /dev/null +++ b/simulations/vip-572/abi/ERC20.json @@ -0,0 +1,134 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "name_", "type": "string" }, + { "internalType": "string", "name": "symbol_", "type": "string" }, + { "internalType": "uint8", "name": "decimals_", "type": "uint8" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "faucet", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-572/abi/binanceOracle.json b/simulations/vip-572/abi/binanceOracle.json new file mode 100644 index 000000000..f740c68c8 --- /dev/null +++ b/simulations/vip-572/abi/binanceOracle.json @@ -0,0 +1,195 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "calledContract", "type": "address" }, + { "internalType": "string", "name": "methodSignature", "type": "string" } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldFeedRegistry", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newFeedRegistry", "type": "address" } + ], + "name": "FeedRegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "string", "name": "asset", "type": "string" }, + { "indexed": false, "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "name": "MaxStalePeriodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "oldAccessControlManager", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAccessControlManager", "type": "address" } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "string", "name": "symbol", "type": "string" }, + { "indexed": false, "internalType": "string", "name": "overriddenSymbol", "type": "string" } + ], + "name": "SymbolOverridden", + "type": "event" + }, + { + "inputs": [], + "name": "BNB_ADDR", + "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": [], + "name": "feedRegistryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFeedRegistryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], + "name": "getPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_sidRegistryAddress", "type": "address" }, + { "internalType": "address", "name": "_acm", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "string", "name": "", "type": "string" }], + "name": "maxStalePeriod", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "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": "address", "name": "newfeedRegistryAddress", "type": "address" }], + "name": "setFeedRegistryAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "uint256", "name": "_maxStalePeriod", "type": "uint256" } + ], + "name": "setMaxStalePeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "symbol", "type": "string" }, + { "internalType": "string", "name": "overrideSymbol", "type": "string" } + ], + "name": "setSymbolOverride", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sidRegistryAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "string", "name": "", "type": "string" }], + "name": "symbols", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-572/abi/boundValidator.json b/simulations/vip-572/abi/boundValidator.json new file mode 100644 index 000000000..bd39b8e51 --- /dev/null +++ b/simulations/vip-572/abi/boundValidator.json @@ -0,0 +1,157 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "calledContract", "type": "address" }, + { "internalType": "string", "name": "methodSignature", "type": "string" } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "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": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "upperBound", "type": "uint256" }, + { "indexed": true, "internalType": "uint256", "name": "lowerBound", "type": "uint256" } + ], + "name": "ValidateConfigAdded", + "type": "event" + }, + { "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": "accessControlManager_", "type": "address" }], + "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": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "upperBoundRatio", "type": "uint256" }, + { "internalType": "uint256", "name": "lowerBoundRatio", "type": "uint256" } + ], + "internalType": "struct BoundValidator.ValidateConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setValidateConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "upperBoundRatio", "type": "uint256" }, + { "internalType": "uint256", "name": "lowerBoundRatio", "type": "uint256" } + ], + "internalType": "struct BoundValidator.ValidateConfig[]", + "name": "configs", + "type": "tuple[]" + } + ], + "name": "setValidateConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "validateConfigs", + "outputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "upperBoundRatio", "type": "uint256" }, + { "internalType": "uint256", "name": "lowerBoundRatio", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "reportedPrice", "type": "uint256" }, + { "internalType": "uint256", "name": "anchorPrice", "type": "uint256" } + ], + "name": "validatePriceWithAnchorPrice", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-572/abi/chainlinkOracle.json b/simulations/vip-572/abi/chainlinkOracle.json new file mode 100644 index 000000000..7dd5f6f5f --- /dev/null +++ b/simulations/vip-572/abi/chainlinkOracle.json @@ -0,0 +1,187 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "calledContract", "type": "address" }, + { "internalType": "string", "name": "methodSignature", "type": "string" } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "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": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "previousPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newPriceMantissa", "type": "uint256" } + ], + "name": "PricePosted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "feed", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "name": "TokenConfigAdded", + "type": "event" + }, + { + "inputs": [], + "name": "NATIVE_TOKEN_ADDR", + "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": "asset", "type": "address" }], + "name": "getPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "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": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "prices", + "outputs": [{ "internalType": "uint256", "name": "", "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": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setDirectPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "feed", "type": "address" }, + { "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "internalType": "struct ChainlinkOracle.TokenConfig", + "name": "tokenConfig", + "type": "tuple" + } + ], + "name": "setTokenConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "feed", "type": "address" }, + { "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "internalType": "struct ChainlinkOracle.TokenConfig[]", + "name": "tokenConfigs_", + "type": "tuple[]" + } + ], + "name": "setTokenConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "tokenConfigs", + "outputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "feed", "type": "address" }, + { "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-572/abi/redstoneOracle.json b/simulations/vip-572/abi/redstoneOracle.json new file mode 100644 index 000000000..7dd5f6f5f --- /dev/null +++ b/simulations/vip-572/abi/redstoneOracle.json @@ -0,0 +1,187 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "calledContract", "type": "address" }, + { "internalType": "string", "name": "methodSignature", "type": "string" } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "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": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "previousPriceMantissa", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newPriceMantissa", "type": "uint256" } + ], + "name": "PricePosted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "feed", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "name": "TokenConfigAdded", + "type": "event" + }, + { + "inputs": [], + "name": "NATIVE_TOKEN_ADDR", + "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": "asset", "type": "address" }], + "name": "getPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "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": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "prices", + "outputs": [{ "internalType": "uint256", "name": "", "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": "address", "name": "asset", "type": "address" }, + { "internalType": "uint256", "name": "price", "type": "uint256" } + ], + "name": "setDirectPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "feed", "type": "address" }, + { "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "internalType": "struct ChainlinkOracle.TokenConfig", + "name": "tokenConfig", + "type": "tuple" + } + ], + "name": "setTokenConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "feed", "type": "address" }, + { "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "internalType": "struct ChainlinkOracle.TokenConfig[]", + "name": "tokenConfigs_", + "type": "tuple[]" + } + ], + "name": "setTokenConfigs", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "tokenConfigs", + "outputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "feed", "type": "address" }, + { "internalType": "uint256", "name": "maxStalePeriod", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/simulations/vip-572/abi/resilientOracle.json b/simulations/vip-572/abi/resilientOracle.json new file mode 100644 index 000000000..373eb14e9 --- /dev/null +++ b/simulations/vip-572/abi/resilientOracle.json @@ -0,0 +1,320 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "nativeMarketAddress", "type": "address" }, + { "internalType": "address", "name": "vaiAddress", "type": "address" }, + { "internalType": "contract BoundValidatorInterface", "name": "_boundValidator", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "calledContract", "type": "address" }, + { "internalType": "string", "name": "methodSignature", "type": "string" } + ], + "name": "Unauthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": true, "internalType": "bool", "name": "enabled", "type": "bool" } + ], + "name": "CachedEnabled", + "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": "asset", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "role", "type": "uint256" }, + { "indexed": true, "internalType": "bool", "name": "enable", "type": "bool" } + ], + "name": "OracleEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "asset", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "oracle", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "role", "type": "uint256" } + ], + "name": "OracleSet", + "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": "asset", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "mainOracle", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "pivotOracle", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "fallbackOracle", "type": "address" } + ], + "name": "TokenConfigAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "CACHE_SLOT", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "INVALID_PRICE", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NATIVE_TOKEN_ADDR", + "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": [], + "name": "boundValidator", + "outputs": [{ "internalType": "contract BoundValidatorInterface", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "enum ResilientOracle.OracleRole", "name": "role", "type": "uint8" }, + { "internalType": "bool", "name": "enable", "type": "bool" } + ], + "name": "enableOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "enum ResilientOracle.OracleRole", "name": "role", "type": "uint8" } + ], + "name": "getOracle", + "outputs": [ + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "bool", "name": "enabled", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], + "name": "getPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "asset", "type": "address" }], + "name": "getTokenConfig", + "outputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address[3]", "name": "oracles", "type": "address[3]" }, + { "internalType": "bool[3]", "name": "enableFlagsForOracles", "type": "bool[3]" }, + { "internalType": "bool", "name": "cachingEnabled", "type": "bool" } + ], + "internalType": "struct ResilientOracle.TokenConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "getUnderlyingPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "nativeMarket", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "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": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "enum ResilientOracle.OracleRole", "name": "role", "type": "uint8" } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address[3]", "name": "oracles", "type": "address[3]" }, + { "internalType": "bool[3]", "name": "enableFlagsForOracles", "type": "bool[3]" }, + { "internalType": "bool", "name": "cachingEnabled", "type": "bool" } + ], + "internalType": "struct ResilientOracle.TokenConfig", + "name": "tokenConfig", + "type": "tuple" + } + ], + "name": "setTokenConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "asset", "type": "address" }, + { "internalType": "address[3]", "name": "oracles", "type": "address[3]" }, + { "internalType": "bool[3]", "name": "enableFlagsForOracles", "type": "bool[3]" }, + { "internalType": "bool", "name": "cachingEnabled", "type": "bool" } + ], + "internalType": "struct ResilientOracle.TokenConfig[]", + "name": "tokenConfigs_", + "type": "tuple[]" + } + ], + "name": "setTokenConfigs", + "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": "address", "name": "asset", "type": "address" }], + "name": "updateAssetPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "vToken", "type": "address" }], + "name": "updatePrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vai", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-572/bscmainnet.ts b/simulations/vip-572/bscmainnet.ts new file mode 100644 index 000000000..b5ee5673d --- /dev/null +++ b/simulations/vip-572/bscmainnet.ts @@ -0,0 +1,351 @@ +import { expect } from "chai"; +import { Contract } from "ethers"; +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES, ORACLE_BNB } from "src/networkAddresses"; +import { expectEvents, initMainnetUser, setMaxStalePeriod, setMaxStalePeriodInBinanceOracle } from "src/utils"; +import { forking, testVip } from "src/vip-framework"; + +import vip572, { + AAVE, + ADA, + BCH, + CAKE, + DAI, + DOGE, + DOT, + FDUSD, + FIL, + LINK, + LTC, + SOL, + SolvBTC, + THE, + TUSD, + UNI, + VAI, + WBETH, + XRP, + XVS, + asBNB, +} from "../../vips/vip-572/bscmainnet"; +import ERC20_ABI from "./abi/ERC20.json"; +import BINANCE_ORACLE_ABI from "./abi/binanceOracle.json"; +import BOUND_VALIDATOR_ABI from "./abi/boundValidator.json"; +import REDSTONE_ORACLE_ABI from "./abi/redstoneOracle.json"; +import RESILIENT_ORACLE_ABI from "./abi/resilientOracle.json"; + +const provider = ethers.provider; + +const { bscmainnet } = NETWORK_ADDRESSES; +const ETH = "0x2170Ed0880ac9A755fd29B2688956BD959F933F8"; + +forking(69306243, async () => { + let resilientOracle: Contract; + let redstoneOracle: Contract; + let impersonatedTimelock: any; + + before(async () => { + resilientOracle = new ethers.Contract(bscmainnet.RESILIENT_ORACLE, RESILIENT_ORACLE_ABI, provider); + redstoneOracle = new ethers.Contract(bscmainnet.REDSTONE_ORACLE, REDSTONE_ORACLE_ABI, provider); + + impersonatedTimelock = await initMainnetUser(bscmainnet.NORMAL_TIMELOCK, ethers.utils.parseEther("2")); + }); + + describe("Pre-VIP behavior", async () => { + it("check AAVE price", async () => { + const price = await resilientOracle.getPrice(AAVE); + expect(price).to.be.equal(parseUnits("170.32621913", 18)); + }); + + it("check ADA price", async () => { + const price = await resilientOracle.getPrice(ADA); + expect(price).to.be.equal(parseUnits("0.40761056", 18)); + }); + + it("check asBNB price", async () => { + const price = await resilientOracle.getPrice(asBNB); + expect(price).to.be.equal(parseUnits("895.652717622043784833", 18)); + }); + + it("check BCH price", async () => { + const price = await resilientOracle.getPrice(BCH); + expect(price).to.be.equal(parseUnits("543.200461790000000000", 18)); + }); + + it.skip("check CAKE price", async () => { + const price = await resilientOracle.getPrice(CAKE); + expect(price).to.be.equal(parseUnits("2.324840000000000000", 18)); + }); + + it("check DAI price", async () => { + const price = await resilientOracle.getPrice(DAI); + expect(price).to.be.equal(parseUnits("0.99967909", 18)); + }); + + it("check DOGE price", async () => { + const price = await resilientOracle.getPrice(DOGE); + expect(price).to.be.equal(parseUnits("1454520000", 18)); + }); + + it("check DOT price", async () => { + const price = await resilientOracle.getPrice(DOT); + expect(price).to.be.equal(parseUnits("2.259085520000000000", 18)); + }); + + it("check FDUSD price", async () => { + const price = await resilientOracle.getPrice(FDUSD); + expect(price).to.be.equal(parseUnits("0.996830", 18)); + }); + + it("check FIL price", async () => { + const price = await resilientOracle.getPrice(FIL); + expect(price).to.be.equal(parseUnits("1.61386171", 18)); + }); + + it("check LINK price", async () => { + const price = await resilientOracle.getPrice(LINK); + expect(price).to.be.equal(parseUnits("12.434677", 18)); + }); + + it("check LTC price", async () => { + const price = await resilientOracle.getPrice(LTC); + expect(price).to.be.equal(parseUnits("83.031787930000000000", 18)); + }); + + it("check SOL price", async () => { + const price = await resilientOracle.getPrice(SOL); + expect(price).to.be.equal(parseUnits("129.056394760000000000", 18)); + }); + + it("check SolvBTC price", async () => { + const price = await resilientOracle.getPrice(SolvBTC); + expect(price).to.be.equal(parseUnits("85930.196134040000000000", 18)); + }); + + it("check THE price", async () => { + const price = await resilientOracle.getPrice(THE); + expect(price).to.be.equal(parseUnits("0.147200000000000000", 18)); + }); + + it("check TUSD price", async () => { + const price = await resilientOracle.getPrice(TUSD); + expect(price).to.be.equal(parseUnits("0.99598455", 18)); + }); + + it("check UNI price", async () => { + const price = await resilientOracle.getPrice(UNI); + expect(price).to.be.equal(parseUnits("6.1390708", 18)); + }); + + it("check VAI price", async () => { + const price = await resilientOracle.getPrice(VAI); + expect(price).to.be.equal(parseUnits("0.999048", 18)); + }); + + it("check WBETH price", async () => { + const price = await resilientOracle.getPrice(WBETH); + expect(price).to.be.equal(parseUnits("3038.578498421588886094", 18)); + }); + + it("check XRP price", async () => { + const price = await resilientOracle.getPrice(XRP); + expect(price).to.be.equal(parseUnits("2.058733000000000000", 18)); + }); + + it("check XVS price", async () => { + const price = await resilientOracle.getPrice(XVS); + expect(price).to.be.equal(parseUnits("4.148370200000000000", 18)); + }); + }); + + testVip("VIP-572 bscmainnet", await vip572(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [RESILIENT_ORACLE_ABI, BINANCE_ORACLE_ABI, BOUND_VALIDATOR_ABI], + ["TokenConfigAdded", "MaxStalePeriodAdded", "ValidateConfigAdded"], + [21, 21, 21], + ); + }, + }); + + describe("Post-VIP behavior", async () => { + before(async () => { + const aave = await new ethers.Contract(AAVE, ERC20_ABI, provider); + const ada = await new ethers.Contract(ADA, ERC20_ABI, provider); + const bch = await new ethers.Contract(BCH, ERC20_ABI, provider); + const cake = await new ethers.Contract(CAKE, ERC20_ABI, provider); + const dai = await new ethers.Contract(DAI, ERC20_ABI, provider); + const doge = await new ethers.Contract(DOGE, ERC20_ABI, provider); + const dot = await new ethers.Contract(DOT, ERC20_ABI, provider); + const fdusd = await new ethers.Contract(FDUSD, ERC20_ABI, provider); + const fil = await new ethers.Contract(FIL, ERC20_ABI, provider); + const link = await new ethers.Contract(LINK, ERC20_ABI, provider); + const ltc = await new ethers.Contract(LTC, ERC20_ABI, provider); + const sol = await new ethers.Contract(SOL, ERC20_ABI, provider); + const tusd = await new ethers.Contract(TUSD, ERC20_ABI, provider); + const uni = await new ethers.Contract(UNI, ERC20_ABI, provider); + const vai = await new ethers.Contract(VAI, ERC20_ABI, provider); + const wbeth = await new ethers.Contract(WBETH, ERC20_ABI, provider); + const xrp = await new ethers.Contract(XRP, ERC20_ABI, provider); + const xvs = await new ethers.Contract(XVS, ERC20_ABI, provider); + const bnb = await new ethers.Contract(ORACLE_BNB, ERC20_ABI, provider); + const eth = await new ethers.Contract(ETH, ERC20_ABI, provider); + + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "AAVE"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "ADA"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "asBNB"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "BNB"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "BCH"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "CAKE"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "DAI"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "DOGE"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "DOT"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "FDUSD"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "FIL"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "LINK"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "LTC"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "SOL"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "SolvBTC"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "THE"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "TUSD"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "UNI"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "VAI"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "WBETH"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "XRP"); + await setMaxStalePeriodInBinanceOracle(bscmainnet.BINANCE_ORACLE, "XVS"); + + await setMaxStalePeriod(resilientOracle, aave); + await setMaxStalePeriod(resilientOracle, ada); + await setMaxStalePeriod(resilientOracle, bnb); + await setMaxStalePeriod(resilientOracle, bch); + await setMaxStalePeriod(resilientOracle, cake); + await setMaxStalePeriod(resilientOracle, dai); + await setMaxStalePeriod(resilientOracle, doge); + await setMaxStalePeriod(resilientOracle, dot); + await setMaxStalePeriod(resilientOracle, fdusd); + await setMaxStalePeriod(resilientOracle, fil); + await setMaxStalePeriod(resilientOracle, link); + await setMaxStalePeriod(resilientOracle, ltc); + await setMaxStalePeriod(resilientOracle, sol); + await setMaxStalePeriod(resilientOracle, tusd); + await setMaxStalePeriod(resilientOracle, uni); + await setMaxStalePeriod(resilientOracle, vai); + await setMaxStalePeriod(resilientOracle, wbeth); + await setMaxStalePeriod(resilientOracle, xrp); + await setMaxStalePeriod(resilientOracle, xvs); + await setMaxStalePeriod(resilientOracle, eth); + + await redstoneOracle + .connect(impersonatedTimelock) + .setDirectPrice(SolvBTC, parseUnits("85930.196134040000000000", 18)); + await redstoneOracle.connect(impersonatedTimelock).setDirectPrice(THE, parseUnits("0.147200000000000000", 18)); + }); + + it("check AAVE price", async () => { + const price = await resilientOracle.getPrice(AAVE); + expect(price).to.be.equal(parseUnits("170.32621913", 18)); + }); + + it("check ADA price", async () => { + const price = await resilientOracle.getPrice(ADA); + expect(price).to.be.equal(parseUnits("0.40761056", 18)); + }); + + it("check asBNB price", async () => { + const price = await resilientOracle.getPrice(asBNB); + expect(price).to.be.equal(parseUnits("896.110983645605175573", 18)); + }); + + it("check BCH price", async () => { + const price = await resilientOracle.getPrice(BCH); + expect(price).to.be.equal(parseUnits("543.200461790000000000", 18)); + }); + + it("check CAKE price", async () => { + const price = await resilientOracle.getPrice(CAKE); + expect(price).to.be.equal(parseUnits("2.324840000000000000", 18)); + }); + + it("check DAI price", async () => { + const price = await resilientOracle.getPrice(DAI); + expect(price).to.be.equal(parseUnits("0.99967909", 18)); + }); + + it("check DOGE price", async () => { + const price = await resilientOracle.getPrice(DOGE); + expect(price).to.be.equal(parseUnits("1454520000", 18)); + }); + + it("check DOT price", async () => { + const price = await resilientOracle.getPrice(DOT); + expect(price).to.be.equal(parseUnits("2.259085520000000000", 18)); + }); + + it("check FDUSD price", async () => { + const price = await resilientOracle.getPrice(FDUSD); + expect(price).to.be.equal(parseUnits("0.996830", 18)); + }); + + it("check FIL price", async () => { + const price = await resilientOracle.getPrice(FIL); + expect(price).to.be.equal(parseUnits("1.61386171", 18)); + }); + + it("check LINK price", async () => { + const price = await resilientOracle.getPrice(LINK); + expect(price).to.be.equal(parseUnits("12.434677", 18)); + }); + + it("check LTC price", async () => { + const price = await resilientOracle.getPrice(LTC); + expect(price).to.be.equal(parseUnits("83.031787930000000000", 18)); + }); + + it("check SOL price", async () => { + const price = await resilientOracle.getPrice(SOL); + expect(price).to.be.equal(parseUnits("129.056394760000000000", 18)); + }); + + it("check SolvBTC price", async () => { + const price = await resilientOracle.getPrice(SolvBTC); + expect(price).to.be.equal(parseUnits("85930.196134040000000000", 18)); + }); + + it("check THE price", async () => { + const price = await resilientOracle.getPrice(THE); + expect(price).to.be.equal(parseUnits("0.147200000000000000", 18)); + }); + + it("check TUSD price", async () => { + const price = await resilientOracle.getPrice(TUSD); + expect(price).to.be.equal(parseUnits("0.99598455", 18)); + }); + + it("check UNI price", async () => { + const price = await resilientOracle.getPrice(UNI); + expect(price).to.be.equal(parseUnits("6.1390708", 18)); + }); + + it("check VAI price", async () => { + const price = await resilientOracle.getPrice(VAI); + expect(price).to.be.equal(parseUnits("0.999048", 18)); + }); + + it("check WBETH price", async () => { + const price = await resilientOracle.getPrice(WBETH); + expect(price).to.be.equal(parseUnits("3038.578498421588886094", 18)); + }); + + it("check XRP price", async () => { + const price = await resilientOracle.getPrice(XRP); + expect(price).to.be.equal(parseUnits("2.058733000000000000", 18)); + }); + + it("check XVS price", async () => { + const price = await resilientOracle.getPrice(XVS); + expect(price).to.be.equal(parseUnits("4.148370200000000000", 18)); + }); + }); +}); diff --git a/vips/vip-572/bscmainnet.ts b/vips/vip-572/bscmainnet.ts new file mode 100644 index 000000000..f526db297 --- /dev/null +++ b/vips/vip-572/bscmainnet.ts @@ -0,0 +1,453 @@ +import { parseUnits } from "ethers/lib/utils"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +const { bscmainnet } = NETWORK_ADDRESSES; + +export const AAVE = "0xfb6115445Bff7b52FeB98650C87f44907E58f802"; +export const ADA = "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47"; +export const asBNB = "0x77734e70b6E88b4d82fE632a168EDf6e700912b6"; +export const BCH = "0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf"; +export const CAKE = "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82"; +export const DAI = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; +export const DOGE = "0xbA2aE424d960c26247Dd6c32edC70B295c744C43"; +export const DOT = "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402"; +export const FDUSD = "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409"; +export const FIL = "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153"; +export const LINK = "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD"; +export const LTC = "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94"; +export const SOL = "0x570A5D26f7765Ecb712C0924E4De545B89fD43dF"; +export const SolvBTC = "0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7"; +export const THE = "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11"; +export const TUSD = "0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9"; +export const UNI = "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1"; +export const VAI = "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7"; +export const WBETH = "0xa2e3356610840701bdf5611a53974510ae27e2e1"; +export const XRP = "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE"; +export const XVS = "0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63"; + +export const asBNBOracle = "0x652B90D1d45a7cD5BE82c5Fb61a4A00bA126dde5"; +export const WBETHOracle = "0x49938fc72262c126eb5D4BdF6430C55189AEB2BA"; +export const BOUND_VALIDATOR = "0x6E332fF0bB52475304494E4AE5063c1051c7d735"; + +export const HEARTBEAT_25_HOURS = 25 * 60 * 60; +export const HEARTBEAT_20_MINUTES = 20 * 60; +export const HEARTBEAT_13_HOURS = 13 * 60 * 60; + +export const PRICE_LOWER_BOUND = parseUnits("0.95", 18); +export const PRICE_UPPER_BOUND = parseUnits("1.05", 18); + +export const vip572 = () => { + const meta = { + version: "v2", + title: "VIP-572 [BNB Chain] Set Pivot Oracle for Core Pool Tokens", + description: `If passed, this VIP will perform the changes to add pivot oracles for the following assets in core pool + +AAVE +- main: chainlink +- pivot: binance (0x0e3018768c0eFF613626b671eFf9F16CE4Fc4729) +- fallback: - +- bound range: 0.95 ~ 1.05 + +ADA +- main: chainlink +- pivot: binance (0x3F0FCBDa321DfEd71dA7532FA783379763D96f5A) +- fallback: - +- bound range: 0.95 ~ 1.05 + +asBNB +- main: CorrelatedTokenOracle +- pivot: binance (0x3D5b45fc74437e71321013a5F07049eF0a685d41) +- fallback: - +- bound range: 0.95 ~ 1.05 + +BCH +- main: chainlink +- pivot: binance (0x7664c905C6b36FdD831cAff88Dac4e9EB8B29210) +- fallback: - +- bound range: 0.95 ~ 1.05 + +CAKE +- main: chainlink +- pivot: binance (0xe2771302CFE70279aDE1734eD9Eb29ceE86AF627) +- fallback: - +- bound range: 0.95 ~ 1.05 + +DAI +- main: chainlink +- pivot: binance (0x939E274A591618F7ae2774b4525aa28f2e9C02ef) +- fallback: - +- bound range: 0.95 ~ 1.05 + +DOGE +- main: chainlink +- pivot: binance (0x3E609D3Ab5ad650b3e5a4F3a0B1AA4F94329C470) +- fallback: - +- bound range: 0.95 ~ 1.05 + +DOT +- main: chainlink +- pivot: binance (0xD78A354F9562FE110Eec3efaD8996bd8DEbDeAE8) +- fallback: - +- bound range: 0.95 ~ 1.05 + +FDUSD +- main: chainlink +- pivot: binance (0x665E8ad56f13A8451c1fBE3E679D97e76119A959) +- fallback: - +- bound range: 0.95 ~ 1.05 + +FIL +- main: chainlink +- pivot: binance (0x066edC843dD087A7CE5B2B66fE5e04B26bed47C0) +- fallback: - +- bound range: 0.95 ~ 1.05 + +LINK +- main: chainlink +- pivot: binance (0x29d3E3AeC0E7d8031c70e13D07b064BD5D390d13) +- fallback: - +- bound range: 0.95 ~ 1.05 + +LTC +- main: chainlink +- pivot: binance (0x9b8bd107c7ccC61210A1c6a7a99B967DF9c0C57D) +- fallback: - +- bound range: 0.95 ~ 1.05 + +SOL +- main: chainlink +- pivot: binance (0x322aB6d93dF49c0Af923f561c6fde22ab3c1Be79) +- fallback: - +- bound range: 0.95 ~ 1.05 + +SolvBTC +- main: redstone +- pivot: binance (0x2e00b5C80428f94A0e526BAfc526F19eC9c5c37B) +- fallback: - +- bound range: 0.95 ~ 1.05 + +THE +- main: redstone +- pivot: binance (0x44Bdb39F73B5278b6a9fb737102F9f5CC906CC45) +- fallback: - +- bound range: 0.95 ~ 1.05 + +TUSD +- main: chainlink +- pivot: binance (0x1688640097bFD52A4616250f7d76E974E8Eb1490) +- fallback: - +- bound range: 0.95 ~ 1.05 + +UNI +- main: chainlink +- pivot: binance (0xf16D0fe3cBC328c5514C1e9d71ca5fE38FBa57c4) +- fallback: - +- bound range: 0.95 ~ 1.05 + +VAI +- main: chainlink +- pivot: binance (0x97896F0bD853625D97EE81d25D80B70281C21C5E) +- fallback: - +- bound range: 0.95 ~ 1.05 + +WBETH +- main: CorrelatedTokenOracle +- pivot: binance (0x97398272a927c56735f7bfce95752540f5e23ccd) +- fallback: - +- bound range: 0.95 ~ 1.05 + +XRP +- main: chainlink +- pivot: binance (0x626Ae4693BFf1Ea4e2CA20EB9F1BFFF224C7EA94) +- fallback: - +- bound range: 0.95 ~ 1.05 + +XVS +- main: chainlink +- pivot: binance (0x15237dd430210234764f8C022E474FfE2C15F5a0) +- fallback: - +- bound range: 0.95 ~ 1.05 + +**References** + +- [VIP simulation](https://github.com/VenusProtocol/vips/pull/642/files)`, + forDescription: "Execute this proposal", + againstDescription: "Do not execute this proposal", + abstainDescription: "Indifferent to execution", + }; + + return makeProposal( + [ + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["AAVE", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["ADA", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["asBNB", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["BCH", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["CAKE", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["DAI", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["DOGE", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["DOT", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["FDUSD", HEARTBEAT_20_MINUTES], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["FIL", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["LINK", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["LTC", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["SOL", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["SolvBTC", HEARTBEAT_13_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["THE", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["TUSD", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["UNI", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["VAI", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["WBETH", HEARTBEAT_20_MINUTES], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["XRP", HEARTBEAT_25_HOURS], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setMaxStalePeriod(string,uint256)", + params: ["XVS", HEARTBEAT_20_MINUTES], + }, + { + target: bscmainnet.BINANCE_ORACLE, + signature: "setSymbolOverride(string,string)", + params: ["Cake", "CAKE"], + }, + { + target: bscmainnet.RESILIENT_ORACLE, + signature: "setTokenConfigs((address,address[3],bool[3],bool)[])", + params: [ + [ + [ + AAVE, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + ADA, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [asBNB, [asBNBOracle, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], [true, true, false], false], + [ + BCH, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + CAKE, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + DAI, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + DOGE, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + DOT, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + FDUSD, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + FIL, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + LINK, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + LTC, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + SOL, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + SolvBTC, + [bscmainnet.REDSTONE_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + THE, + [bscmainnet.REDSTONE_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + TUSD, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + UNI, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + VAI, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [WBETH, [WBETHOracle, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], [true, true, false], false], + [ + XRP, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + [ + XVS, + [bscmainnet.CHAINLINK_ORACLE, bscmainnet.BINANCE_ORACLE, ethers.constants.AddressZero], + [true, true, false], + false, + ], + ], + ], + }, + { + target: BOUND_VALIDATOR, + signature: "setValidateConfigs((address,uint256,uint256)[])", + params: [ + [ + [AAVE, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [ADA, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [asBNB, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [BCH, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [CAKE, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [DAI, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [DOGE, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [DOT, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [FDUSD, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [FIL, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [LINK, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [LTC, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [SOL, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [SolvBTC, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [THE, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [TUSD, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [UNI, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [VAI, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [WBETH, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [XRP, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + [XVS, PRICE_UPPER_BOUND, PRICE_LOWER_BOUND], + ], + ], + }, + ], + meta, + ProposalType.REGULAR, + ); +}; + +export default vip572;