This repository contains a collection of utility smart contracts used across various Solidity projects. The motivation behind this repository is to reduce code duplication.
The following projects use these contracts:
In-depth documentation is available at docs.sablier.com.
This is the recommended approach.
Install using your favorite package manager, e.g., with Bun:
bun add @sablier/solidity-utils
Then, if you are using Foundry, you need to add these to your remappings.txt
file:
@sablier/solidity-utils/=node_modules/@sablier/solidity-utils/
This installation method is not recommended, but it is available for those who prefer it.
First, install the submodule using Forge:
forge install --no-commit sablier-labs/solidity-utils
Second, if you are using Foundry, you need to add these to your remappings.txt
file:
@sablier/solidity-utils/=lib/solidity-utils/
import { Adminable } from "@sablier/solidity-utils/src/Adminable.sol";
import { Batch } from "@sablier/solidity-utils/src/Batch.sol";
import { NoDelegateCall } from "@sablier/solidity-utils/src/NoDelegateCall.sol";
import { SablierFees } from "@sablier/solidity-utils/src/SablierFees.sol";
contract MyContract is Adminable, Batch, NoDelegateCall, SablierFees {
constructor(address initialAdmin) SablierFees(initialAdmin) { }
// Use the `noDelegateCall` modifier to prevent delegate calls.
function foo() public noDelegateCall { }
// Use the `onlyAdmin` modifier to restrict access to the admin.
function editFee(uint256 newFee) public onlyAdmin { }
}