-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Gearbox-protocol/fix--zapper-weth-fix
feat(zappers): `tokenOut` + approval fix
- Loading branch information
Showing
7 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
// Gearbox Protocol. Generalized leverage for DeFi protocols | ||
// (c) Gearbox Foundation, 2023. | ||
pragma solidity ^0.8.17; | ||
|
||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; | ||
import {WETHZapper} from "../../../zappers/WETHZapper.sol"; | ||
import {NetworkDetector} from "@gearbox-protocol/sdk-gov/contracts/NetworkDetector.sol"; | ||
import "@gearbox-protocol/core-v3/contracts/test/lib/constants.sol"; | ||
|
||
import {Test} from "forge-std/Test.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
address constant ap = 0x0Bf1626d4925F8A872801968be11c052862AC2D3; | ||
|
||
contract ZapperTest is Test { | ||
uint256 chainId; | ||
WETHZapper wethZapper; | ||
|
||
address weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; | ||
|
||
constructor() { | ||
NetworkDetector nd = new NetworkDetector(); | ||
chainId = nd.chainId(); | ||
} | ||
|
||
modifier liveTestOnly() { | ||
if (chainId == 1) { | ||
_; | ||
} | ||
} | ||
|
||
function setUp() public liveTestOnly { | ||
wethZapper = new WETHZapper(0x9357C9b42b9a555fCcF94cA5C702d72782865B71); | ||
} | ||
|
||
function test_weth_zapper() public liveTestOnly { | ||
console.log("Allowance", IERC20(weth).allowance(address(wethZapper), wethZapper.pool())); | ||
vm.prank(USER); | ||
wethZapper.deposit{value: 10 ether}(USER); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule forge-std
updated
17 files
+29 −0 | .github/workflows/sync.yml | |
+1 −1 | foundry.toml | |
+1 −1 | lib/ds-test | |
+1 −1 | package.json | |
+5 −3 | src/Base.sol | |
+8 −8 | src/StdAssertions.sol | |
+17 −19 | src/StdChains.sol | |
+53 −6 | src/StdCheats.sol | |
+12 −3 | src/StdUtils.sol | |
+94 −11 | src/Vm.sol | |
+394 −382 | src/console2.sol | |
+13,248 −0 | src/safeconsole.sol | |
+58 −13 | test/StdAssertions.t.sol | |
+20 −20 | test/StdChains.t.sol | |
+96 −0 | test/StdCheats.t.sol | |
+4 −4 | test/StdStyle.t.sol | |
+15 −0 | test/StdUtils.t.sol |