Skip to content

Commit

Permalink
feat: support permit
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavaparoksham committed Jan 14, 2025
1 parent db499fd commit 2ab01f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/interfaces/IXToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
pragma solidity ^0.8.20;

import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {IERC20Permit} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol';
import {IAssetOracle} from './IAssetOracle.sol';

interface IXToken is IERC20 {
interface IXToken is IERC20, IERC20Permit {
/**
* @dev Thrown when a caller is not the pool contract
*/
Expand Down
5 changes: 3 additions & 2 deletions src/protocol/xToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
pragma solidity ^0.8.20;

import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol";
import "openzeppelin-contracts/contracts/utils/math/Math.sol";
import "../interfaces/IAssetOracle.sol";
import "../interfaces/IXToken.sol";
Expand All @@ -15,7 +16,7 @@ import "../interfaces/IXToken.sol";
* All amounts are expected to be in 18 decimal precision.
* The asset price is assumed to be in 18 decimal precision.
*/
contract xToken is IXToken, ERC20 {
contract xToken is IXToken, ERC20, ERC20Permit {
/// @notice Reference to the oracle providing asset price feeds
IAssetOracle public immutable oracle;

Expand Down Expand Up @@ -48,7 +49,7 @@ contract xToken is IXToken, ERC20 {
* @param symbol The symbol of the token
* @param _oracle The address of the asset price oracle
*/
constructor(string memory name, string memory symbol, address _oracle) ERC20(name, symbol) {
constructor(string memory name, string memory symbol, address _oracle) ERC20(name, symbol) ERC20Permit(name) {
if (_oracle == address(0)) revert ZeroAddress();
oracle = IAssetOracle(_oracle);
pool = msg.sender;
Expand Down

0 comments on commit 2ab01f2

Please sign in to comment.