Skip to content

Commit 9d23f66

Browse files
authored
Merge pull request #23 from kostysh/refactor/no-ethers-src
refactor: 💡 Ethers removed from exports; Types for ethers-v6
2 parents f56a4fe + 3124f00 commit 9d23f66

File tree

16 files changed

+45
-33
lines changed

16 files changed

+45
-33
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ cache-zk
1111
artifacts
1212
cache
1313
./**/*.sol
14+
typechain
15+
typechainV6

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ cache-zk
1818
artifacts
1919
cache
2020
typechain
21+
typechainV6
2122
network/volumes

.lintstagedrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"*.{ts,js}": ["prettier --write", "eslint --cache --fix"],
2+
"*.{ts,js}": ["prettier --write", "eslint --config ./.eslintrc --ignore-path ./.eslintignore --cache --fix"],
33
"*.md": ["prettier --write"]
44
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ artifacts
1313
cache
1414
network
1515
typechain
16+
typechainV6

deploy/001.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
protocolFee,
1010
retailerFee,
1111
minDeposit,
12-
} from '../src';
12+
} from '../utils/constants';
1313

1414
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1515
const { network, deployments, getNamedAccounts } = hre;

deploy/002.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
protocolFee,
1010
retailerFee,
1111
minDeposit,
12-
} from '../src';
12+
} from '../utils/constants';
1313

1414
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1515
const { network, deployments, getNamedAccounts } = hre;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@
8989
"typechain": "^8.1.1",
9090
"@typechain/hardhat": "^6.1.6",
9191
"@typechain/ethers-v5": "^10.2.1",
92+
"@typechain/ethers-v6": "^0.3.2",
9293
"dotenv": "^16.0.3"
9394
},
9495
"dependencies": {
9596
"@openzeppelin/contracts-upgradeable": "^4.8.3"
9697
},
9798
"scripts": {
9899
"build:contracts": "hardhat compile",
99-
"build:src": "rm -rf ./lib && tsc -p ./tsconfig.build.json",
100+
"build:src": "rm -rf ./lib && typechain --target=ethers-v6 --out-dir typechainV6 artifacts/**/Config.json artifacts/**/EntitiesRegistry.json artifacts/**/Market.json && tsc -p ./tsconfig.build.json",
100101
"test:contracts": "hardhat test",
101102
"test:src": "mocha -t 60000 --extension spec.ts test/src",
102103
"lint": "solhint . && eslint --ext .ts",

src/constants.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import { utils, BigNumber } from 'ethers';
2-
3-
// utils.solidityKeccak256(
1+
// ethers.solidityPackedKeccak256(
42
// ['string'],
53
// ['PaymentOption(bytes32 id,uint256 price,address asset)'],
64
// );
75
export const PAYMENT_OPTION_TYPE_HASH =
86
'0x2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6';
97

10-
// utils.solidityKeccak256(
8+
// ethers.solidityPackedKeccak256(
119
// ['string'],
1210
// ['CancelOption(uint256 time,uint256 penalty)'],
1311
// );
1412
export const CANCEL_OPTION_TYPE_HASH =
1513
'0x8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5';
1614

17-
// utils.solidityKeccak256(
15+
// ethers.solidityPackedKeccak256(
1816
// ['string'],
1917
// [
2018
// 'Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn)',
@@ -23,28 +21,11 @@ export const CANCEL_OPTION_TYPE_HASH =
2321
export const OFFER_TYPE_HASH =
2422
'0xcf2addd2f89a78825d3f130a17e47b4e9963adfd09837fa9c454569faa073354';
2523

26-
// utils.solidityKeccak256(
24+
// ethers.solidityPackedKeccak256(
2725
// ['string'],
2826
// [
2927
// 'Voucher(bytes32 id,address signer)',
3028
// ],
3129
// );
3230
export const CHECK_IN_TYPE_HASH =
3331
'0xf811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c';
34-
35-
// Protocol entities types (kinds) as object
36-
export const kinds = {
37-
supplier: utils.formatBytes32String('supplier'),
38-
retailer: utils.formatBytes32String('retailer'),
39-
};
40-
41-
// Protocol entities types (kinds) as values array
42-
export const kindsArr = Object.values(kinds);
43-
44-
// Protocol defaults
45-
export const eip712name = 'Market';
46-
export const eip712version = '1';
47-
export const minDeposit = BigNumber.from('1000000000000000000000');
48-
export const claimPeriod = BigNumber.from('60');
49-
export const protocolFee = BigNumber.from('1');
50-
export const retailerFee = BigNumber.from('1');

test/contracts/EntitiesRegistry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from 'chai';
22
import { BigNumber, constants } from 'ethers';
3-
import { minDeposit, kinds } from '../../src';
3+
import { minDeposit, kinds } from '../../utils/constants';
44
import { randomId, createSupplierId, createPermitSignature } from './utils';
55
import { User, setup, registerEntity } from './setup';
66

test/contracts/Market.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { expect } from 'chai';
22
import { BigNumber, constants } from 'ethers';
33
import { ethers } from 'hardhat';
44
import { TransferEventObject } from '../../typechain/contracts/Market';
5-
import { kinds } from '../../src';
6-
import { Offer } from '../../src/types';
5+
import { kinds } from '../../utils/constants';
6+
import { Offer } from '../../utils/types';
77
import {
88
structEqual,
99
buildRandomOffer,

0 commit comments

Comments
 (0)