@@ -7,10 +7,12 @@ import "@1inch/solidity-utils/contracts/libraries/AddressSet.sol";
77
88import "./interfaces/IERC20Pods.sol " ;
99import "./interfaces/IPod.sol " ;
10+ import "./libs/ReentrancyGuard.sol " ;
1011
11- abstract contract ERC20Pods is ERC20 , IERC20Pods {
12+ abstract contract ERC20Pods is ERC20 , IERC20Pods , ReentrancyGuardExt {
1213 using AddressSet for AddressSet.Data;
1314 using AddressArray for AddressArray.Data;
15+ using ReentrancyGuardLib for ReentrancyGuardLib.Data;
1416
1517 error PodAlreadyAdded ();
1618 error PodNotFound ();
@@ -22,10 +24,12 @@ abstract contract ERC20Pods is ERC20, IERC20Pods {
2224
2325 uint256 public immutable podsLimit;
2426
27+ ReentrancyGuardLib.Data private _guard;
2528 mapping (address => AddressSet.Data) private _pods;
2629
2730 constructor (uint256 podsLimit_ ) {
2831 podsLimit = podsLimit_;
32+ _guard.init ();
2933 }
3034
3135 function hasPod (address account , address pod ) public view virtual returns (bool ) {
@@ -44,7 +48,11 @@ abstract contract ERC20Pods is ERC20, IERC20Pods {
4448 return _pods[account].items.get ();
4549 }
4650
47- function podBalanceOf (address pod , address account ) public view returns (uint256 ) {
51+ function balanceOf (address account ) public nonReentrantView (_guard) view override (IERC20 , ERC20 ) returns (uint256 ) {
52+ return super .balanceOf (account);
53+ }
54+
55+ function podBalanceOf (address pod , address account ) public nonReentrantView (_guard) view returns (uint256 ) {
4856 if (hasPod (account, pod)) {
4957 return balanceOf (account);
5058 }
@@ -119,7 +127,7 @@ abstract contract ERC20Pods is ERC20, IERC20Pods {
119127
120128 // ERC20 Overrides
121129
122- function _afterTokenTransfer (address from , address to , uint256 amount ) internal override virtual {
130+ function _afterTokenTransfer (address from , address to , uint256 amount ) internal nonReentrant (_guard) override virtual {
123131 super ._afterTokenTransfer (from, to, amount);
124132
125133 unchecked {
0 commit comments