Compare commits
16 Commits
protocol@1
...
@0x/protoc
Author | SHA1 | Date | |
---|---|---|---|
|
d06f6c8b4d | ||
|
a689e98b0f | ||
|
6f72a8e8e3 | ||
|
422f83fc99 | ||
|
b6597df84f | ||
|
c9b1aac8a5 | ||
|
87f4189e93 | ||
|
390e1b8510 | ||
|
5645e87aca | ||
|
0daa988996 | ||
|
b4d6f74d7b | ||
|
2163cb221b | ||
|
4575300016 | ||
|
82341c3b9d | ||
|
f89c2d2fed | ||
|
09419a7909 |
@@ -3,7 +3,7 @@ version: 2.1
|
||||
parameters:
|
||||
cache_version:
|
||||
type: string
|
||||
default: v4
|
||||
default: v5
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-feat/NerveMixinArbitrum
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
@@ -33,46 +33,46 @@ jobs:
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
paths:
|
||||
- ~/project/contracts/erc20/node_modules
|
||||
- ~/project/contracts/test-utils/node_modules
|
||||
- ~/project/contracts/treasury/node_modules
|
||||
- ~/project/contracts/utils/node_modules
|
||||
- ~/project/contracts/zero-ex/node_modules
|
||||
- ~/project/node_modules
|
||||
- ~/project/packages/asset-swapper/node_modules
|
||||
- ~/project/packages/contract-addresses/node_modules
|
||||
- ~/project/packages/contract-artifacts/node_modules
|
||||
- ~/project/packages/contract-wrappers/node_modules
|
||||
- ~/project/packages/protocol-utils/node_modules
|
||||
- ~/.cache/yarn
|
||||
- save_cache:
|
||||
key: lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
key: lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
paths:
|
||||
- ~/project/contracts/erc20/generated-artifacts/
|
||||
- ~/project/contracts/erc20/generated-wrappers/
|
||||
- ~/project/contracts/erc20/lib/
|
||||
- ~/project/contracts/erc20/node_modules
|
||||
- ~/project/contracts/erc20/test/generated-artifacts/
|
||||
- ~/project/contracts/erc20/test/generated-wrappers/
|
||||
- ~/project/contracts/test-utils/lib/
|
||||
- ~/project/contracts/test-utils/node_modules
|
||||
- ~/project/contracts/treasury/generated-artifacts/
|
||||
- ~/project/contracts/treasury/generated-wrappers/
|
||||
- ~/project/contracts/treasury/lib/
|
||||
- ~/project/contracts/treasury/node_modules
|
||||
- ~/project/contracts/treasury/test/generated-artifacts/
|
||||
- ~/project/contracts/treasury/test/generated-wrappers/
|
||||
- ~/project/contracts/utils/generated-artifacts/
|
||||
- ~/project/contracts/utils/generated-wrappers/
|
||||
- ~/project/contracts/utils/lib/
|
||||
- ~/project/contracts/utils/node_modules
|
||||
- ~/project/contracts/utils/test/generated-artifacts/
|
||||
- ~/project/contracts/utils/test/generated-wrappers/
|
||||
- ~/project/contracts/zero-ex/generated-artifacts/
|
||||
- ~/project/contracts/zero-ex/generated-wrappers/
|
||||
- ~/project/contracts/zero-ex/lib/
|
||||
- ~/project/contracts/zero-ex/node_modules
|
||||
- ~/project/contracts/zero-ex/test/generated-artifacts/
|
||||
- ~/project/contracts/zero-ex/test/generated-wrappers/
|
||||
- ~/project/packages/asset-swapper/node_modules
|
||||
- ~/project/packages/contract-addresses/lib/
|
||||
- ~/project/packages/contract-addresses/node_modules
|
||||
- ~/project/packages/contract-artifacts/lib/
|
||||
- ~/project/packages/contract-artifacts/node_modules
|
||||
- ~/project/packages/contract-wrappers/lib/
|
||||
- ~/project/packages/contract-wrappers/node_modules
|
||||
- ~/project/packages/protocol-utils/lib/
|
||||
- ~/project/packages/protocol-utils/node_modules
|
||||
- store_artifacts:
|
||||
path: ~/repo/packages/abi-gen/test-cli/output
|
||||
- store_artifacts:
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
|
||||
test-integrations-ganache:
|
||||
resource_class: xlarge
|
||||
@@ -101,7 +101,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
|
||||
test-contracts-staking-ganache:
|
||||
resource_class: xlarge
|
||||
@@ -112,7 +112,7 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
|
||||
test-contracts-extra-ganache:
|
||||
resource_class: xlarge
|
||||
@@ -125,7 +125,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
|
||||
test-contracts-rest-ganache:
|
||||
resource_class: xlarge
|
||||
@@ -143,7 +143,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: |
|
||||
yarn wsrun \
|
||||
-p @0x/contracts-multisig \
|
||||
@@ -173,7 +173,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: git submodule update --init --recursive
|
||||
- run:
|
||||
command: forge test
|
||||
@@ -198,7 +198,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn test:publish:circleci
|
||||
no_output_timeout: 1800
|
||||
@@ -214,7 +214,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn test:generate_docs:circleci
|
||||
no_output_timeout: 1200
|
||||
@@ -230,7 +230,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-addresses -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
|
||||
@@ -257,7 +257,10 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn lerna run lint
|
||||
- run:
|
||||
@@ -275,7 +278,7 @@ jobs:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}
|
||||
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}
|
||||
|
@@ -80,10 +80,8 @@ lib
|
||||
/contracts/erc1155/build/
|
||||
/contracts/extensions/build/
|
||||
/contracts/exchange-forwarder/build/
|
||||
/packages/asset-swapper/generated-artifacts
|
||||
/packages/asset-swapper/generated-wrappers
|
||||
/packages/asset-swapper/test/generated-artifacts
|
||||
/packages/asset-swapper/test/generated-wrappers
|
||||
/packages/asset-swapper/
|
||||
/packages/contract-wrappers/src/generated-wrappers/
|
||||
package.json
|
||||
packages/*/docs
|
||||
docs/
|
||||
|
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"extends": "default",
|
||||
"rules": {
|
||||
"avoid-low-level-calls": false,
|
||||
"avoid-tx-origin": "warn",
|
||||
"bracket-align": false,
|
||||
"code-complexity": false,
|
||||
"compiler-fixed": false,
|
||||
"const-name-snakecase": "error",
|
||||
"expression-indent": "error",
|
||||
"function-max-lines": false,
|
||||
"func-order": "error",
|
||||
"indent": ["error", 4],
|
||||
"max-line-length": ["warn", 160],
|
||||
"no-inline-assembly": false,
|
||||
"quotes": ["error", "double"],
|
||||
"separate-by-one-line-in-contract": "error",
|
||||
"space-after-comma": "error",
|
||||
"statement-indent": "error",
|
||||
"no-empty-blocks": false
|
||||
}
|
||||
}
|
25
contracts/erc20/.eslintrc
Normal file
25
contracts/erc20/.eslintrc
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"contracts/**/*",
|
||||
"generated-wrappers/**/*",
|
||||
"generated-artifacts/**/*",
|
||||
"test/generated-wrappers/**/*",
|
||||
"test/generated-artifacts/**/*"
|
||||
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
contracts/src/ZRXToken.sol
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "3.3.45",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Migrate from TSLint to ESLint and fix linting errors",
|
||||
"pr": 589
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "3.3.44",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "3.3.43",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.45 - _October 5, 2022_
|
||||
|
||||
* Migrate from TSLint to ESLint and fix linting errors (#589)
|
||||
|
||||
## v3.3.44 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.43 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.3.43",
|
||||
"version": "3.3.45",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -23,8 +23,8 @@
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
@@ -32,7 +32,6 @@
|
||||
"test:circleci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
|
||||
},
|
||||
@@ -53,12 +52,11 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.34",
|
||||
"@0x/contracts-utils": "^4.8.24",
|
||||
"@0x/contracts-test-utils": "^5.4.36",
|
||||
"@0x/contracts-utils": "^4.8.26",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^7.0.0",
|
||||
@@ -66,18 +64,20 @@
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false
|
||||
}
|
||||
}
|
25
contracts/test-utils/.eslintrc
Normal file
25
contracts/test-utils/.eslintrc
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"contracts/**/*",
|
||||
"generated-wrappers/**/*",
|
||||
"generated-artifacts/**/*",
|
||||
"test/generated-wrappers/**/*",
|
||||
"test/generated-artifacts/**/*"
|
||||
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "5.4.36",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Migrate from TSLint to ESLint and fix linting errors",
|
||||
"pr": 589
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "5.4.35",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "5.4.34",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.4.36 - _October 5, 2022_
|
||||
|
||||
* Migrate from TSLint to ESLint and fix linting errors (#589)
|
||||
|
||||
## v5.4.35 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.34 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.4.34",
|
||||
"version": "5.4.36",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -16,8 +16,8 @@
|
||||
"test:coverage": "run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"clean": "shx rm -rf lib",
|
||||
"lint": "tslint --format stylish --project tsconfig.lint.json",
|
||||
"fix": "tslint --fix --format stylish --project tsconfig.lint.json",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
@@ -35,16 +35,18 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
||||
"devDependencies": {
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.23.3",
|
||||
"@0x/contract-addresses": "^6.24.0",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
|
@@ -102,9 +102,9 @@ export async function expectTransactionFailedAsync(p: sendTransactionResult, rea
|
||||
if (nodeType === undefined) {
|
||||
nodeType = await web3Wrapper.getNodeTypeAsync();
|
||||
}
|
||||
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
|
||||
switch (nodeType) {
|
||||
case NodeType.Ganache:
|
||||
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
|
||||
return expect(p).to.be.rejectedWith(rejectionMessageRegex);
|
||||
case NodeType.Geth:
|
||||
logUtils.warn(
|
||||
|
@@ -11,9 +11,14 @@ export function shortZip<T1, T2>(a: T1[], b: T2[]): Array<[T1, T2]> {
|
||||
/**
|
||||
* Replaces the keys in a deeply nested object. Adapted from https://stackoverflow.com/a/39126851
|
||||
*/
|
||||
export function replaceKeysDeep(obj: {}, mapKeys: (key: string) => string | void): _.Dictionary<{}> {
|
||||
export function replaceKeysDeep(
|
||||
obj: Record<string, unknown>,
|
||||
mapKeys: (key: string) => string | void,
|
||||
): _.Dictionary<Record<string, unknown>> {
|
||||
return _.transform(obj, (result, value, key) => {
|
||||
const currentKey = mapKeys(key) || key;
|
||||
result[currentKey] = _.isObject(value) ? replaceKeysDeep(value as {}, mapKeys) : (value as {});
|
||||
result[currentKey] = _.isObject(value)
|
||||
? replaceKeysDeep(value as Record<string, unknown>, mapKeys)
|
||||
: (value as Record<string, unknown>);
|
||||
});
|
||||
}
|
||||
|
@@ -236,7 +236,7 @@ export const describe = _.assign(mochaDescribe, {
|
||||
* Like mocha's `describe()`, but sets up a blockchain environment for you.
|
||||
*/
|
||||
export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
return defineBlockchainSuite(StandardBlockchainTestsEnvironmentSingleton, description, callback, describe);
|
||||
},
|
||||
{
|
||||
@@ -275,7 +275,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
);
|
||||
},
|
||||
fork: _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
return defineBlockchainSuite(
|
||||
ForkedBlockchainTestsEnvironmentSingleton,
|
||||
description,
|
||||
@@ -319,7 +319,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
},
|
||||
),
|
||||
live: _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
|
||||
return defineBlockchainSuite(
|
||||
LiveBlockchainTestsEnvironmentSingleton,
|
||||
description,
|
||||
@@ -355,7 +355,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
|
||||
},
|
||||
),
|
||||
resets: _.assign(
|
||||
function(description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
function (description: string, callback: BlockchainSuiteCallback): ISuite {
|
||||
return defineResetsBlockchainSuite(
|
||||
StandardBlockchainTestsEnvironmentSingleton,
|
||||
description,
|
||||
@@ -399,7 +399,7 @@ function defineBlockchainSuite<T>(
|
||||
callback: BlockchainSuiteCallback,
|
||||
describeCall: ContextDefinitionCallback<T>,
|
||||
): T {
|
||||
return describeCall(description, function(this: ISuiteCallbackContext): void {
|
||||
return describeCall(description, function (this: ISuiteCallbackContext): void {
|
||||
callback.call(this, envFactory.create());
|
||||
});
|
||||
}
|
||||
@@ -410,7 +410,7 @@ function defineResetsBlockchainSuite<T>(
|
||||
callback: BlockchainSuiteCallback,
|
||||
describeCall: ContextDefinitionCallback<T>,
|
||||
): T {
|
||||
return describeCall(description, function(this: ISuiteCallbackContext): void {
|
||||
return describeCall(description, function (this: ISuiteCallbackContext): void {
|
||||
const env = envFactory.create();
|
||||
beforeEach(async () => env.blockchainLifecycle.startAsync());
|
||||
afterEach(async () => env.blockchainLifecycle.revertAsync());
|
||||
|
@@ -40,10 +40,7 @@ export function getRandomPortion(total: Numberish): BigNumber {
|
||||
export function getRandomFloat(min: Numberish, max: Numberish): BigNumber {
|
||||
// Generate a really high precision number between [0, 1]
|
||||
const r = new BigNumber(crypto.randomBytes(32).toString('hex'), 16).dividedBy(new BigNumber(2).pow(256).minus(1));
|
||||
return new BigNumber(max)
|
||||
.minus(min)
|
||||
.times(r)
|
||||
.plus(min);
|
||||
return new BigNumber(max).minus(min).times(r).plus(min);
|
||||
}
|
||||
|
||||
export const FIXED_POINT_BASE = new BigNumber(2).pow(127);
|
||||
@@ -66,7 +63,7 @@ export function fromFixed(n: Numberish): BigNumber {
|
||||
* Converts two decimal numbers to integers with `precision` digits, then returns
|
||||
* the absolute difference.
|
||||
*/
|
||||
export function getNumericalDivergence(a: Numberish, b: Numberish, precision: number = 18): number {
|
||||
export function getNumericalDivergence(a: Numberish, b: Numberish, precision = 18): number {
|
||||
const _a = new BigNumber(a);
|
||||
const _b = new BigNumber(b);
|
||||
const maxIntegerDigits = Math.max(
|
||||
@@ -77,16 +74,13 @@ export function getNumericalDivergence(a: Numberish, b: Numberish, precision: nu
|
||||
const base = 10 ** (precision - maxIntegerDigits);
|
||||
return n.times(base).integerValue(BigNumber.ROUND_DOWN);
|
||||
};
|
||||
return _toInteger(_a)
|
||||
.minus(_toInteger(_b))
|
||||
.abs()
|
||||
.toNumber();
|
||||
return _toInteger(_a).minus(_toInteger(_b)).abs().toNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two numbers are equal up to `precision` digits.
|
||||
*/
|
||||
export function assertRoughlyEquals(actual: Numberish, expected: Numberish, precision: number = 18): void {
|
||||
export function assertRoughlyEquals(actual: Numberish, expected: Numberish, precision = 18): void {
|
||||
if (getNumericalDivergence(actual, expected, precision) <= 1) {
|
||||
return;
|
||||
}
|
||||
@@ -96,16 +90,8 @@ export function assertRoughlyEquals(actual: Numberish, expected: Numberish, prec
|
||||
/**
|
||||
* Asserts that two numbers are equal with up to `maxError` difference between them.
|
||||
*/
|
||||
export function assertIntegerRoughlyEquals(
|
||||
actual: Numberish,
|
||||
expected: Numberish,
|
||||
maxError: number = 1,
|
||||
msg?: string,
|
||||
): void {
|
||||
const diff = new BigNumber(actual)
|
||||
.minus(expected)
|
||||
.abs()
|
||||
.toNumber();
|
||||
export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberish, maxError = 1, msg?: string): void {
|
||||
const diff = new BigNumber(actual).minus(expected).abs().toNumber();
|
||||
if (diff <= maxError) {
|
||||
return;
|
||||
}
|
||||
|
@@ -8,10 +8,7 @@ import { BatchMatchOrder, CancelOrder, MatchOrder } from './types';
|
||||
|
||||
export const orderUtils = {
|
||||
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
|
||||
const partialAmount = numerator
|
||||
.multipliedBy(target)
|
||||
.div(denominator)
|
||||
.integerValue(BigNumber.ROUND_FLOOR);
|
||||
const partialAmount = numerator.multipliedBy(target).div(denominator).integerValue(BigNumber.ROUND_FLOOR);
|
||||
return partialAmount;
|
||||
},
|
||||
createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => {
|
||||
|
@@ -15,7 +15,7 @@ export const txDefaults = {
|
||||
gasPrice: constants.DEFAULT_GAS_PRICE,
|
||||
};
|
||||
|
||||
export let providerConfigs: Web3Config = {
|
||||
export const providerConfigs: Web3Config = {
|
||||
total_accounts: constants.NUM_TEST_ACCOUNTS,
|
||||
shouldUseInProcessGanache: true,
|
||||
shouldAllowUnlimitedContractSize: true,
|
||||
|
@@ -4,6 +4,7 @@ import * as process from 'process';
|
||||
import { expect } from '../src/chai_setup';
|
||||
import { constants } from '../src/constants';
|
||||
import { blockchainTests, describe } from '../src/mocha_blockchain';
|
||||
import { append } from './subtests/mocha_blockchain_1';
|
||||
|
||||
blockchainTests('mocha blockchain extensions', env => {
|
||||
describe('blockchainTests()', () => {
|
||||
@@ -78,7 +79,7 @@ blockchainTests('mocha blockchain extensions', env => {
|
||||
});
|
||||
|
||||
describe('subtests', () => {
|
||||
require('./subtests/mocha_blockchain_1').append(env);
|
||||
append(env);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -96,7 +97,7 @@ blockchainTests('mocha blockchain extensions', env => {
|
||||
function createHookedObject(obj: any, handler: (name: string) => void, methods: string[]): any {
|
||||
const hookedMethods = _.map(methods, methodName => {
|
||||
// tslint:disable: only-arrow-functions
|
||||
return function(this: any, ...args: any[]): any {
|
||||
return function (this: any, ...args: any[]): any {
|
||||
handler(methodName);
|
||||
return obj[methodName].call(this, ...args);
|
||||
};
|
||||
|
@@ -55,7 +55,7 @@ describe('Order hashing', () => {
|
||||
it('throws a readable error message if taker format is invalid', async () => {
|
||||
const orderWithInvalidtakerFormat = {
|
||||
...order,
|
||||
takerAddress: (null as any) as string,
|
||||
takerAddress: null as any as string,
|
||||
};
|
||||
const expectedErrorMessage = `Expected order to conform to schema`;
|
||||
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
|
||||
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false
|
||||
}
|
||||
}
|
25
contracts/treasury/.eslintrc
Normal file
25
contracts/treasury/.eslintrc
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"contracts/**/*",
|
||||
"generated-wrappers/**/*",
|
||||
"generated-artifacts/**/*",
|
||||
"test/generated-wrappers/**/*",
|
||||
"test/generated-artifacts/**/*"
|
||||
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "1.4.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Migrate from TSLint to ESLint and fix linting errors",
|
||||
"pr": 589
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "1.4.27",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "1.4.26",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.4.28 - _October 5, 2022_
|
||||
|
||||
* Migrate from TSLint to ESLint and fix linting errors (#589)
|
||||
|
||||
## v1.4.27 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.26 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.4.26",
|
||||
"version": "1.4.28",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -21,12 +21,11 @@
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"test:circleci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"lint-contracts": "#solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"publish:private": "yarn build && gitpkg publish"
|
||||
@@ -47,33 +46,34 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^6.23.3",
|
||||
"@0x/contract-addresses": "^6.24.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-erc20": "^3.3.43",
|
||||
"@0x/contracts-erc20": "^3.3.45",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-test-utils": "^5.4.34",
|
||||
"@0x/contracts-test-utils": "^5.4.36",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/isomorphic-fetch": "^0.0.35",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/prompts": "^2.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"lodash": "^4.17.11",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prompts": "^2.4.0",
|
||||
"shx": "^0.2.2",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.16.10",
|
||||
"@0x/protocol-utils": "^11.16.12",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
|
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false,
|
||||
"max-file-line-count": false,
|
||||
"no-non-null-assertion": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"number-literal-format": false
|
||||
},
|
||||
"linterOptions": {
|
||||
"exclude": ["src/artifacts.ts", "test/artifacts.ts"]
|
||||
}
|
||||
}
|
25
contracts/utils/.eslintrc
Normal file
25
contracts/utils/.eslintrc
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"contracts/**/*",
|
||||
"generated-wrappers/**/*",
|
||||
"generated-artifacts/**/*",
|
||||
"test/generated-wrappers/**/*",
|
||||
"test/generated-artifacts/**/*"
|
||||
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "4.8.26",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Migrate from TSLint to ESLint and fix linting errors",
|
||||
"pr": 589
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "4.8.25",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "4.8.24",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.8.26 - _October 5, 2022_
|
||||
|
||||
* Migrate from TSLint to ESLint and fix linting errors (#589)
|
||||
|
||||
## v4.8.25 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.24 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.8.24",
|
||||
"version": "4.8.26",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -23,8 +23,8 @@
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
@@ -32,7 +32,6 @@
|
||||
"test:circleci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
|
||||
"compile:truffle": "truffle compile"
|
||||
},
|
||||
"config": {
|
||||
@@ -52,30 +51,31 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.34",
|
||||
"@0x/contracts-test-utils": "^5.4.36",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solhint": "^1.4.1",
|
||||
"truffle": "^5.0.32",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@@ -748,15 +748,7 @@ blockchainTests('LibBytes', env => {
|
||||
const result = await libBytes
|
||||
.publicWriteLength(byteArrayLongerThan32Bytes, newLen, constants.NULL_BYTES)
|
||||
.callAsync();
|
||||
expect(result).to.eq(
|
||||
byteArrayLongerThan32Bytes.slice(
|
||||
0,
|
||||
newLen
|
||||
.multipliedBy(2)
|
||||
.plus(2)
|
||||
.toNumber(),
|
||||
),
|
||||
);
|
||||
expect(result).to.eq(byteArrayLongerThan32Bytes.slice(0, newLen.multipliedBy(2).plus(2).toNumber()));
|
||||
});
|
||||
it("should right pad with 0's if new length is greater than original and no extra bytes are appended", async () => {
|
||||
const byteLen = fromHex(byteArrayLongerThan32Bytes).length;
|
||||
|
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false
|
||||
}
|
||||
}
|
23
contracts/zero-ex/.eslintrc
Normal file
23
contracts/zero-ex/.eslintrc
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"generated-wrappers/**/*",
|
||||
"generated-artifacts/**/*",
|
||||
"test/generated-wrappers/**/*",
|
||||
"test/generated-artifacts/**/*"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "0.37.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Migrate from TSLint to ESLint and fix linting errors",
|
||||
"pr": 587
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "0.37.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "0.37.3",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.37.5 - _October 5, 2022_
|
||||
|
||||
* Migrate from TSLint to ESLint and fix linting errors (#587)
|
||||
|
||||
## v0.37.4 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.37.3 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -23,19 +23,29 @@ pragma experimental ABIEncoderV2;
|
||||
import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinCurveV2.sol";
|
||||
import "./mixins/MixinDodoV2.sol";
|
||||
import "./mixins/MixinKyberDmm.sol";
|
||||
import "./mixins/MixinGMX.sol";
|
||||
import "./mixins/MixinNerve.sol";
|
||||
import "./mixins/MixinUniswapV3.sol";
|
||||
import "./mixins/MixinUniswapV2.sol";
|
||||
import "./mixins/MixinZeroExBridge.sol";
|
||||
|
||||
contract ArbitrumBridgeAdapter is
|
||||
AbstractBridgeAdapter(42161, "Arbitrum"),
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinCurve,
|
||||
MixinCurveV2,
|
||||
MixinDodoV2,
|
||||
MixinKyberDmm,
|
||||
MixinGMX,
|
||||
MixinNerve,
|
||||
MixinUniswapV3,
|
||||
MixinUniswapV2,
|
||||
MixinZeroExBridge
|
||||
{
|
||||
constructor(IEtherTokenV06 weth)
|
||||
@@ -63,6 +73,12 @@ contract ArbitrumBridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeBalancerV2Batch(
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.CURVE) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeCurve(
|
||||
@@ -71,6 +87,14 @@ contract ArbitrumBridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.CURVEV2) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeCurveV2(
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.DODOV2) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeDodoV2(
|
||||
@@ -78,6 +102,13 @@ contract ArbitrumBridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeKyberDmm(
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeUniswapV3(
|
||||
@@ -85,9 +116,23 @@ contract ArbitrumBridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeUniswapV2(
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.GMX) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeGMX(
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.NERVE) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeNerve(
|
||||
sellToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
|
@@ -22,6 +22,8 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinCurveV2.sol";
|
||||
import "./mixins/MixinNerve.sol";
|
||||
@@ -32,6 +34,8 @@ import "./mixins/MixinZeroExBridge.sol";
|
||||
|
||||
contract OptimismBridgeAdapter is
|
||||
AbstractBridgeAdapter(10, "Optimism"),
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinCurve,
|
||||
MixinCurveV2,
|
||||
MixinNerve,
|
||||
@@ -109,7 +113,21 @@ contract OptimismBridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
}
|
||||
}else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeBalancerV2(
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeBalancerV2Batch(
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
}
|
||||
|
||||
emit BridgeFill(
|
||||
order.source,
|
||||
@@ -119,4 +137,4 @@ contract OptimismBridgeAdapter is
|
||||
boughtAmount
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.37.3",
|
||||
"version": "0.37.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,8 +24,8 @@
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint": "eslint src test scripts",
|
||||
"fix": "eslint --fix src scripts test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
@@ -33,7 +33,6 @@
|
||||
"test:circleci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"lint-contracts": "#solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
|
||||
"compile:truffle": "truffle compile",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
@@ -57,36 +56,37 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^6.23.3",
|
||||
"@0x/contracts-erc20": "^3.3.43",
|
||||
"@0x/contract-addresses": "^6.24.0",
|
||||
"@0x/contracts-erc20": "^3.3.45",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.34",
|
||||
"@0x/contracts-test-utils": "^5.4.36",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@typechain/ethers-v5": "^10.0.0",
|
||||
"@types/isomorphic-fetch": "^0.0.35",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/prompts": "^2.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"lodash": "^4.17.11",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prompts": "^2.4.0",
|
||||
"shx": "^0.2.2",
|
||||
"solhint": "^1.4.1",
|
||||
"truffle": "^5.0.32",
|
||||
"tslint": "5.11.0",
|
||||
"typechain": "^8.0.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.16.10",
|
||||
"@0x/protocol-utils": "^11.16.12",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
|
@@ -386,7 +386,7 @@ async function getMainnetContractAsync(): Promise<wrappers.IZeroExContract> {
|
||||
const proxyFunctions = await querySubgraphAsync();
|
||||
const deployments = reconstructDeployments(proxyFunctions);
|
||||
|
||||
while (true) {
|
||||
for (;;) {
|
||||
const { action } = await prompts({
|
||||
type: 'select',
|
||||
name: 'action',
|
||||
|
@@ -294,7 +294,7 @@ blockchainTests.resets('MultiplexFeature', env => {
|
||||
};
|
||||
}
|
||||
|
||||
function getUniswapV2MultiHopSubcall(tokens: string[], isSushi: boolean = false): MultiHopSellSubcall {
|
||||
function getUniswapV2MultiHopSubcall(tokens: string[], isSushi = false): MultiHopSellSubcall {
|
||||
const uniswapDataEncoder = AbiEncoder.create([
|
||||
{ name: 'tokens', type: 'address[]' },
|
||||
{ name: 'isSushi', type: 'bool' },
|
||||
@@ -307,7 +307,7 @@ blockchainTests.resets('MultiplexFeature', env => {
|
||||
function getUniswapV2BatchSubcall(
|
||||
tokens: string[],
|
||||
sellAmount: BigNumber = getRandomInteger(1, toBaseUnitAmount(1)),
|
||||
isSushi: boolean = false,
|
||||
isSushi = false,
|
||||
): BatchSellSubcall {
|
||||
return {
|
||||
...getUniswapV2MultiHopSubcall(tokens, isSushi),
|
||||
|
@@ -61,15 +61,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
|
||||
before(async () => {
|
||||
let owner;
|
||||
[
|
||||
owner,
|
||||
maker,
|
||||
taker,
|
||||
notMaker,
|
||||
notTaker,
|
||||
contractWalletOwner,
|
||||
contractWalletSigner,
|
||||
] = await env.getAccountAddressesAsync();
|
||||
[owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner] =
|
||||
await env.getAccountAddressesAsync();
|
||||
[makerToken, takerToken, wethToken] = await Promise.all(
|
||||
[...new Array(3)].map(async () =>
|
||||
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
@@ -761,11 +754,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
receipt: undefined,
|
||||
...opts,
|
||||
};
|
||||
const {
|
||||
makerTokenFilledAmount,
|
||||
takerTokenFilledAmount,
|
||||
takerTokenFeeFilledAmount,
|
||||
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
|
||||
computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const makerBalance = await takerToken.balanceOf(maker).callAsync();
|
||||
const takerBalance = await makerToken.balanceOf(taker).callAsync();
|
||||
const feeRecipientBalance = await takerToken.balanceOf(order.feeRecipient).callAsync();
|
||||
|
@@ -42,17 +42,8 @@ blockchainTests.resets('OtcOrdersFeature', env => {
|
||||
// Useful for ETH balance accounting
|
||||
const txDefaults = { ...env.txDefaults, gasPrice: 0 };
|
||||
let owner;
|
||||
[
|
||||
owner,
|
||||
maker,
|
||||
taker,
|
||||
notMaker,
|
||||
notTaker,
|
||||
contractWalletOwner,
|
||||
contractWalletSigner,
|
||||
txOrigin,
|
||||
notTxOrigin,
|
||||
] = await env.getAccountAddressesAsync();
|
||||
[owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner, txOrigin, notTxOrigin] =
|
||||
await env.getAccountAddressesAsync();
|
||||
[makerToken, takerToken] = await Promise.all(
|
||||
[...new Array(2)].map(async () =>
|
||||
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
|
@@ -334,17 +334,13 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
|
||||
async function getBalancesAsync(owner: string): Promise<Balances> {
|
||||
const balances = { ...ZERO_BALANCES };
|
||||
[
|
||||
balances.makerTokenBalance,
|
||||
balances.takerTokensBalance,
|
||||
balances.takerFeeBalance,
|
||||
balances.ethBalance,
|
||||
] = await Promise.all([
|
||||
makerToken.balanceOf(owner).callAsync(),
|
||||
takerToken.balanceOf(owner).callAsync(),
|
||||
takerFeeToken.balanceOf(owner).callAsync(),
|
||||
env.web3Wrapper.getBalanceInWeiAsync(owner),
|
||||
]);
|
||||
[balances.makerTokenBalance, balances.takerTokensBalance, balances.takerFeeBalance, balances.ethBalance] =
|
||||
await Promise.all([
|
||||
makerToken.balanceOf(owner).callAsync(),
|
||||
takerToken.balanceOf(owner).callAsync(),
|
||||
takerFeeToken.balanceOf(owner).callAsync(),
|
||||
env.web3Wrapper.getBalanceInWeiAsync(owner),
|
||||
]);
|
||||
return balances;
|
||||
}
|
||||
|
||||
@@ -365,11 +361,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
|
||||
function normalizeFillAmount(raw: BigNumber, balance: BigNumber): BigNumber {
|
||||
if (raw.gte(HIGH_BIT)) {
|
||||
return raw
|
||||
.minus(HIGH_BIT)
|
||||
.div('1e18')
|
||||
.times(balance)
|
||||
.integerValue(BigNumber.ROUND_DOWN);
|
||||
return raw.minus(HIGH_BIT).div('1e18').times(balance).integerValue(BigNumber.ROUND_DOWN);
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ interface RfqOrderFilledAmounts {
|
||||
makerTokenFilledAmount: BigNumber;
|
||||
takerTokenFilledAmount: BigNumber;
|
||||
}
|
||||
interface OtcOrderFilledAmounts extends RfqOrderFilledAmounts {}
|
||||
type OtcOrderFilledAmounts = RfqOrderFilledAmounts;
|
||||
|
||||
interface LimitOrderFilledAmounts {
|
||||
makerTokenFilledAmount: BigNumber;
|
||||
@@ -52,7 +52,7 @@ export class NativeOrdersTestEnvironment {
|
||||
public static async createAsync(
|
||||
env: BlockchainTestsEnvironment,
|
||||
gasPrice: BigNumber = new BigNumber('123e9'),
|
||||
protocolFeeMultiplier: number = 70e3,
|
||||
protocolFeeMultiplier = 70e3,
|
||||
): Promise<NativeOrdersTestEnvironment> {
|
||||
const [owner, maker, taker] = await env.getAccountAddressesAsync();
|
||||
const [makerToken, takerToken] = await Promise.all(
|
||||
@@ -153,7 +153,7 @@ export class NativeOrdersTestEnvironment {
|
||||
order: OtcOrder,
|
||||
fillAmount: BigNumber | number = order.takerAmount,
|
||||
taker: string = this.taker,
|
||||
unwrapWeth: boolean = false,
|
||||
unwrapWeth = false,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
await this.prepareBalancesForOrdersAsync([order], taker);
|
||||
if (unwrapWeth) {
|
||||
@@ -179,7 +179,7 @@ export class NativeOrdersTestEnvironment {
|
||||
order: OtcOrder,
|
||||
origin: string = order.txOrigin,
|
||||
taker: string = order.taker,
|
||||
unwrapWeth: boolean = false,
|
||||
unwrapWeth = false,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
await this.prepareBalancesForOrdersAsync([order], taker);
|
||||
if (unwrapWeth) {
|
||||
@@ -217,11 +217,8 @@ export class NativeOrdersTestEnvironment {
|
||||
takerTokenFillAmount: BigNumber = order.takerAmount,
|
||||
takerTokenAlreadyFilledAmount: BigNumber = ZERO,
|
||||
): IZeroExLimitOrderFilledEventArgs {
|
||||
const {
|
||||
makerTokenFilledAmount,
|
||||
takerTokenFilledAmount,
|
||||
takerTokenFeeFilledAmount,
|
||||
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
|
||||
computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
|
||||
const protocolFee = order.taker !== NULL_ADDRESS ? ZERO : this.protocolFee;
|
||||
return {
|
||||
takerTokenFilledAmount,
|
||||
@@ -354,7 +351,7 @@ export function assertOrderInfoEquals(actual: OrderInfo, expected: OrderInfo): v
|
||||
/**
|
||||
* Creates an order expiry field.
|
||||
*/
|
||||
export function createExpiry(deltaSeconds: number = 60): BigNumber {
|
||||
export function createExpiry(deltaSeconds = 60): BigNumber {
|
||||
return new BigNumber(Math.floor(Date.now() / 1000) + deltaSeconds);
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@
|
||||
"lcov-result-merger": "^3.0.0",
|
||||
"lerna": "^3.0.0-beta.25",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prettier": "1.19.1",
|
||||
"prettier": "2.7.1",
|
||||
"source-map-support": "^0.5.6",
|
||||
"typescript": "4.6.3",
|
||||
"wsrun": "^5.2.4"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/asset-swapper",
|
||||
"version": "16.66.10",
|
||||
"version": "16.66.12",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
@@ -8,36 +8,7 @@
|
||||
"description": "Convenience package for discovering and buying assets on-chain and off-chain.",
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "#yarn pre_build && tsc -b",
|
||||
"build:ts": "#tsc -b",
|
||||
"watch": "tsc -w -p tsconfig.json",
|
||||
"watch:contracts": "sol-compiler -w",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
|
||||
"compile": "sol-compiler",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint-contracts": "#solhint -c .solhint.json contracts/**/**/**/**/*.sol",
|
||||
"prettier": "prettier --write '**/*.{ts,tsx,json}' --config ../../.prettierrc --ignore-path ../../.prettierignore",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"test": "#yarn run_mocha",
|
||||
"rebuild_and_test": "run-s clean build test",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"test:circleci": "#yarn test:coverage",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*_test.js' lib/test/global_hooks.js --timeout 30000 --bail --exit",
|
||||
"clean": "shx rm -rf lib test_temp generated_docs test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
"diff_docs": "git diff --exit-code ./docs",
|
||||
"s3:sync_md_docs": "aws s3 sync ./docs s3://docs-markdown/${npm_package_name}/v${npm_package_version} --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"publish:private": "yarn build && gitpkg publish",
|
||||
"sampler-size": "jq .compilerOutput.evm.deployedBytecode.object -- test/generated-artifacts/ERC20BridgeSampler.json | echo $(( $(wc -c) / 2 - 1 ))",
|
||||
"list:deps": "yarn lerna list -l"
|
||||
},
|
||||
"scripts": {},
|
||||
"config": {
|
||||
"publicInterfaceContracts": "ERC20BridgeSampler,BalanceChecker,FakeTaker",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||
@@ -62,15 +33,15 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.23.3",
|
||||
"@0x/contract-wrappers": "^13.22.3",
|
||||
"@0x/contracts-erc20": "^3.3.43",
|
||||
"@0x/contracts-zero-ex": "^0.37.3",
|
||||
"@0x/contract-addresses": "^6.24.0",
|
||||
"@0x/contract-wrappers": "^13.22.5",
|
||||
"@0x/contracts-erc20": "^3.3.45",
|
||||
"@0x/contracts-zero-ex": "^0.37.5",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/fast-abi": "^0.0.5",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/neon-router": "^0.3.5",
|
||||
"@0x/protocol-utils": "^11.16.10",
|
||||
"@0x/protocol-utils": "^11.16.12",
|
||||
"@0x/quote-server": "^8.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/utils": "^7.0.0",
|
||||
@@ -95,7 +66,7 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.34",
|
||||
"@0x/contracts-test-utils": "^5.4.36",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -1,10 +1,34 @@
|
||||
[
|
||||
{
|
||||
"version": "6.24.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add missing zeroExGovernor for Arbitrum",
|
||||
"pr": 583
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"version": "6.23.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "New FQT for Arbitrum with Nerve",
|
||||
"pr": 581
|
||||
}
|
||||
],
|
||||
"timestamp": 1663786955
|
||||
},
|
||||
{
|
||||
"version": "6.23.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "New FQT for Optimism with BalV2",
|
||||
"pr": 577
|
||||
},
|
||||
{
|
||||
"note": "Add balV2/batch to opt bridge adapter code",
|
||||
"pr": 578
|
||||
}
|
||||
],
|
||||
"timestamp": 1662998180
|
||||
|
@@ -5,9 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.24.0 - _October 5, 2022_
|
||||
|
||||
* Add missing zeroExGovernor for Arbitrum (#583)
|
||||
|
||||
## v6.23.4 - _September 21, 2022_
|
||||
|
||||
* New FQT for Arbitrum with Nerve (#581)
|
||||
|
||||
## v6.23.3 - _September 12, 2022_
|
||||
|
||||
* New FQT for Optimism with BalV2 (#577)
|
||||
* Add balV2/batch to opt bridge adapter code (#578)
|
||||
|
||||
## v6.23.2 - _September 7, 2022_
|
||||
|
||||
|
@@ -324,7 +324,7 @@
|
||||
"42161": {
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
||||
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||
"zeroExGovernor": "0x1fe80d5ad9464dba2d60b88e449305f184823f8a",
|
||||
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||
"staking": "0x0000000000000000000000000000000000000000",
|
||||
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||
@@ -340,7 +340,7 @@
|
||||
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
|
||||
"payTakerTransformer": "0xae3e8cf7bf340d7084f312dfae2aa8b01c885b02",
|
||||
"affiliateFeeTransformer": "0x05a24978471869327904ea13da3c4322128e2aaa",
|
||||
"fillQuoteTransformer": "0x542c7dfc7959d8d03c5b738478213885ab3f214e",
|
||||
"fillQuoteTransformer": "0x466b00a77662245c2cc7b093a7102a687afc16f3",
|
||||
"positiveSlippageFeeTransformer": "0xd56b9c014b45ed95e2a048a0c28121db30265f13"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "6.23.3",
|
||||
"version": "6.24.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
22
packages/contract-wrappers/.eslintrc
Normal file
22
packages/contract-wrappers/.eslintrc
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"migrations/*",
|
||||
"src/generated-wrappers/**/*",
|
||||
"src/generated-artifacts/**/*"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1665013355,
|
||||
"version": "13.22.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "13.22.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "13.22.3",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v13.22.5 - _October 5, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v13.22.4 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v13.22.3 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers",
|
||||
"version": "13.22.3",
|
||||
"version": "13.22.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -18,8 +18,8 @@
|
||||
"rebuild": "yarn wrappers:clean && yarn wrappers:generate && yarn wrappers:prettier && yarn build",
|
||||
"build:ci": "yarn build",
|
||||
"publish:private": "yarn rebuild && gitpkg publish",
|
||||
"lint": "tslint --format stylish --project . --exclude **/lib/**/*",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude **/lib/**/*",
|
||||
"lint": "eslint src",
|
||||
"fix": "eslint --fix src",
|
||||
"prettier": "prettier --write **/* --config ../../.prettierrc",
|
||||
"clean": "shx rm -rf lib generated_docs",
|
||||
"docs_test": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --out generated_docs ./src/generated-wrappers/*",
|
||||
@@ -48,16 +48,18 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-wrappers",
|
||||
"devDependencies": {
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"gitpkg": "https://github.com/0xProject/gitpkg.git",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.23.3",
|
||||
"@0x/contract-addresses": "^6.24.0",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/utils": "^7.0.0",
|
||||
|
24
packages/protocol-utils/.eslintrc.json
Normal file
24
packages/protocol-utils/.eslintrc.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"env": {
|
||||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json",
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"ignorePatterns": [
|
||||
"lib/**/*",
|
||||
"migrations/*",
|
||||
"generated-wrappers/**/*",
|
||||
"generated-artifacts/**/*",
|
||||
"test/generated-wrappers/**/*",
|
||||
"test/generated-artifacts/**/*"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "11.16.12",
|
||||
"changes": [
|
||||
{
|
||||
"note": "tslint -> eslint",
|
||||
"pr": "582"
|
||||
}
|
||||
],
|
||||
"timestamp": 1665013355
|
||||
},
|
||||
{
|
||||
"timestamp": 1663786955,
|
||||
"version": "11.16.11",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1662998180,
|
||||
"version": "11.16.10",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v11.16.12 - _October 5, 2022_
|
||||
|
||||
* tslint -> eslint (#582)
|
||||
|
||||
## v11.16.11 - _September 21, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v11.16.10 - _September 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/protocol-utils",
|
||||
"version": "11.16.10",
|
||||
"version": "11.16.12",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -19,8 +19,8 @@
|
||||
"test:coverage": "mkdir -p ./coverage && nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"clean": "shx rm -rf lib generated_docs",
|
||||
"lint": "tslint --format stylish --project .",
|
||||
"fix": "tslint --fix --format stylish --project .",
|
||||
"lint": "eslint src --max-warnings 32",
|
||||
"fix": "eslint --fix --quiet src test",
|
||||
"diff_docs": "git diff --exit-code ./docs",
|
||||
"s3:sync_md_docs": "aws s3 sync ./docs s3://docs-markdown/${npm_package_name}/v${npm_package_version} --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
@@ -43,7 +43,6 @@
|
||||
"devDependencies": {
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
@@ -51,24 +50,28 @@
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"sinon": "^4.0.0",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3",
|
||||
"web3-provider-engine": "14.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/contract-addresses": "^6.23.3",
|
||||
"@0x/contract-wrappers": "^13.22.3",
|
||||
"@0x/contract-addresses": "^6.24.0",
|
||||
"@0x/contract-wrappers": "^13.22.5",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"chai": "^4.0.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4",
|
||||
|
@@ -19,12 +19,10 @@ import {
|
||||
SignatureType,
|
||||
} from './signature_utils';
|
||||
|
||||
// tslint:disable:enum-naming
|
||||
export enum TradeDirection {
|
||||
SellNFT = 0,
|
||||
BuyNFT = 1,
|
||||
}
|
||||
// tslint:enable:enum-naming
|
||||
|
||||
export enum OrderStatus {
|
||||
Invalid = 0,
|
||||
@@ -136,7 +134,7 @@ export abstract class NFTOrder {
|
||||
public abstract getEIP712TypedData(): EIP712TypedData;
|
||||
protected abstract _getProperties(): Property[];
|
||||
|
||||
public willExpire(secondsFromNow: number = 0): boolean {
|
||||
public willExpire(secondsFromNow = 0): boolean {
|
||||
const millisecondsInSecond = 1000;
|
||||
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
|
||||
return this.expiry.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));
|
||||
|
@@ -242,7 +242,7 @@ export class LimitOrder extends OrderBase {
|
||||
};
|
||||
}
|
||||
|
||||
public willExpire(secondsFromNow: number = 0): boolean {
|
||||
public willExpire(secondsFromNow = 0): boolean {
|
||||
const millisecondsInSecond = 1000;
|
||||
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
|
||||
return this.expiry.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));
|
||||
@@ -338,7 +338,7 @@ export class RfqOrder extends OrderBase {
|
||||
};
|
||||
}
|
||||
|
||||
public willExpire(secondsFromNow: number = 0): boolean {
|
||||
public willExpire(secondsFromNow = 0): boolean {
|
||||
const millisecondsInSecond = 1000;
|
||||
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
|
||||
return this.expiry.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));
|
||||
@@ -368,9 +368,7 @@ export class OtcOrder extends OrderBase {
|
||||
public nonceBucket: BigNumber;
|
||||
public nonce: BigNumber;
|
||||
|
||||
public static parseExpiryAndNonce(
|
||||
expiryAndNonce: BigNumber,
|
||||
): {
|
||||
public static parseExpiryAndNonce(expiryAndNonce: BigNumber): {
|
||||
expiry: BigNumber;
|
||||
nonceBucket: BigNumber;
|
||||
nonce: BigNumber;
|
||||
@@ -468,7 +466,7 @@ export class OtcOrder extends OrderBase {
|
||||
};
|
||||
}
|
||||
|
||||
public willExpire(secondsFromNow: number = 0): boolean {
|
||||
public willExpire(secondsFromNow = 0): boolean {
|
||||
const millisecondsInSecond = 1000;
|
||||
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
|
||||
const expiryRightShift = new BigNumber(2).pow(192);
|
||||
|
@@ -1,4 +1,3 @@
|
||||
// tslint:disable: max-classes-per-file
|
||||
import { Numberish, RevertError } from '@0x/utils';
|
||||
|
||||
import { OrderStatus } from '../orders';
|
||||
|
@@ -1,4 +1,3 @@
|
||||
// tslint:disable: max-classes-per-file
|
||||
import { Numberish, RevertError } from '@0x/utils';
|
||||
|
||||
import { OrderStatus } from '../nft_orders';
|
||||
|
@@ -105,8 +105,8 @@ export enum FillQuoteTransformerSide {
|
||||
export enum FillQuoteTransformerOrderType {
|
||||
Bridge,
|
||||
Limit,
|
||||
Otc,
|
||||
Rfq,
|
||||
Otc,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,6 @@ export interface FillQuoteTransformerData {
|
||||
refundReceiver: string;
|
||||
}
|
||||
|
||||
// tslint:disable: enum-naming
|
||||
/**
|
||||
* Identifies the DEX protocol used to fill a bridge order.
|
||||
* Note: These need to correspond exactly with BridgeProtocols.sol!
|
||||
@@ -164,7 +163,6 @@ export enum BridgeProtocol {
|
||||
Synthetix,
|
||||
WOOFi,
|
||||
}
|
||||
// tslint:enable: enum-naming
|
||||
|
||||
/**
|
||||
* `FillQuoteTransformer.BridgeOrder`
|
||||
@@ -338,11 +336,7 @@ export function decodeAffiliateFeeTransformerData(encoded: string): AffiliateFee
|
||||
* Find the nonce for a transformer given its deployer.
|
||||
* If `deployer` is the null address, zero will always be returned.
|
||||
*/
|
||||
export function findTransformerNonce(
|
||||
transformer: string,
|
||||
deployer: string = NULL_ADDRESS,
|
||||
maxGuesses: number = 1024,
|
||||
): number {
|
||||
export function findTransformerNonce(transformer: string, deployer: string = NULL_ADDRESS, maxGuesses = 1024): number {
|
||||
if (deployer === NULL_ADDRESS) {
|
||||
return 0;
|
||||
}
|
||||
@@ -361,10 +355,7 @@ export function findTransformerNonce(
|
||||
* Compute the deployed address for a transformer given a deployer and nonce.
|
||||
*/
|
||||
export function getTransformerAddress(deployer: string, nonce: number): string {
|
||||
return ethjs.bufferToHex(
|
||||
// tslint:disable-next-line: custom-no-magic-numbers
|
||||
ethjs.rlphash([deployer, nonce] as any).slice(12),
|
||||
);
|
||||
return ethjs.bufferToHex(ethjs.rlphash([deployer, nonce] as any).slice(12));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false,
|
||||
"max-classes-per-file": false
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user