Skip to content

Commit

Permalink
feat: send owner as constructor arg
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChin committed Nov 20, 2024
1 parent 651e06e commit cc7667c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
15 changes: 13 additions & 2 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ contract Deploy is Script {
uint256 public constant CHAIN_ARBITRUM_SEPOLIA = 421_614;

address public constant GRATEFUL_MULTISIG = 0xbC4d66e4FA462d4deeb77495E7Aa51Bb8034710b;
address public constant DEV_ADDRESS = 0xe84DbC4EE14b0360B7bF87c7d30Cd0604E0e1E0F;

/*//////////////////////////////////////////////////////////////
STRUCTS
Expand All @@ -41,6 +42,7 @@ contract Deploy is Script {

struct DeploymentParams {
address[] tokens;
address owner;
IPool aavePool;
uint256 initialFee;
uint256 initialPerformanceFee;
Expand Down Expand Up @@ -84,6 +86,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand Down Expand Up @@ -117,6 +120,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0x794a61358D6845594F94dc1DB02A252b5b4814aD),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand Down Expand Up @@ -150,6 +154,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0x794a61358D6845594F94dc1DB02A252b5b4814aD),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand Down Expand Up @@ -183,6 +188,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0x794a61358D6845594F94dc1DB02A252b5b4814aD),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand Down Expand Up @@ -210,6 +216,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0x6807dc923806fE8Fd134338EABCA509979a7e0cB),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand All @@ -228,6 +235,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0xb50201558B00496A145fE76f7424749556E326D8),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand All @@ -249,6 +257,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: GRATEFUL_MULTISIG,
aavePool: IPool(0xA238Dd80C259a72e81d7e4664a9801593F98d1c5),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand All @@ -267,6 +276,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: DEV_ADDRESS,
aavePool: IPool(0xb50201558B00496A145fE76f7424749556E326D8),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand All @@ -285,6 +295,7 @@ contract Deploy is Script {

params = DeploymentParams({
tokens: _tokens,
owner: DEV_ADDRESS,
aavePool: IPool(0xBfC91D59fdAA134A4ED45f7B584cAf96D7792Eff),
initialFee: 0.01 ether, // 1%
initialPerformanceFee: 0.05 ether, // 5%
Expand All @@ -302,8 +313,8 @@ contract Deploy is Script {
vm.startBroadcast();
}

grateful = new Grateful(_params.tokens, _params.aavePool, _params.initialFee, _params.initialPerformanceFee);
grateful.transferOwnership(GRATEFUL_MULTISIG);
grateful =
new Grateful(_params.tokens, _params.aavePool, _params.initialFee, _params.initialPerformanceFee, _params.owner);

// Deploy vaults and add them to Grateful
uint256 vaultsLength = _params.vaults.length;
Expand Down
6 changes: 4 additions & 2 deletions src/contracts/Grateful.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ contract Grateful is IGrateful, Ownable2Step, ReentrancyGuard {
* @param _tokens Array of token addresses to whitelist.
* @param _aavePool Address of the Aave V3 pool.
* @param _initialFee Initial fee in fixed-point (1 ether = 100%).
* @param _owner Address of the contract owner.
*/
constructor(
address[] memory _tokens,
IPool _aavePool,
uint256 _initialFee,
uint256 _initialPerformanceFee
) Ownable(msg.sender) {
uint256 _initialPerformanceFee,
address _owner

Check warning on line 113 in src/contracts/Grateful.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Variable "_owner" is unused
) Ownable(_owner) {
if (address(_aavePool) == address(0)) {
revert Grateful_InvalidAddress();
}
Expand Down
6 changes: 4 additions & 2 deletions test/integration/IntegrationBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract IntegrationBase is Test, Deploy {
address internal _user = makeAddr("user");
address internal _merchant = makeAddr("merchant");
address internal _merchant2 = makeAddr("user2");
address internal _owner = makeAddr("owner");
address internal _owner;
address internal _gratefulAutomation = makeAddr("gratefulAutomation");

// Tokens array
Expand All @@ -64,11 +64,13 @@ contract IntegrationBase is Test, Deploy {

// Use fork block from deployment parameters
vm.createSelectFork(vm.rpcUrl(forkedNetwork), forkBlock);
vm.startPrank(_owner);

// Get deployment parameters
DeploymentParams memory params = getDeploymentParams(block.chainid);

_owner = params.owner;
vm.startPrank(_owner);

// Copy tokens to storage variable _tokens
uint256 tokensLength = params.tokens.length;
_tokens = new address[](tokensLength);
Expand Down

0 comments on commit cc7667c

Please sign in to comment.