Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy: SimpleFeeCollect Module deployed on all networks #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"StepwiseCollectModule": "0x210c94877dcfceda8238acd382372278844a54d7",
"ERC4626FeeCollectModule": "0x394fd100b13197787023ef4cf318cde456545db7",
"AaveFeeCollectModule": "0xa94713d0688c8a483c3352635cec4e0ce88d6a29",
"TokenGatedReferenceModule": "0x3d7f4f71a90fe5a9d13fab2716080f2917cf88f3"
"TokenGatedReferenceModule": "0x3d7f4f71a90fe5a9d13fab2716080f2917cf88f3",
"SimpleFeeCollectModule": "0x54325d507ed1b3776c146700eff61a98b45aec76"
},
"testnet": {
"chainId": 80001,
Expand All @@ -25,7 +26,8 @@
"StepwiseCollectModule": "0x7a7b8e7699e0492da1d3c7eab7e2f3bf1065aa40",
"ERC4626FeeCollectModule": "0x79697402bd2caa19a53d615fb1a30a98e35b84d5",
"AaveFeeCollectModule": "0x912860ed4ed6160c48a52d52fcab5c059d34fe5a",
"TokenGatedReferenceModule": "0xb4ba8dccd35bd3dcc5d58dbb9c7dff9c9268add9"
"TokenGatedReferenceModule": "0xb4ba8dccd35bd3dcc5d58dbb9c7dff9c9268add9",
"SimpleFeeCollectModule": "0xb4a9874adc790eec88fd086e43d329bbc9520efd"
},
"sandbox": {
"chainId": 80001,
Expand All @@ -39,6 +41,7 @@
"StepwiseCollectModule": "0x6928d6127dfa0da401737e6ff421fcf62d5617a3",
"ERC4626FeeCollectModule": "0x31126c602cf88193825a99dcd1d17bf1124b1b4f",
"AaveFeeCollectModule": "0x666e06215747879ee68b3e5a317dcd8411de1897",
"TokenGatedReferenceModule": "0x86d35562ceb9f10d7c2c23c098dfeacb02f53853"
"TokenGatedReferenceModule": "0x86d35562ceb9f10d7c2c23c098dfeacb02f53853",
"SimpleFeeCollectModule": "0xbeac9c00383d04054dbc82a44f8dc8d9be995fd8"
}
}
19 changes: 19 additions & 0 deletions script/deploy-module.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.10;
import 'forge-std/Script.sol';
import 'forge-std/StdJson.sol';
import {StepwiseCollectModule} from 'contracts/collect/StepwiseCollectModule.sol';
import {SimpleFeeCollectModule} from 'contracts/collect/SimpleFeeCollectModule.sol';
import {MultirecipientFeeCollectModule} from 'contracts/collect/MultirecipientFeeCollectModule.sol';
import {AaveFeeCollectModule} from 'contracts/collect/AaveFeeCollectModule.sol';
import {ERC4626FeeCollectModule} from 'contracts/collect/ERC4626FeeCollectModule.sol';
Expand Down Expand Up @@ -94,6 +95,24 @@ contract DeployMultirecipientFeeCollectModule is DeployBase {
}
}

contract DeploySimpleFeeCollectModule is DeployBase {
function deploy() internal override returns (address) {
console.log('\nContract: SimpleFeeCollectModule');
console.log('Init params:');
console.log('\tLensHubProxy:', lensHubProxy);
console.log('\tModuleGlobals:', moduleGlobals);

vm.startBroadcast(deployerPrivateKey);
SimpleFeeCollectModule module = new SimpleFeeCollectModule(lensHubProxy, moduleGlobals);
vm.stopBroadcast();

console.log('Constructor arguments:');
console.logBytes(abi.encode(lensHubProxy, moduleGlobals));

return address(module);
}
}

import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';

