Skip to content

Commit

Permalink
Merge branch 'master' into feature/erc721-erc1155
Browse files Browse the repository at this point in the history
# Conflicts:
#	contracts/Pod.sol
#	contracts/interfaces/IPod.sol
#	contracts/mocks/PodMock.sol
#	contracts/mocks/WrongPodMock.sol
#	package.json
  • Loading branch information
k06a committed Dec 25, 2022
2 parents 3af990f + 9a3e4f7 commit cd831e1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 deletions.
7 changes: 4 additions & 3 deletions contracts/Pod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
pragma solidity ^0.8.0;

import "./interfaces/IPod.sol";
import "./interfaces/IERC20Pods.sol";

abstract contract Pod is IPod {
error AccessDenied();

address public immutable token;
IERC20Pods public immutable token;
uint256 public immutable tokenId;

modifier onlyToken {
if (msg.sender != token) revert AccessDenied();
if (msg.sender != address(token)) revert AccessDenied();
_;
}

Expand All @@ -20,7 +21,7 @@ abstract contract Pod is IPod {
_;
}

constructor(address token_, uint256 tokenId_) {
constructor(IERC20Pods token_, uint256 tokenId_) {
token = token_;
tokenId = tokenId_;
}
Expand Down
6 changes: 2 additions & 4 deletions contracts/mocks/ERC20PodsMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ pragma solidity ^0.8.0;
import "../ERC20Pods.sol";

contract ERC20PodsMock is ERC20Pods {
uint256 private constant _POD_CALL_GAS_LIMIT = 200_000;

constructor(string memory name, string memory symbol, uint256 podsLimit)
constructor(string memory name, string memory symbol, uint256 podsLimit, uint256 podCallGasLimit)
ERC20(name, symbol)
ERC20Pods(podsLimit, _POD_CALL_GAS_LIMIT)
ERC20Pods(podsLimit, podCallGasLimit)
{} // solhint-disable-line no-empty-blocks

function mint(address account, uint256 amount) external {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/PodMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../Pod.sol";

contract PodMock is ERC20, Pod {
constructor(string memory name, string memory symbol, address token_)
constructor(string memory name, string memory symbol, IERC20Pods token_)
ERC20(name, symbol)
Pod(token_, 0)
{} // solhint-disable-line no-empty-blocks
Expand Down
5 changes: 4 additions & 1 deletion contracts/mocks/WrongPodMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ contract WrongPodMock is ERC20, Pod {
bool public isOutOfGas;
bool public isReturnGasBomb;

constructor(string memory name, string memory symbol, address token_) ERC20(name, symbol) Pod(token_, 0) {} // solhint-disable-line no-empty-blocks
constructor(string memory name, string memory symbol, IERC20Pods token_)
ERC20(name, symbol)
Pod(token_, 0)
{} // solhint-disable-line no-empty-blocks

function _updateBalances(address /* from */, address /* to */, uint256 /* amount */) internal view override {
if (isRevert) revert PodsUpdateBalanceRevert();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1inch/token-pods",
"version": "0.0.15",
"version": "0.0.17",
"description": "ERC20 extension enabling external smart contract based Pods to track balances of those users who opted-in to these Pods",
"repository": {
"type": "git",
Expand All @@ -13,7 +13,7 @@
"author": "1inch",
"license": "MIT",
"dependencies": {
"@1inch/solidity-utils": "2.2.2",
"@1inch/solidity-utils": "2.2.5",
"@openzeppelin/contracts": "4.8.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion test/ERC20Pods.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
const { shouldBehaveLikeERC20Pods, shouldBehaveLikeERC20PodsTransfers } = require('./behaviors/ERC20Pods.behavior');

const POD_LIMITS = 10;
const POD_GAS_LIMIT = 200_000;

describe('ERC20Pods', function () {
let wallet1;
Expand All @@ -14,7 +15,7 @@ describe('ERC20Pods', function () {

async function initContracts () {
const ERC20PodsMock = await ethers.getContractFactory('ERC20PodsMock');
const erc20Pods = await ERC20PodsMock.deploy('ERC20PodsMock', 'EPM', POD_LIMITS);
const erc20Pods = await ERC20PodsMock.deploy('ERC20PodsMock', 'EPM', POD_LIMITS, POD_GAS_LIMIT);
await erc20Pods.deployed();

const pods = [];
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@1inch/[email protected].2":
version "2.2.2"
resolved "https://registry.yarnpkg.com/@1inch/solidity-utils/-/solidity-utils-2.2.2.tgz#3c7165b0131426a11abd35a556fa244a5ac0c59b"
integrity sha512-nO65pP6fgbc0RUbKaI7PrqZdM20KjK6FONrh3iOf5o5y+iH/kf7njcUwXSU9hEB/UmnTUD0lr2LeGOwiCVDCkg==
"@1inch/[email protected].5":
version "2.2.5"
resolved "https://registry.yarnpkg.com/@1inch/solidity-utils/-/solidity-utils-2.2.5.tgz#1d372065cdd8bae096aa831867f22f4b2baeef30"
integrity sha512-zdrFYmQYQS0eTkoxgylRq9/2sFMSCMIT73pNLfcYIf4zmkB2cvNzQCiU3W9GvnQTktTMJrmIdbxsCyo/ZZkgbg==
dependencies:
"@metamask/eth-sig-util" "4.0.1"
"@nomicfoundation/hardhat-network-helpers" "1.0.6"
Expand Down

0 comments on commit cd831e1

Please sign in to comment.