Skip to content

Commit

Permalink
chore: Minor code style related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnfy-view committed Mar 24, 2024
1 parent 90f27ae commit 565c117
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/ThunderSwapPoolFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ contract ThunderSwapPoolFactory is Ownable {
if (!s_supportedTokens[_token1]) revert TokenNotSupported(_token1);
if (!s_supportedTokens[_token2]) revert TokenNotSupported(_token2);
if (_token1 == _token2) revert PoolCannotHaveTwoTokensOfTheSameType();
address _pool = s_pairings[_token1][_token2];
if (_pool != address(0)) revert PoolAlreadyExists(_pool);
address pool = s_pairings[_token1][_token2];
if (pool != address(0)) revert PoolAlreadyExists(pool);

string memory poolName =
string.concat("ThunderSwap", ERC20(_token1).name(), ERC20(_token2).name());
Expand Down Expand Up @@ -96,12 +96,12 @@ contract ThunderSwapPoolFactory is Ownable {
}

/**
* @notice Returns the address of the pool that two tokens have.
* @param _token1 The address of the first token.
* @param _token2 The address of the second token.
* @return The address of the pool for _token1 and _token2.
* @notice Gets the address of the pool that two tokens have
* @param _token1 The address of the first token
* @param _token2 The address of the second token
* @return The address of the pool for _token1 and _token2
*/
function getPairing(address _token1, address _token2) external view returns (address) {
function getPoolFromPairing(address _token1, address _token2) external view returns (address) {
return s_pairings[_token1][_token2];
}
}
File renamed without changes.
10 changes: 8 additions & 2 deletions test/unit/miscellaneousTests/miscellaneous.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ contract MiscellaneousTest is UniversalHelper {
}

function testGetPoolFromPairings() public view {
assertEq(thunderSwapPoolFactory.getPairing(address(tokenA),address(tokenB)), address(thunderSwapPool));
assertEq(thunderSwapPoolFactory.getPairing(address(tokenA),address(tokenB)), address(thunderSwapPool));
assertEq(
thunderSwapPoolFactory.getPoolFromPairing(address(tokenA), address(tokenB)),
address(thunderSwapPool)
);
assertEq(
thunderSwapPoolFactory.getPoolFromPairing(address(tokenA), address(tokenB)),
address(thunderSwapPool)
);
}
}

0 comments on commit 565c117

Please sign in to comment.