contract DeployAaveFeeCollectModule is DeployBase {
Expand Down
8 changes: 6 additions & 2 deletions test/foundry/BaseSetup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ contract BaseSetup is Test, ForkManagement {
uint256 firstProfileId;
address deployer;
address governance;
address modulesGovernance;
address treasury;

address constant publisher = address(4);
Expand Down Expand Up @@ -109,6 +110,7 @@ contract BaseSetup is Test, ForkManagement {

governance = hub.getGovernance();
treasury = moduleGlobals.getTreasury();
modulesGovernance = moduleGlobals.getGovernance();

TREASURY_FEE_BPS = moduleGlobals.getTreasuryFee();
}
Expand All @@ -118,6 +120,7 @@ contract BaseSetup is Test, ForkManagement {
deployer = address(1);
governance = address(2);
treasury = address(3);
modulesGovernance = address(4);

TREASURY_FEE_BPS = 50;

Expand Down Expand Up @@ -149,7 +152,7 @@ contract BaseSetup is Test, ForkManagement {
// Deploy the FreeCollectModule.
freeCollectModule = new FreeCollectModule(hubProxyAddr);

moduleGlobals = new ModuleGlobals(governance, treasury, TREASURY_FEE_BPS);
moduleGlobals = new ModuleGlobals(modulesGovernance, treasury, TREASURY_FEE_BPS);

currency = new Currency();
nft = new NFT();
Expand Down Expand Up @@ -189,11 +192,12 @@ contract BaseSetup is Test, ForkManagement {

// Whitelist the test contract as a profile creator
hub.whitelistProfileCreator(me, true);
vm.stopPrank();

// Whitelist mock currency in ModuleGlobals
vm.prank(modulesGovernance);
moduleGlobals.whitelistCurrency(address(currency), true);

vm.stopPrank();
///////////////////////////////////////// End governance actions.
}

Expand Down
21 changes: 17 additions & 4 deletions test/foundry/collect/BaseFeeCollectModule.base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {SimpleFeeCollectModule} from 'contracts/collect/SimpleFeeCollectModule.s
import {BaseFeeCollectModuleInitData} from 'contracts/collect/base/IBaseFeeCollectModule.sol';

contract BaseFeeCollectModuleBase is BaseSetup {
using stdJson for string;
address baseFeeCollectModule;
SimpleFeeCollectModule simpleFeeCollectModule;

BaseFeeCollectModuleInitData exampleInitData;

Expand All @@ -16,10 +18,21 @@ contract BaseFeeCollectModuleBase is BaseSetup {

// Deploy & Whitelist BaseFeeCollectModule
constructor() BaseSetup() {
vm.prank(deployer);
baseFeeCollectModule = address(
new SimpleFeeCollectModule(hubProxyAddr, address(moduleGlobals))
);
if (fork && keyExists(string(abi.encodePacked('.', forkEnv, '.SimpleFeeCollectModule')))) {
simpleFeeCollectModule = SimpleFeeCollectModule(
json.readAddress(string(abi.encodePacked('.', forkEnv, '.SimpleFeeCollectModule')))
);
baseFeeCollectModule = address(simpleFeeCollectModule);
console.log(
'Testing against already deployed module at:',
address(baseFeeCollectModule)
);
} else {
vm.prank(deployer);
baseFeeCollectModule = address(
new SimpleFeeCollectModule(hubProxyAddr, address(moduleGlobals))
);
}
vm.prank(governance);
hub.whitelistCollectModule(address(baseFeeCollectModule), true);
}
Expand Down
4 changes: 2 additions & 2 deletions test/foundry/collect/BaseFeeCollectModule.test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ contract BaseFeeCollectModule_FeeDistribution is BaseFeeCollectModuleBase {
}

function verifyFeesWithoutMirror(uint16 treasuryFee, uint128 amount) public {
vm.prank(governance);
vm.prank(modulesGovernance);
moduleGlobals.setTreasuryFee(treasuryFee);
(uint256 pubId, ) = hubPostAndMirror(0, amount);

Expand Down Expand Up @@ -676,7 +676,7 @@ contract BaseFeeCollectModule_FeeDistribution is BaseFeeCollectModuleBase {
uint16 referralFee,
uint128 amount
) public {
vm.prank(governance);
vm.prank(modulesGovernance);
moduleGlobals.setTreasuryFee(treasuryFee);
(, uint256 mirrorId) = hubPostAndMirror(referralFee, amount);

Expand Down
6 changes: 3 additions & 3 deletions test/foundry/collect/StepwiseCollectModule.test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ contract StepwiseCollectModule_FeeDistribution is StepwiseCollectModuleBase {
}

function verifyFeesWithoutMirror(uint16 treasuryFee, uint128 amount) public {
vm.prank(governance);
vm.prank(modulesGovernance);
moduleGlobals.setTreasuryFee(treasuryFee);
(uint256 pubId, ) = hubPostAndMirror(exampleInitData, 0, amount);

Expand Down Expand Up @@ -718,7 +718,7 @@ contract StepwiseCollectModule_FeeDistribution is StepwiseCollectModuleBase {
uint16 referralFee,
uint128 amount
) public {
vm.prank(governance);
vm.prank(modulesGovernance);
moduleGlobals.setTreasuryFee(treasuryFee);
(uint256 pubId, uint256 mirrorId) = hubPostAndMirror(exampleInitData, referralFee, amount);

Expand Down Expand Up @@ -903,7 +903,7 @@ contract StepwiseCollectModule_StepwiseCurveFormula is StepwiseCollectModuleBase
})
);

vm.prank(governance);
vm.prank(modulesGovernance);
moduleGlobals.setTreasuryFee(0);
}

Expand Down