From 76f125e47921928cbc2dad03f9683c5364f672b0 Mon Sep 17 00:00:00 2001 From: don mosites Date: Tue, 10 Sep 2024 04:26:22 +0200 Subject: [PATCH] Fixes to Beta (#1328) * Scripts enhancements (#1321) * Added checks to validate target deployment address matches mainnet * Added storing of commit hashes upon deployment to track deployed code * Created script to populate the latest deploy commits * Renamed deploy commits script for clarity * Updated module declarations * Removed script to populate hashes * prompt language update --------- Co-authored-by: Don Mosites * Bump micromatch from 4.0.5 to 4.0.8 (#1323) Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8. - [Release notes](https://github.com/micromatch/micromatch/releases) - [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md) - [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8) --- updated-dependencies: - dependency-name: micromatch dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump axios from 1.6.7 to 1.7.7 (#1324) Bumps [axios](https://github.com/axios/axios) from 1.6.7 to 1.7.7. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.6.7...v1.7.7) --- updated-dependencies: - dependency-name: axios dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Increased Delegate test coverage to 100% (#1325) * Fix/audit fixes (#1327) * Increased Delegate test coverage to 100% * Implemented audit fixes * Removed unused import --------- Signed-off-by: dependabot[bot] Co-authored-by: Smartcontrart <100962328+smartcontrart@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- source/delegate/contracts/Delegate.sol | 8 +++++--- source/delegate/contracts/interfaces/IDelegate.sol | 4 ++-- source/delegate/test/Delegate.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/delegate/contracts/Delegate.sol b/source/delegate/contracts/Delegate.sol index 15e9366ad..b5076486a 100644 --- a/source/delegate/contracts/Delegate.sol +++ b/source/delegate/contracts/Delegate.sol @@ -4,7 +4,6 @@ pragma solidity 0.8.23; import "./interfaces/IDelegate.sol"; import "@airswap/swap-erc20/contracts/interfaces/ISwapERC20.sol"; -import { ERC20 } from "solady/src/tokens/ERC20.sol"; import { Ownable } from "solady/src/auth/Ownable.sol"; import { SafeTransferLib } from "solady/src/utils/SafeTransferLib.sol"; @@ -152,8 +151,11 @@ contract Delegate is IDelegate, Ownable { _senderAmount ); - // Approve the SwapERC20 contract to transfer the sender token - ERC20(_senderToken).approve(address(swapERC20), _senderAmount); + SafeTransferLib.safeApprove( + _senderToken, + address(swapERC20), + _senderAmount + ); // Execute the swap swapERC20.swapLight( diff --git a/source/delegate/contracts/interfaces/IDelegate.sol b/source/delegate/contracts/interfaces/IDelegate.sol index 2a2da99d2..51b17ad53 100644 --- a/source/delegate/contracts/interfaces/IDelegate.sol +++ b/source/delegate/contracts/interfaces/IDelegate.sol @@ -63,7 +63,7 @@ interface IDelegate { function unsetRule( address sender, - address signerToken, - address senderToken + address senderToken, + address signerToken ) external; } diff --git a/source/delegate/test/Delegate.js b/source/delegate/test/Delegate.js index 91c2f7d04..689f1d9dd 100644 --- a/source/delegate/test/Delegate.js +++ b/source/delegate/test/Delegate.js @@ -146,7 +146,7 @@ describe('Delegate Unit', () => { it('the swapERC20Contract address cannot be address(0)', async () => { await expect( delegate.setSwapERC20Contract(ADDRESS_ZERO) - ).to.be.revertedWith('InvalidAddress') + ).to.be.revertedWith('AddressInvalid') }) it('only the owner can set the swapERC20Contract address', async () => {