forked from foundry-rs/foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forge): Support library linking (foundry-rs#586)
* lib linking * fmt * `run` lib linking support * clippy + fmt * nonce fix * cargotoml fix * remove dirty deploy WIP * refactor link step * Update cli/src/cmd/run.rs Co-authored-by: Matthias Seitz <[email protected]> * Update forge/src/multi_runner.rs Co-authored-by: Matthias Seitz <[email protected]> * Update cli/src/cmd/run.rs Co-authored-by: Matthias Seitz <[email protected]> * nits * refactor post_link * Update cli/src/cmd/run.rs Co-authored-by: Georgios Konstantopoulos <[email protected]> * Update forge/testdata/LibLinking.sol Co-authored-by: Georgios Konstantopoulos <[email protected]> * Update cli/src/cmd/run.rs Co-authored-by: Georgios Konstantopoulos <[email protected]> * Update forge/src/multi_runner.rs Co-authored-by: Georgios Konstantopoulos <[email protected]> * nits * test fixes * remove next_nonce * lints Co-authored-by: Matthias Seitz <[email protected]> Co-authored-by: Georgios Konstantopoulos <[email protected]>
- Loading branch information
1 parent
9fb5d9d
commit 568534d
Showing
13 changed files
with
591 additions
and
196 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
pragma solidity ^0.7.6; | ||
|
||
interface ERC20 { | ||
function balanceOf(address) external view returns (uint256); | ||
function deposit() payable external; | ||
} | ||
|
||
interface VM { | ||
function startPrank(address) external; | ||
} | ||
|
||
library T { | ||
function getBal(ERC20 t, address who) public view returns (uint256) { | ||
return t.balanceOf(who); | ||
} | ||
} | ||
|
||
contract C { | ||
ERC20 weth = ERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); | ||
VM constant vm = VM(address(bytes20(uint160(uint256(keccak256('hevm cheat code')))))); | ||
address who = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045; | ||
|
||
event log_uint(uint256); | ||
|
||
function run() external { | ||
// impersonate the account | ||
vm.startPrank(who); | ||
|
||
uint256 balanceBefore = T.getBal(weth, who); | ||
emit log_uint(balanceBefore); | ||
|
||
weth.deposit{value: 15 ether}(); | ||
|
||
uint256 balanceAfter = weth.balanceOf(who); | ||
emit log_uint(balanceAfter); | ||
|
||
} | ||
} |
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
Oops, something went wrong.