Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Ethers v6 and latest versions of all packages. #255

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions contracts/mocks/OwnableMintableERC721Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ pragma solidity ^0.8.21;
/// @dev This mock smart contract is intended to be used with `@defi-wonderland/smock` and doesn't need any business
/// logic.
contract OwnableMintableERC721Mock {
function owner() public pure returns (address) {
return address(0);

address private _mockOwner;
address private _mockOwnerOf;

constructor (
address mockOwner, address mockOwnerOf
) {
_mockOwner = mockOwner;
_mockOwnerOf = mockOwnerOf;
}

function owner() public view returns (address) {
return _mockOwner;
}

function ownerOf(uint256) public pure returns (address) {
return address(0);
function ownerOf(uint256) public view returns (address) {
return _mockOwnerOf;
}
}
9 changes: 4 additions & 5 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as dotenv from 'dotenv';

import { HardhatUserConfig, task } from 'hardhat/config';
import '@nomiclabs/hardhat-etherscan';
import '@nomicfoundation/hardhat-chai-matchers';
import '@typechain/hardhat';
import 'hardhat-gas-reporter';
import 'solidity-coverage';
// import '@nomiclabs/hardhat-etherscan';
import '@nomicfoundation/hardhat-ethers';
// import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-toolbox';
import 'hardhat-contract-sizer';
import '@primitivefi/hardhat-dodoc';

Expand Down
63 changes: 22 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,30 @@
"node": ">=16.0.0"
},
"dependencies": {
"@openzeppelin/contracts": "^5.0.0"
},
"devDependencies": {
"@defi-wonderland/smock": "^2.3.4",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.1",
"@nomicfoundation/hardhat-network-helpers": "^1.0.7",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomiclabs/hardhat-etherscan": "^3.1.3",
"@openzeppelin/test-helpers": "^0.5.16",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.3",
"@nomicfoundation/hardhat-ethers": "^3.0.5",
"@nomicfoundation/hardhat-network-helpers": "^1.0.10",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.3",
"@nomiclabs/hardhat-etherscan": "^3.1.8",
"@openzeppelin/contracts": "^5.0.0",
"@primitivefi/hardhat-dodoc": "^0.2.3",
"@typechain/ethers-v5": "^10.1.1",
"@typechain/hardhat": "^6.1.4",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.10",
"@types/rimraf": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"chai": "^4.3.6",
"dotenv": "^16.0.3",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"ethers": "^5.7.2",
"hardhat": "^2.17.0",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.8",
"chai": "^4.2.0",
"dotenv": "^16.3.1",
"ethers": "^6.9.2",
"hardhat": "^2.19.4",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-gas-reporter": "^1.0.9",
"prettier": "2.8.0",
"prettier-plugin-solidity": "^1.1.3",
"rimraf": "^3.0.2",
"solc": "^0.8.21",
"solhint": "^3.3.7",
"solidity-coverage": "^0.8.4",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^4.9.3",
"walk-sync": "^3.0.0"
"solidity-coverage": "^0.8.6-sha1.0",
"squirrelly": "^8.0.8",
"ts-node": "^11.0.0-beta.1",
"typechain": "^8.3.2",
"typescript": "^5.3.3"
},
"resolutions": {
"@solidity-parser/parser": "0.16.0"
}
"devDependencies": {}
}
10 changes: 5 additions & 5 deletions scripts/deploy_bulkWriter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { ethers, run } from 'hardhat';

