Skip to content

Commit

Permalink
fix: deploy protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
dristpunk committed Dec 20, 2023
1 parent b7b030e commit b60ff6d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ud60x18} from '@prb/math/src/UD60x18.sol';

/// @notice Example of how to create a Lockup Dynamic stream.
/// @dev This code is referenced in the docs: https://docs.sablier.com/contracts/v2/guides/create-stream/lockup-dynamic
contract LockupDynamicStreamCreator {
contract TestLockupDynamicStreamCreator {
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
ISablierV2LockupDynamic public immutable lockupDynamic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
pragma solidity 0.8.19;

import {ISablierV2LockupDynamic} from '@sablier/v2-core/src/interfaces/ISablierV2LockupDynamic.sol';
import {LockupDynamicStreamCreator} from 'contracts/LockupDynamicStreamCreator.sol';
import {SablierV2LockupDynamic} from '@sablier/v2-core/src/SablierV2LockupDynamic.sol';

import {TestLockupDynamicStreamCreator} from 'contracts/TestLockupDynamicStreamCreator.sol';
import {ISablierV2NFTDescriptor} from '@sablier/v2-core/src/interfaces/ISablierV2NFTDescriptor.sol';
import {ISablierV2Comptroller} from '@sablier/v2-core/src/interfaces/ISablierV2Comptroller.sol';
import {SablierV2NFTDescriptor} from '@sablier/v2-core/src/SablierV2NFTDescriptor.sol';
import {SablierV2Comptroller} from '@sablier/v2-core/src/SablierV2Comptroller.sol';

import {Broker, LockupDynamic} from '@sablier/v2-core/src/types/DataTypes.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {ud2x18} from '@prb/math/src/UD2x18.sol';
Expand All @@ -12,7 +19,7 @@ import {console} from 'forge-std/Console.sol';

/// @notice Example of how to create a Lockup Dynamic stream.
/// @dev This code is referenced in the docs: https://docs.sablier.com/contracts/v2/guides/create-stream/lockup-dynamic
contract LockupDynamicStreamCreatorTest is Test {
contract TestLockupDynamicStreamCreatorTest is Test {
address internal _owner = makeAddr('owner');

address constant SABLIER_DYNAMIC_MAINNET = 0x39EFdC3dbB57B2388CcC4bb40aC4CB1226Bc9E44;
Expand All @@ -21,17 +28,25 @@ contract LockupDynamicStreamCreatorTest is Test {
uint256 constant TOTAL_AMOUNT = 24_960_000 ether;

ISablierV2LockupDynamic internal lockupDynamic;
LockupDynamicStreamCreator internal creator;
ISablierV2Comptroller internal comptroller;
ISablierV2NFTDescriptor internal nftDescriptor;
TestLockupDynamicStreamCreator internal creator;

function setUp() public {
// mint some NEXT tokens
vm.createSelectFork(vm.rpcUrl('mainnet'), 18_820_679);
creator = new LockupDynamicStreamCreator(ISablierV2LockupDynamic(SABLIER_DYNAMIC_MAINNET));

deal(DAI, _owner, TOTAL_AMOUNT);
vm.prank(_owner);
vm.startPrank(_owner);
// deploy core
comptroller = new SablierV2Comptroller(_owner);
nftDescriptor = new SablierV2NFTDescriptor();
lockupDynamic = new SablierV2LockupDynamic(_owner, comptroller, nftDescriptor, 300);
// creator
creator = new TestLockupDynamicStreamCreator(lockupDynamic);
// approve
IERC20(DAI).approve(address(creator), TOTAL_AMOUNT);

lockupDynamic = ISablierV2LockupDynamic(SABLIER_DYNAMIC_MAINNET);
vm.stopPrank();
}

function test_Creation() external {
Expand Down

0 comments on commit b60ff6d

Please sign in to comment.