Skip to content

Commit

Permalink
chore: Polygon Emissions Controller contract deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Dec 6, 2021
1 parent bb8b871 commit 23c8a44
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion contracts/emissions/VotiumBribeForwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ImmutableModule } from "../shared/ImmutableModule.sol";
* @title VotiumBribeForwarder
* @author mStable
* @notice Uses reward tokens to bribe vlCVX holders to vote for a Curve gauge using Votium.
* @dev VotiumBribe contract on Mainnet, Polygon, Fantom: 0x19bbc3463dd8d07f55438014b021fb457ebd4595
* @dev VotiumBribe contract on Mainnet: 0x19bbc3463dd8d07f55438014b021fb457ebd4595
* @dev VERSION: 1.0
* DATE: 2021-11-03
*/
Expand Down
7 changes: 3 additions & 4 deletions tasks/deployEmissionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ task("deploy-emissions-polly", "Deploys L2EmissionsController and L2 Bridge Reci

const disperseForwarder = await deployDisperseForwarder(signer, hre)
console.log(`Set PBAL bridgeRecipient to ${disperseForwarder.address}`)

const votiumBribeForwarder = await deployVotiumBribeForwarder(signer, hre)
console.log(`Set ? bridgeRecipient to ${votiumBribeForwarder.address}`)

})

task("deploy-emissions")
Expand All @@ -44,6 +40,9 @@ task("deploy-emissions")
const emissionsController = await deployEmissionsController(signer, hre)

console.log(`Set RewardsDistributor in the networkAddressFactory to ${emissionsController.address}`)

const votiumBribeForwarder = await deployVotiumBribeForwarder(signer, hre)
console.log(`Set VotiumForwarder to ${votiumBribeForwarder.address}`)
})

