Skip to content

Commit

Permalink
set convertFromStableCoin() function as internal
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcabot committed Nov 10, 2022
1 parent 0c18bf4 commit 14780c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions contracts/SoulLinker.sol
Expand Up @@ -355,7 +355,7 @@ contract SoulLinker is PayDexAMM, EIP712 {
view
returns (uint256 priceInUtilityToken)
{
priceInUtilityToken = convertFromStableCoin(
priceInUtilityToken = _convertFromStableCoin(
utilityToken,
addPermissionPrice
);
Expand All @@ -367,7 +367,7 @@ contract SoulLinker is PayDexAMM, EIP712 {
/// @dev This method will transfer the funds to the reserve wallet, performing the swap
function _payForStoringPermission() internal {
// pay with $MASA
uint256 swapAmout = convertFromStableCoin(
uint256 swapAmout = _convertFromStableCoin(
utilityToken,
addPermissionPrice
);
Expand Down
11 changes: 7 additions & 4 deletions contracts/SoulStore.sol
Expand Up @@ -214,8 +214,11 @@ contract SoulStore is PayDexAMM {
{
priceInStableCoin = mintingPrice;
// get swapped price in ETH and $MASA
priceInETH = convertFromStableCoin(wrappedNativeToken, mintingPrice);
priceInUtilityToken = convertFromStableCoin(utilityToken, mintingPrice);
priceInETH = _convertFromStableCoin(wrappedNativeToken, mintingPrice);
priceInUtilityToken = _convertFromStableCoin(
utilityToken,
mintingPrice
);
}

/// @notice Performs the payment for the minting
Expand All @@ -235,7 +238,7 @@ contract SoulStore is PayDexAMM {
);
} else if (paymentMethod == address(0)) {
// ETH
uint256 swapAmout = convertFromStableCoin(
uint256 swapAmout = _convertFromStableCoin(
wrappedNativeToken,
mintingPrice
);
Expand All @@ -252,7 +255,7 @@ contract SoulStore is PayDexAMM {
}
} else if (paymentMethod == utilityToken) {
// $MASA
uint256 swapAmout = convertFromStableCoin(
uint256 swapAmout = _convertFromStableCoin(
paymentMethod,
mintingPrice
);
Expand Down
8 changes: 4 additions & 4 deletions contracts/dex/PayDexAMM.sol
Expand Up @@ -113,16 +113,16 @@ abstract contract PayDexAMM is Ownable {

/* ========== VIEWS ===================================================== */

function convertFromStableCoin(address _token, uint256 _amount)
public
/* ========== PRIVATE FUNCTIONS ========================================= */

function _convertFromStableCoin(address _token, uint256 _amount)
internal
view
returns (uint256)
{
return _estimateSwapAmount(_token, stableCoin, _amount);
}

/* ========== PRIVATE FUNCTIONS ========================================= */

function _estimateSwapAmount(
address _fromToken,
address _toToken,
Expand Down

0 comments on commit 14780c4

Please sign in to comment.