Skip to content

Commit

Permalink
refactor: bancor swapper variables to immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
b0dhidharma committed Jan 28, 2022
1 parent 5a99d09 commit 635ce3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions packages/yswaps/contracts/swappers/async/BancorSwapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ interface IBancorNetwork {
) external payable returns (uint256 returnAmount);
}

interface IBancorSwapper is IAsyncSwapper {}
interface IBancorSwapper is IAsyncSwapper {
function contractRegistry() external returns (IContractRegistry);

function bancorNetworkName() external returns (bytes32);
}

contract BancorSwapper is IBancorSwapper, AsyncSwapper {
using SafeERC20 for IERC20;

IContractRegistry public contractRegistry;
bytes32 public bancorNetworkName;
IContractRegistry public immutable override contractRegistry;
bytes32 public immutable override bancorNetworkName;

constructor(
address _governor,
Expand Down
10 changes: 7 additions & 3 deletions packages/yswaps/contracts/swappers/sync/BancorSwapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ interface IBancorNetwork {
) external payable returns (uint256 returnAmount);
}

interface IBancorSwapper is ISyncSwapper {}
interface IBancorSwapper is ISyncSwapper {
function contractRegistry() external returns (IContractRegistry);

function bancorNetworkName() external returns (bytes32);
}

contract BancorSwapper is IBancorSwapper, SyncSwapper {
using SafeERC20 for IERC20;

IContractRegistry public contractRegistry;
bytes32 public bancorNetworkName;
IContractRegistry public immutable override contractRegistry;
bytes32 public immutable override bancorNetworkName;

constructor(
address _governor,
Expand Down
2 changes: 1 addition & 1 deletion packages/yswaps/contracts/swappers/sync/SyncSwapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract contract SyncSwapper is ISyncSwapper, Swapper {
address _tokenIn,
address _tokenOut,
uint256 _amountIn,
uint256 _maxSlippage
uint256
) internal pure {
if (_receiver == address(0) || _tokenIn == address(0) || _tokenOut == address(0)) revert CommonErrors.ZeroAddress();
if (_amountIn == 0) revert CommonErrors.ZeroAmount();
Expand Down

0 comments on commit 635ce3d

Please sign in to comment.