Skip to content

Commit

Permalink
Remove protocol fee (#839)
Browse files Browse the repository at this point in the history
* refactor: remove protocol fee

refactor: remove comptroller
test: update tests accordingly

chore: update gas snapshot

test: remove outdated comments

* chore: update some inherited components comments

* refactor: remove unused imports and improve natspec

* docs: improve natspec

---------

Co-authored-by: smol-ninja <[email protected]>
  • Loading branch information
andreivladbrg and smol-ninja committed Jul 3, 2024
1 parent 0fa0715 commit e36f797
Show file tree
Hide file tree
Showing 106 changed files with 942 additions and 2,400 deletions.
969 changes: 579 additions & 390 deletions .gas-snapshot

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
ffi = true
fs_permissions = [{ access = "read", path = "out-optimized" }]
gas_reports = [
"SablierV2Comptroller",
"SablierV2LockupDynamic",
"SablierV2LockupLinear",
"SablierV2LockupTranched",
Expand Down
12 changes: 0 additions & 12 deletions script/DeployComptroller.s.sol

This file was deleted.

18 changes: 7 additions & 11 deletions script/DeployCore.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { SablierV2Comptroller } from "../src/SablierV2Comptroller.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";
Expand All @@ -11,28 +10,25 @@ import { BaseScript } from "./Base.s.sol";

/// @notice Deploys all V2 Core contract in the following order:
///
/// 1. {SablierV2Comptroller}
/// 2. {SablierV2NFTDescriptor}
/// 3. {SablierV2LockupDynamic}
/// 4. {SablierV2LockupLinear}
/// 5. {SablierV2LockupTranched}
/// 1. {SablierV2NFTDescriptor}
/// 2. {SablierV2LockupDynamic}
/// 3. {SablierV2LockupLinear}
/// 4. {SablierV2LockupTranched}
contract DeployCore is BaseScript {
function run(address initialAdmin)
public
virtual
broadcast
returns (
SablierV2Comptroller comptroller,
SablierV2LockupDynamic lockupDynamic,
SablierV2LockupLinear lockupLinear,
SablierV2LockupTranched lockupTranched,
SablierV2NFTDescriptor nftDescriptor
)
{
comptroller = new SablierV2Comptroller(initialAdmin);
nftDescriptor = new SablierV2NFTDescriptor();
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear(initialAdmin, comptroller, nftDescriptor);
lockupTranched = new SablierV2LockupTranched(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear(initialAdmin, nftDescriptor);
lockupTranched = new SablierV2LockupTranched(initialAdmin, nftDescriptor, maxCount);
}
}
16 changes: 6 additions & 10 deletions script/DeployCore2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2Comptroller } from "../src/SablierV2Comptroller.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";
Expand All @@ -11,10 +10,9 @@ import { BaseScript } from "./Base.s.sol";

/// @notice Deploys these contracts in the following order:
///
/// 1. {SablierV2Comptroller}
/// 2. {SablierV2LockupDynamic}
/// 3. {SablierV2LockupLinear}
/// 4. {SablierV2LockupTranched}
/// 1. {SablierV2LockupDynamic}
/// 2. {SablierV2LockupLinear}
/// 3. {SablierV2LockupTranched}
contract DeployCore2 is BaseScript {
function run(
address initialAdmin,
Expand All @@ -24,15 +22,13 @@ contract DeployCore2 is BaseScript {
virtual
broadcast
returns (
SablierV2Comptroller comptroller,
SablierV2LockupDynamic lockupDynamic,
SablierV2LockupLinear lockupLinear,
SablierV2LockupTranched lockupTranched
)
{
comptroller = new SablierV2Comptroller(initialAdmin);
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear(initialAdmin, comptroller, nftDescriptor);
lockupTranched = new SablierV2LockupTranched(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear(initialAdmin, nftDescriptor);
lockupTranched = new SablierV2LockupTranched(initialAdmin, nftDescriptor, maxCount);
}
}
12 changes: 4 additions & 8 deletions script/DeployCore3.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";
Expand All @@ -16,10 +15,7 @@ import { BaseScript } from "./Base.s.sol";
/// 3. {SablierV2LockupLinear}
/// 4. {SablierV2LockupTranched}
contract DeployCore3 is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller comptroller
)
function run(address initialAdmin)
public
virtual
broadcast
Expand All @@ -31,8 +27,8 @@ contract DeployCore3 is BaseScript {
)
{
nftDescriptor = new SablierV2NFTDescriptor();
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear(initialAdmin, comptroller, nftDescriptor);
lockupTranched = new SablierV2LockupTranched(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear(initialAdmin, nftDescriptor);
lockupTranched = new SablierV2LockupTranched(initialAdmin, nftDescriptor, maxCount);
}
}
15 changes: 0 additions & 15 deletions script/DeployDeterministicComptroller.s.sol

This file was deleted.

18 changes: 7 additions & 11 deletions script/DeployDeterministicCore.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { SablierV2Comptroller } from "../src/SablierV2Comptroller.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";
Expand All @@ -11,11 +10,10 @@ import { BaseScript } from "./Base.s.sol";

/// @notice Deploys all V2 Core contracts at deterministic addresses across chains, in the following order:
///
/// 1. {SablierV2Comptroller}
/// 2. {SablierV2NFTDescriptor}
/// 3. {SablierV2LockupDynamic}
/// 4. {SablierV2LockupLinear}
/// 5. {SablierV2LockupTranched}
/// 1. {SablierV2NFTDescriptor}
/// 2. {SablierV2LockupDynamic}
/// 3. {SablierV2LockupLinear}
/// 4. {SablierV2LockupTranched}
///
/// @dev Reverts if any contract has already been deployed.
contract DeployDeterministicCore is BaseScript {
Expand All @@ -24,18 +22,16 @@ contract DeployDeterministicCore is BaseScript {
virtual
broadcast
returns (
SablierV2Comptroller comptroller,
SablierV2LockupDynamic lockupDynamic,
SablierV2LockupLinear lockupLinear,
SablierV2LockupTranched lockupTranched,
SablierV2NFTDescriptor nftDescriptor
)
{
bytes32 salt = constructCreate2Salt();
comptroller = new SablierV2Comptroller{ salt: salt }(initialAdmin);
nftDescriptor = new SablierV2NFTDescriptor{ salt: salt }();
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, comptroller, nftDescriptor);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, nftDescriptor);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, nftDescriptor, maxCount);
}
}
16 changes: 6 additions & 10 deletions script/DeployDeterministicCore2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2Comptroller } from "../src/SablierV2Comptroller.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";
Expand All @@ -11,10 +10,9 @@ import { BaseScript } from "./Base.s.sol";

/// @notice Deploys these contracts at deterministic addresses across chains, in the following order:
///
/// 1. {SablierV2Comptroller}
/// 2. {SablierV2LockupDynamic}
/// 3. {SablierV2LockupLinear}
/// 4. {SablierV2LockupTranched}
/// 1. {SablierV2LockupDynamic}
/// 2. {SablierV2LockupLinear}
/// 3. {SablierV2LockupTranched}
///
/// @dev Reverts if any contract has already been deployed.
contract DeployDeterministicCore2 is BaseScript {
Expand All @@ -26,16 +24,14 @@ contract DeployDeterministicCore2 is BaseScript {
virtual
broadcast
returns (
SablierV2Comptroller comptroller,
SablierV2LockupDynamic lockupDynamic,
SablierV2LockupLinear lockupLinear,
SablierV2LockupTranched lockupTranched
)
{
bytes32 salt = constructCreate2Salt();
comptroller = new SablierV2Comptroller{ salt: salt }(initialAdmin);
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, comptroller, nftDescriptor);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, nftDescriptor);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, nftDescriptor, maxCount);
}
}
12 changes: 4 additions & 8 deletions script/DeployDeterministicCore3.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";
Expand All @@ -18,10 +17,7 @@ import { BaseScript } from "./Base.s.sol";
///
/// @dev Reverts if any contract has already been deployed.
contract DeployDeterministicCore3 is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller comptroller
)
function run(address initialAdmin)
public
virtual
broadcast
Expand All @@ -34,8 +30,8 @@ contract DeployDeterministicCore3 is BaseScript {
{
bytes32 salt = constructCreate2Salt();
nftDescriptor = new SablierV2NFTDescriptor{ salt: salt }();
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, comptroller, nftDescriptor);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, nftDescriptor, maxCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, nftDescriptor);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, nftDescriptor, maxCount);
}
}
5 changes: 1 addition & 4 deletions script/DeployDeterministicLockupDynamic.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";

