Skip to content

Commit

Permalink
Update to latest OpenZeppelin base contracts
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
  • Loading branch information
awrichar committed Mar 4, 2024
1 parent a0ca070 commit cbc1c50
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions samples/solidity/contracts/ERC1155MixedFungible.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import './IERC1155MixedFungible.sol';

/**
Expand Down Expand Up @@ -114,7 +113,7 @@ contract ERC1155MixedFungible is Context, ERC1155, IERC1155MixedFungible {

// Indexes are 1-based.
uint256 index = maxIndex[type_id] + 1;
maxIndex[type_id] = SafeMath.add(to.length, maxIndex[type_id]);
maxIndex[type_id] = to.length + maxIndex[type_id];

for (uint256 i = 0; i < to.length; ++i) {
_mint(to[i], type_id | (index + i), 1, data);
Expand All @@ -134,7 +133,7 @@ contract ERC1155MixedFungible is Context, ERC1155, IERC1155MixedFungible {

// Indexes are 1-based.
uint256 index = maxIndex[type_id] + 1;
maxIndex[type_id] = SafeMath.add(to.length, maxIndex[type_id]);
maxIndex[type_id] = to.length + maxIndex[type_id];

for (uint256 i = 0; i < to.length; ++i) {
uint256 id = type_id | (index + i);
Expand Down
8 changes: 4 additions & 4 deletions samples/solidity/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "hardhat test --network hardhat"
},
"dependencies": {
"@openzeppelin/contracts": "^4.5.0"
"@openzeppelin/contracts": "^5.0.2"
},
"devDependencies": {
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/solidity/test/ERC1155MixedFungible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe('ERC1155MixedFungible - Unit Tests', () => {
1,
'0x00',
),
).to.be.revertedWith('ERC1155: caller is not token owner or approved');
).to.be.revertedWithCustomError(deployedERC1155, 'ERC1155MissingApprovalForAll');
expect(
await deployedERC1155
.connect(deployerSignerA)
Expand Down Expand Up @@ -371,7 +371,7 @@ describe('ERC1155MixedFungible - Unit Tests', () => {
1,
'0x00',
),
).to.be.revertedWith('ERC1155: caller is not token owner or approved');
).to.be.revertedWithCustomError(deployedERC1155, 'ERC1155MissingApprovalForAll');
expect(
await deployedERC1155
.connect(deployerSignerA)
Expand Down

0 comments on commit cbc1c50

Please sign in to comment.