Skip to content

Commit 7e2b23d

Browse files
committed
Merge branch 'master' into feature/erc721-erc1155
2 parents ccb9862 + ce60b69 commit 7e2b23d

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

contracts/ERC20Pods.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract contract ERC20Pods is ERC20, IERC20Pods, ReentrancyGuardExt {
4646
}
4747

4848
function podBalanceOf(address pod, address account) public nonReentrantView(_guard) view virtual returns(uint256) {
49-
return _pods.podBalanceOf(account, pod, balanceOf(account));
49+
return _pods.podBalanceOf(account, pod, super.balanceOf(account));
5050
}
5151

5252
function addPod(address pod) public virtual {

contracts/libs/ReentrancyGuard.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ library ReentrancyGuardLib {
3232

3333
contract ReentrancyGuardExt {
3434
using ReentrancyGuardLib for ReentrancyGuardLib.Data;
35-
error AccessDenied();
3635

3736
modifier nonReentrant(ReentrancyGuardLib.Data storage self) {
3837
self.enter();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@1inch/erc20-pods",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "ERC20 extension enabling external smart contract based Pods to track balances of those users who opted-in to these Pods",
55
"repository": {
66
"type": "git",

test/ERC20Pods.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
const { ether } = require('@1inch/solidity-utils');
1+
const { expect, ether } = require('@1inch/solidity-utils');
22
const { ethers } = require('hardhat');
3+
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
34
const { shouldBehaveLikeERC20Pods } = require('./behaviors/ERC20Pods.behavior');
45

56
const POD_LIMITS = 10;
67

78
describe('ERC20Pods', function () {
9+
let wallet1;
10+
11+
before(async function () {
12+
[wallet1] = await ethers.getSigners();
13+
});
14+
815
async function initContracts () {
916
const ERC20PodsMock = await ethers.getContractFactory('ERC20PodsMock');
1017
const erc20Pods = await ERC20PodsMock.deploy('ERC20PodsMock', 'EPM', POD_LIMITS);
@@ -20,5 +27,23 @@ describe('ERC20Pods', function () {
2027
return { erc20Pods, pods, amount };
2128
};
2229

30+
async function initWrongPodAndMint () {
31+
const { erc20Pods, amount } = await initContracts();
32+
await erc20Pods.mint(wallet1.address, amount);
33+
const WrongPodMock = await ethers.getContractFactory('WrongPodMock');
34+
const wrongPod = await WrongPodMock.deploy('WrongPodMock', 'WPM', erc20Pods.address);
35+
await wrongPod.deployed();
36+
return { erc20Pods, wrongPod, amount };
37+
};
38+
2339
shouldBehaveLikeERC20Pods(initContracts);
40+
41+
it('should not fail when updateBalance returns gas bomb @skip-on-coverage', async function () {
42+
const { erc20Pods, wrongPod } = await loadFixture(initWrongPodAndMint);
43+
await wrongPod.setReturnGasBomb(true);
44+
const tx = await erc20Pods.addPod(wrongPod.address);
45+
const receipt = await tx.wait();
46+
expect(receipt.gasUsed).to.be.lt(274168);
47+
expect(await erc20Pods.pods(wallet1.address)).to.have.deep.equals([wrongPod.address]);
48+
});
2449
});

test/behaviors/ERC20Pods.behavior.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,6 @@ function shouldBehaveLikeERC20Pods (initContracts) {
252252
await erc20Pods.addPod(wrongPod.address);
253253
expect(await erc20Pods.pods(wallet1.address)).to.be.deep.equals([wrongPod.address]);
254254
});
255-
256-
it('should not fail when updateBalance returns gas bomb @skip-on-coverage', async function () {
257-
const { erc20Pods, wrongPod } = await loadFixture(initWrongPodAndMint);
258-
await wrongPod.setReturnGasBomb(true);
259-
const tx = await erc20Pods.addPod(wrongPod.address);
260-
const receipt = await tx.wait();
261-
expect(receipt.gasUsed).to.be.lt(274286); // 274286 with solidity instead of assembly
262-
expect(await erc20Pods.pods(wallet1.address)).to.be.deep.equals([wrongPod.address]);
263-
});
264255
});
265256

266257
describe('_afterTokenTransfer', function () {

0 commit comments

Comments
 (0)