task("deploy-bridge-forwarder", "Deploys a BridgeForwarder contract on mainnet for Polygon dials.")
Expand Down
24 changes: 16 additions & 8 deletions tasks/utils/emissions-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DisperseForwarder,
DisperseForwarder__factory,
VotiumBribeForwarder,
VotiumBribeForwarder__factory,
VotiumBribeForwarder__factory,
EmissionsController,
EmissionsController__factory,
L2BridgeRecipient,
Expand Down Expand Up @@ -139,7 +139,7 @@ export const deployL2EmissionsController = async (signer: Signer, hre: HardhatRu

const nexusAddress = resolveAddress("Nexus", chain)
const proxyAdminAddress = resolveAddress("DelayedProxyAdmin", chain)
const mtaAddress = MTA.address
const mtaAddress = resolveAddress("MTA", chain)

// Deploy logic contract
const constructorArguments = [nexusAddress, mtaAddress]
Expand Down Expand Up @@ -172,7 +172,8 @@ export const deployL2BridgeRecipients = async (
hre: HardhatRuntimeEnvironment,
l2EmissionsControllerAddress: string,
): Promise<L2BridgeRecipient> => {
const mtaAddress = MTA.address
const chain = getChain(hre)
const mtaAddress = resolveAddress("MTA", chain)
const constructorArguments = [mtaAddress, l2EmissionsControllerAddress]

const bridgeRecipient = await deployContract<L2BridgeRecipient>(new L2BridgeRecipient__factory(signer), "L2BridgeRecipient", [
Expand All @@ -193,10 +194,14 @@ export const deployDisperseForwarder = async (signer: Signer, hre: HardhatRuntim
const chain = getChain(hre)
const nexusAddress = resolveAddress("Nexus", chain)
const disperseAddress = resolveAddress("Disperse", chain)
const mtaAddress = MTA.address
const constructorArguments = [nexusAddress, disperseAddress, mtaAddress]
const mtaAddress = resolveAddress("MTA", chain)
const constructorArguments = [nexusAddress, mtaAddress, disperseAddress]

const disperseForwarder = await deployContract<DisperseForwarder>(new DisperseForwarder__factory(signer), "DisperseForwarder", constructorArguments)
const disperseForwarder = await deployContract<DisperseForwarder>(
new DisperseForwarder__factory(signer),
"DisperseForwarder",
constructorArguments,
)

await verifyEtherscan(hre, {
address: disperseForwarder.address,
Expand All @@ -208,14 +213,17 @@ export const deployDisperseForwarder = async (signer: Signer, hre: HardhatRuntim
}

export const deployVotiumBribeForwarder = async (signer: Signer, hre: HardhatRuntimeEnvironment): Promise<VotiumBribeForwarder> => {

const chain = getChain(hre)
const nexusAddress = resolveAddress("Nexus", chain)
const votiumBribeAddress = resolveAddress("VotiumBribe", chain)
const mtaAddress = MTA.address
const constructorArguments = [nexusAddress, mtaAddress, votiumBribeAddress]

const votiumBribeForwarder = await deployContract<VotiumBribeForwarder>(new VotiumBribeForwarder__factory(signer), "VotiumBribeForwarder", constructorArguments)
const votiumBribeForwarder = await deployContract<VotiumBribeForwarder>(
new VotiumBribeForwarder__factory(signer),
"VotiumBribeForwarder",
constructorArguments,
)

await verifyEtherscan(hre, {
address: votiumBribeForwarder.address,
Expand Down
16 changes: 14 additions & 2 deletions tasks/utils/networkAddressFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const contractNames = [
"AlchemixStakingPool",
"CompController",
"CurveRegistryExchange",
"Disperse",
"QuickSwapRouter",
"UniswapRouterV3",
"UniswapQuoterV3",
Expand All @@ -58,6 +59,8 @@ export const contractNames = [
"ENSResolver",
"FraxVault",
"VisorRouter",
"VotiumBribe",
"VotiumForwarder",
] as const
export type ContractNames = typeof contractNames[number]

Expand Down Expand Up @@ -157,6 +160,8 @@ export const getChainAddress = (contractName: ContractNames, chain: Chain): stri
return "0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B"
case "CurveRegistryExchange":
return "0xD1602F68CC7C4c7B59D686243EA35a9C73B0c6a2"
case "Disperse":
return "0xD152f549545093347A162Dce210e7293f1452150"
case "UniswapRouterV3":
return "0xE592427A0AEce92De3Edee1F18E0157C05861564"
case "UniswapQuoterV3":
Expand All @@ -175,6 +180,10 @@ export const getChainAddress = (contractName: ContractNames, chain: Chain): stri
return "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41"
case "VisorRouter":
return "0xF3f4F4e17cC65BDC36A36fDa5283F8D8020Ad0a4"
case "VotiumBribe":
return "0x19bbc3463dd8d07f55438014b021fb457ebd4595"
case "VotiumForwarder":
return DEAD_ADDRESS
default:
}
} else if (chain === Chain.polygon) {
Expand Down Expand Up @@ -202,10 +211,14 @@ export const getChainAddress = (contractName: ContractNames, chain: Chain): stri
return "0xc929E040b6C8F2fEFE6B45c6bFEB55508554F3E2"
case "FeederInterestValidator":
return "0x4A268958BC2f0173CDd8E0981C4c0a259b5cA291"
case "L2EmissionsController":
return "0x82182Ac492fef111FB458FCe8f4228553Ed59a19"
case "AaveIncentivesController":
return "0x357D51124f59836DeD84c8a1730D72B749d8BC23"
case "AaveLendingPoolAddressProvider":
return "0xd05e3E715d945B59290df0ae8eF85c1BdB684744"
case "Disperse":
return "0xD152f549545093347A162Dce210e7293f1452150"
case "QuickSwapRouter":
return "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff"
case "MStableYieldSource":
Expand Down Expand Up @@ -339,8 +352,7 @@ export const resolveAddress = (
if (!address) {
// If a token Symbol
const token = tokens.find((t) => t.symbol === addressContractNameSymbol && t.chain === chain)
if (!token)
throw Error(`Invalid approve address, token symbol or contract name "${addressContractNameSymbol}" for chain ${chain}`)
if (!token) throw Error(`Invalid address, token symbol or contract name "${addressContractNameSymbol}" for chain ${chain}`)
if (!token[tokenType])
throw Error(`Can not find token type "${tokenType}" for "${addressContractNameSymbol}" on chain ${chain}`)

Expand Down
4 changes: 2 additions & 2 deletions tasks/utils/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const PmUSD: Token = {
vault: "0x32aBa856Dc5fFd5A56Bcd182b13380e5C855aa29",
platformTokenVendor: "0x7b19a4f4ee26037ffef77bc7d99f56209acc8db1",
bridgeForwarder: DEAD_ADDRESS, // TODO after deployment,
bridgeRecipient: DEAD_ADDRESS, // TODO after deployment
bridgeRecipient: "0xd3778a18Ee00a6368A0e5D545cB3412886e5a04c",
}
export const MmUSD: Token = {
symbol: "mUSD",
Expand Down Expand Up @@ -480,7 +480,7 @@ export const PBAL: Token = {
quantityFormatter: "USD",
bridgeForwarder: DEAD_ADDRESS,
// The DisperseForwarder contract on Polygon
bridgeRecipient: DEAD_ADDRESS,
bridgeRecipient: "0x5783458E67B380d19a84514F11054ABDc326EB07",
}

export const RBAL: Token = {
Expand Down

0 comments on commit 23c8a44

Please sign in to comment.