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

Refactor: seggregate scripts by launch phase #13

Merged
merged 16 commits into from
Nov 27, 2023
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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ out/
/broadcast

# Ignores script config
/script/input/*/*.json
!/script/input/*/template-*.json
/script/output/*/*.json
/script/input/**/*.json
!/script/input/**/template-*.json
/script/output/**/*.json

# Docs
docs/
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ src = 'src'
out = 'out'
script = 'script'
libs = ['lib']
solc_version = '0.8.19'
solc_version = '0.8.16'
optimizer = true
fs_permissions = [
{ access = "read", path = "./out/" },
Expand Down
98 changes: 0 additions & 98 deletions script/02-StakingRewardsInit.s.sol

This file was deleted.

2 changes: 1 addition & 1 deletion script/dependencies/SDAODeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;
pragma solidity ^0.8.16;

import {ScriptTools} from "dss-test/ScriptTools.sol";
import {SDAO} from "../../src/SDAO.sol";
Expand Down
6 changes: 3 additions & 3 deletions script/dependencies/StakingRewardsDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;
pragma solidity ^0.8.16;

import {StakingRewards} from "../../src/synthetix/StakingRewards.sol";

Expand All @@ -24,7 +24,7 @@ struct StakingRewardsDeployParams {
}

library StakingRewardsDeploy {
function deploy(StakingRewardsDeployParams memory p) internal returns (address farm) {
farm = address(new StakingRewards(p.owner, address(0), p.rewardsToken, p.stakingToken));
function deploy(StakingRewardsDeployParams memory p) internal returns (address rewards) {
rewards = address(new StakingRewards(p.owner, address(0), p.rewardsToken, p.stakingToken));
}
}
30 changes: 15 additions & 15 deletions script/dependencies/StakingRewardsInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;

interface StakingRewardsLike {
function setRewardsDistribution(address _rewardsDistribution) external;

function acceptOwnership() external;

function nominateNewOwner(address _owner) external;
}
pragma solidity ^0.8.16;

struct StakingRewardsInitParams {
address dist;
Expand All @@ -32,17 +24,25 @@ struct StakingRewardsNominateNewOwnerParams {
}

library StakingRewardsInit {
function init(address farm, StakingRewardsInitParams memory p) internal {
StakingRewardsLike(farm).setRewardsDistribution(p.dist);
function init(address rewards, StakingRewardsInitParams memory p) internal {
StakingRewardsLike(rewards).setRewardsDistribution(p.dist);
}

/// @dev `StakingRewards` ownership transfer is a 2-step process: nominate + acceptance.
function nominateNewOwner(address farm, StakingRewardsNominateNewOwnerParams memory p) internal {
StakingRewardsLike(farm).nominateNewOwner(p.newOwner);
function nominateNewOwner(address rewards, StakingRewardsNominateNewOwnerParams memory p) internal {
StakingRewardsLike(rewards).nominateNewOwner(p.newOwner);
}

/// @dev `StakingRewards` ownership transfer requires the new owner to explicitly accept it.
function acceptOwnership(address farm) internal {
StakingRewardsLike(farm).acceptOwnership();
function acceptOwnership(address rewards) internal {
StakingRewardsLike(rewards).acceptOwnership();
}
}

interface StakingRewardsLike {
function setRewardsDistribution(address _rewardsDistribution) external;

function acceptOwnership() external;

function nominateNewOwner(address _owner) external;
}
2 changes: 1 addition & 1 deletion script/dependencies/SubProxyDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;
pragma solidity ^0.8.16;

import {ScriptTools} from "dss-test/ScriptTools.sol";
import {SubProxy} from "../../src/SubProxy.sol";
Expand Down
10 changes: 5 additions & 5 deletions script/dependencies/SubProxyInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;
pragma solidity ^0.8.16;

import {ScriptTools} from "dss-test/ScriptTools.sol";
import {DssInstance, MCD} from "dss-test/MCD.sol";

interface SubProxyLike {
function rely(address who) external;
}

struct SubProxyInitParams {
address chainlog;
string name;
Expand All @@ -42,3 +38,7 @@ library SubProxyInit {
mcd.chainlog.setAddress(string.concat("SUBPROXY_", name).stringToBytes32(), subProxy);
}
}

interface SubProxyLike {
function rely(address who) external;
}
36 changes: 16 additions & 20 deletions script/dependencies/VestInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;

import {ScriptTools} from "dss-test/ScriptTools.sol";

interface DssVestLike {
function file(bytes32 _what, uint256 _data) external;

function create(
address _usr,
uint256 _tot,
uint256 _bgn,
uint256 _tau,
uint256 _eta,
address _mgr
) external returns (uint256 id);

function restrict(uint256 _id) external;
}
pragma solidity ^0.8.16;

struct VestInitParams {
uint256 cap;
Expand All @@ -45,8 +28,6 @@ struct VestCreateParams {
}

library VestInit {
using ScriptTools for string;

function init(address vest, VestInitParams memory p) internal {
DssVestLike(vest).file("cap", p.cap);
}
Expand All @@ -64,3 +45,18 @@ library VestInit {
DssVestLike(vest).restrict(vestId);
}
}

interface DssVestLike {
function file(bytes32 _what, uint256 _data) external;

function create(
address _usr,
uint256 _tot,
uint256 _bgn,
uint256 _tau,
uint256 _eta,
address _mgr
) external returns (uint256 id);

function restrict(uint256 _id) external;
}
6 changes: 3 additions & 3 deletions script/dependencies/VestedRewardsDistributionDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;
pragma solidity ^0.8.16;

import {ScriptTools} from "dss-test/ScriptTools.sol";
import {VestedRewardsDistribution} from "../../src/VestedRewardsDistribution.sol";
Expand All @@ -22,12 +22,12 @@ struct VestedRewardsDistributionDeployParams {
address deployer;
address owner;
address vest;
address farm;
address rewards;
}

library VestedRewardsDistributionDeploy {
function deploy(VestedRewardsDistributionDeployParams memory p) internal returns (address dist) {
dist = address(new VestedRewardsDistribution(p.vest, p.farm));
dist = address(new VestedRewardsDistribution(p.vest, p.rewards));

ScriptTools.switchOwner(dist, p.deployer, p.owner);
}
Expand Down
10 changes: 5 additions & 5 deletions script/dependencies/VestedRewardsDistributionInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;

interface VestedRewardsDistributionLike {
function file(bytes32 what, uint256 data) external;
}
pragma solidity ^0.8.16;

struct VestedRewardsDistributionInitParams {
uint256 vestId;
Expand All @@ -28,3 +24,7 @@ library VestedRewardsDistributionInit {
VestedRewardsDistributionLike(dist).file("vestId", p.vestId);
}
}

interface VestedRewardsDistributionLike {
function file(bytes32 what, uint256 data) external;
}
Loading