Skip to content

Commit

Permalink
chore: update governance submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
danielattilasimon committed Jan 13, 2025
1 parent 2cd299c commit d7f4f67
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 53 deletions.
2 changes: 1 addition & 1 deletion contracts/lib/V2-gov
51 changes: 1 addition & 50 deletions contracts/script/DeployGovernance.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,24 @@ import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol";

import {Script} from "forge-std/Script.sol";

import {PoolManager, Deployers, Hooks} from "v4-core/test/utils/Deployers.sol";
import {ICurveStableswapFactoryNG} from "V2-gov/src/interfaces/ICurveStableswapFactoryNG.sol";
import {ICurveStableswapNG} from "V2-gov/src/interfaces/ICurveStableswapNG.sol";
import {ILiquidityGauge} from "V2-gov/src/interfaces/ILiquidityGauge.sol";

import {IGovernance} from "V2-gov/src/interfaces/IGovernance.sol";

import {Governance} from "V2-gov/src/Governance.sol";
import {UniV4Donations} from "V2-gov/src/UniV4Donations.sol";
import {CurveV2GaugeRewards} from "V2-gov/src/CurveV2GaugeRewards.sol";
import {Hooks} from "V2-gov/src/utils/BaseHook.sol";

import {HookMiner} from "V2-gov/script/utils/HookMiner.sol";

import "forge-std/console2.sol";

contract DeployGovernance is Script, Deployers {
contract DeployGovernance is Script {
using Strings for *;

// Environment Constants
address internal lqty;
address internal stakingV1;

PoolManager private constant poolManager = PoolManager(0xE8E23e97Fa135823143d6b9Cba9c699040D51F70);

// Governance Constants
uint128 private constant REGISTRATION_FEE = 1000e18;
uint128 private constant REGISTRATION_THRESHOLD_FACTOR = 0.0001e18; // 0.01%
Expand All @@ -52,15 +45,13 @@ contract DeployGovernance is Script, Deployers {
// Contracts
Governance private governance;
address[] private initialInitiatives;
UniV4Donations private uniV4Donations;
CurveV2GaugeRewards private curveV2GaugeRewards;
ILiquidityGauge private gauge;

function deployGovernance(
address _deployer,
bytes32 _salt,
IERC20 _boldToken,
IERC20 _usdc,
address _curveFactoryAddress,
address _curvePoolAddress
) internal returns (address, string memory) {
Expand All @@ -82,8 +73,6 @@ contract DeployGovernance is Script, Deployers {
//console2.log(address(governance), "address(governance)");
//console2.log(governanceAddress, "governanceAddress");
assert(governanceAddress == address(governance));
// Uni V4 initiative
deployUniV4Donations(governance, _boldToken, _usdc);

// Curve initiative
if (block.chainid == 1) {
Expand Down Expand Up @@ -148,43 +137,6 @@ contract DeployGovernance is Script, Deployers {
return (governanceAddress, governanceConfiguration);
}

function deployUniV4Donations(IGovernance _governance, IERC20 _boldToken, IERC20 _usdc) private {
uint160 flags = uint160(Hooks.AFTER_INITIALIZE_FLAG | Hooks.AFTER_ADD_LIQUIDITY_FLAG);

(, bytes32 salt) = HookMiner.find(
0x4e59b44847b379578588920cA78FbF26c0B4956C,
// address(this),
flags,
type(UniV4Donations).creationCode,
abi.encode(
address(_governance),
address(_boldToken),
lqty,
block.timestamp,
EPOCH_DURATION,
address(poolManager),
address(_usdc),
FEE,
MAX_TICK_SPACING
)
);

uniV4Donations = new UniV4Donations{salt: salt}(
address(_governance),
address(_boldToken),
lqty,
block.timestamp,
EPOCH_DURATION,
address(poolManager),
address(_usdc),
FEE,
MAX_TICK_SPACING
);

assert(address(governance) == address(uniV4Donations.governance()));
initialInitiatives.push(address(uniV4Donations));
}

function deployCurveV2GaugeRewards(
IGovernance _governance,
IERC20 _boldToken,
Expand Down Expand Up @@ -232,7 +184,6 @@ contract DeployGovernance is Script, Deployers {
string.concat(
string.concat('"constants":', _getGovernanceDeploymentConstants(), ","),
string.concat('"governance":"', address(governance).toHexString(), '",'),
string.concat('"uniV4DonationsInitiative":"', address(uniV4Donations).toHexString(), '",'),
string.concat('"curveV2GaugeRewardsInitiative":"', address(curveV2GaugeRewards).toHexString(), '",'),
string.concat('"curvePool":"', _curvePoolAddress.toHexString(), '",'),
string.concat('"gauge":"', address(gauge).toHexString(), '",'),
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/DeployLiquity2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ contract DeployLiquity2Script is DeployGovernance, UniPriceConverter, StdCheats,

// Governance
(address governanceAddress, string memory governanceManifest) = deployGovernance(
deployer, SALT, deployed.boldToken, USDC, address(curveStableswapFactory), address(deployed.usdcCurvePool)
deployer, SALT, deployed.boldToken, address(curveStableswapFactory), address(deployed.usdcCurvePool)
);
address computedGovernanceAddress =
computeGovernanceAddress(deployer, SALT, deployed.boldToken, new address[](0));
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/DeployOnlyGovernance.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ contract DeployOnlyGovernance is DeployGovernance {
console2.log(deployer, "deployer");
console2.log(deployer.balance, "deployer balance");

deployGovernance(deployer, SALT, boldToken, usdc, curveFactoryAddress, usdcCurvePoolAddress);
deployGovernance(deployer, SALT, boldToken, curveFactoryAddress, usdcCurvePoolAddress);
}
}

0 comments on commit d7f4f67

Please sign in to comment.