Compare commits
8 Commits
@0x/protoc
...
@0x/contra
Author | SHA1 | Date | |
---|---|---|---|
|
92e681f21b | ||
|
3f65dd6049 | ||
|
4425c316a3 | ||
|
9058839645 | ||
|
46a7a2e620 | ||
|
b35dccd43d | ||
|
08e0c2ebb9 | ||
|
8aa313a437 |
@@ -128,6 +128,7 @@ jobs:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- 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
|
||||
- run: yarn wsrun -p @0x/contract-wrappers-test -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/order-utils -m --serial -c test:circleci
|
||||
@@ -195,7 +196,7 @@ workflows:
|
||||
# - build
|
||||
- test-foundry:
|
||||
requires:
|
||||
- build
|
||||
- build
|
||||
- test-contracts-rest-ganache:
|
||||
requires:
|
||||
- build
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "3.3.37",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "3.3.36",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.37 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.36 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.3.36",
|
||||
"version": "3.3.37",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -51,18 +51,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/contracts-utils": "^4.8.17",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.28",
|
||||
"@0x/contracts-utils": "^4.8.18",
|
||||
"@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": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -70,7 +70,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -82,7 +82,7 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"ethers": "~4.0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "5.4.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "5.4.27",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.4.28 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.27 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.4.27",
|
||||
"version": "5.4.28",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -34,7 +34,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
||||
"devDependencies": {
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
@@ -42,20 +42,20 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.20.1",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-coverage": "^4.0.45",
|
||||
"@0x/sol-profiler": "^4.1.35",
|
||||
"@0x/sol-trace": "^3.0.45",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/sol-coverage": "^4.0.46",
|
||||
"@0x/sol-profiler": "^4.1.36",
|
||||
"@0x/sol-trace": "^3.0.46",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"@types/lodash": "4.14.104",
|
||||
@@ -67,7 +67,7 @@
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"decimal.js": "^10.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4",
|
||||
"js-combinatorics": "^0.5.3",
|
||||
|
@@ -38,7 +38,7 @@ async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: stri
|
||||
}
|
||||
|
||||
async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
|
||||
return _getGanacheOrGethErrorAsync("sender doesn't have enough funds", 'insufficient funds');
|
||||
return _getGanacheOrGethErrorAsync('insufficient funds for gas * price + value', 'insufficient funds');
|
||||
}
|
||||
|
||||
async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "1.4.20",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "1.4.19",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.4.20 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.19 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.4.19",
|
||||
"version": "1.4.20",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -46,14 +46,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^6.20.1",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-erc20": "^3.3.36",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-erc20": "^3.3.37",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/contracts-test-utils": "^5.4.28",
|
||||
"@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",
|
||||
@@ -72,14 +72,14 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/protocol-utils": "^11.16.3",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.16.4",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethereumjs-util": "^7.0.10"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "4.8.18",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "4.8.17",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.8.18 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.17 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.8.17",
|
||||
"version": "4.8.18",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -50,15 +50,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.28",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
@@ -79,11 +79,11 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^3.7.0"
|
||||
"ethereum-types": "^3.7.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "0.36.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "0.36.3",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.36.4 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.36.3 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.36.3",
|
||||
"version": "0.36.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -56,14 +56,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contracts-erc20": "^3.3.36",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^6.20.1",
|
||||
"@0x/contracts-erc20": "^3.3.37",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.28",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@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",
|
||||
@@ -85,14 +85,14 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/protocol-utils": "^11.16.3",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.16.4",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4"
|
||||
},
|
||||
|
@@ -30,7 +30,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
let maker: string;
|
||||
let sender: string;
|
||||
let notSigner: string;
|
||||
let signers: string[];
|
||||
const signers: string[] = [];
|
||||
let zeroEx: IZeroExContract;
|
||||
let feature: MetaTransactionsFeatureContract;
|
||||
let feeToken: TestMintableERC20TokenContract;
|
||||
@@ -45,7 +45,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
const REENTRANCY_FLAG_MTX = 0x1;
|
||||
|
||||
before(async () => {
|
||||
[owner, maker, sender, notSigner, ...signers] = await env.getAccountAddressesAsync();
|
||||
let possibleSigners: string[];
|
||||
[owner, maker, sender, notSigner, ...possibleSigners] = await env.getAccountAddressesAsync();
|
||||
transformERC20Feature = await TestMetaTransactionsTransformERC20FeatureContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestMetaTransactionsTransformERC20Feature,
|
||||
env.provider,
|
||||
@@ -74,20 +75,26 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
env.txDefaults,
|
||||
{},
|
||||
);
|
||||
// Fund signers with fee tokens.
|
||||
await Promise.all(
|
||||
signers.map(async signer => {
|
||||
await feeToken.mint(signer, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
|
||||
await feeToken.approve(zeroEx.address, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync({ from: signer });
|
||||
}),
|
||||
);
|
||||
|
||||
// some accounts returned can be unfunded
|
||||
for (const possibleSigner of possibleSigners) {
|
||||
const balance = await env.web3Wrapper.getBalanceInWeiAsync(possibleSigner);
|
||||
if (balance.isGreaterThan(0)) {
|
||||
signers.push(possibleSigner);
|
||||
await feeToken
|
||||
.approve(zeroEx.address, MAX_FEE_AMOUNT)
|
||||
.awaitTransactionSuccessAsync({ from: possibleSigner });
|
||||
await feeToken.mint(possibleSigner, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function getRandomMetaTransaction(fields: Partial<MetaTransactionFields> = {}): MetaTransaction {
|
||||
return new MetaTransaction({
|
||||
signer: _.sampleSize(signers)[0],
|
||||
sender,
|
||||
minGasPrice: getRandomInteger('2', '1e9'),
|
||||
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
minGasPrice: ZERO_AMOUNT,
|
||||
maxGasPrice: getRandomInteger('1e9', '100e9'),
|
||||
expirationTimeSeconds: new BigNumber(Math.floor(_.now() / 1000) + 360),
|
||||
salt: new BigNumber(hexUtils.random()),
|
||||
@@ -145,6 +152,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
gasPrice: mtx.minGasPrice,
|
||||
value: mtx.value,
|
||||
};
|
||||
|
||||
const rawResult = await feature.executeMetaTransaction(mtx, signature).callAsync(callOpts);
|
||||
expect(rawResult).to.eq(RAW_ORDER_SUCCESS_RESULT);
|
||||
const receipt = await feature.executeMetaTransaction(mtx, signature).awaitTransactionSuccessAsync(callOpts);
|
||||
@@ -434,7 +442,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
);
|
||||
});
|
||||
|
||||
it('fails if gas price too low', async () => {
|
||||
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it.skip('fails if gas price too low', async () => {
|
||||
const mtx = getRandomMetaTransaction();
|
||||
const mtxHash = mtx.getHash();
|
||||
const signature = await mtx.getSignatureWithProviderAsync(env.provider);
|
||||
@@ -453,7 +462,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
);
|
||||
});
|
||||
|
||||
it('fails if gas price too high', async () => {
|
||||
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it.skip('fails if gas price too high', async () => {
|
||||
const mtx = getRandomMetaTransaction();
|
||||
const mtxHash = mtx.getHash();
|
||||
const signature = await mtx.getSignatureWithProviderAsync(env.provider);
|
||||
|
@@ -938,7 +938,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
);
|
||||
});
|
||||
|
||||
it('fails if no protocol fee attached', async () => {
|
||||
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it.skip('fails if no protocol fee attached', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
await testUtils.prepareBalancesForOrdersAsync([order]);
|
||||
const tx = zeroEx
|
||||
|
@@ -10,7 +10,8 @@ import {
|
||||
TestWethContract,
|
||||
} from './wrappers';
|
||||
|
||||
blockchainTests.resets('ProtocolFees', env => {
|
||||
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
blockchainTests.resets.skip('ProtocolFees', env => {
|
||||
const FEE_MULTIPLIER = 70e3;
|
||||
let taker: string;
|
||||
let unauthorized: string;
|
||||
@@ -62,7 +63,7 @@ blockchainTests.resets('ProtocolFees', env => {
|
||||
it('should disallow unauthorized initialization', async () => {
|
||||
const pool = hexUtils.random();
|
||||
|
||||
await protocolFees.collectProtocolFee(pool).awaitTransactionSuccessAsync({ value: singleFeeAmount });
|
||||
await protocolFees.collectProtocolFee(pool).awaitTransactionSuccessAsync({ value: 1e9 });
|
||||
await protocolFees.transferFeesForPool(pool).awaitTransactionSuccessAsync();
|
||||
|
||||
const feeCollector = new FeeCollectorContract(
|
||||
@@ -89,6 +90,7 @@ blockchainTests.resets('ProtocolFees', env => {
|
||||
feeCollector2Address = await protocolFees.getFeeCollector(pool2).callAsync();
|
||||
});
|
||||
|
||||
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it('should revert if insufficient ETH transferred', async () => {
|
||||
const tooLittle = singleFeeAmount.minus(1);
|
||||
const tx = protocolFees.collectProtocolFee(pool1).awaitTransactionSuccessAsync({ value: tooLittle });
|
||||
|
@@ -75,7 +75,6 @@
|
||||
"wsrun": "^5.2.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"merkle-patricia-tree": "3.0.0",
|
||||
"**/bignumber.js": "^9.0.2"
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,18 @@
|
||||
[
|
||||
{
|
||||
"version": "16.66.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Offboard Cream",
|
||||
"pr": 546
|
||||
},
|
||||
{
|
||||
"note": "Change WooFi gas estimates",
|
||||
"pr": 551
|
||||
}
|
||||
],
|
||||
"timestamp": 1661145612
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "16.66.3",
|
||||
|
@@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v16.66.4 - _August 22, 2022_
|
||||
|
||||
* Offboard Cream (#546)
|
||||
* Change WooFi gas estimates (#551)
|
||||
|
||||
## v16.66.3 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/asset-swapper",
|
||||
"version": "16.66.3",
|
||||
"version": "16.66.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -59,21 +59,21 @@
|
||||
"registry": "git@github.com:0xProject/gitpkg-registry.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contract-wrappers": "^13.20.8",
|
||||
"@0x/contracts-erc20": "^3.3.36",
|
||||
"@0x/contracts-zero-ex": "^0.36.3",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.20.1",
|
||||
"@0x/contract-wrappers": "^13.21.1",
|
||||
"@0x/contracts-erc20": "^3.3.37",
|
||||
"@0x/contracts-zero-ex": "^0.36.4",
|
||||
"@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.3",
|
||||
"@0x/protocol-utils": "^11.16.4",
|
||||
"@0x/quote-server": "^8.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@balancer-labs/sdk": "0.1.6",
|
||||
"@bancor/sdk": "0.2.9",
|
||||
"@ethersproject/abi": "^5.0.1",
|
||||
@@ -84,8 +84,7 @@
|
||||
"axios": "^0.21.1",
|
||||
"axios-mock-adapter": "^1.19.0",
|
||||
"balancer-labs-sor-v1": "npm:@balancer-labs/sor@0.3.2",
|
||||
"cream-sor": "^0.3.3",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"graphql": "^15.4.0",
|
||||
"graphql-request": "^3.4.0",
|
||||
"heartbeats": "^5.0.1",
|
||||
@@ -93,11 +92,11 @@
|
||||
"msw": "^0.44.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/lodash": "4.14.137",
|
||||
|
@@ -144,7 +144,7 @@ export class SwapQuoter {
|
||||
this.chainId,
|
||||
samplerContract,
|
||||
samplerOverrides,
|
||||
undefined, // pools caches for balancer and cream
|
||||
undefined, // pools caches for balancer
|
||||
tokenAdjacencyGraph,
|
||||
liquidityProviderRegistry,
|
||||
this.chainId === ChainId.Mainnet // Enable Bancor only on Mainnet
|
||||
|
@@ -95,7 +95,6 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.MultiHop,
|
||||
ERC20BridgeSource.Dodo,
|
||||
ERC20BridgeSource.DodoV2,
|
||||
ERC20BridgeSource.Cream,
|
||||
ERC20BridgeSource.LiquidityProvider,
|
||||
ERC20BridgeSource.CryptoCom,
|
||||
ERC20BridgeSource.Lido,
|
||||
@@ -247,7 +246,6 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.MultiHop,
|
||||
ERC20BridgeSource.Dodo,
|
||||
ERC20BridgeSource.DodoV2,
|
||||
ERC20BridgeSource.Cream,
|
||||
ERC20BridgeSource.Lido,
|
||||
ERC20BridgeSource.LiquidityProvider,
|
||||
ERC20BridgeSource.CryptoCom,
|
||||
@@ -2520,7 +2518,6 @@ export const DEFAULT_GAS_SCHEDULE: Required<GasSchedule> = {
|
||||
[ERC20BridgeSource.BalancerV2]: (fillData?: FillData) => {
|
||||
return 100e3 + ((fillData as BalancerV2BatchSwapFillData).swapSteps.length - 1) * 50e3;
|
||||
},
|
||||
[ERC20BridgeSource.Cream]: () => 120e3,
|
||||
[ERC20BridgeSource.MStable]: () => 200e3,
|
||||
[ERC20BridgeSource.MakerPsm]: (fillData?: FillData) => {
|
||||
const psmFillData = fillData as MakerPsmFillData;
|
||||
@@ -2660,14 +2657,34 @@ export const DEFAULT_GAS_SCHEDULE: Required<GasSchedule> = {
|
||||
[ERC20BridgeSource.WOOFi]: (fillData?: FillData) => {
|
||||
const woofiFillData = fillData as WOOFiFillData;
|
||||
const quoteTokenAddresses = [BSC_TOKENS.USDT, AVALANCHE_TOKENS.nUSDC, FANTOM_TOKENS.USDC, POLYGON_TOKENS.USDC];
|
||||
|
||||
if (
|
||||
const hasQuoteToken =
|
||||
quoteTokenAddresses.includes(woofiFillData.takerToken) ||
|
||||
quoteTokenAddresses.includes(woofiFillData.makerToken)
|
||||
) {
|
||||
return 500e3;
|
||||
quoteTokenAddresses.includes(woofiFillData.makerToken);
|
||||
if (woofiFillData.chainId === ChainId.BSC) {
|
||||
if (hasQuoteToken) {
|
||||
return 550e3;
|
||||
} else {
|
||||
return 100e4;
|
||||
}
|
||||
} else if (woofiFillData.chainId === ChainId.Avalanche) {
|
||||
if (hasQuoteToken) {
|
||||
return 300e3;
|
||||
} else {
|
||||
return 550e3;
|
||||
}
|
||||
} else if (woofiFillData.chainId === ChainId.Polygon) {
|
||||
if (hasQuoteToken) {
|
||||
return 500e3;
|
||||
} else {
|
||||
return 700e3;
|
||||
}
|
||||
} else {
|
||||
return 100e4;
|
||||
// Fantom
|
||||
if (hasQuoteToken) {
|
||||
return 400e3;
|
||||
} else {
|
||||
return 600e3;
|
||||
}
|
||||
}
|
||||
},
|
||||
//
|
||||
|
@@ -8,7 +8,6 @@ import { MAX_UINT256, ZERO_AMOUNT } from './constants';
|
||||
import {
|
||||
AaveV2FillData,
|
||||
AggregationError,
|
||||
BalancerFillData,
|
||||
BalancerV2BatchSwapFillData,
|
||||
BalancerV2FillData,
|
||||
BancorFillData,
|
||||
@@ -101,8 +100,6 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
|
||||
return encodeBridgeSourceId(BridgeProtocol.Bancor, 'Bancor');
|
||||
case ERC20BridgeSource.Curve:
|
||||
return encodeBridgeSourceId(BridgeProtocol.Curve, 'Curve');
|
||||
case ERC20BridgeSource.Cream:
|
||||
return encodeBridgeSourceId(BridgeProtocol.Balancer, 'Cream');
|
||||
case ERC20BridgeSource.CryptoCom:
|
||||
return encodeBridgeSourceId(BridgeProtocol.CryptoCom, 'CryptoCom');
|
||||
case ERC20BridgeSource.Dodo:
|
||||
@@ -258,10 +255,6 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
|
||||
]);
|
||||
break;
|
||||
case ERC20BridgeSource.Balancer:
|
||||
case ERC20BridgeSource.Cream:
|
||||
const balancerFillData = (order as OptimizedMarketBridgeOrder<BalancerFillData>).fillData;
|
||||
bridgeData = encoder.encode([balancerFillData.poolAddress]);
|
||||
break;
|
||||
case ERC20BridgeSource.BalancerV2:
|
||||
{
|
||||
const balancerV2FillData = (order as OptimizedMarketBridgeOrder<BalancerV2BatchSwapFillData>).fillData;
|
||||
@@ -505,7 +498,6 @@ export const BRIDGE_ENCODERS: {
|
||||
[ERC20BridgeSource.Mooniswap]: poolEncoder,
|
||||
[ERC20BridgeSource.MStable]: poolEncoder,
|
||||
[ERC20BridgeSource.Balancer]: poolEncoder,
|
||||
[ERC20BridgeSource.Cream]: poolEncoder,
|
||||
[ERC20BridgeSource.Uniswap]: poolEncoder,
|
||||
// Custom integrations
|
||||
[ERC20BridgeSource.MakerPsm]: makerPsmEncoder,
|
||||
|
@@ -1,36 +0,0 @@
|
||||
import { ChainId } from '@0x/contract-addresses';
|
||||
import { Pool } from 'balancer-labs-sor-v1/dist/types';
|
||||
import { getPoolsWithTokens, parsePoolData } from 'cream-sor';
|
||||
|
||||
import { BALANCER_MAX_POOLS_FETCHED } from '../constants';
|
||||
|
||||
import { NoOpPoolsCache } from './no_op_pools_cache';
|
||||
import { AbstractPoolsCache, CacheValue, PoolsCache } from './pools_cache';
|
||||
|
||||
export class CreamPoolsCache extends AbstractPoolsCache {
|
||||
public static create(chainId: ChainId): PoolsCache {
|
||||
if (chainId !== ChainId.Mainnet) {
|
||||
return new NoOpPoolsCache();
|
||||
}
|
||||
|
||||
return new CreamPoolsCache();
|
||||
}
|
||||
protected async _fetchPoolsForPairAsync(takerToken: string, makerToken: string): Promise<Pool[]> {
|
||||
try {
|
||||
const poolData = (await getPoolsWithTokens(takerToken, makerToken)).pools;
|
||||
// Sort by maker token balance (descending)
|
||||
const pools = parsePoolData(poolData, takerToken, makerToken).sort((a, b) =>
|
||||
b.balanceOut.minus(a.balanceOut).toNumber(),
|
||||
);
|
||||
return pools.slice(0, this.maxPoolsFetched);
|
||||
} catch (err) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
private constructor(
|
||||
_cache: Map<string, CacheValue> = new Map(),
|
||||
private readonly maxPoolsFetched: number = BALANCER_MAX_POOLS_FETCHED,
|
||||
) {
|
||||
super(_cache);
|
||||
}
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
export { BalancerPoolsCache } from './balancer_pools_cache';
|
||||
export { BalancerV2PoolsCache } from './balancer_v2_pools_cache';
|
||||
export { CreamPoolsCache } from './cream_pools_cache';
|
||||
export { AbstractPoolsCache, PoolsCache } from './pools_cache';
|
||||
|
@@ -58,7 +58,7 @@ import {
|
||||
} from './constants';
|
||||
import { getGeistInfoForPair } from './geist_utils';
|
||||
import { getLiquidityProvidersForPair } from './liquidity_provider_utils';
|
||||
import { BalancerPoolsCache, BalancerV2PoolsCache, CreamPoolsCache, PoolsCache } from './pools_cache';
|
||||
import { BalancerPoolsCache, BalancerV2PoolsCache, PoolsCache } from './pools_cache';
|
||||
import { BalancerV2SwapInfoCache } from './pools_cache/balancer_v2_swap_info_cache';
|
||||
import { SamplerContractOperation } from './sampler_contract_operation';
|
||||
import { SamplerNoOperation } from './sampler_no_operation';
|
||||
@@ -120,7 +120,6 @@ export interface PoolsCacheMap {
|
||||
[ERC20BridgeSource.Balancer]: PoolsCache;
|
||||
[ERC20BridgeSource.BalancerV2]: BalancerV2SwapInfoCache | undefined;
|
||||
[ERC20BridgeSource.Beethovenx]: PoolsCache;
|
||||
[ERC20BridgeSource.Cream]: PoolsCache;
|
||||
}
|
||||
|
||||
// tslint:disable:no-inferred-empty-object-type no-unbound-method
|
||||
@@ -160,7 +159,6 @@ export class SamplerOperations {
|
||||
: {
|
||||
[ERC20BridgeSource.Beethovenx]: BalancerV2PoolsCache.createBeethovenXPoolCache(chainId),
|
||||
[ERC20BridgeSource.Balancer]: BalancerPoolsCache.create(chainId),
|
||||
[ERC20BridgeSource.Cream]: CreamPoolsCache.create(chainId),
|
||||
[ERC20BridgeSource.BalancerV2]:
|
||||
BALANCER_V2_VAULT_ADDRESS_BY_CHAIN[chainId] === NULL_ADDRESS
|
||||
? undefined
|
||||
@@ -1373,8 +1371,9 @@ export class SamplerOperations {
|
||||
makerToken: string,
|
||||
makerFillAmounts: BigNumber[],
|
||||
): SourceQuoteOperation<WOOFiFillData> {
|
||||
const chainId = this.chainId;
|
||||
return new SamplerContractOperation({
|
||||
fillData: { poolAddress, takerToken, makerToken },
|
||||
fillData: { poolAddress, takerToken, makerToken, chainId },
|
||||
source: ERC20BridgeSource.WOOFi,
|
||||
contract: this._samplerContract,
|
||||
function: this._samplerContract.sampleSellsFromWooPP,
|
||||
@@ -1388,8 +1387,9 @@ export class SamplerOperations {
|
||||
makerToken: string,
|
||||
makerFillAmounts: BigNumber[],
|
||||
): SourceQuoteOperation<WOOFiFillData> {
|
||||
const chainId = this.chainId;
|
||||
return new SamplerContractOperation({
|
||||
fillData: { poolAddress, takerToken, makerToken },
|
||||
fillData: { poolAddress, takerToken, makerToken, chainId },
|
||||
source: ERC20BridgeSource.WOOFi,
|
||||
contract: this._samplerContract,
|
||||
function: this._samplerContract.sampleBuysFromWooPP,
|
||||
@@ -1668,18 +1668,6 @@ export class SamplerOperations {
|
||||
),
|
||||
);
|
||||
}
|
||||
case ERC20BridgeSource.Cream:
|
||||
return this.poolsCaches[ERC20BridgeSource.Cream]
|
||||
.getPoolAddressesForPair(takerToken, makerToken)
|
||||
.map(creamPool =>
|
||||
this.getBalancerSellQuotes(
|
||||
creamPool,
|
||||
makerToken,
|
||||
takerToken,
|
||||
takerFillAmounts,
|
||||
ERC20BridgeSource.Cream,
|
||||
),
|
||||
);
|
||||
case ERC20BridgeSource.Dodo:
|
||||
if (!isValidAddress(DODOV1_CONFIG_BY_CHAIN_ID[this.chainId].registry)) {
|
||||
return [];
|
||||
@@ -2031,18 +2019,6 @@ export class SamplerOperations {
|
||||
),
|
||||
);
|
||||
}
|
||||
case ERC20BridgeSource.Cream:
|
||||
return this.poolsCaches[ERC20BridgeSource.Cream]
|
||||
.getPoolAddressesForPair(takerToken, makerToken)
|
||||
.map(poolAddress =>
|
||||
this.getBalancerBuyQuotes(
|
||||
poolAddress,
|
||||
makerToken,
|
||||
takerToken,
|
||||
makerFillAmounts,
|
||||
ERC20BridgeSource.Cream,
|
||||
),
|
||||
);
|
||||
case ERC20BridgeSource.Dodo:
|
||||
if (!isValidAddress(DODOV1_CONFIG_BY_CHAIN_ID[this.chainId].registry)) {
|
||||
return [];
|
||||
|
@@ -45,7 +45,6 @@ export enum ERC20BridgeSource {
|
||||
MultiBridge = 'MultiBridge',
|
||||
Balancer = 'Balancer',
|
||||
BalancerV2 = 'Balancer_V2',
|
||||
Cream = 'CREAM',
|
||||
Bancor = 'Bancor',
|
||||
MakerPsm = 'MakerPsm',
|
||||
MStable = 'mStable',
|
||||
@@ -378,6 +377,8 @@ export interface WOOFiFillData extends FillData {
|
||||
poolAddress: string;
|
||||
takerToken: string;
|
||||
makerToken: string;
|
||||
// Only needed for gas estimation
|
||||
chainId: ChainId;
|
||||
}
|
||||
|
||||
export interface VelodromeFillData extends FillData {
|
||||
|
@@ -43,7 +43,7 @@ blockchainTests.resets('BalanceChecker contract', env => {
|
||||
|
||||
const testResults = await contract.balances([owner, owner2], [makerToken.address, ETH_ADDRESS]).callAsync();
|
||||
|
||||
expect(testResults).to.eql([new BigNumber(100), new BigNumber(100000000000000000000)]);
|
||||
expect(testResults).to.eql([new BigNumber(100), new BigNumber(1000000000000000000000)]);
|
||||
});
|
||||
it('it throws an error if the input arrays of different lengths', async () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
|
@@ -107,7 +107,7 @@ class MockPoolsCache extends AbstractPoolsCache {
|
||||
}
|
||||
}
|
||||
|
||||
// Return some pool so that sampling functions are called for Balancer, BalancerV2, and Cream
|
||||
// Return some pool so that sampling functions are called for Balancer and BalancerV2
|
||||
// tslint:disable:custom-no-magic-numbers
|
||||
const mockPoolsCache = new MockPoolsCache((_takerToken: string, _makerToken: string) => {
|
||||
return [
|
||||
@@ -362,7 +362,6 @@ describe('MarketOperationUtils tests', () => {
|
||||
[ERC20BridgeSource.MultiHop]: {},
|
||||
[ERC20BridgeSource.Shell]: { poolAddress: randomAddress() },
|
||||
[ERC20BridgeSource.Component]: { poolAddress: randomAddress() },
|
||||
[ERC20BridgeSource.Cream]: { poolAddress: randomAddress() },
|
||||
[ERC20BridgeSource.Dodo]: {},
|
||||
[ERC20BridgeSource.DodoV2]: {},
|
||||
[ERC20BridgeSource.CryptoCom]: { tokenAddressPath: [] },
|
||||
@@ -402,7 +401,6 @@ describe('MarketOperationUtils tests', () => {
|
||||
poolsCaches: {
|
||||
[ERC20BridgeSource.BalancerV2]: mockPoolsCache,
|
||||
[ERC20BridgeSource.Balancer]: mockPoolsCache,
|
||||
[ERC20BridgeSource.Cream]: mockPoolsCache,
|
||||
},
|
||||
liquidityProviderRegistry: {},
|
||||
chainId: CHAIN_ID,
|
||||
|
@@ -2,12 +2,7 @@ import { ChainId } from '@0x/contract-addresses';
|
||||
import * as chai from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
import {
|
||||
BalancerPoolsCache,
|
||||
BalancerV2PoolsCache,
|
||||
CreamPoolsCache,
|
||||
PoolsCache,
|
||||
} from '../src/utils/market_operation_utils/pools_cache';
|
||||
import { BalancerPoolsCache, BalancerV2PoolsCache, PoolsCache } from '../src/utils/market_operation_utils/pools_cache';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
@@ -17,7 +12,6 @@ const expect = chai.expect;
|
||||
const usdcAddress = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
|
||||
const daiAddress = '0x6b175474e89094c44da98b954eedeac495271d0f';
|
||||
const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
|
||||
const creamAddress = '0x2ba592f78db6436527729929aaf6c908497cb200';
|
||||
|
||||
const timeoutMs = 5000;
|
||||
const poolKeys: string[] = ['id', 'balanceIn', 'balanceOut', 'weightIn', 'weightOut', 'swapFee'];
|
||||
@@ -63,17 +57,4 @@ describe('Pools Caches for Balancer-based sampling', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('CreamPoolsCache', () => {
|
||||
const cache = CreamPoolsCache.create(ChainId.Mainnet);
|
||||
it('fetches pools', async () => {
|
||||
const pairs = [
|
||||
[usdcAddress, creamAddress],
|
||||
[creamAddress, wethAddress],
|
||||
];
|
||||
await Promise.all(
|
||||
pairs.map(async ([takerToken, makerToken]) => fetchAndAssertPoolsAsync(cache, takerToken, makerToken)),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -68,7 +68,7 @@ export const testHelpers = {
|
||||
const { endpoint, mmApiKey, requestData, responseData, responseCode } = mockedResponse;
|
||||
const requestHeaders = {
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${mmApiKey}`,
|
||||
};
|
||||
mockedAxios
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"version": "6.20.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Revert: Remove contract addresses that are no longer needed"
|
||||
}
|
||||
],
|
||||
"timestamp": 1661145612
|
||||
},
|
||||
{
|
||||
"version": "6.20.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Remove contract addresses that are no longer needed",
|
||||
"pr": 548
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "6.19.2",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.20.1 - _August 22, 2022_
|
||||
|
||||
* Revert: Remove contract addresses that are no longer needed
|
||||
|
||||
## v6.20.0 - _Invalid date_
|
||||
|
||||
* Remove contract addresses that are no longer needed (#548)
|
||||
|
||||
## v6.19.2 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "6.19.2",
|
||||
"version": "6.20.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -12,6 +12,8 @@
|
||||
"scripts": {
|
||||
"build": "yarn tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"test": "mocha --require source-map-support/register 'lib/test/**/*_test.js' --timeout 10000 --bail --exit",
|
||||
"test:circleci": "yarn test",
|
||||
"clean": "shx rm -rf lib",
|
||||
"publish:private": "yarn build && gitpkg publish"
|
||||
},
|
||||
@@ -28,7 +30,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-addresses",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^5.2.7",
|
||||
"chai": "^4.0.1",
|
||||
"ethereumjs-util": "^7.1.5",
|
||||
"gitpkg": "https://github.com/0xProject/gitpkg.git",
|
||||
"mocha": "^6.2.0",
|
||||
"shx": "^0.2.2",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
|
70
packages/contract-addresses/test/addresses_test.ts
Normal file
70
packages/contract-addresses/test/addresses_test.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import * as chai from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
import { ChainId, getContractAddressesForChainOrThrow } from '../src';
|
||||
import { bufferToHex, rlphash } from 'ethereumjs-util';
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
function toDeployedAddress(deployerAddress: string, nonce: number): string {
|
||||
return bufferToHex(rlphash([deployerAddress, nonce]).slice(12));
|
||||
}
|
||||
|
||||
function isValidDeployedAddress(deployerAddress: string, deployedAddress: string): boolean {
|
||||
for (let i = 0; i < 256; i++) {
|
||||
const address = toDeployedAddress(deployerAddress, i);
|
||||
if (address.toLowerCase() === deployedAddress.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
describe('addresses.json sanity test', () => {
|
||||
const allChainIds = Object.values(ChainId).filter(chainId => !isNaN(Number(chainId))) as ChainId[];
|
||||
allChainIds.forEach(chainId => {
|
||||
describe(`addresses of chain id ${chainId}`, () => {
|
||||
const contractAddresses = getContractAddressesForChainOrThrow(chainId);
|
||||
it('all addresses are lowercased', async () => {
|
||||
const addresses = [
|
||||
contractAddresses.zrxToken,
|
||||
contractAddresses.etherToken,
|
||||
contractAddresses.zeroExGovernor,
|
||||
contractAddresses.zrxVault,
|
||||
contractAddresses.staking,
|
||||
contractAddresses.erc20BridgeProxy,
|
||||
contractAddresses.erc20BridgeSampler,
|
||||
contractAddresses.exchangeProxyGovernor,
|
||||
contractAddresses.exchangeProxy,
|
||||
contractAddresses.exchangeProxyTransformerDeployer,
|
||||
contractAddresses.exchangeProxyFlashWallet,
|
||||
contractAddresses.exchangeProxyLiquidityProviderSandbox,
|
||||
contractAddresses.zrxTreasury,
|
||||
contractAddresses.transformers.wethTransformer,
|
||||
contractAddresses.transformers.payTakerTransformer,
|
||||
contractAddresses.transformers.fillQuoteTransformer,
|
||||
contractAddresses.transformers.affiliateFeeTransformer,
|
||||
contractAddresses.transformers.positiveSlippageFeeTransformer,
|
||||
];
|
||||
addresses.forEach(address => {
|
||||
expect(address).to.eq(address.toLowerCase());
|
||||
});
|
||||
});
|
||||
|
||||
it('all transformer addresses are valid', async () => {
|
||||
const transformerAddresses = [
|
||||
contractAddresses.transformers.wethTransformer,
|
||||
contractAddresses.transformers.payTakerTransformer,
|
||||
contractAddresses.transformers.fillQuoteTransformer,
|
||||
contractAddresses.transformers.affiliateFeeTransformer,
|
||||
contractAddresses.transformers.positiveSlippageFeeTransformer,
|
||||
].filter(address => address !== '0x0000000000000000000000000000000000000000');
|
||||
transformerAddresses.forEach(transformerAddress => {
|
||||
expect(
|
||||
isValidDeployedAddress(contractAddresses.exchangeProxyTransformerDeployer, transformerAddress),
|
||||
).to.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -6,6 +6,6 @@
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"include": ["./src/**/*", "./test/**/*"],
|
||||
"files": ["./addresses.json"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "3.18.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "3.18.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.18.1 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.18.0 - _March 31, 2022_
|
||||
|
||||
* Regenerate all artifacts (#449)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-artifacts",
|
||||
"version": "3.18.0",
|
||||
"version": "3.18.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-artifacts",
|
||||
"devDependencies": {
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"chai": "^4.0.1",
|
||||
"lodash": "^4.17.11",
|
||||
|
@@ -1,4 +1,21 @@
|
||||
[
|
||||
{
|
||||
"version": "13.21.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Revert: Remove deprecated contracts"
|
||||
}
|
||||
],
|
||||
"timestamp": 1661145612
|
||||
},
|
||||
{
|
||||
"version": "13.21.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Remove deprecated contracts"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "13.20.8",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v13.21.1 - _August 22, 2022_
|
||||
|
||||
* Revert: Remove deprecated contracts
|
||||
|
||||
## v13.21.0 - _Invalid date_
|
||||
|
||||
* Remove deprecated contracts
|
||||
|
||||
## v13.20.8 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers",
|
||||
"version": "13.20.8",
|
||||
"version": "13.21.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -55,14 +55,14 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.20.1",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethers": "~4.0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "11.16.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "11.16.3",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v11.16.4 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v11.16.3 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/protocol-utils",
|
||||
"version": "11.16.3",
|
||||
"version": "11.16.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -41,7 +41,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/protocol-utils",
|
||||
"devDependencies": {
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
@@ -51,7 +51,7 @@
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
@@ -62,13 +62,13 @@
|
||||
"web3-provider-engine": "14.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contract-wrappers": "^13.20.8",
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/contract-addresses": "^6.20.1",
|
||||
"@0x/contract-wrappers": "^13.21.1",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"chai": "^4.0.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4",
|
||||
|
Reference in New Issue
Block a user