Expand All @@ -12,7 +11,6 @@ import { BaseScript } from "./Base.s.sol";
contract DeployDeterministicLockupDynamic is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor
)
public
Expand All @@ -21,7 +19,6 @@ contract DeployDeterministicLockupDynamic is BaseScript {
returns (SablierV2LockupDynamic lockupDynamic)
{
bytes32 salt = constructCreate2Salt();
lockupDynamic =
new SablierV2LockupDynamic{ salt: salt }(initialAdmin, initialComptroller, initialNFTDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic{ salt: salt }(initialAdmin, initialNFTDescriptor, maxCount);
}
}
4 changes: 1 addition & 3 deletions script/DeployDeterministicLockupLinear.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";

Expand All @@ -12,7 +11,6 @@ import { BaseScript } from "./Base.s.sol";
contract DeployDeterministicLockupLinear is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor
)
public
Expand All @@ -21,6 +19,6 @@ contract DeployDeterministicLockupLinear is BaseScript {
returns (SablierV2LockupLinear lockupLinear)
{
bytes32 salt = constructCreate2Salt();
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, initialComptroller, initialNFTDescriptor);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, initialNFTDescriptor);
}
}
5 changes: 1 addition & 4 deletions script/DeployDeterministicLockupTranched.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2LockupTranched } from "../src/SablierV2LockupTranched.sol";

