Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove V2 and obsolete references #994

Merged
merged 14 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions src/core/SablierNFTDescriptor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ contract SablierNFTDescriptor is ISablierNFTDescriptor {
/// @dev Reverts if the symbol is unknown.
function mapSymbol(IERC721Metadata sablier) internal view returns (string memory) {
string memory symbol = sablier.symbol();
if (symbol.equal("SAB-LOCKUP-LIN")) {
return "Sablier Lockup Linear";
} else if (symbol.equal("SAB-LOCKUP-DYN")) {
return "Sablier Lockup Dynamic";
} else if (symbol.equal("SAB-LOCKUP-TRA")) {
return "Sablier Lockup Tranched";
if (symbol.equal("SAB-LOCKUP-LIN") || symbol.equal("SAB-V2-LOCKUP-LIN")) {
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
return "Lockup Linear";
} else if (symbol.equal("SAB-LOCKUP-DYN") || symbol.equal("SAB-V2-LOCKUP-DYN")) {
return "Lockup Dynamic";
} else if (symbol.equal("SAB-LOCKUP-TRA") || symbol.equal("SAB-V2-LOCKUP-TRA")) {
return "Lockup Tranched";
} else {
revert Errors.SablierNFTDescriptor_UnknownNFT(sablier, symbol);
}
Expand Down
21 changes: 19 additions & 2 deletions test/periphery/fork/merkle-lockup/MerkleLL.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ abstract contract MerkleLL_Fork_Test is Fork_Test {

// Sort the leaves in ascending order to match the production environment.
MerkleBuilder.sortLeaves(leaves);
vars.merkleRoot = getRoot(leaves.toBytes32());

// Compute the Merkle root.
if (leaves.toBytes32().length == 1) {
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
// If there is only one leaf, the Merkle root is the leaf itself.
vars.merkleRoot = leaves.toBytes32()[0];
} else {
vars.merkleRoot = getRoot(leaves.toBytes32());
}

// Make the caller the admin.
resetPrank({ msgSender: params.admin });
Expand Down Expand Up @@ -152,11 +159,21 @@ abstract contract MerkleLL_Fork_Test is Fork_Test {
vars.amounts[params.posBeforeSort],
vars.expectedStreamId
);

// Compute the Merkle proof.
bytes32[] memory proof;
if (leaves.toBytes32().length == 1) {
// If there is only one leaf, the Merkle proof is hash of the single leaf.
proof[0] = leaves.toBytes32()[0];
} else {
proof = getProof(leaves.toBytes32(), vars.leafPos);
}

vars.actualStreamId = vars.merkleLL.claim({
index: vars.indexes[params.posBeforeSort],
recipient: vars.recipients[params.posBeforeSort],
amount: vars.amounts[params.posBeforeSort],
merkleProof: getProof(leaves.toBytes32(), vars.leafPos)
merkleProof: proof
});

vars.actualStream = lockupLinear.getStream(vars.actualStreamId);
Expand Down
21 changes: 19 additions & 2 deletions test/periphery/fork/merkle-lockup/MerkleLT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ abstract contract MerkleLT_Fork_Test is Fork_Test {

// Sort the leaves in ascending order to match the production environment.
MerkleBuilder.sortLeaves(leaves);
vars.merkleRoot = getRoot(leaves.toBytes32());

// Compute the Merkle root.
if (leaves.toBytes32().length == 1) {
// If there is only one leaf, the Merkle root is the leaf itself.
vars.merkleRoot = leaves.toBytes32()[0];
} else {
vars.merkleRoot = getRoot(leaves.toBytes32());
}

// Make the caller the admin.
resetPrank({ msgSender: params.admin });
Expand Down Expand Up @@ -154,11 +161,21 @@ abstract contract MerkleLT_Fork_Test is Fork_Test {
vars.amounts[params.posBeforeSort],
vars.expectedStreamId
);

// Compute the Merkle proof.
bytes32[] memory proof;
if (leaves.toBytes32().length == 1) {
// If there is only one leaf, the Merkle proof is hash of the single leaf.
proof[0] = leaves.toBytes32()[0];
} else {
proof = getProof(leaves.toBytes32(), vars.leafPos);
}

vars.actualStreamId = vars.merkleLT.claim({
index: vars.indexes[params.posBeforeSort],
recipient: vars.recipients[params.posBeforeSort],
amount: vars.amounts[params.posBeforeSort],
merkleProof: getProof(leaves.toBytes32(), vars.leafPos)
merkleProof: proof
});

vars.actualStream = lockupTranched.getStream(vars.actualStreamId);
Expand Down
Loading