Skip to content

Commit

Permalink
Lh/deployments update (AztecProtocol#294)
Browse files Browse the repository at this point in the history
* feat: add element deployment + update workaround

* fix: remapping + clarity improvement data provider deployment

* fix: formatting

* fix: Add missing broadcast in element deployment s

* fix: we be formatting

Co-authored-by: cheethas <[email protected]>
  • Loading branch information
LHerskind and Maddiaa0 authored Jan 9, 2023
1 parent 5aa529b commit a81537b
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 28 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
src = 'src'
out = 'out'
libs = ['lib']
remappings = ['@openzeppelin/=lib/openzeppelin-contracts/', 'forge-std/=lib/forge-std/src', 'rollup-encoder/=lib/rollup-encoder/src']
remappings = ['@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/', 'forge-std/=lib/forge-std/src', 'rollup-encoder/=lib/rollup-encoder/src']
fuzz_runs = 256
gas_reports = ["*"]
eth-rpc-url = 'https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c'
Expand Down
30 changes: 29 additions & 1 deletion src/deployment/AggregateDeployment.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {BaseDeployment} from "./base/BaseDeployment.s.sol";
import {IRollupProcessor} from "rollup-encoder/interfaces/IRollupProcessor.sol";
import {DataProvider} from "../aztec/DataProvider.sol";

import {ElementDeployment} from "./element/ElementDeployment.s.sol";
import {CurveDeployment} from "./curve/CurveDeployment.s.sol";
import {DonationDeployment} from "./donation/DonationDeployment.s.sol";
import {ERC4626Deployment} from "./erc4626/ERC4626Deployment.s.sol";
Expand All @@ -27,11 +28,36 @@ import {CurveStethLpDeployment} from "./curve/CurveStethLpDeployment.s.sol";
contract AggregateDeployment is BaseDeployment {
address internal erc4626Bridge;

function deployAndListAll() public {
function deployAndListAll() public returns (address) {
DataProviderDeployment dataProviderDeploy = new DataProviderDeployment();
dataProviderDeploy.setUp();
address dataProvider = dataProviderDeploy.deploy();

emit log("--- Element ---");
{
ElementDeployment elementDeployment = new ElementDeployment();
elementDeployment.setUp();
address elementBridge = elementDeployment.deployAndList();

address wrappedDai = 0x3A285cbE492cB172b78E76Cf4f15cb6Fe9f162E4;

elementDeployment.registerPool(
elementBridge, 0x71628c66C502F988Fbb9e17081F2bD14e361FAF4, wrappedDai, 1634346845
);
elementDeployment.registerPool(
elementBridge, 0xA47D1251CF21AD42685Cc6B8B3a186a73Dbd06cf, wrappedDai, 1643382446
);
elementDeployment.registerPool(
elementBridge, 0xEdf085f65b4F6c155e13155502Ef925c9a756003, wrappedDai, 1651275535
);
elementDeployment.registerPool(
elementBridge, 0x8fFD1dc7C3eF65f833CF84dbCd15b6Ad7f9C54EC, wrappedDai, 1663361092
);
elementDeployment.registerPool(
elementBridge, 0x7F4A33deE068C4fA012d64677C61519a578dfA35, wrappedDai, 1677243924
);
}

emit log("--- Curve ---");
{
CurveDeployment curveDeployment = new CurveDeployment();
Expand Down Expand Up @@ -162,6 +188,8 @@ contract AggregateDeployment is BaseDeployment {
{
dataProviderDeploy.updateNames(dataProvider);
}

return dataProvider;
}

function readStats() public {
Expand Down
20 changes: 8 additions & 12 deletions src/deployment/base/BaseDeployment.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ abstract contract BaseDeployment is Test {
address internal ROLLUP_PROCESSOR;
address internal LISTER;

function setRollupProcessor(address _rollupProcessor) public {
ROLLUP_PROCESSOR = _rollupProcessor;
}

function setLister(address _lister) public {
LISTER = _lister;
}

/* solhint-enable var-name-mixedcase */

function setUp() public virtual {
Expand All @@ -67,10 +59,16 @@ abstract contract BaseDeployment is Test {
} else {
NETWORK = Network.DONT_CARE;
MODE = Mode.BROADCAST;
/* solhint-disable var-name-mixedcase */
string memory rollup_processor_key = "ROLLUP_PROCESSOR_ADDRESS";
string memory lister_key = "LISTER_ADDRESS";
/* solhint-enable var-name-mixedcase */

ROLLUP_PROCESSOR = vm.envAddress(rollup_processor_key);
LISTER = vm.envAddress(lister_key);

require(ROLLUP_PROCESSOR != address(0), "RollupProcessor address resolved to 0");
require(LISTER != address(0), "Lister address resolved to 0");
emit log_named_address("Rollup at", ROLLUP_PROCESSOR);
emit log_named_address("Lister at", LISTER);
return;
}

Expand All @@ -88,8 +86,6 @@ abstract contract BaseDeployment is Test {
/* solhint-disable custom-error-over-require */
require(ROLLUP_PROCESSOR != address(0), "RollupProcessor address resolved to 0");
require(LISTER != address(0), "Lister address resolved to 0");
emit log_named_address("Rollup at", ROLLUP_PROCESSOR);
emit log_named_address("Lister at", LISTER);
}

/**
Expand Down
17 changes: 3 additions & 14 deletions src/deployment/dataprovider/DataProviderDeployment.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,9 @@ contract DataProviderDeployment is BaseDeployment {

uint256[] memory bridgeAddressIds = new uint256[](13);
string[] memory bridgeTags = new string[](13);

bridgeAddressIds[0] = 1;
bridgeAddressIds[1] = 5;
bridgeAddressIds[2] = 6;
bridgeAddressIds[3] = 7;
bridgeAddressIds[4] = 8;
bridgeAddressIds[5] = 9;
bridgeAddressIds[6] = 10;
bridgeAddressIds[7] = 11;
bridgeAddressIds[8] = 12;
bridgeAddressIds[9] = 13;
bridgeAddressIds[10] = 14;
bridgeAddressIds[11] = 15;
bridgeAddressIds[12] = 16;
for (uint256 i = 0; i < bridgeAddressIds.length; i++) {
bridgeAddressIds[i] = i + 1;
}

bridgeTags[0] = "ElementBridge_800K";
bridgeTags[1] = "CurveStEthBridge_250K";
Expand Down
47 changes: 47 additions & 0 deletions src/deployment/element/ElementDeployment.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2022 Aztec.
pragma solidity >=0.8.4;

import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

import {BaseDeployment} from "../base/BaseDeployment.s.sol";
import {ElementBridge} from "../../bridges/element/ElementBridge.sol";

contract ElementDeployment is BaseDeployment {
address internal constant TRANCHE_FACTORY = 0x62F161BF3692E4015BefB05A03a94A40f520d1c0;
address internal constant ELEMENT_REGISTRY_ADDRESS = 0xc68e2BAb13a7A2344bb81badBeA626012C62C510;
bytes32 internal constant TRANCHE_BYTECODE_HASH = 0xf481a073666136ab1f5e93b296e84df58092065256d0db23b2d22b62c68e978d;
address internal constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;

function deployAndList() public returns (address) {
emit log("Deploying element bridge");
vm.broadcast();
ElementBridge bridge = new ElementBridge(
ROLLUP_PROCESSOR,
TRANCHE_FACTORY,
TRANCHE_BYTECODE_HASH,
BALANCER_VAULT,
ELEMENT_REGISTRY_ADDRESS
);
emit log_named_address("element bridge deployed to", address(bridge));

uint256 addressId = listBridge(address(bridge), 800000);
emit log_named_uint("Curve bridge address id", addressId);

return address(bridge);
}

function registerPool(address _bridge, address _pool, address _position, uint64 _expiry) public {
if (_expiry < block.timestamp) {
return;
}

string memory symbol = IERC20Metadata(_position).symbol();
string memory s = string(abi.encodePacked("Registering ", symbol, " pool with expiry at "));

emit log_named_uint(s, _expiry);

vm.broadcast();
ElementBridge(_bridge).registerConvergentPoolAddress(_pool, _position, _expiry);
}
}

0 comments on commit a81537b

Please sign in to comment.