Skip to content

Commit

Permalink
fix ordering delegate metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-something committed Sep 30, 2023
1 parent 4a76e59 commit 73bf06c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions contracts/JBBuybackDelegate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ contract JBBuybackDelegate is ERC165, JBOperatable, IJBBuybackDelegate {
delegateAllocations[0] = JBPayDelegateAllocation3_1_1({
delegate: IJBPayDelegate3_1_1(this),
amount: _amountToSwapWith,
metadata: abi.encode(_quoteExists, _projectTokenIs0, _minimumSwapAmountOut, _totalPaid == _amountToSwapWith ? 0 : _totalPaid - _amountToSwapWith, _weight)
metadata: abi.encode(_quoteExists, _projectTokenIs0, _totalPaid == _amountToSwapWith ? 0 : _totalPaid - _amountToSwapWith, _minimumSwapAmountOut, _weight)
});

// All the mint will be done in didPay, return 0 as weight to avoid minting via the terminal
Expand Down Expand Up @@ -267,8 +267,8 @@ contract JBBuybackDelegate is ERC165, JBOperatable, IJBBuybackDelegate {
(
bool _quoteExists,
bool _projectTokenIs0,
uint256 _minimumSwapAmountOut,
uint256 _amountToMintWith,
uint256 _minimumSwapAmountOut,
uint256 _weight
) = abi.decode(_data.dataSourceMetadata, (bool, bool, uint256, uint256, uint256));

Expand Down
16 changes: 8 additions & 8 deletions contracts/test/JBBuybackDelegate_Unit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ contract TestJBBuybackDelegate_Units is Test {
assertEq(_allocationsReturned[0].amount, _amountIn, "worng amount in returned");
assertEq(
_allocationsReturned[0].metadata,
abi.encode(true, address(projectToken) < address(weth), _swapOutCount, payParams.amount.value - _amountIn, payParams.weight),
abi.encode(true, address(projectToken) < address(weth), payParams.amount.value - _amountIn, _swapOutCount, payParams.weight),
"wrong metadata"
);

Expand Down Expand Up @@ -274,7 +274,7 @@ contract TestJBBuybackDelegate_Units is Test {
assertEq(
_allocationsReturned[0].metadata,
abi.encode(
false, address(projectToken) < address(weth), _twapAmountOut, 0, payParams.weight
false, address(projectToken) < address(weth), 0, _twapAmountOut, payParams.weight
),
"wrong metadata"
);
Expand Down Expand Up @@ -372,8 +372,8 @@ contract TestJBBuybackDelegate_Units is Test {
didPayData.dataSourceMetadata = abi.encode(
true, // use quote
address(projectToken) < address(weth),
_tokenCount,
0,
_tokenCount,
_twapQuote
);

Expand Down Expand Up @@ -464,8 +464,8 @@ contract TestJBBuybackDelegate_Units is Test {
didPayData.dataSourceMetadata = abi.encode(
true, // use quote
address(projectToken) < address(weth),
_twapQuote,
0,
_twapQuote,
_tokenCount
);

Expand Down Expand Up @@ -564,8 +564,8 @@ contract TestJBBuybackDelegate_Units is Test {
didPayData.dataSourceMetadata = abi.encode(
true, // use quote
address(projectToken) < address(weth),
_tokenCount,
0,
_tokenCount,
_twapQuote
);

Expand Down Expand Up @@ -665,8 +665,8 @@ contract TestJBBuybackDelegate_Units is Test {
didPayData.dataSourceMetadata = abi.encode(
true, // use quote
address(projectToken) < address(weth),
_tokenCount,
0,
_tokenCount,
1 ether // weight - unused
);

Expand Down Expand Up @@ -735,8 +735,8 @@ contract TestJBBuybackDelegate_Units is Test {
didPayData.dataSourceMetadata = abi.encode(
false, // use quote
address(otherRandomProjectToken) < address(randomTerminalToken),
_tokenCount,
_extraMint, // extra amount to mint with
_tokenCount,
_weight
);

Expand Down Expand Up @@ -856,8 +856,8 @@ contract TestJBBuybackDelegate_Units is Test {
didPayData.dataSourceMetadata = abi.encode(
false, // use quote
address(projectToken) < address(weth),
_tokenCount,
_extraMint,
_tokenCount,
_weight
);

Expand Down

0 comments on commit 73bf06c

Please sign in to comment.