Skip to content

Commit

Permalink
refactor: use mainnet chain addresses for tests (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg authored Feb 3, 2025
1 parent 0630cac commit a179fa5
Show file tree
Hide file tree
Showing 26 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export SEPOLIA_RPC_URL="YOUR_SEPOLIA_RPC_URL"
export MAINNET_RPC_URL="YOUR_MAINNET_RPC_URL"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "CI"

env:
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
FOUNDRY_PROFILE: "ci"

on:
Expand Down
8 changes: 4 additions & 4 deletions airdrops/MerkleCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import { MerkleBase, MerkleLL, MerkleLT } from "@sablier/airdrops/src/types/Data
/// @notice Example of how to create Merkle airdrop campaigns.
/// @dev This code is referenced in the docs: https://docs.sablier.com/guides/airdrops/examples/create-campaign
contract MerkleCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);

// See https://docs.sablier.com/guides/lockup/deployments for all deployments
ISablierMerkleFactory public constant FACTORY = ISablierMerkleFactory(0x4ECd5A688b0365e61c1a764E8BF96A7C5dF5d35F);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
ISablierMerkleFactory public constant FACTORY = ISablierMerkleFactory(0x71DD3Ca88E7564416E5C2E350090C12Bf8F6144a);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

function createMerkleInstant() public virtual returns (ISablierMerkleInstant merkleInstant) {
// Declare the constructor parameter of MerkleBase.
Expand Down
4 changes: 2 additions & 2 deletions airdrops/MerkleCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ contract MerkleCreatorTest is Test {
address internal user;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the Merkle creator
merkleCreator = new MerkleCreator();
Expand Down
6 changes: 3 additions & 3 deletions flow/FlowBatchable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { Broker, ISablierFlow } from "@sablier/flow/src/interfaces/ISablierFlow.
/// enables any possible combination of functions to be executed within a single transaction.
/// @dev For some functions to work, `msg.sender` must have approved this contract to spend USDC.
contract FlowBatchable {
// Sepolia addresses
IERC20 public constant USDC = IERC20(0xf08A50178dfcDe18524640EA6618a1f965821715);
ISablierFlow public constant FLOW = ISablierFlow(0x52ab22e769E31564E17D524b683264B65662A014);
// Mainnet addresses
IERC20 public constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
ISablierFlow public constant FLOW = ISablierFlow(0x3DF2AAEdE81D2F6b261F79047517713B8E844E04);

/// @dev A function to adjust the rate per second and deposit into a stream in a single transaction.
/// Note: The streamId's sender must be this contract, otherwise, the call will fail due to no authorization.
Expand Down
4 changes: 2 additions & 2 deletions flow/FlowBatchable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ contract FlowBatchable_Test is Test {
address internal user;

function setUp() external {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the batchable contract
batchable = new FlowBatchable();
Expand Down
6 changes: 3 additions & 3 deletions flow/FlowStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { ISablierFlow } from "@sablier/flow/src/interfaces/ISablierFlow.sol";
import { FlowUtilities } from "./FlowUtilities.sol";

contract FlowStreamCreator {
// Sepolia addresses
IERC20 public constant USDC = IERC20(0xf08A50178dfcDe18524640EA6618a1f965821715);
ISablierFlow public constant FLOW = ISablierFlow(0x52ab22e769E31564E17D524b683264B65662A014);
// Mainnet addresses
IERC20 public constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
ISablierFlow public constant FLOW = ISablierFlow(0x3DF2AAEdE81D2F6b261F79047517713B8E844E04);

// Create a stream that sends 1000 USDC per month.
function createStream_1K_PerMonth() external returns (uint256 streamId) {
Expand Down
4 changes: 2 additions & 2 deletions flow/FlowStreamCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ contract FlowStreamCreator_Test is Test {
address internal user;

function setUp() external {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the FlowStreamCreator contract
streamCreator = new FlowStreamCreator();
Expand Down
4 changes: 2 additions & 2 deletions flow/FlowStreamManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { ud60x18 } from "@prb/math/src/UD60x18.sol";
import { Broker, ISablierFlow } from "@sablier/flow/src/interfaces/ISablierFlow.sol";

contract FlowStreamManager {
// Sepolia address
ISablierFlow public constant FLOW = ISablierFlow(0x52ab22e769E31564E17D524b683264B65662A014);
// Mainnet address
ISablierFlow public constant FLOW = ISablierFlow(0x3DF2AAEdE81D2F6b261F79047517713B8E844E04);

function adjustRatePerSecond(uint256 streamId) external {
FLOW.adjustRatePerSecond({ streamId: streamId, newRatePerSecond: ud21x18(0.0001e18) });
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ tab_width = 4
wrap_comments = true

[rpc_endpoints]
sepolia = "${SEPOLIA_RPC_URL}"
mainnet = "${MAINNET_RPC_URL}"
8 changes: 4 additions & 4 deletions lockup/BatchLDStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { ISablierLockup } from "@sablier/lockup/src/interfaces/ISablierLockup.so
import { BatchLockup, Broker, LockupDynamic } from "@sablier/lockup/src/types/DataTypes.sol";

contract BatchLDStreamCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
// See https://docs.sablier.com/guides/lockup/deployments for all deployments
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
ISablierBatchLockup public constant BATCH_LOCKUP = ISablierBatchLockup(0xd4294579236eE290668c8FdaE9403c4F00D914f0);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);
ISablierBatchLockup public constant BATCH_LOCKUP = ISablierBatchLockup(0x3F6E8a8Cffe377c4649aCeB01e6F20c60fAA356c);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function batchCreateStreams(uint128 perStreamAmount) public returns (uint256[] memory streamIds) {
Expand Down
8 changes: 4 additions & 4 deletions lockup/BatchLLStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { ISablierBatchLockup } from "@sablier/lockup/src/interfaces/ISablierBatc
import { BatchLockup } from "@sablier/lockup/src/types/DataTypes.sol";

contract BatchLLStreamCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
// See https://docs.sablier.com/guides/lockup/deployments for all deployments
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
ISablierBatchLockup public constant BATCH_LOCKUP = ISablierBatchLockup(0xd4294579236eE290668c8FdaE9403c4F00D914f0);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);
ISablierBatchLockup public constant BATCH_LOCKUP = ISablierBatchLockup(0x3F6E8a8Cffe377c4649aCeB01e6F20c60fAA356c);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function batchCreateStreams(uint128 perStreamAmount) public returns (uint256[] memory streamIds) {
Expand Down
8 changes: 4 additions & 4 deletions lockup/BatchLTStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { ISablierLockup } from "@sablier/lockup/src/interfaces/ISablierLockup.so
import { BatchLockup, Broker, LockupTranched } from "@sablier/lockup/src/types/DataTypes.sol";

contract BatchLTStreamCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
// See https://docs.sablier.com/guides/lockup/deployments for all deployments
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
ISablierBatchLockup public constant BATCH_LOCKUP = ISablierBatchLockup(0xd4294579236eE290668c8FdaE9403c4F00D914f0);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);
ISablierBatchLockup public constant BATCH_LOCKUP = ISablierBatchLockup(0x3F6E8a8Cffe377c4649aCeB01e6F20c60fAA356c);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function batchCreateStreams(uint128 perStreamAmount) public returns (uint256[] memory streamIds) {
Expand Down
4 changes: 2 additions & 2 deletions lockup/BatchStreamCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ contract BatchStreamCreatorTest is Test {
address internal user;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the stream creators
dynamicCreator = new BatchLDStreamCreator();
Expand Down
6 changes: 3 additions & 3 deletions lockup/LockupDynamicCurvesCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { Broker, Lockup, LockupDynamic } from "@sablier/lockup/src/types/DataTyp
/// https://docs.sablier.com/concepts/lockup/stream-shapes#lockup-dynamic
/// Visualizing the curves while reviewing this code is recommended. The X axis will be assumed to represent "days".
contract LockupDynamicCurvesCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function createStream_Exponential() external returns (uint256 streamId) {
Expand Down
4 changes: 2 additions & 2 deletions lockup/LockupDynamicCurvesCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ contract LockupDynamicCurvesCreatorTest is Test {
address internal user;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the stream creator
creator = new LockupDynamicCurvesCreator();
Expand Down
6 changes: 3 additions & 3 deletions lockup/LockupDynamicStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { Broker, Lockup, LockupDynamic } from "@sablier/lockup/src/types/DataTyp
/// @dev This code is referenced in the docs:
/// https://docs.sablier.com/guides/lockup/examples/create-stream/lockup-dynamic
contract LockupDynamicStreamCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function createStream(uint128 amount0, uint128 amount1) public returns (uint256 streamId) {
Expand Down
6 changes: 3 additions & 3 deletions lockup/LockupLinearCurvesCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { Broker, Lockup, LockupLinear } from "@sablier/lockup/src/types/DataType
/// https://docs.sablier.com/concepts/lockup/stream-shapes#lockup-linear
/// Visualizing the curves while reviewing this code is recommended. The X axis will be assumed to represent "days".
contract LockupLinearCurvesCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function createStream_Linear() public returns (uint256 streamId) {
Expand Down
4 changes: 2 additions & 2 deletions lockup/LockupLinearCurvesCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ contract LockupLinearCurvesCreatorTest is Test {
address internal user;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the stream creator
creator = new LockupLinearCurvesCreator();
Expand Down
6 changes: 3 additions & 3 deletions lockup/LockupLinearStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { Broker, Lockup, LockupLinear } from "@sablier/lockup/src/types/DataType
/// @dev This code is referenced in the docs:
/// https://docs.sablier.com/guides/lockup/examples/create-stream/lockup-linear
contract LockupLinearStreamCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function createStream(uint128 totalAmount) public returns (uint256 streamId) {
Expand Down
4 changes: 2 additions & 2 deletions lockup/LockupStreamCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ contract LockupStreamCreatorTest is Test {
address internal user;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the stream creators
dynamicCreator = new LockupDynamicStreamCreator();
Expand Down
6 changes: 3 additions & 3 deletions lockup/LockupTranchedCurvesCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { Broker, Lockup, LockupTranched } from "@sablier/lockup/src/types/DataTy
/// https://docs.sablier.com/concepts/lockup/stream-shapes#lockup-tranched
/// Visualizing the curves while reviewing this code is recommended. The X axis will be assumed to represent "days".
contract LockupTranchedCurvesCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

function createStream_UnlockInSteps() external returns (uint256 streamId) {
// Declare the total amount as 100 DAI
Expand Down
4 changes: 2 additions & 2 deletions lockup/LockupTranchedCurvesCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ contract LockupTranchedCurvesCreatorTest is Test {
address internal user;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Deploy the stream creator
creator = new LockupTranchedCurvesCreator();
Expand Down
6 changes: 3 additions & 3 deletions lockup/LockupTranchedStreamCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { Broker, Lockup, LockupTranched } from "@sablier/lockup/src/types/DataTy
/// @dev This code is referenced in the docs:
/// https://docs.sablier.com/guides/lockup/examples/create-stream/lockup-tranched
contract LockupTranchedStreamCreator {
// Sepolia addresses
IERC20 public constant DAI = IERC20(0x68194a729C2450ad26072b3D33ADaCbcef39D574);
ISablierLockup public constant LOCKUP = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
// Mainnet addresses
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierLockup public constant LOCKUP = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

/// @dev For this function to work, the sender must have approved this dummy contract to spend DAI.
function createStream(uint128 amount0, uint128 amount1) public returns (uint256 streamId) {
Expand Down
2 changes: 1 addition & 1 deletion lockup/StreamManagementWithHook.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract StreamManagementWithHookTest is Test {
address internal sablierAdmin;

function setUp() public {
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
vm.createSelectFork("mainnet");

// Create a test users
alice = makeAddr("Alice");
Expand Down
10 changes: 5 additions & 5 deletions lockup/tests/stake-sablier-nft-test/StakeSablierNFT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ abstract contract StakeSablierNFT_Fork_Test is Test {
event Staked(address indexed user, uint256 streamId);
event Unstaked(address indexed user, uint256 streamId);

IERC20 public constant DAI = IERC20(0x776b6fC2eD15D6Bb5Fc32e0c89DE68683118c62A);
IERC20 public constant USDC = IERC20(0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238);
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
IERC20 public constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);

// Get the latest deployment address from the docs: https://docs.sablier.com/guides/lockup/deployments.
ISablierLockup internal constant SABLIER = ISablierLockup(0xC2Da366fD67423b500cDF4712BdB41d0995b0794);
ISablierLockup internal constant SABLIER = ISablierLockup(0x7C01AA3783577E15fD7e272443D44B92d5b21056);

// Set a stream ID to stake.
uint256 internal stakingStreamId = 2;
Expand All @@ -65,8 +65,8 @@ abstract contract StakeSablierNFT_Fork_Test is Test {
Users internal users;

function setUp() public {
// Fork Ethereum Sepolia
vm.createSelectFork({ urlOrAlias: "sepolia", blockNumber: 7_497_776 });
// Fork Ethereum Mainnet
vm.createSelectFork("mainnet");

// Create users.
users.admin = makeAddr("admin");
Expand Down

0 comments on commit a179fa5

Please sign in to comment.