Skip to content

Commit

Permalink
Fix audittens I10 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless authored Nov 29, 2024
1 parent db41088 commit 3f2589c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
2 changes: 0 additions & 2 deletions l1-contracts/contracts/bridge/asset-router/L1AssetRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,6 @@ contract L1AssetRouter is AssetRouterBase, IL1AssetRouter, ReentrancyGuard {
bytes memory bridgeMintCalldata;
// Inner call to encode data to decrease local var numbers
_assetId = _ensureTokenRegisteredWithNTV(_l1Token);
IERC20(_l1Token).forceApprove(address(nativeTokenVault), _amount);

bridgeMintCalldata = _burn({
_chainId: ERA_CHAIN_ID,
_nextMsgValue: 0,
Expand Down
17 changes: 0 additions & 17 deletions l1-contracts/contracts/bridge/ntv/L1NativeTokenVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,6 @@ contract L1NativeTokenVault is IL1NativeTokenVault, IL1AssetHandler, NativeToken
);
}

/// @notice Transfers tokens from the depositor address to the smart contract address.
/// @param _from The address of the depositor.
/// @param _token The ERC20 token to be transferred.
/// @param _amount The amount to be transferred.
/// @return The difference between the contract balance before and after the transferring of funds.
function _depositFunds(address _from, IERC20 _token, uint256 _amount) internal override returns (uint256) {
address from = _from;
// in the legacy scenario the SharedBridge = L1Nullifier was granting the allowance, we have to transfer from them instead of the user
if (
_token.allowance(address(ASSET_ROUTER), address(this)) >= _amount &&
_token.allowance(_from, address(this)) < _amount
) {
from = address(ASSET_ROUTER);
}
return super._depositFunds(from, _token, _amount);
}

function _withdrawFunds(bytes32 _assetId, address _to, address _token, uint256 _amount) internal override {
if (_assetId == BASE_TOKEN_ASSET_ID) {
bool callSuccess;
Expand Down

0 comments on commit 3f2589c

Please sign in to comment.