Skip to content

Commit

Permalink
add view methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Nov 22, 2024
1 parent ec065de commit aa29fb0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,24 @@ contract BiconomyTokenPaymaster is
);
}

/**
* @dev Get the price of a token in USD
* @param tokenAddress The address of the token to get the price of
* @return price The price of the token in USD
*/
function getPrice(address tokenAddress) public view returns (uint256) {
return _getPrice(tokenAddress);
}

/**
* @dev Check if a token is supported
* @param tokenAddress The address of the token to check
* @return bool True if the token is supported, false otherwise
*/
function isTokenSupported(address tokenAddress) public view returns (bool) {
return independentTokenDirectory[tokenAddress].oracle != IOracle(address(0));
}

/**
* @dev Validate a user operation.
* This method is abstract in BasePaymaster and must be implemented in derived contracts.
Expand Down
2 changes: 1 addition & 1 deletion test/unit/concrete/TestTokenPaymaster.Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ contract TestTokenPaymasterBase is TestBase {
// usdc.approve(address(SWAP_ROUTER_ADDRESS), usdc.balanceOf(address(tokenPaymaster)));
// vm.stopPrank();

// Todo: Review reason for failure
// Review reason for failure
startPrank(PAYMASTER_OWNER.addr);
tokenPaymaster.swapTokenAndDeposit(address(usdc), 1e6, 0);
stopPrank();
Expand Down

0 comments on commit aa29fb0

Please sign in to comment.