Skip to content

Commit

Permalink
permissionIds and adapt to new redeem hook spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mejango committed Feb 23, 2024
1 parent 487d626 commit 65b308d
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 518 deletions.
30 changes: 15 additions & 15 deletions broadcast/Deploy.s.sol/11155111/run-latest.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions broadcast/Deploy.s.sol/11155420/run-latest.json

Large diffs are not rendered by default.

669 changes: 192 additions & 477 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"deploy:optimism-sepolia": "source .env && forge script Deploy --chain-id 11155420 --rpc-url $RPC_OPTIMISM_SEPOLIA --broadcast --verify --etherscan-api-key $OPTIMISTIC_ETHERSCAN_API_KEY --interactives 1 --sender $SENDER_OPTIMISM_SEPOLIA -vvv"
},
"dependencies": {
"@bananapus/core": "^0.0.4",
"@bananapus/core": "^0.0.5",
"@bananapus/permission-ids": "^0.0.2",
"@exhausted-pigeon/uniswap-v3-forge-quoter": "^1.0.1",
"@openzeppelin/contracts": "^5.0.1",
"@uniswap/v3-core": "1.0.2-solc-0.8-simulate",
"@uniswap/v3-periphery": "github:uniswap/v3-periphery#0.8"
}
}
}
4 changes: 2 additions & 2 deletions src/JBBuybackHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ contract JBBuybackHook is ERC165, JBPermissioned, IJBBuybackHook {
external
pure
override
returns (uint256, JBRedeemHookSpecification[] memory hookSpecifications)
returns (uint256, uint256, uint256, JBRedeemHookSpecification[] memory hookSpecifications)
{
return (context.reclaimAmount.value, hookSpecifications);
return (context.redemptionRate, context.redeemCount, context.totalSupply, hookSpecifications);
}

//*********************************************************************//
Expand Down
29 changes: 20 additions & 9 deletions test/Unit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1553,27 +1553,38 @@ contract Test_BuybackHook_Unit is Test {
}

/// @notice Test whether redemption functionality is left unchanged by the hook.
function test_beforeRedeemRecordedWith_unchangedRedeem(uint256 amountIn) public {
function test_beforeRedeemRecordedWith_unchangedRedeem(
uint256 redemptionRateIn,
uint256 redeemCountIn,
uint256 totalSupplyIn
)
public
{
// Set up basic redemption context.
JBBeforeRedeemRecordedContext memory beforeRedeemRecordedContext = JBBeforeRedeemRecordedContext({
terminal: makeAddr("terminal"),
holder: makeAddr("hooldooor"),
projectId: 69,
rulesetId: 420,
redeemCount: 4,
totalSupply: 5,
surplus: 6,
reclaimAmount: JBTokenAmount(address(1), amountIn, 2, 3),
redeemCount: redeemCountIn,
totalSupply: totalSupplyIn,
surplus: JBTokenAmount(address(1), 6, 2, 3),
useTotalSurplus: true,
redemptionRate: 7,
redemptionRate: redemptionRateIn,
metadata: ""
});

(uint256 amountOut, JBRedeemHookSpecification[] memory redeemSpecifications) =
hook.beforeRedeemRecordedWith(beforeRedeemRecordedContext);
(
uint256 redemptionRateOut,
uint256 redeemCountOut,
uint256 totalSupplyOut,
JBRedeemHookSpecification[] memory redeemSpecifications
) = hook.beforeRedeemRecordedWith(beforeRedeemRecordedContext);

// Make sure the redemption amount is unchanged and that no specifications were returned.
assertEq(amountOut, amountIn);
assertEq(redemptionRateOut, redemptionRateIn);
assertEq(redeemCountOut, redeemCountIn);
assertEq(totalSupplyOut, totalSupplyIn);
assertEq(redeemSpecifications.length, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion test/helpers/TestBaseWorkflowV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ contract TestBaseWorkflowV3 is Test {

// Deploy the JBX ERC-20 for the project.
vm.prank(multisig);
jbController.deployERC20For(projectId, "jbx", "jbx");
jbController.deployERC20For(projectId, "jbx", "jbx", bytes32(0));

// Set the buyback hook pool up for the project.
vm.prank(multisig);
Expand Down

0 comments on commit 65b308d

Please sign in to comment.