Skip to content

Commit

Permalink
script: delete DeploymentLogger (#1152)
Browse files Browse the repository at this point in the history
* script: delete DeploymentLogger

* chore: remove unneeded ignored file

---------

Co-authored-by: Andrei Vlad Birgaoanu <[email protected]>
  • Loading branch information
smol-ninja and andreivladbrg authored Jan 20, 2025
1 parent 6102c04 commit 68924c3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 198 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ deployments.md
lcov.info
package-lock.json
pnpm-lock.yaml
script/*.md
yarn.lock
29 changes: 29 additions & 0 deletions script/Base.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ contract BaseScript is Script {
/// @dev The default value for `maxCountMap`.
uint256 internal constant DEFAULT_MAX_COUNT = 500;

/// @dev The address of the default Sablier admin.
address internal constant DEFAULT_SABLIER_ADMIN = 0xb1bEF51ebCA01EB12001a639bDBbFF6eEcA12B9F;

/// @dev The salt used for deterministic deployments.
bytes32 internal immutable SALT;

/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";

/// @dev Admin address mapped by the chain Id.
mapping(uint256 chainId => address admin) internal adminMap;

/// @dev The address of the transaction broadcaster.
address internal broadcaster;

Expand Down Expand Up @@ -49,9 +55,17 @@ contract BaseScript is Script {
// Construct the salt for deterministic deployments.
SALT = constructCreate2Salt();

// Populate the admin map.
populateAdminMap();

// Populate the max count map for segments and tranches.
populateMaxCountMap();

// If there is no admin set for a specific chain, use the default Sablier admin.
if (adminMap[block.chainid] == address(0)) {
adminMap[block.chainid] = DEFAULT_SABLIER_ADMIN;
}

// If there is no maximum value set for a specific chain, use the default value.
if (maxCountMap[block.chainid] == 0) {
maxCountMap[block.chainid] = DEFAULT_MAX_COUNT;
Expand Down Expand Up @@ -83,6 +97,21 @@ contract BaseScript is Script {
return json.readString(".version");
}

/// @dev Populates the admin map. The reason the chain IDs configured for the admin map do not match the other
/// maps is that we only have multisigs for the chains listed below, otherwise, the default admin is used.​
function populateAdminMap() internal {
adminMap[42_161] = 0xF34E41a6f6Ce5A45559B1D3Ee92E141a3De96376; // Arbitrum
adminMap[43_114] = 0x4735517616373c5137dE8bcCDc887637B8ac85Ce; // Avalanche
adminMap[8453] = 0x83A6fA8c04420B3F9C7A4CF1c040b63Fbbc89B66; // Base
adminMap[56] = 0x6666cA940D2f4B65883b454b7Bc7EEB039f64fa3; // BNB
adminMap[100] = 0x72ACB57fa6a8fa768bE44Db453B1CDBa8B12A399; // Gnosis
adminMap[1] = 0x79Fb3e81aAc012c08501f41296CCC145a1E15844; // Mainnet
adminMap[59_144] = 0x72dCfa0483d5Ef91562817C6f20E8Ce07A81319D; // Linea
adminMap[10] = 0x43c76FE8Aec91F63EbEfb4f5d2a4ba88ef880350; // Optimism
adminMap[137] = 0x40A518C5B9c1d3D6d62Ba789501CE4D526C9d9C6; // Polygon
adminMap[534_352] = 0x0F7Ad835235Ede685180A5c611111610813457a9; // Scroll
}

/// @dev Updates max values for segments and tranches. Values can be updated using the `update-counts.sh` script.
function populateMaxCountMap() internal {
// forgefmt: disable-start
Expand Down
7 changes: 2 additions & 5 deletions script/DeployDeterministicProtocol.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { LockupNFTDescriptor } from "../src/LockupNFTDescriptor.sol";
import { SablierBatchLockup } from "../src/SablierBatchLockup.sol";
import { SablierLockup } from "../src/SablierLockup.sol";

import { DeploymentLogger } from "./DeploymentLogger.s.sol";
import { BaseScript } from "./Base.s.sol";

/// @notice Deploys the Lockup Protocol at deterministic addresses across chains.
contract DeployDeterministicProtocol is DeploymentLogger("deterministic") {
contract DeployDeterministicProtocol is BaseScript {
/// @dev Deploys the protocol with the admin set in `adminMap`.
function run()
public
Expand All @@ -17,7 +17,6 @@ contract DeployDeterministicProtocol is DeploymentLogger("deterministic") {
returns (LockupNFTDescriptor nftDescriptor, SablierLockup lockup, SablierBatchLockup batchLockup)
{
address initialAdmin = adminMap[block.chainid];

(nftDescriptor, lockup, batchLockup) = _run(initialAdmin);
}

Expand All @@ -37,7 +36,5 @@ contract DeployDeterministicProtocol is DeploymentLogger("deterministic") {
batchLockup = new SablierBatchLockup{ salt: SALT }();
nftDescriptor = new LockupNFTDescriptor{ salt: SALT }();
lockup = new SablierLockup{ salt: SALT }(initialAdmin, nftDescriptor, maxCountMap[block.chainid]);

appendToFileDeployedAddresses(address(lockup), address(nftDescriptor), address(batchLockup));
}
}
7 changes: 2 additions & 5 deletions script/DeployProtocol.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { LockupNFTDescriptor } from "../src/LockupNFTDescriptor.sol";
import { SablierBatchLockup } from "../src/SablierBatchLockup.sol";
import { SablierLockup } from "../src/SablierLockup.sol";

import { DeploymentLogger } from "./DeploymentLogger.s.sol";
import { BaseScript } from "./Base.s.sol";

/// @notice Deploys the Lockup Protocol.
contract DeployProtocol is DeploymentLogger("non_deterministic") {
contract DeployProtocol is BaseScript {
/// @dev Deploys the protocol with the admin set in `adminMap`.
function run()
public
Expand All @@ -17,7 +17,6 @@ contract DeployProtocol is DeploymentLogger("non_deterministic") {
returns (LockupNFTDescriptor nftDescriptor, SablierLockup lockup, SablierBatchLockup batchLockup)
{
address initialAdmin = adminMap[block.chainid];

(nftDescriptor, lockup, batchLockup) = _run(initialAdmin);
}

Expand All @@ -37,7 +36,5 @@ contract DeployProtocol is DeploymentLogger("non_deterministic") {
batchLockup = new SablierBatchLockup();
nftDescriptor = new LockupNFTDescriptor();
lockup = new SablierLockup(initialAdmin, nftDescriptor, maxCountMap[block.chainid]);

appendToFileDeployedAddresses(address(lockup), address(nftDescriptor), address(batchLockup));
}
}
187 changes: 0 additions & 187 deletions script/DeploymentLogger.s.sol

This file was deleted.

0 comments on commit 68924c3

Please sign in to comment.