Skip to content

Commit d2f87fe

Browse files
feat: FeeFlowControllerUtil
1 parent 8d3bfde commit d2f87fe

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

script/11_FeeFlow.s.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ pragma solidity ^0.8.0;
44

55
import {ScriptUtils} from "./utils/ScriptUtils.s.sol";
66
import {FeeFlowController} from "fee-flow/FeeFlowController.sol";
7+
import {FeeFlowControllerUtil} from "../src/Util/FeeFlowControllerUtil.sol";
78

89
contract FeeFlow is ScriptUtils {
9-
function run() public broadcast returns (address feeFlowController) {
10+
function run() public broadcast returns (address feeFlowController, address feeFlowControllerUtil) {
1011
string memory inputScriptFileName = "11_FeeFlow_input.json";
1112
string memory outputScriptFileName = "11_FeeFlow_output.json";
1213
string memory json = getScriptFile(inputScriptFileName);
@@ -18,11 +19,12 @@ contract FeeFlow is ScriptUtils {
1819
uint256 priceMultiplier = vm.parseJsonUint(json, ".priceMultiplier");
1920
uint256 minInitPrice = vm.parseJsonUint(json, ".minInitPrice");
2021

21-
feeFlowController =
22+
(feeFlowController, feeFlowControllerUtil) =
2223
execute(evc, initPrice, paymentToken, paymentReceiver, epochPeriod, priceMultiplier, minInitPrice);
2324

2425
string memory object;
2526
object = vm.serializeAddress("feeFlow", "feeFlowController", feeFlowController);
27+
object = vm.serializeAddress("feeFlow", "feeFlowControllerUtil", feeFlowControllerUtil);
2628
vm.writeJson(object, string.concat(vm.projectRoot(), "/script/", outputScriptFileName));
2729
}
2830

@@ -34,8 +36,8 @@ contract FeeFlow is ScriptUtils {
3436
uint256 epochPeriod,
3537
uint256 priceMultiplier,
3638
uint256 minInitPrice
37-
) public broadcast returns (address feeFlowController) {
38-
feeFlowController =
39+
) public broadcast returns (address feeFlowController, address feeFlowControllerUtil) {
40+
(feeFlowController, feeFlowControllerUtil) =
3941
execute(evc, initPrice, paymentToken, paymentReceiver, epochPeriod, priceMultiplier, minInitPrice);
4042
}
4143

@@ -47,11 +49,12 @@ contract FeeFlow is ScriptUtils {
4749
uint256 epochPeriod,
4850
uint256 priceMultiplier,
4951
uint256 minInitPrice
50-
) public returns (address feeFlowController) {
52+
) public returns (address feeFlowController, address feeFlowControllerUtil) {
5153
feeFlowController = address(
5254
new FeeFlowController(
5355
evc, initPrice, paymentToken, paymentReceiver, epochPeriod, priceMultiplier, minInitPrice
5456
)
5557
);
58+
feeFlowControllerUtil = address(new FeeFlowControllerUtil(address(feeFlowController)));
5659
}
5760
}

script/50_CoreAndPeriphery.s.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,15 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
682682
console.log("- At least one of the Periphery factories contracts already deployed. Skipping...");
683683
}
684684

685-
if (peripheryAddresses.feeFlowController == address(0)) {
685+
if (
686+
peripheryAddresses.feeFlowController == address(0) && peripheryAddresses.feeFlowControllerUtil == address(0)
687+
) {
686688
address paymentToken = bridgeAddresses.oftAdapter == address(0) ? getWETHAddress() : tokenAddresses.EUL;
687689

688690
if (input.feeFlowInitPrice != 0 && paymentToken != address(0)) {
689-
console.log("+ Deploying FeeFlow...");
691+
console.log("+ Deploying FeeFlowController and FeeFlowControllerUtil...");
690692
FeeFlow deployer = new FeeFlow();
691-
peripheryAddresses.feeFlowController = deployer.deploy(
693+
(peripheryAddresses.feeFlowController, peripheryAddresses.feeFlowControllerUtil) = deployer.deploy(
692694
coreAddresses.evc,
693695
input.feeFlowInitPrice,
694696
paymentToken,
@@ -698,7 +700,9 @@ contract CoreAndPeriphery is BatchBuilder, SafeMultisendBuilder {
698700
FEE_FLOW_MIN_INIT_PRICE
699701
);
700702
} else {
701-
console.log("! feeFlowInitPrice or paymentToken is not set for FeeFlow deployment. Skipping...");
703+
console.log(
704+
"! feeFlowInitPrice or paymentToken is not set for FeeFlowController and FeeFlowControllerUtil deployment. Skipping..."
705+
);
702706
}
703707

704708
address feeReceiver = peripheryAddresses.feeFlowController == address(0)

script/utils/ScriptUtils.s.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ abstract contract PeripheryAddressesLib is ScriptExtended {
7777
address swapper;
7878
address swapVerifier;
7979
address feeFlowController;
80+
address feeFlowControllerUtil;
8081
address evkFactoryPerspective;
8182
address governedPerspective;
8283
address escrowedCollateralPerspective;
@@ -106,6 +107,7 @@ abstract contract PeripheryAddressesLib is ScriptExtended {
106107
result = vm.serializeAddress("peripheryAddresses", "swapper", Addresses.swapper);
107108
result = vm.serializeAddress("peripheryAddresses", "swapVerifier", Addresses.swapVerifier);
108109
result = vm.serializeAddress("peripheryAddresses", "feeFlowController", Addresses.feeFlowController);
110+
result = vm.serializeAddress("peripheryAddresses", "feeFlowControllerUtil", Addresses.feeFlowControllerUtil);
109111
result = vm.serializeAddress("peripheryAddresses", "evkFactoryPerspective", Addresses.evkFactoryPerspective);
110112
result = vm.serializeAddress("peripheryAddresses", "governedPerspective", Addresses.governedPerspective);
111113
result = vm.serializeAddress(
@@ -149,6 +151,7 @@ abstract contract PeripheryAddressesLib is ScriptExtended {
149151
swapper: getAddressFromJson(json, ".swapper"),
150152
swapVerifier: getAddressFromJson(json, ".swapVerifier"),
151153
feeFlowController: getAddressFromJson(json, ".feeFlowController"),
154+
feeFlowControllerUtil: getAddressFromJson(json, ".feeFlowControllerUtil"),
152155
evkFactoryPerspective: getAddressFromJson(json, ".evkFactoryPerspective"),
153156
governedPerspective: getAddressFromJson(json, ".governedPerspective"),
154157
escrowedCollateralPerspective: getAddressFromJson(json, ".escrowedCollateralPerspective"),

0 commit comments

Comments
 (0)