Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
check:
uses: "sablier-labs/gha-utils/.github/workflows/full-check.yml@main"
uses: "sablier-labs/gha-utils/.github/workflows/evm-lint.yml@main"

build:
uses: "sablier-labs/gha-utils/.github/workflows/forge-build.yml@main"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@
"clean": "rm -rf broadcast cache out out-*",
"forge:check": "forge fmt --check",
"forge:write": "forge fmt",
"full-check": "bun run solhint:check && bun run forge:write && bun run prettier:check",
"full-write": "bun run solhint:write && bun run forge:write && bun run prettier:write",
"full:check": "bun run solhint:check && bun run forge:write && bun run prettier:check",
"full:write": "bun run solhint:write && bun run forge:write && bun run prettier:write",
"lint": "bun run full:check",
"solhint:check": "solhint \"{precompiles,script,src,tests}/**/*.sol\"",
"solhint:write": "solhint --fix --noPrompt \"{precompiles,script,src,tests}/**/*.sol\"",
"prepack": "bun install",
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/AdminableMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Adminable } from "src/Adminable.sol";
import { Adminable } from "../../src/Adminable.sol";

contract AdminableMock is Adminable {
constructor(address initialAdmin) Adminable(initialAdmin) { }
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/BatchMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Batch } from "src/Batch.sol";
import { Batch } from "../../src/Batch.sol";

contract BatchMock is Batch {
error InvalidNumber(uint256);
Expand Down
14 changes: 14 additions & 0 deletions src/mocks/ERC1271WalletMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { Adminable } from "../../src/Adminable.sol";

contract ERC1271WalletMock is Adminable {
constructor(address initialAdmin) Adminable(initialAdmin) { }

function isValidSignature(bytes32 hash, bytes memory signature) public view returns (bytes4 magicValue) {
return
ECDSA.recover(hash, signature) == admin ? bytes4(keccak256("isValidSignature(bytes32,bytes)")) : bytes4(0);
Comment thread
smol-ninja marked this conversation as resolved.
}
}
2 changes: 1 addition & 1 deletion src/mocks/NoDelegateCallMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { NoDelegateCall } from "src/NoDelegateCall.sol";
import { NoDelegateCall } from "../../src/NoDelegateCall.sol";

contract NoDelegateCallMock is NoDelegateCall {
/// @dev An empty function that uses the `noDelegateCall` modifier.
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/RoleAdminableMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { RoleAdminable } from "src/RoleAdminable.sol";
import { RoleAdminable } from "../../src/RoleAdminable.sol";

contract RoleAdminableMock is RoleAdminable {
constructor(address initialAdmin) RoleAdminable(initialAdmin) { }
Expand Down
35 changes: 29 additions & 6 deletions src/tests/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { console2 } from "forge-std/src/console2.sol";
import { StdCheats } from "forge-std/src/StdCheats.sol";
import { StdStyle } from "forge-std/src/StdStyle.sol";
import { StdUtils } from "forge-std/src/StdUtils.sol";
import { IRoleAdminable } from "src/interfaces/IRoleAdminable.sol";

import { IRoleAdminable } from "../interfaces/IRoleAdminable.sol";
import { ERC20MissingReturn } from "../mocks/erc20/ERC20MissingReturn.sol";
import { ERC20Mock } from "../mocks/erc20/ERC20Mock.sol";
import { ContractWithoutReceive, ContractWithReceive } from "../mocks/Receive.sol";
Expand Down Expand Up @@ -108,12 +108,37 @@ contract BaseTest is StdBase, StdCheats, StdUtils {
return new ERC20Mock(name, symbol, decimals);
}

/// @dev Generates a user, label its address, funds it with test tokens and approve `spenders` contracts.
function createUser(string memory name, address[] memory spenders) internal returns (address payable) {
address payable user = payable(makeAddr(name));
/// @dev Generates a user, labels its address, funds it with test tokens, approves `spenders` contracts and returns
/// the user's address.
function createUser(string memory name, address[] memory spenders) internal returns (address payable user) {
user = payable(makeAddr(name));
vm.label(user, name);
vm.deal({ account: user, newBalance: 100 ether });

dealAndApproveSpenders(user, spenders);
}

/// @dev Generates a user, labels its address, funds it with test tokens, approves `spenders` contracts and returns
/// the user's address and the private key.
function createUserAndKey(
string memory name,
address[] memory spenders
)
internal
returns (address payable user, uint256 privateKey)
{
address addr;
(addr, privateKey) = makeAddrAndKey(name);

user = payable(addr);
vm.label(user, name);
vm.deal({ account: user, newBalance: 100 ether });

dealAndApproveSpenders(user, spenders);
}

/// @dev Deals tokens to user and approve contracts from spenders list.
function dealAndApproveSpenders(address user, address[] memory spenders) internal {
for (uint256 i = 0; i < spenders.length; ++i) {
for (uint256 j = 0; j < tokens.length; ++j) {
deal({
Expand All @@ -124,8 +149,6 @@ contract BaseTest is StdBase, StdCheats, StdUtils {
approveContract(address(tokens[j]), user, spenders[i]);
}
}

return user;
}

/// @dev Retrieves the current block timestamp as an `uint40`.
Expand Down
Loading