diff --git a/src/App.tsx b/src/App.tsx index ce8260c14..5e4a44bd9 100755 --- a/src/App.tsx +++ b/src/App.tsx @@ -33,6 +33,7 @@ import { girth as gTheme } from "src/themes/girth.js"; import { light as lightTheme } from "src/themes/light.js"; import { BondModalContainer } from "src/views/Bond/components/BondModal/BondModal"; import { BondModalContainerV3 } from "src/views/Bond/components/BondModal/BondModalContainerV3"; +import { Emission } from "src/views/Emission"; import { Governance } from "src/views/Governance"; import { Delegate } from "src/views/Governance/Delegation"; import { ProposalPage } from "src/views/Governance/Proposals"; @@ -251,6 +252,7 @@ function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/src/abi/EmissionManager.json b/src/abi/EmissionManager.json new file mode 100644 index 000000000..d22116a42 --- /dev/null +++ b/src/abi/EmissionManager.json @@ -0,0 +1,422 @@ +{ + "abi": [ + { + "inputs": [ + { "internalType": "contract Kernel", "name": "kernel_", "type": "address" }, + { "internalType": "address", "name": "ohm_", "type": "address" }, + { "internalType": "address", "name": "gohm_", "type": "address" }, + { "internalType": "address", "name": "reserve_", "type": "address" }, + { "internalType": "address", "name": "sReserve_", "type": "address" }, + { "internalType": "address", "name": "auctioneer_", "type": "address" }, + { "internalType": "address", "name": "teller_", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "AlreadyActive", "type": "error" }, + { + "inputs": [{ "internalType": "uint48", "name": "availableAt", "type": "uint48" }], + "name": "CannotRestartYet", + "type": "error" + }, + { "inputs": [], "name": "InvalidCallback", "type": "error" }, + { "inputs": [], "name": "InvalidMarket", "type": "error" }, + { + "inputs": [{ "internalType": "string", "name": "parameter", "type": "string" }], + "name": "InvalidParam", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "caller_", "type": "address" }], + "name": "KernelAdapter_OnlyKernel", + "type": "error" + }, + { "inputs": [], "name": "NotActive", "type": "error" }, + { "inputs": [], "name": "OnlyTeller", "type": "error" }, + { + "inputs": [{ "internalType": "Keycode", "name": "keycode_", "type": "bytes5" }], + "name": "Policy_ModuleDoesNotExist", + "type": "error" + }, + { + "inputs": [{ "internalType": "bytes", "name": "expected_", "type": "bytes" }], + "name": "Policy_WrongModuleVersion", + "type": "error" + }, + { "inputs": [], "name": "RestartTimeframePassed", "type": "error" }, + { "anonymous": false, "inputs": [], "name": "Activated", "type": "event" }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newBacking", "type": "uint256" }], + "name": "BackingChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "newBacking", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "supplyAdded", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "reservesAdded", "type": "uint256" } + ], + "name": "BackingUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "changeBy", "type": "uint256" }, + { "indexed": false, "internalType": "uint48", "name": "forNumBeats", "type": "uint48" }, + { "indexed": false, "internalType": "bool", "name": "add", "type": "bool" } + ], + "name": "BaseRateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "auctioneer", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "teller", "type": "address" } + ], + "name": "BondContractsSet", + "type": "event" + }, + { "anonymous": false, "inputs": [], "name": "Deactivated", "type": "event" }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newMinimumPremium", "type": "uint256" }], + "name": "MinimumPremiumChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint48", "name": "newRestartTimeframe", "type": "uint48" }], + "name": "RestartTimeframeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "marketID", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "saleAmount", "type": "uint256" } + ], + "name": "SaleCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint48", "name": "newVestingPeriod", "type": "uint48" }], + "name": "VestingPeriodChanged", + "type": "event" + }, + { + "inputs": [], + "name": "CHREG", + "outputs": [{ "internalType": "contract CHREGv1", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTR", + "outputs": [{ "internalType": "contract MINTRv1", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PRICE", + "outputs": [{ "internalType": "contract PRICEv1", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ROLES", + "outputs": [{ "internalType": "contract ROLESv1", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TRSRY", + "outputs": [{ "internalType": "contract TRSRYv1", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "activeMarketId", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "auctioneer", + "outputs": [{ "internalType": "contract IBondSDA", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "backing", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseEmissionRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beatCounter", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "id_", "type": "uint256" }, + { "internalType": "uint256", "name": "inputAmount_", "type": "uint256" }, + { "internalType": "uint256", "name": "outputAmount_", "type": "uint256" } + ], + "name": "callback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "changeBy_", "type": "uint256" }, + { "internalType": "uint48", "name": "forNumBeats_", "type": "uint48" }, + { "internalType": "bool", "name": "add", "type": "bool" } + ], + "name": "changeBaseRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract Kernel", "name": "newKernel_", "type": "address" }], + "name": "changeKernel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "configureDependencies", + "outputs": [{ "internalType": "Keycode[]", "name": "dependencies", "type": "bytes5[]" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "execute", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "getNextSale", + "outputs": [ + { "internalType": "uint256", "name": "premium", "type": "uint256" }, + { "internalType": "uint256", "name": "emissionRate", "type": "uint256" }, + { "internalType": "uint256", "name": "emission", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPremium", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserves", + "outputs": [{ "internalType": "uint256", "name": "reserves", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSupply", + "outputs": [{ "internalType": "uint256", "name": "supply", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gohm", + "outputs": [{ "internalType": "contract IgOHM", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "baseEmissionsRate_", "type": "uint256" }, + { "internalType": "uint256", "name": "minimumPremium_", "type": "uint256" }, + { "internalType": "uint256", "name": "backing_", "type": "uint256" }, + { "internalType": "uint48", "name": "restartTimeframe_", "type": "uint48" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isActive", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "kernel", + "outputs": [{ "internalType": "contract Kernel", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "locallyActive", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumPremium", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ohm", + "outputs": [{ "internalType": "contract ERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rateChange", + "outputs": [ + { "internalType": "uint256", "name": "changeBy", "type": "uint256" }, + { "internalType": "uint48", "name": "daysLeft", "type": "uint48" }, + { "internalType": "bool", "name": "addition", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "requestPermissions", + "outputs": [ + { + "components": [ + { "internalType": "Keycode", "name": "keycode", "type": "bytes5" }, + { "internalType": "bytes4", "name": "funcSelector", "type": "bytes4" } + ], + "internalType": "struct Permissions[]", + "name": "permissions", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "token_", "type": "address" }], + "name": "rescue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "reserve", + "outputs": [{ "internalType": "contract ERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "restart", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "restartTimeframe", + "outputs": [{ "internalType": "uint48", "name": "", "type": "uint48" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sReserve", + "outputs": [{ "internalType": "contract ERC4626", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newBacking", "type": "uint256" }], + "name": "setBacking", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "auctioneer_", "type": "address" }, + { "internalType": "address", "name": "teller_", "type": "address" } + ], + "name": "setBondContracts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newMinimumPremium_", "type": "uint256" }], + "name": "setMinimumPremium", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint48", "name": "newTimeframe", "type": "uint48" }], + "name": "setRestartTimeframe", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint48", "name": "newVestingPeriod_", "type": "uint48" }], + "name": "setVestingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "shutdown", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "shutdownTimestamp", + "outputs": [{ "internalType": "uint48", "name": "", "type": "uint48" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "teller", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vestingPeriod", + "outputs": [{ "internalType": "uint48", "name": "", "type": "uint48" }], + "stateMutability": "view", + "type": "function" + } + ] +} diff --git a/src/components/Sidebar/NavContent.tsx b/src/components/Sidebar/NavContent.tsx index 43658cad9..65518089f 100644 --- a/src/components/Sidebar/NavContent.tsx +++ b/src/components/Sidebar/NavContent.tsx @@ -60,7 +60,7 @@ const NavContent: React.VFC = () => { label={`Cooler Loans`} to="/lending/cooler" /> - + diff --git a/src/constants/addresses.ts b/src/constants/addresses.ts index a0cde0a4e..c9d6ed293 100644 --- a/src/constants/addresses.ts +++ b/src/constants/addresses.ts @@ -292,3 +292,8 @@ export const COOLER_CONSOLIDATION_ADDRESSES = { [NetworkId.MAINNET]: "0xB15bcb1b6593d85890f5287Baa2245B8A29F464a", [NetworkId.TESTNET_GOERLI]: "", }; + +export const EMISSION_MANAGER_ADDRESSES = { + [NetworkId.MAINNET]: "0x50f441a3387625bDA8B8081cE3fd6C04CC48C0A2", + [NetworkId.TESTNET_GOERLI]: "", +}; diff --git a/src/constants/contracts.ts b/src/constants/contracts.ts index b6557a9a9..da7380d9f 100644 --- a/src/constants/contracts.ts +++ b/src/constants/contracts.ts @@ -11,6 +11,7 @@ import { CROSS_CHAIN_BRIDGE_ADDRESSES_TESTNET, DEV_FAUCET, DISTRIBUTOR_ADDRESSES, + EMISSION_MANAGER_ADDRESSES, LIQUIDITY_REGISTRY_ADDRESSES, MIGRATOR_ADDRESSES, OLYMPUS_GOVERNANCE_ADDRESSES, @@ -33,6 +34,7 @@ import { CrossChainBridge__factory, CrossChainBridgeTestnet__factory, CrossChainMigrator__factory, + EmissionManager__factory, OlympusGovernorBravo__factory, OlympusLiquidityRegistry__factory, OlympusProV2__factory, @@ -178,3 +180,9 @@ export const COOLER_CONSOLIDATION_CONTRACT = new Contract({ name: "Cooler Consolidation Utils", addresses: COOLER_CONSOLIDATION_ADDRESSES, }); + +export const EMISSION_MANAGER_CONTRACT = new Contract({ + factory: EmissionManager__factory, + name: "Emissions Manager", + addresses: EMISSION_MANAGER_ADDRESSES, +}); diff --git a/src/views/Emission/hooks/useGetEmissionConfig.ts b/src/views/Emission/hooks/useGetEmissionConfig.ts new file mode 100644 index 000000000..c065ca8d0 --- /dev/null +++ b/src/views/Emission/hooks/useGetEmissionConfig.ts @@ -0,0 +1,41 @@ +import { useQuery } from "@tanstack/react-query"; +import { EMISSION_MANAGER_CONTRACT } from "src/constants/contracts"; +import { useTestableNetworks } from "src/hooks/useTestableNetworks"; + +export const useGetEmissionConfig = () => { + const networks = useTestableNetworks(); + const contract = EMISSION_MANAGER_CONTRACT.getEthersContract(networks.MAINNET); + const { + data = { symbol: "", reserveAddress: "" }, + isFetched, + isLoading, + } = useQuery(["getEmissionConfig", networks.MAINNET], async () => { + const baseEmissionRate = await contract.baseEmissionRate(); + const backing = await contract.backing(); + const premium = await contract.getPremium(); + const minimumPremium = await contract.minimumPremium(); + const nextSale = await contract.getNextSale(); + + //active base emissions rate change information + const rateChange = await contract.rateChange(); + + const activeMarketId = await contract.activeMarketId(); + const vestingPeriod = await contract.vestingPeriod(); + const reserves = await contract.getReserves(); + + //addresses + const tellerAddress = await contract.teller(); + const reserveAddress = await contract.reserve(); + const kernelAddress = await contract.kernel(); + const auctioneerAddress = await contract.auctioneer(); + const chregAddress = await contract.CHREG(); + const mintrAddress = await contract.MINTR(); + const priceAddress = await contract.PRICE(); + const rolesAddress = await contract.ROLES(); + const trsryAddress = await contract.TRSRY(); + + //todo + return {}; + }); + return { data, isFetched, isLoading }; +}; diff --git a/src/views/Emission/index.tsx b/src/views/Emission/index.tsx new file mode 100644 index 000000000..7847d94f6 --- /dev/null +++ b/src/views/Emission/index.tsx @@ -0,0 +1,3 @@ +export const Emission = () => { + return
Emission Manager
; +};