export const sleep = (ms: number): Promise<void> => {
Expand All @@ -10,16 +10,16 @@ export const sleep = (ms: number): Promise<void> => {
async function main() {
const accounts: SignerWithAddress[] = await ethers.getSigners();
const owner = accounts[0];
console.log('Deployer address: ' + owner.address);
console.log('Deployer address: ' + (await owner.getAddress()));
// We get the contract to deploy
const factory = await ethers.getContractFactory('RMRKBulkWriter');
const bulkwriter = await factory.deploy();
await bulkwriter.deployed();
console.log('RMRK Bulk Writer deployed to:', bulkwriter.address);
await bulkwriter.waitForDeployment();
console.log('RMRK Bulk Writer deployed to:', await bulkwriter.getAddress());
await sleep(1000);

await run('verify:verify', {
address: bulkwriter.address,
address: await bulkwriter.getAddress(),
constructorArguments: [],
});
}
Expand Down
8 changes: 4 additions & 4 deletions scripts/deploy_catalogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function main() {
// // Send eth to this address:0xfbea1b97406c6945d07f50f588e54144ea8b684f
// let tx = {
// to: '0xfbea1b97406c6945d07f50f588e54144ea8b684f',
// value: ethers.utils.parseEther('0.03'),
// value: ethers.parseEther('0.03'),
// nonce: 235,
// };
// const [signer] = await ethers.getSigners();
Expand All @@ -21,12 +21,12 @@ async function main() {

const catalogUtilsFactory = await ethers.getContractFactory('RMRKCatalogUtils');
const catalogUtils = await catalogUtilsFactory.deploy();
await catalogUtils.deployed();
console.log('RMRK Catalog Utils deployed to:', catalogUtils.address);
await catalogUtils.waitForDeployment();
console.log('RMRK Catalog Utils deployed to:', await catalogUtils.getAddress());
await sleep(1000);

await run('verify:verify', {
address: catalogUtils.address,
address: await catalogUtils.getAddress(),
constructorArguments: [],
});
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/deploy_collectionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ async function main() {
// We get the contract to deploy
const collectionUtilsFactory = await ethers.getContractFactory('RMRKCollectionUtils');
const collectionUtils = await collectionUtilsFactory.deploy();
await collectionUtils.deployed();
console.log('RMRK Collection Utils deployed to:', collectionUtils.address);
await collectionUtils.waitForDeployment();
console.log('RMRK Collection Utils deployed to:', await collectionUtils.getAddress());
await sleep(1000);

await run('verify:verify', {
address: collectionUtils.address,
address: await collectionUtils.getAddress(),
constructorArguments: [],
});
}
Expand Down
32 changes: 32 additions & 0 deletions scripts/deploy_emotable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { ethers, run } from 'hardhat';

export const sleep = (ms: number): Promise<void> => {
return new Promise((resolve) => {
setTimeout(() => resolve(), ms);
});
};

async function main() {
const accounts: SignerWithAddress[] = await ethers.getSigners();
const owner = accounts[0];
console.log('Deployer address: ' + (await owner.getAddress()));
// We get the contract to deploy
const emotableRepoFactory = await ethers.getContractFactory('RMRKEmotesRepository');
const emotableRepo = await emotableRepoFactory.deploy();
await emotableRepo.waitForDeployment();
console.log('RMRKEmotesRepository deployed to:', await emotableRepo.getAddress());
await sleep(1000);

await run('verify:verify', {
address: await emotableRepo.getAddress(),
constructorArguments: [],
});
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
10 changes: 5 additions & 5 deletions scripts/deploy_renderUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { ethers, run } from 'hardhat';

export const sleep = (ms: number): Promise<void> => {
Expand All @@ -10,16 +10,16 @@ export const sleep = (ms: number): Promise<void> => {
async function main() {
const accounts: SignerWithAddress[] = await ethers.getSigners();
const owner = accounts[0];
console.log('Deployer address: ' + owner.address);
console.log('Deployer address: ' + (await owner.getAddress()));
// We get the contract to deploy
const renderUtilsFactory = await ethers.getContractFactory('RMRKEquipRenderUtils');
const renderUtils = await renderUtilsFactory.deploy();
await renderUtils.deployed();
console.log('RMRK Equip Render Utils deployed to:', renderUtils.address);
await renderUtils.waitForDeployment();
console.log('RMRK Equip Render Utils deployed to:', await renderUtils.getAddress());
await sleep(1000);

await run('verify:verify', {
address: renderUtils.address,
address: await renderUtils.getAddress(),
constructorArguments: [],
});
}
Expand Down
35 changes: 35 additions & 0 deletions scripts/deploy_royaltiesSplitter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { ethers, run } from 'hardhat';

export const sleep = (ms: number): Promise<void> => {
return new Promise((resolve) => {
setTimeout(() => resolve(), ms);
});
};

async function main() {
const accounts: SignerWithAddress[] = await ethers.getSigners();
const owner = accounts[0];
console.log('Deployer address: ' + (await owner.getAddress()));
// We get the contract to deploy
const royaltiesSplitterFactory = await ethers.getContractFactory('RMRKRoyaltiesSplitter');
const royaltiesSplitter = await royaltiesSplitterFactory.deploy(
['0x147d79f1c9244b85cba959262fb71ad38069febb', '0xacD3d4b7b0706d39e6cA6E8c75dDdD446b8cdB1D'],
[7000, 3000],
);
await royaltiesSplitter.waitForDeployment();
console.log('RMRK Royalties Splitter deployed to:', await royaltiesSplitter.getAddress());
await sleep(10000);

await run('verify:verify', {
address: await royaltiesSplitter.getAddress(),
constructorArguments: [],
});
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
34 changes: 34 additions & 0 deletions scripts/deploy_tokenAttributesRepo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { ethers, run } from 'hardhat';

export const sleep = (ms: number): Promise<void> => {
return new Promise((resolve) => {
setTimeout(() => resolve(), ms);
});
};

async function main() {
const accounts: SignerWithAddress[] = await ethers.getSigners();
const owner = accounts[0];
console.log('Deployer address: ' + (await owner.getAddress()));
// We get the contract to deploy
const tokenAttributesRepoFactory = await ethers.getContractFactory(
'RMRKTokenAttributesRepository',
);
const tokenAttributesRepo = await tokenAttributesRepoFactory.deploy();
await tokenAttributesRepo.waitForDeployment();
console.log('RMRKTokenAttributesRepository deployed to:', await tokenAttributesRepo.getAddress());
await sleep(10000);

await run('verify:verify', {
address: await tokenAttributesRepo.getAddress(),
constructorArguments: [],
});
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
26 changes: 13 additions & 13 deletions test/behavior/catalog.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { ethers } from 'hardhat';
import { expect } from 'chai';
import { Contract } from 'ethers';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { IOtherInterface, IERC165, IRMRKCatalog } from '../interfaces';
import { RMRKCatalogImpl } from '../../typechain-types';

async function shouldBehaveLikeCatalog(contractName: string, metadataURI: string, type: string) {
let testCatalog: Contract;
let testCatalog: RMRKCatalogImpl;

let addrs: SignerWithAddress[];
const metadataUriDefault = 'src';

const noType = 0;
const slotType = 1;
const fixedType = 2;
const noType = 0n;
const slotType = 1n;
const fixedType = 2n;

const sampleSlotPartData = {
itemType: slotType,
Expand All @@ -33,8 +33,8 @@ async function shouldBehaveLikeCatalog(contractName: string, metadataURI: string
addrs = signersAddr;

const Catalog = await ethers.getContractFactory(contractName);
testCatalog = await Catalog.deploy(metadataURI, type);
await testCatalog.deployed();
testCatalog = <RMRKCatalogImpl>await Catalog.deploy(metadataURI, type);
await testCatalog.waitForDeployment();
});

describe('Init Catalog', async function () {
Expand Down Expand Up @@ -64,13 +64,13 @@ async function shouldBehaveLikeCatalog(contractName: string, metadataURI: string
const partId = 1;

await testCatalog.addPart({ partId: partId, part: sampleFixedPartData });
expect(await testCatalog.getPart(partId)).to.eql([2, 0, [], metadataUriDefault]);
expect(await testCatalog.getPart(partId)).to.eql([2n, 0n, [], metadataUriDefault]);
});

it('can add slot part', async function () {
const partId = 2;
await testCatalog.addPart({ partId: partId, part: sampleSlotPartData });
expect(await testCatalog.getPart(partId)).to.eql([1, 0, [], metadataUriDefault]);
expect(await testCatalog.getPart(partId)).to.eql([1n, 0n, [], metadataUriDefault]);
});

it('can add parts list', async function () {
Expand All @@ -93,8 +93,8 @@ async function shouldBehaveLikeCatalog(contractName: string, metadataURI: string
{ partId: partId2, part: partData2 },
]);
expect(await testCatalog.getParts([partId, partId2])).to.eql([
[slotType, 0, [], 'src1'],
[fixedType, 1, [], 'src2'],
[slotType, 0n, [], 'src1'],
[fixedType, 1n, [], 'src2'],
]);
});

Expand Down Expand Up @@ -249,7 +249,7 @@ async function shouldBehaveLikeCatalog(contractName: string, metadataURI: string
await testCatalog.setEquippableToAll(partId);

// This should reset it:
testCatalog.setEquippableAddresses(partId, [addrs[1].address]);
await testCatalog.setEquippableAddresses(partId, [addrs[1].address]);
expect(await testCatalog.checkIsEquippableToAll(partId)).to.eql(false);
});

Expand Down
Loading
Loading