Skip to content

Commit

Permalink
refactor: remove struct in script
Browse files Browse the repository at this point in the history
docs: fix typo in comments
  • Loading branch information
PaulRBerg committed Oct 19, 2023
1 parent d97d7f2 commit 90c6212
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/v2-core
Submodule v2-core updated 48 files
+330 −318 .gas-snapshot
+0 −2 .solhint.json
+2 −6 CHANGELOG.md
+6 −6 README.md
+1 −0 foundry.toml
+3 −3 package.json
+78 −91 pnpm-lock.yaml
+1 −0 shell/prepare-artifacts.sh
+30 −22 src/SablierV2LockupDynamic.sol
+30 −22 src/SablierV2LockupLinear.sol
+4 −4 src/abstracts/NoDelegateCall.sol
+10 −9 src/abstracts/SablierV2Lockup.sol
+3 −6 src/interfaces/ISablierV2Lockup.sol
+27 −0 src/interfaces/hooks/ISablierV2LockupSender.sol
+4 −0 test/Base.t.sol
+16 −16 test/fork/Fork.t.sol
+17 −18 test/fork/LockupDynamic.t.sol
+17 −18 test/fork/LockupLinear.t.sol
+4 −4 test/fork/assets/DAI.t.sol
+4 −4 test/fork/assets/EURS.t.sol
+4 −4 test/fork/assets/SHIB.t.sol
+4 −4 test/fork/assets/USDC.t.sol
+4 −4 test/fork/assets/USDT.t.sol
+6 −0 test/integration/Integration.t.sol
+0 −2 test/integration/concrete/lockup/burn/burn.t.sol
+51 −6 test/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol
+16 −6 test/integration/concrete/lockup/cancel-multiple/cancelMultiple.tree
+213 −8 test/integration/concrete/lockup/cancel/cancel.t.sol
+61 −28 test/integration/concrete/lockup/cancel/cancel.tree
+1 −6 test/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol
+2 −8 test/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol
+4 −19 test/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol
+2 −12 test/integration/concrete/lockup/withdraw/withdraw.t.sol
+1 −1 test/integration/concrete/nft-descriptor/generateAccentColor.t.sol
+1 −1 test/integration/fuzz/lockup-dynamic/withdraw.t.sol
+68 −2 test/integration/fuzz/lockup/cancel.t.sol
+0 −2 test/integration/fuzz/lockup/cancelMultiple.t.sol
+2 −4 test/integration/fuzz/lockup/withdraw.t.sol
+1 −7 test/integration/fuzz/lockup/withdrawMax.t.sol
+1 −6 test/integration/fuzz/lockup/withdrawMaxAndTransfer.t.sol
+2 −2 test/integration/fuzz/lockup/withdrawMultiple.t.sol
+27 −1 test/integration/shared/lockup/cancel.t.sol
+1 −1 test/integration/shared/lockup/cancelMultiple.t.sol
+21 −0 test/mocks/hooks/GoodSender.sol
+22 −0 test/mocks/hooks/ReentrantSender.sol
+22 −0 test/mocks/hooks/RevertingSender.sol
+2 −3 test/utils/Events.sol
+4 −4 test/utils/Precompiles.sol
30 changes: 13 additions & 17 deletions script/DeployDeterministicPeriphery.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ import { SablierV2ProxyTargetPush } from "../src/SablierV2ProxyTargetPush.sol";
///
/// @dev Reverts if any contract has already been deployed.
contract DeployDeterministicPeriphery is BaseScript {
struct DeployedContracts {
SablierV2Batch batch;
SablierV2MerkleStreamerFactory merkleStreamerFactory;
SablierV2ProxyTargetApprove targetApprove;
SablierV2ProxyTargetPermit2 targetPermit2;
SablierV2ProxyTargetPush targetPush;
}

/// @dev The presence of the salt instructs Forge to deploy the contract via a deterministic CREATE2 factory.
/// https://github.com/Arachnid/deterministic-deployment-proxy
function run(
Expand All @@ -37,15 +29,19 @@ contract DeployDeterministicPeriphery is BaseScript {
public
virtual
broadcast
returns (DeployedContracts memory deployedContracts)
returns (
SablierV2Batch batch,
SablierV2MerkleStreamerFactory merkleStreamerFactory,
SablierV2ProxyTargetApprove targetApprove,
SablierV2ProxyTargetPermit2 targetPermit2,
SablierV2ProxyTargetPush targetPush
)
{
deployedContracts.batch = new SablierV2Batch{ salt: bytes32(abi.encodePacked(create2Salt)) }();
deployedContracts.merkleStreamerFactory =
new SablierV2MerkleStreamerFactory{ salt: bytes32(abi.encodePacked(create2Salt)) }();
deployedContracts.targetApprove =
new SablierV2ProxyTargetApprove{ salt: bytes32(abi.encodePacked(create2Salt)) }();
deployedContracts.targetPermit2 =
new SablierV2ProxyTargetPermit2{ salt: bytes32(abi.encodePacked(create2Salt)) }(permit2);
deployedContracts.targetPush = new SablierV2ProxyTargetPush{ salt: bytes32(abi.encodePacked(create2Salt)) }();
bytes32 salt = bytes32(abi.encodePacked(create2Salt));
batch = new SablierV2Batch{ salt: bytes32(salt) }();
merkleStreamerFactory = new SablierV2MerkleStreamerFactory{ salt: bytes32(salt) }();
targetApprove = new SablierV2ProxyTargetApprove{ salt: bytes32(salt) }();
targetPermit2 = new SablierV2ProxyTargetPermit2{ salt: bytes32(salt) }(permit2);
targetPush = new SablierV2ProxyTargetPush{ salt: bytes32(salt) }();
}
}
2 changes: 1 addition & 1 deletion test/Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ abstract contract Base_Test is Assertions, DeployOptimized, Events, Merkle, V2Co
deal({ token: address(asset), to: user.addr, give: 1_000_000e18 });
}

/// @dev Conditionally deploy V2 Periphery normally or from a optimized source compiled with `--via-ir`.
/// @dev Conditionally deploy V2 Periphery normally or from an optimized source compiled with `--via-ir`.
function deployPeripheryConditionally() internal {
if (!isTestOptimizedProfile()) {
batch = new SablierV2Batch();
Expand Down
12 changes: 6 additions & 6 deletions test/utils/DeployOptimized.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ import { SablierV2ProxyTargetPermit2 } from "../../src/SablierV2ProxyTargetPermi
import { SablierV2ProxyTargetPush } from "../../src/SablierV2ProxyTargetPush.sol";

abstract contract DeployOptimized is StdCheats {
/// @dev Deploys {SablierV2Batch} from a optimized source compiled with `--via-ir`.
/// @dev Deploys {SablierV2Batch} from an optimized source compiled with `--via-ir`.
function deployOptimizedBatch() internal returns (ISablierV2Batch) {
return ISablierV2Batch(deployCode("out-optimized/SablierV2Batch.sol/SablierV2Batch.json"));
}

/// @dev Deploys {SablierV2MerkleStreamerFactory} from a optimized source compiled with `--via-ir`.
/// @dev Deploys {SablierV2MerkleStreamerFactory} from an optimized source compiled with `--via-ir`.
function deployOptimizedMerkleStreamerFactory() internal returns (ISablierV2MerkleStreamerFactory) {
return ISablierV2MerkleStreamerFactory(
deployCode("out-optimized/SablierV2MerkleStreamerFactory.sol/SablierV2MerkleStreamerFactory.json")
);
}

/// @dev Deploys {SablierV2ProxyTargetApprove} from a optimized source compiled with `--via-ir`.
/// @dev Deploys {SablierV2ProxyTargetApprove} from an optimized source compiled with `--via-ir`.
function deployOptimizedProxyTargetApprove() internal returns (SablierV2ProxyTargetApprove) {
return SablierV2ProxyTargetApprove(
deployCode("out-optimized/SablierV2ProxyTargetApprove.sol/SablierV2ProxyTargetApprove.json")
);
}

/// @dev Deploys {SablierV2ProxyTargetPermit2} from a optimized source compiled with `--via-ir`.
/// @dev Deploys {SablierV2ProxyTargetPermit2} from an optimized source compiled with `--via-ir`.
function deployOptimizedProxyTargetPermit2(IAllowanceTransfer permit2_)
internal
returns (SablierV2ProxyTargetPermit2)
Expand All @@ -42,14 +42,14 @@ abstract contract DeployOptimized is StdCheats {
);
}

/// @dev Deploys {SablierV2ProxyTargetPush} from a optimized source compiled with `--via-ir`.
/// @dev Deploys {SablierV2ProxyTargetPush} from an optimized source compiled with `--via-ir`.
function deployOptimizedProxyTargetPush() internal returns (SablierV2ProxyTargetPush) {
return SablierV2ProxyTargetPush(
deployCode("out-optimized/SablierV2ProxyTargetPush.sol/SablierV2ProxyTargetPush.json")
);
}

/// @notice Deploys all V2 Periphery contracts from a optimized source in the following order:
/// @notice Deploys all V2 Periphery contracts from an optimized source in the following order:
///
/// 1. {SablierV2Batch}
/// 2. {SablierV2MerkleStreamerFactory}
Expand Down

0 comments on commit 90c6212

Please sign in to comment.