Expand All @@ -12,7 +11,6 @@ import { BaseScript } from "./Base.s.sol";
contract DeployDeterministicLockupTranched is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor
)
public
Expand All @@ -21,7 +19,6 @@ contract DeployDeterministicLockupTranched is BaseScript {
returns (SablierV2LockupTranched lockupTranched)
{
bytes32 salt = constructCreate2Salt();
lockupTranched =
new SablierV2LockupTranched{ salt: salt }(initialAdmin, initialComptroller, initialNFTDescriptor, maxCount);
lockupTranched = new SablierV2LockupTranched{ salt: salt }(initialAdmin, initialNFTDescriptor, maxCount);
}
}
4 changes: 1 addition & 3 deletions script/DeployLockupDynamic.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol";

Expand All @@ -10,14 +9,13 @@ import { BaseScript } from "./Base.s.sol";
contract DeployLockupDynamic is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor
)
public
virtual
broadcast
returns (SablierV2LockupDynamic lockupDynamic)
{
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, initialComptroller, initialNFTDescriptor, maxCount);
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, initialNFTDescriptor, maxCount);
}
}
4 changes: 1 addition & 3 deletions script/DeployLockupLinear.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22 <0.9.0;

import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2NFTDescriptor } from "../src/interfaces/ISablierV2NFTDescriptor.sol";
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol";

Expand All @@ -10,14 +9,13 @@ import { BaseScript } from "./Base.s.sol";
contract DeployLockupLinear is BaseScript {
function run(
address initialAdmin,
ISablierV2Comptroller initialComptroller,
ISablierV2NFTDescriptor initialNFTDescriptor
)
public
virtual
broadcast
returns (SablierV2LockupLinear lockupLinear)
{
lockupLinear = new SablierV2LockupLinear(initialAdmin, initialComptroller, initialNFTDescriptor);
lockupLinear = new SablierV2LockupLinear(initialAdmin, initialNFTDescriptor);
}
}
Loading

0 comments on commit e36f797

Please sign in to comment.