Verified contractExactBUSL-1.1
SablierMerkleLL
Address0x1df36dfb986efe13993f1ab778f03c0660a0cacc
- Balance
0 ETH
- Transactions
2,141
- Compiler
solc 0.8.29
- Same code
15 more contracts
Details
- Compiler
- solc 0.8.29+commit.ab55807c
- Language
- solidity
- Optimization
- Yes, 60,000 runs
- EVM version
- shanghai
- Via IR
- yes
- License
- BUSL-1.1
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,124,095
- Creation transaction
- 0x53f6133b5e…5573d67f30
88 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/SablierMerkleLL.solmain12.03 KB
- node_modules/@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol645 B
- node_modules/@openzeppelin/contracts/interfaces/IERC1271.sol654 B
- node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol4.45 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC165.sol192 B
- node_modules/@openzeppelin/contracts/interfaces/IERC20.sol181 B
- node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol841 B
- node_modules/@openzeppelin/contracts/interfaces/IERC721.sol185 B
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol881 B
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol10.08 KB
- node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol4.93 KB
- node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol792 B
- node_modules/@openzeppelin/contracts/utils/Panic.sol1.97 KB
- node_modules/@openzeppelin/contracts/utils/Strings.sol19.28 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol7.82 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/Hashes.sol1.03 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol24.34 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol4.25 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol2.34 KB
- node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol870 B
- node_modules/@openzeppelin/contracts/utils/math/Math.sol32.15 KB
- node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol34.94 KB
- node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol2.61 KB
- node_modules/@openzeppelin/contracts/utils/structs/BitMaps.sol2.02 KB
- node_modules/@prb/math/src/Common.sol25.41 KB
- node_modules/@prb/math/src/UD2x18.sol1.88 KB
- node_modules/@prb/math/src/UD60x18.sol2.15 KB
- node_modules/@prb/math/src/sd1x18/Casting.sol2.32 KB
- node_modules/@prb/math/src/sd1x18/Constants.sol758 B
- node_modules/@prb/math/src/sd1x18/Errors.sol786 B
- node_modules/@prb/math/src/sd1x18/ValueType.sol855 B
- node_modules/@prb/math/src/sd21x18/Casting.sol2.35 KB
- node_modules/@prb/math/src/sd21x18/Constants.sol823 B
- node_modules/@prb/math/src/sd21x18/Errors.sol802 B
- node_modules/@prb/math/src/sd21x18/ValueType.sol863 B
- node_modules/@prb/math/src/sd59x18/Casting.sol4.94 KB
- node_modules/@prb/math/src/sd59x18/Constants.sol2.78 KB
- node_modules/@prb/math/src/sd59x18/Errors.sol4.46 KB
- node_modules/@prb/math/src/sd59x18/Helpers.sol4.12 KB
- node_modules/@prb/math/src/sd59x18/Math.sol27.63 KB
- node_modules/@prb/math/src/sd59x18/ValueType.sol2.66 KB
- node_modules/@prb/math/src/ud21x18/Casting.sol1.91 KB
- node_modules/@prb/math/src/ud21x18/Constants.sol633 B
- node_modules/@prb/math/src/ud21x18/Errors.sol241 B
- node_modules/@prb/math/src/ud21x18/ValueType.sol868 B
- node_modules/@prb/math/src/ud2x18/Casting.sol1.9 KB
- node_modules/@prb/math/src/ud2x18/Constants.sol596 B
- node_modules/@prb/math/src/ud2x18/Errors.sol237 B
- node_modules/@prb/math/src/ud2x18/ValueType.sol861 B
- node_modules/@prb/math/src/ud60x18/Casting.sol3.95 KB
- node_modules/@prb/math/src/ud60x18/Constants.sol1.93 KB
- node_modules/@prb/math/src/ud60x18/Conversions.sol1.02 KB
- node_modules/@prb/math/src/ud60x18/Errors.sol2.03 KB
- node_modules/@prb/math/src/ud60x18/Helpers.sol3.79 KB
- node_modules/@prb/math/src/ud60x18/Math.sol22.83 KB
- node_modules/@prb/math/src/ud60x18/ValueType.sol2.84 KB
- node_modules/@sablier/evm-utils/src/Adminable.sol2.92 KB
- node_modules/@sablier/evm-utils/src/interfaces/IAdminable.sol1.85 KB
- node_modules/@sablier/evm-utils/src/interfaces/IBatch.sol675 B
- node_modules/@sablier/evm-utils/src/interfaces/IComptrollerable.sol2.24 KB
- node_modules/@sablier/evm-utils/src/interfaces/IRoleAdminable.sol3.23 KB
- node_modules/@sablier/evm-utils/src/interfaces/ISablierComptroller.sol14.71 KB
- node_modules/@sablier/evm-utils/src/libraries/Errors.sol4.2 KB
- node_modules/@sablier/lockup/src/interfaces/ILockupNFTDescriptor.sol1.07 KB
- node_modules/@sablier/lockup/src/interfaces/ISablierLockup.sol17.02 KB
- node_modules/@sablier/lockup/src/interfaces/ISablierLockupDynamic.sol4.29 KB
- node_modules/@sablier/lockup/src/interfaces/ISablierLockupLinear.sol5.4 KB
- node_modules/@sablier/lockup/src/interfaces/ISablierLockupPriceGated.sol4.14 KB
- node_modules/@sablier/lockup/src/interfaces/ISablierLockupState.sol8.88 KB
- node_modules/@sablier/lockup/src/interfaces/ISablierLockupTranched.sol4.3 KB
- node_modules/@sablier/lockup/src/types/Lockup.sol7.11 KB
- node_modules/@sablier/lockup/src/types/LockupDynamic.sol1.18 KB
- node_modules/@sablier/lockup/src/types/LockupLinear.sol915 B
- node_modules/@sablier/lockup/src/types/LockupPriceGated.sol685 B
- node_modules/@sablier/lockup/src/types/LockupTranched.sol918 B
- src/abstracts/SablierMerkleBase.sol10.34 KB
- src/abstracts/SablierMerkleLockup.sol2.75 KB
- src/abstracts/SablierMerkleSignature.sol8.51 KB
- src/interfaces/ISablierMerkleBase.sol6.01 KB
- src/interfaces/ISablierMerkleLL.sol9.92 KB
- src/interfaces/ISablierMerkleLockup.sol1.74 KB
- src/interfaces/ISablierMerkleSignature.sol1.98 KB
- src/libraries/Errors.sol7.56 KB
- src/libraries/SignatureHash.sol959 B
- src/types/MerkleBase.sol1.93 KB
- src/types/MerkleLL.sol2.95 KB
- src/types/MerkleLockup.sol819 B
src/SablierMerkleLL.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.22;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ud60x18, UD60x18 } from "@prb/math/src/UD60x18.sol";
import { Lockup } from "@sablier/lockup/src/types/Lockup.sol";
import { LockupLinear } from "@sablier/lockup/src/types/LockupLinear.sol";
import { SablierMerkleBase } from "./abstracts/SablierMerkleBase.sol";
import { SablierMerkleLockup } from "./abstracts/SablierMerkleLockup.sol";
import { SablierMerkleSignature } from "./abstracts/SablierMerkleSignature.sol";
import { ISablierMerkleLL } from "./interfaces/ISablierMerkleLL.sol";
import { ClaimType, MerkleBase } from "./types/MerkleBase.sol";
import { MerkleLockup } from "./types/MerkleLockup.sol";
import { MerkleLL } from "./types/MerkleLL.sol";
/*
███████╗ █████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝██╔══██╗
███████╗███████║██████╔╝██║ ██║█████╗ ██████╔╝
╚════██║██╔══██║██╔══██╗██║ ██║██╔══╝ ██╔══██╗
███████║██║ ██║██████╔╝███████╗██║███████╗██║ ██║
╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝╚══════╝╚═╝ ╚═╝
███╗ ███╗███████╗██████╗ ██╗ ██╗██╗ ███████╗ ██╗ ██╗
████╗ ████║██╔════╝██╔══██╗██║ ██╔╝██║ ██╔════╝ ██║ ██║
██╔████╔██║█████╗ ██████╔╝█████╔╝ ██║ █████╗ ██║ ██║
██║╚██╔╝██║██╔══╝ ██╔══██╗██╔═██╗ ██║ ██╔══╝ ██║ ██║
██║ ╚═╝ ██║███████╗██║ ██║██║ ██╗███████╗███████╗ ███████╗███████╗
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝ ╚══════╝╚══════╝
*/
/// @title SablierMerkleLL
/// @notice See the documentation in {ISablierMerkleLL}.
contract SablierMerkleLL is
ISablierMerkleLL, // 4 inherited components
SablierMerkleSignature, // 5 inherited components
SablierMerkleLockup // 5 inherited components
{
using SafeERC20 for IERC20;
/*//////////////////////////////////////////////////////////////////////////
STATE VARIABLES
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierMerkleLL
uint40 public immutable override VESTING_CLIFF_DURATION;
/// @inheritdoc ISablierMerkleLL
UD60x18 public immutable override VESTING_CLIFF_UNLOCK_PERCENTAGE;
/// @inheritdoc ISablierMerkleLL
uint40 public immutable override VESTING_GRANULARITY;
/// @inheritdoc ISablierMerkleLL
uint40 public immutable override VESTING_START_TIME;
/// @inheritdoc ISablierMerkleLL
UD60x18 public immutable override VESTING_START_UNLOCK_PERCENTAGE;
/// @inheritdoc ISablierMerkleLL
uint40 public immutable override VESTING_TOTAL_DURATION;
/*//////////////////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////////////////*/
/// @dev Constructs the contract by initializing the immutable state variables, and max approving the Lockup
/// contract.
constructor(
MerkleLL.ConstructorParams memory campaignParams,
address campaignCreator,
address comptroller
)
SablierMerkleBase(MerkleBase.ConstructorParams({
campaignCreator: campaignCreator,
campaignName: campaignParams.campaignName,
campaignStartTime: campaignParams.campaignStartTime,
claimType: campaignParams.claimType,
comptroller: comptroller,
expiration: campaignParams.expiration,
initialAdmin: campaignParams.initialAdmin,
ipfsCID: campaignParams.ipfsCID,
merkleRoot: campaignParams.merkleRoot,
token: campaignParams.token
}))
SablierMerkleLockup(MerkleLockup.ConstructorParams({
cancelable: campaignParams.cancelable,
lockup: campaignParams.lockup,
shape: campaignParams.shape,
transferable: campaignParams.transferable
}))
{
// Effect: set the immutable variables.
VESTING_CLIFF_DURATION = campaignParams.cliffDuration;
VESTING_CLIFF_UNLOCK_PERCENTAGE = campaignParams.cliffUnlockPercentage;
VESTING_GRANULARITY = campaignParams.granularity;
VESTING_START_TIME = campaignParams.vestingStartTime;
VESTING_START_UNLOCK_PERCENTAGE = campaignParams.startUnlockPercentage;
VESTING_TOTAL_DURATION = campaignParams.totalDuration;
}
/*//////////////////////////////////////////////////////////////////////////
USER-FACING STATE-CHANGING FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierMerkleLL
function claim(
uint256 index,
address recipient,
uint128 amount,
bytes32[] calldata merkleProof
)
external
payable
override
revertIfNot(ClaimType.DEFAULT)
{
// Check, Effect and Interaction: Pre-process the claim parameters on behalf of the recipient.
_preProcessClaim(index, recipient, amount, merkleProof);
// Effect and Interaction: Post-process the claim parameters on behalf of the recipient.
_postProcessClaim({ index: index, recipient: recipient, to: recipient, amount: amount, viaSig: false });
}
/// @inheritdoc ISablierMerkleLL
function claimTo(
uint256 index,
address to,
uint128 amount,
bytes32[] calldata merkleProof
)
external
payable
override
revertIfNot(ClaimType.DEFAULT)
notZeroAddress(to)
{
// Check, Effect and Interaction: Pre-process the claim parameters on behalf of `msg.sender`.
_preProcessClaim({ index: index, recipient: msg.sender, amount: amount, merkleProof: merkleProof });
// Effect and Interaction: Post-process the claim parameters on behalf of `msg.sender`.
_postProcessClaim({ index: index, recipient: msg.sender, to: to, amount: amount, viaSig: false });
}
/// @inheritdoc ISablierMerkleLL
function claimViaAttestation(
uint256 index,
address to,
uint128 amount,
uint40 expireAt,
bytes32[] calldata merkleProof,
bytes calldata attestation
)
external
payable
override
revertIfNot(ClaimType.ATTEST)
notZeroAddress(to)
{
// Check: the attestation signature is valid and the recovered signer matches the attestor.
_verifyAttestationSignature(msg.sender, expireAt, attestation);
// Check, Effect and Interaction: Pre-process the claim parameters on behalf of `msg.sender`.
_preProcessClaim({ index: index, recipient: msg.sender, amount: amount, merkleProof: merkleProof });
// Effect and Interaction: Post-process the claim parameters on behalf of `msg.sender`.
_postProcessClaim({ index: index, recipient: msg.sender, to: to, amount: amount, viaSig: false });
}
/// @inheritdoc ISablierMerkleLL
function claimViaSig(
uint256 index,
address recipient,
address to,
uint128 amount,
uint40 validFrom,
bytes32[] calldata merkleProof,
bytes calldata signature
)
external
payable
override
revertIfNot(ClaimType.DEFAULT)
notZeroAddress(to)
{
// Check: the signature is valid and the recovered signer matches the recipient.
_verifyClaimSignature(index, recipient, to, amount, validFrom, signature);
// Check, Effect and Interaction: Pre-process the claim parameters on behalf of the recipient.
_preProcessClaim(index, recipient, amount, merkleProof);
// Effect and Interaction: Post-process the claim parameters on behalf of the recipient.
_postProcessClaim({ index: index, recipient: recipient, to: to, amount: amount, viaSig: true });
}
/*//////////////////////////////////////////////////////////////////////////
PRIVATE STATE-CHANGING FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/
/// @dev Post-processes the claim execution by creating the stream or transferring the tokens directly and emitting
/// an event.
function _postProcessClaim(uint256 index, address recipient, address to, uint128 amount, bool viaSig) private {
// Calculate the timestamps.
Lockup.Timestamps memory timestamps;
// Zero is a sentinel value for `block.timestamp`.
if (VESTING_START_TIME == 0) {
timestamps.start = uint40(block.timestamp);
} else {
timestamps.start = VESTING_START_TIME;
}
timestamps.end = timestamps.start + VESTING_TOTAL_DURATION;
// If the end time is not in the future, transfer the amount directly to the `to` address..
if (timestamps.end <= block.timestamp) {
// Interaction: transfer the tokens to the `to` address.
TOKEN.safeTransfer(to, amount);
// Emit claim event.
emit ClaimLLWithTransfer(index, recipient, amount, to, viaSig);
}
// Otherwise, create the Lockup stream to start the vesting.
else {
// Calculate cliff time.
uint40 cliffTime;
if (VESTING_CLIFF_DURATION > 0) {
cliffTime = timestamps.start + VESTING_CLIFF_DURATION;
}
// Calculate the unlock amounts based on the percentages.
LockupLinear.UnlockAmounts memory unlockAmounts;
unlockAmounts.start = ud60x18(amount).mul(VESTING_START_UNLOCK_PERCENTAGE).intoUint128();
unlockAmounts.cliff = ud60x18(amount).mul(VESTING_CLIFF_UNLOCK_PERCENTAGE).intoUint128();
// Safe Interaction: create the stream with `to` as the stream recipient.
uint256 streamId = SABLIER_LOCKUP.createWithTimestampsLL(
Lockup.CreateWithTimestamps({
sender: admin,
recipient: to,
depositAmount: amount,
token: TOKEN,
cancelable: STREAM_CANCELABLE,
transferable: STREAM_TRANSFERABLE,
timestamps: timestamps,
shape: streamShape
}),
unlockAmounts,
VESTING_GRANULARITY,
cliffTime
);
// Effect: push the stream ID into the claimed streams array.
_claimedStreams[recipient].push(streamId);
// Emit claim event.
emit ClaimLLWithVesting(index, recipient, amount, streamId, to, viaSig);
}
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 60000,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": [
"@arbitrum/=node_modules/@arbitrum/",
"@chainlink/=node_modules/@chainlink/",
"@eth-optimism/=node_modules/@eth-optimism/",
"@offchainlabs/=node_modules/@offchainlabs/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@prb/=node_modules/@prb/",
"@sablier/=node_modules/@sablier/",
"@scroll-tech/=node_modules/@scroll-tech/",
"@zksync/=node_modules/@zksync/",
"forge-std/=node_modules/forge-std/",
"murky/=node_modules/murky/",
"openzeppelin-contracts/=node_modules/murky/lib/openzeppelin-contracts/",
"solady/=node_modules/solady/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.