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

feat(Rewards): add deploy script #42

Merged
merged 3 commits into from
Jul 15, 2024
Merged
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
2 changes: 1 addition & 1 deletion script/DeployNodlMigration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Script, console} from "forge-std/Script.sol";
import {NODL} from "../src/NODL.sol";
import {NODLMigration} from "../src/bridge/NODLMigration.sol";

contract DeployClick is Script {
contract DeployNodlMigration is Script {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oopsie! Thanks 🙈

address[] internal voters;
address internal withdrawer;

Expand Down
42 changes: 42 additions & 0 deletions script/DeployRewards.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear

pragma solidity 0.8.23;

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

import {NODL} from "../src/NODL.sol";
import {Rewards} from "../src/Rewards.sol";

contract DeployRewards is Script {
address internal nodlAddress;
address internal oracleAddress;
uint256 internal rewardQuotaPerPeriod;
uint256 internal rewardPeriod;
uint256 internal batchSubmitterIncentive; // in percentage of total rewards in a batch. 1 = 1%

function setUp() public {
nodlAddress = vm.envOr("N_TOKEN_ADDR", address(0));
oracleAddress = vm.envAddress("N_REWARDS_ORACLE_ADDR");
rewardQuotaPerPeriod = vm.envUint("N_REWARDS_QUOTA");
rewardPeriod = vm.envUint("N_REWARDS_PERIOD");
batchSubmitterIncentive = vm.envUint("N_REWARDS_SUBMITTER_INCENTIVE");
}

function run() public {
vm.startBroadcast();
if (nodlAddress == address(0)) {
NODL token = new NODL();
nodlAddress = address(token);
console.log("Deployed NODL at %s", nodlAddress);
}

NODL nodl = NODL(nodlAddress);
Rewards rewards = new Rewards(nodl, rewardQuotaPerPeriod, rewardPeriod, oracleAddress, batchSubmitterIncentive);
address rewardsAddress = address(rewards);
nodl.grantRole(nodl.MINTER_ROLE(), rewardsAddress);

vm.stopBroadcast();

console.log("Deployed Rewards at %s", rewardsAddress);
}
}