Skip to content

Latest commit

 

History

History

README.md

Sablier EVM Utils GitHub Actions Coverage Foundry

This package contains the following two sets of contracts:

Sablier Comptroller

Its a standalone contract with the following responsibilities:

  • Handles state variables, setters and getters, and calculations using external oracles to manage fees across all the Sablier protocols.
  • Authority over admin functions across Sablier protocols.

Utility contracts

Its a collection of smart contracts used across various Sablier Solidity projects. The motivation behind this is to reduce code duplication. The following projects imports these contracts:

In-depth documentation is available at docs.sablier.com.

Repository Structure

This package contains the following subdirectories:

  • src/interfaces: Interfaces to be used by external projects.
  • src/libraries: Helper libraries used by external projects.
  • src/mocks: Mock contracts used by external projects in tests.
  • src/tests: Helper contracts used by external projects in tests and deployment scripts.

Install

Node.js

This is the recommended approach.

Install using your favorite package manager, e.g., with Bun:

bun add @sablier/evm-utils

Git Submodules

This installation method is not recommended, but it is available for those who prefer it.

Install the monorepo using Forge:

forge install sablier-labs/evm-monorepo@utils@v2.0.1 OpenZeppelin/openzeppelin-contracts@v5.3.0 smartcontractkit/chainlink-evm@contracts-v1.4.0

Then, add the following remapping in remappings.txt:

@chainlink/contracts/=lib/chainlink/contracts-evm/
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@sablier/evm-utils/=lib/evm-monorepo/utils/

Usage

import { Adminable } from "@sablier/evm-utils/src/Adminable.sol";
import { Batch } from "@sablier/evm-utils/src/Batch.sol";
import { NoDelegateCall } from "@sablier/evm-utils/src/NoDelegateCall.sol";

contract MyContract is Adminable, Batch, NoDelegateCall {
    constructor(address initialAdmin) Adminable(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 { }
}

Contributing

This repository is not accepting pull requests of any kind, including changes to code comments. Comment-only edits can change the compiled bytecode, and the source on main must remain byte-for-byte verifiable against the deployed addresses. PRs will be closed without review.

For questions or informal feedback, open an issue or start a discussion.

License

See LICENSE.md.