-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
100 additions
and
43 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 |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
pragma solidity 0.8.21; | ||
Check warning Code scanning / Slither Incorrect versions of Solidity Warning
Pragma version0.8.21 necessitates a version too recent to be trusted. Consider deploying with 0.8.18.
|
||
|
||
/** | ||
* @title IWETH9Like | ||
* @title IWrappedNative | ||
* | ||
* @notice Provides the minimum interface for native token wrapper | ||
*/ | ||
interface IWETH9Like { | ||
interface IWrappedNative { | ||
function withdraw(uint256) external; | ||
|
||
function deposit() external payable; | ||
|
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
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 |
---|---|---|
|
@@ -346,7 +346,7 @@ library FundsLib { | |
} | ||
|
||
/** | ||
* @notice Forwared values to increaseAvailableFunds and emits notifies external listeners. | ||
* @notice Forwards values to increaseAvailableFunds and emits notifies external listeners. | ||
* | ||
* Emits FundsReleased events | ||
* | ||
|
@@ -397,6 +397,13 @@ library FundsLib { | |
} | ||
} | ||
Check failure Code scanning / Slither Arbitrary `from` in transferFrom High
FundsLib.transferFundsToProtocol(address,address,uint256) uses arbitrary from in transferFrom: IERC20(_tokenAddress).safeTransferFrom(_from,address(this),_amount)
Check warning Code scanning / Slither Dangerous strict equalities Medium |
||
|
||
/** | ||
* @notice Same as transferFundsToProtocol(address _tokenAddress, address _from, uint256 _amount), | ||
* but _from is message sender | ||
* | ||
* @param _tokenAddress - address of the token to be transferred | ||
* @param _amount - amount to be transferred | ||
*/ | ||
function transferFundsToProtocol(address _tokenAddress, uint256 _amount) internal { | ||
transferFundsToProtocol(_tokenAddress, EIP712Lib.msgSender(), _amount); | ||
} | ||
|
@@ -412,6 +419,7 @@ library FundsLib { | |
* - Contract at token address does not support ERC20 function transfer | ||
* - Available funds is less than amount to be decreased | ||
* | ||
* @param _entityId - id of entity for which funds should be decreased, or 0 for protocol | ||
* @param _tokenAddress - address of the token to be transferred | ||
* @param _to - address of the recipient | ||
* @param _amount - amount to be transferred | ||
|
@@ -432,6 +440,20 @@ library FundsLib { | |
emit FundsWithdrawn(_entityId, _to, _tokenAddress, _amount, EIP712Lib.msgSender()); | ||
} | ||
|
||
/** | ||
* @notice Tries to transfer native currency or tokens from the protocol to the recipient. | ||
* | ||
* Emits ERC20 Transfer event in call stack if ERC20 token is withdrawn and transfer is successful. | ||
* | ||
* Reverts if: | ||
* - Transfer of native currency is not successful (i.e. recipient is a contract which reverted) | ||
* - Contract at token address does not support ERC20 function transfer | ||
* - Available funds is less than amount to be decreased | ||
* | ||
* @param _tokenAddress - address of the token to be transferred | ||
* @param _to - address of the recipient | ||
* @param _amount - amount to be transferred | ||
*/ | ||
function transferFundsFromProtocol(address _tokenAddress, address payable _to, uint256 _amount) internal { | ||
// try to transfer the funds | ||
if (_tokenAddress == address(0)) { | ||
|
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