Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ block number the fork starts from. If it starts from an old state some tests mig
`npm run test [network] [test-file]` - run a test to the specified network by calling the script from the `/test` folder

`npm run verify [network] [contract-name]` - verify contract based on address and arguments from `/deployments` folder

## Remarks

- `Exchange.sol` in the `_swap` function we are calling low level function `call` with arbitrary address and call data, which may impose some security threats, however by design the `Exchange` contract does not hold any founds and is used only as proxy to Exchange (1inch) and collecting fees. Thus calling `call` in our case is safe and does not expose us or our users to theft of funds.
2 changes: 2 additions & 0 deletions contracts/multiply/Exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ contract Exchange {
bytes calldata withData
) internal returns (uint256) {
IERC20(fromAsset).safeApprove(callee, amount);
// In general we shouldn't call arbitrary address with arbitrary data. This would be a security risk,
// However in this case by design the Exchange contract does not hold any funds, so there is nothing to be stolen.
(bool success, ) = callee.call(withData);
require(success, "Exchange / Could not swap");
uint256 balance = IERC20(toAsset).balanceOf(address(this));
Expand Down