Verified contractPartialGPL-3.0-or-later
SablierV2MerkleStreamerLL
Address0x6f83899fd97a90d91476e7bf0ea04a404a7ea8a5
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.21
- Same code
56 more contracts
Details
- Compiler
- solc 0.8.21+commit.d9974bed
- Language
- solidity
- Optimization
- Yes, 10,000 runs
- EVM version
- paris
- Via IR
- yes
- License
- GPL-3.0-or-later
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 19,570,849
- Creation transaction
- 0xc0ed2dcb92…0f58f7300a
- Main copy (most transactions)
- 0x70e3e243…ee4b951e
89 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/SablierV2MerkleStreamerLL.solmain4.21 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.74 KB
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol2.26 KB
- @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol6.91 KB
- @openzeppelin/contracts/token/ERC721/IERC721.sol4.88 KB
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol761 B
- @openzeppelin/contracts/utils/Address.sol9.36 KB
- @openzeppelin/contracts/utils/cryptography/MerkleProof.sol9.62 KB
- @openzeppelin/contracts/utils/introspection/IERC165.sol853 B
- @openzeppelin/contracts/utils/structs/BitMaps.sol1.56 KB
- @prb/math/src/Common.sol25.31 KB
- @prb/math/src/UD2x18.sol1.88 KB
- @prb/math/src/UD60x18.sol2.15 KB
- @prb/math/src/sd1x18/Casting.sol2.77 KB
- @prb/math/src/sd1x18/Constants.sol759 B
- @prb/math/src/sd1x18/Errors.sol916 B
- @prb/math/src/sd1x18/ValueType.sol879 B
- @prb/math/src/sd59x18/Casting.sol3.94 KB
- @prb/math/src/sd59x18/Constants.sol2.4 KB
- @prb/math/src/sd59x18/Errors.sol3.88 KB
- @prb/math/src/sd59x18/Helpers.sol4.12 KB
- @prb/math/src/sd59x18/Math.sol27.56 KB
- @prb/math/src/sd59x18/ValueType.sol2.61 KB
- @prb/math/src/ud2x18/Casting.sol2.48 KB
- @prb/math/src/ud2x18/Constants.sol597 B
- @prb/math/src/ud2x18/Errors.sol373 B
- @prb/math/src/ud2x18/ValueType.sol885 B
- @prb/math/src/ud60x18/Casting.sol3.15 KB
- @prb/math/src/ud60x18/Constants.sol1.93 KB
- @prb/math/src/ud60x18/Conversions.sol1.04 KB
- @prb/math/src/ud60x18/Errors.sol1.75 KB
- @prb/math/src/ud60x18/Helpers.sol3.79 KB
- @prb/math/src/ud60x18/Math.sol22.95 KB
- @prb/math/src/ud60x18/ValueType.sol2.79 KB
- @sablier/v2-core/src/abstracts/Adminable.sol1.56 KB
- @sablier/v2-core/src/interfaces/IAdminable.sol1.85 KB
- @sablier/v2-core/src/interfaces/ISablierV2Base.sol3.62 KB
- @sablier/v2-core/src/interfaces/ISablierV2Comptroller.sol5.02 KB
- @sablier/v2-core/src/interfaces/ISablierV2Lockup.sol15.17 KB
- @sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol6.26 KB
- @sablier/v2-core/src/interfaces/ISablierV2NFTDescriptor.sol859 B
- @sablier/v2-core/src/libraries/Errors.sol7.24 KB
- @sablier/v2-core/src/types/DataTypes.sol13.3 KB
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.74 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol2.26 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol6.91 KB
- node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol4.88 KB
- node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol761 B
- node_modules/@openzeppelin/contracts/utils/Address.sol9.36 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol9.62 KB
- node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol853 B
- node_modules/@openzeppelin/contracts/utils/structs/BitMaps.sol1.56 KB
- node_modules/@prb/math/src/Common.sol25.31 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.77 KB
- node_modules/@prb/math/src/sd1x18/Constants.sol759 B
- node_modules/@prb/math/src/sd1x18/Errors.sol916 B
- node_modules/@prb/math/src/sd1x18/ValueType.sol879 B
- node_modules/@prb/math/src/sd59x18/Casting.sol3.94 KB
- node_modules/@prb/math/src/sd59x18/Constants.sol2.4 KB
- node_modules/@prb/math/src/sd59x18/Errors.sol3.88 KB
- node_modules/@prb/math/src/sd59x18/Helpers.sol4.12 KB
- node_modules/@prb/math/src/sd59x18/Math.sol27.56 KB
- node_modules/@prb/math/src/sd59x18/ValueType.sol2.61 KB
- node_modules/@prb/math/src/ud2x18/Casting.sol2.48 KB
- node_modules/@prb/math/src/ud2x18/Constants.sol597 B
- node_modules/@prb/math/src/ud2x18/Errors.sol373 B
- node_modules/@prb/math/src/ud2x18/ValueType.sol885 B
- node_modules/@prb/math/src/ud60x18/Casting.sol3.15 KB
- node_modules/@prb/math/src/ud60x18/Constants.sol1.93 KB
- node_modules/@prb/math/src/ud60x18/Conversions.sol1.04 KB
- node_modules/@prb/math/src/ud60x18/Errors.sol1.75 KB
- node_modules/@prb/math/src/ud60x18/Helpers.sol3.79 KB
- node_modules/@prb/math/src/ud60x18/Math.sol22.95 KB
- node_modules/@prb/math/src/ud60x18/ValueType.sol2.79 KB
- node_modules/@sablier/v2-core/src/abstracts/Adminable.sol1.56 KB
- node_modules/@sablier/v2-core/src/interfaces/IAdminable.sol1.85 KB
- node_modules/@sablier/v2-core/src/interfaces/ISablierV2Base.sol3.62 KB
- node_modules/@sablier/v2-core/src/interfaces/ISablierV2Comptroller.sol5.02 KB
- node_modules/@sablier/v2-core/src/interfaces/ISablierV2Lockup.sol15.17 KB
- node_modules/@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol6.26 KB
- node_modules/@sablier/v2-core/src/interfaces/ISablierV2NFTDescriptor.sol859 B
- node_modules/@sablier/v2-core/src/libraries/Errors.sol7.24 KB
- node_modules/@sablier/v2-core/src/types/DataTypes.sol13.3 KB
- src/abstracts/SablierV2MerkleStreamer.sol6.04 KB
- src/interfaces/ISablierV2MerkleStreamer.sol3.77 KB
- src/interfaces/ISablierV2MerkleStreamerLL.sol2.01 KB
- src/libraries/Errors.sol1.41 KB
src/SablierV2MerkleStreamerLL.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.19;
import { BitMaps } from "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ISablierV2LockupLinear } from "@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol";
import { Broker, LockupLinear } from "@sablier/v2-core/src/types/DataTypes.sol";
import { ud } from "@prb/math/src/UD60x18.sol";
import { SablierV2MerkleStreamer } from "./abstracts/SablierV2MerkleStreamer.sol";
import { ISablierV2MerkleStreamerLL } from "./interfaces/ISablierV2MerkleStreamerLL.sol";
/// @title SablierV2MerkleStreamerLL
/// @notice See the documentation in {ISablierV2MerkleStreamerLL}.
contract SablierV2MerkleStreamerLL is
ISablierV2MerkleStreamerLL, // 2 inherited components
SablierV2MerkleStreamer // 4 inherited components
{
using BitMaps for BitMaps.BitMap;
using SafeERC20 for IERC20;
/*//////////////////////////////////////////////////////////////////////////
USER-FACING CONSTANTS
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierV2MerkleStreamerLL
ISablierV2LockupLinear public immutable override LOCKUP_LINEAR;
/*//////////////////////////////////////////////////////////////////////////
USER-FACING STORAGE
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierV2MerkleStreamerLL
LockupLinear.Durations public override streamDurations;
/*//////////////////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////////////////*/
/// @dev Constructs the contract by initializing the immutable state variables, and max approving the Sablier
/// contract.
constructor(
address initialAdmin,
ISablierV2LockupLinear lockupLinear,
IERC20 asset,
bytes32 merkleRoot,
uint40 expiration,
LockupLinear.Durations memory streamDurations_,
bool cancelable,
bool transferable
)
SablierV2MerkleStreamer(initialAdmin, asset, lockupLinear, merkleRoot, expiration, cancelable, transferable)
{
LOCKUP_LINEAR = lockupLinear;
streamDurations = streamDurations_;
// Max approve the Sablier contract to spend funds from the Merkle streamer.
ASSET.forceApprove(address(LOCKUP_LINEAR), type(uint256).max);
}
/*//////////////////////////////////////////////////////////////////////////
USER-FACING NON-CONSTANT FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/
/// @inheritdoc ISablierV2MerkleStreamerLL
function claim(
uint256 index,
address recipient,
uint128 amount,
bytes32[] calldata merkleProof
)
external
override
returns (uint256 streamId)
{
// Generate the Merkle tree leaf by hashing the corresponding parameters. Hashing twice prevents second
// preimage attacks.
bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(index, recipient, amount))));
// Checks: validate the function.
_checkClaim(index, leaf, merkleProof);
// Effects: mark the index as claimed.
_claimedBitMap.set(index);
// Interactions: create the stream via {SablierV2LockupLinear}.
streamId = LOCKUP_LINEAR.createWithDurations(
LockupLinear.CreateWithDurations({
asset: ASSET,
broker: Broker({ account: address(0), fee: ud(0) }),
cancelable: CANCELABLE,
durations: streamDurations,
recipient: recipient,
sender: admin,
totalAmount: amount,
transferable: TRANSFERABLE
})
);
// Log the claim.
emit Claim(index, recipient, amount, streamId);
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"bytecodeHash": "none"
},
"libraries": {},
"optimizer": {
"runs": 10000,
"enabled": true
},
"evmVersion": "paris",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.