Compare commits
115 Commits
@0x/dev-ut
...
@0x/react-
Author | SHA1 | Date | |
---|---|---|---|
|
c78a602990 | ||
|
0acec57ba9 | ||
|
7423028fea | ||
|
49d951b7be | ||
|
a554c9518d | ||
|
f3c7ba445e | ||
|
3abff41385 | ||
|
6c36832f0e | ||
|
2ff5c39712 | ||
|
ded849fd6d | ||
|
02f7064953 | ||
|
1ddadfce1e | ||
|
7720e5007c | ||
|
ccfd021796 | ||
|
fdcad84cee | ||
|
ad3e3b8421 | ||
|
f67b4f8902 | ||
|
3c0d7319ba | ||
|
7f0aab6ec6 | ||
|
669578a926 | ||
|
fa1db64a8e | ||
|
7cf60fa927 | ||
|
75a0d3e494 | ||
|
a98218ae22 | ||
|
10952e9dc4 | ||
|
b36e23471b | ||
|
f45bf1c95b | ||
|
d4db2587aa | ||
|
62e6336a7d | ||
|
2d8acd4711 | ||
|
d7d95be042 | ||
|
e3c97f0681 | ||
|
1a4fa015b9 | ||
|
63dacfaac5 | ||
|
f7263ac2c6 | ||
|
c7d7e1f0e3 | ||
|
9c54b615f5 | ||
|
69fe1aa981 | ||
|
bfb3d19e3b | ||
|
0b4e62a63e | ||
|
5cdbc03e71 | ||
|
16cd6dd25d | ||
|
fc71e7f99f | ||
|
e740380731 | ||
|
f9921d2c91 | ||
|
d8bfc92cc5 | ||
|
1f2214f891 | ||
|
50835e317f | ||
|
6c8d4dcc1e | ||
|
85a7efbd61 | ||
|
6b5ef10467 | ||
|
0bf46bfcb5 | ||
|
8b8dc7ac78 | ||
|
a017122c44 | ||
|
86a9a892d2 | ||
|
f31a141d78 | ||
|
fa67997424 | ||
|
a5f06c577d | ||
|
e575672877 | ||
|
a34d5b29e8 | ||
|
91ec65da1b | ||
|
ee8d40a66e | ||
|
38ac2e80ed | ||
|
8b70762e34 | ||
|
18c613a611 | ||
|
957f8c56a1 | ||
|
b16446877e | ||
|
9164d58dc7 | ||
|
0beb2f9d3c | ||
|
ccdd66052a | ||
|
518fd814b6 | ||
|
f49bb78dba | ||
|
a54aa77d28 | ||
|
f85e443c9c | ||
|
399e004e7f | ||
|
3099ba71eb | ||
|
951fcf384c | ||
|
c750368a3e | ||
|
3149d86855 | ||
|
3aaf21e34e | ||
|
519c375a42 | ||
|
3ed2c732bd | ||
|
0aa5550d0f | ||
|
1bc8dd83d3 | ||
|
c642cd6fed | ||
|
f72918362d | ||
|
28c4ca73ab | ||
|
a256494ec8 | ||
|
e043735362 | ||
|
7010b1adb9 | ||
|
17ff262729 | ||
|
1c18838cd8 | ||
|
55b87ae78d | ||
|
e446e902f3 | ||
|
095b52e0b2 | ||
|
4f25ff6a50 | ||
|
6242e0aeec | ||
|
fde9fc9dd4 | ||
|
c481e42673 | ||
|
5e228d7232 | ||
|
6b8e40fdc9 | ||
|
bca44bf9e3 | ||
|
08e49dcf2e | ||
|
50f5002b71 | ||
|
346c6fc590 | ||
|
3bdc1802cb | ||
|
095882d016 | ||
|
1693506f80 | ||
|
b88e42a52d | ||
|
8d1b27d130 | ||
|
1148d37102 | ||
|
88704ce417 | ||
|
9f69d2cb76 | ||
|
55fd71c5e1 | ||
|
1991bd437f |
@@ -11,9 +11,14 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- run:
|
||||
# HACK(albrow): Without this, yarn commands will sometimes
|
||||
# fail with a "permission denied" error.
|
||||
name: Set npm path
|
||||
command: npm set prefix=/home/circleci/npm && echo 'export PATH=$HOME/circleci/npm/bin:$PATH' >> /home/circleci/.bashrc
|
||||
- run:
|
||||
name: install-yarn
|
||||
command: sudo npm install --global yarn@1.9.4
|
||||
command: npm install --global yarn@1.9.4
|
||||
- run:
|
||||
name: yarn
|
||||
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
|
||||
@@ -119,6 +124,7 @@ jobs:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-test-utils
|
||||
- run: yarn wsrun test:circleci @0x/abi-gen
|
||||
- run: yarn wsrun test:circleci @0x/contract-artifacts
|
||||
- run: yarn wsrun test:circleci @0x/assert
|
||||
- run: yarn wsrun test:circleci @0x/base-contract
|
||||
- run: yarn wsrun test:circleci @0x/connect
|
||||
@@ -201,8 +207,11 @@ jobs:
|
||||
- image: circleci/python
|
||||
- image: 0xorg/ganache-cli:2.2.2
|
||||
- image: 0xorg/launch-kit-ci
|
||||
command: |
|
||||
yarn start:ts -p 3000:3000
|
||||
environment:
|
||||
RPC_URL: http://localhost:8545
|
||||
NETWORK_ID: 50
|
||||
WHITELIST_ALL_TOKENS: True
|
||||
command: bash -c "until curl -sfd'{\"method\":\"net_listening\"}' http://localhost:8545 | grep true; do continue; done; forever ts/lib/index.js"
|
||||
steps:
|
||||
- checkout
|
||||
- run: sudo chown -R circleci:circleci /usr/local/bin
|
||||
@@ -390,9 +399,11 @@ workflows:
|
||||
- test-contracts-ganache:
|
||||
requires:
|
||||
- build
|
||||
- test-contracts-geth:
|
||||
requires:
|
||||
- build
|
||||
# TODO(albrow): Tests always fail on Geth right now because our fork
|
||||
# is outdated. Uncomment once we have updated our Geth fork.
|
||||
# - test-contracts-geth:
|
||||
# requires:
|
||||
# - build
|
||||
- test-pipeline:
|
||||
requires:
|
||||
- build
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "2.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-asset-proxy",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,17 +68,17 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-erc1155": "^1.1.0",
|
||||
"@0x/contracts-erc20": "^2.1.0",
|
||||
"@0x/contracts-erc721": "^2.1.0",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-erc1155": "^1.1.1",
|
||||
"@0x/contracts-erc20": "^2.2.0",
|
||||
"@0x/contracts-erc721": "^2.1.1",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -115,7 +115,7 @@ export class ERC1155ProxyWrapper {
|
||||
valuesToTransfer,
|
||||
receiverCallbackData,
|
||||
);
|
||||
if (!_.isUndefined(extraData)) {
|
||||
if (extraData !== undefined) {
|
||||
encodedAssetData = `${encodedAssetData}${extraData}`;
|
||||
}
|
||||
const data = this._assetProxyInterface.transferFrom.getABIEncodedTransactionData(
|
||||
@@ -199,10 +199,10 @@ export class ERC1155ProxyWrapper {
|
||||
// Mint tokens for each owner for this token
|
||||
for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
if (_.isUndefined(fungibleHoldingsByOwner[tokenOwnerAddress])) {
|
||||
if (fungibleHoldingsByOwner[tokenOwnerAddress] === undefined) {
|
||||
fungibleHoldingsByOwner[tokenOwnerAddress] = {};
|
||||
}
|
||||
if (_.isUndefined(fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress])) {
|
||||
if (fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] === undefined) {
|
||||
fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] = {};
|
||||
}
|
||||
fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString] =
|
||||
@@ -221,13 +221,13 @@ export class ERC1155ProxyWrapper {
|
||||
const tokenIdAsString = tokenId.toString();
|
||||
this._nonFungibleTokenIds.push(tokenIdAsString);
|
||||
_.each(this._tokenOwnerAddresses, async (tokenOwnerAddress: string, i: number) => {
|
||||
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress])) {
|
||||
if (nonFungibleHoldingsByOwner[tokenOwnerAddress] === undefined) {
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress] = {};
|
||||
}
|
||||
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress])) {
|
||||
if (nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] === undefined) {
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] = {};
|
||||
}
|
||||
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString])) {
|
||||
if (nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString] === undefined) {
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString] = [];
|
||||
}
|
||||
this._nfts.push({ id: nftIds[i], tokenId });
|
||||
@@ -278,26 +278,25 @@ export class ERC1155ProxyWrapper {
|
||||
for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
|
||||
// Fungible tokens
|
||||
for (const tokenId of this._fungibleTokenIds) {
|
||||
if (_.isUndefined(tokenHoldingsByOwner[tokenOwnerAddress])) {
|
||||
if (tokenHoldingsByOwner[tokenOwnerAddress] === undefined) {
|
||||
tokenHoldingsByOwner[tokenOwnerAddress] = {};
|
||||
}
|
||||
if (_.isUndefined(tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress])) {
|
||||
if (tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress] === undefined) {
|
||||
tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress] = {};
|
||||
}
|
||||
tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress][tokenId] = balances[i++];
|
||||
}
|
||||
// Non-fungible tokens
|
||||
for (const nft of this._nfts) {
|
||||
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress])) {
|
||||
if (nonFungibleHoldingsByOwner[tokenOwnerAddress] === undefined) {
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress] = {};
|
||||
}
|
||||
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress])) {
|
||||
if (nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress] === undefined) {
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress] = {};
|
||||
}
|
||||
if (
|
||||
_.isUndefined(
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress][nft.tokenId.toString()],
|
||||
)
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress][nft.tokenId.toString()] ===
|
||||
undefined
|
||||
) {
|
||||
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress][nft.tokenId.toString()] = [];
|
||||
}
|
||||
@@ -348,25 +347,25 @@ export class ERC1155ProxyWrapper {
|
||||
const tokenWrapper = _.find(this._dummyTokenWrappers, (wrapper: Erc1155Wrapper) => {
|
||||
return wrapper.getContract().address === contractAddress;
|
||||
});
|
||||
if (_.isUndefined(tokenWrapper)) {
|
||||
if (tokenWrapper === undefined) {
|
||||
throw new Error(`Contract: ${contractAddress} was not deployed through ERC1155ProxyWrapper`);
|
||||
}
|
||||
return tokenWrapper;
|
||||
}
|
||||
private _getContractFromAddress(tokenAddress: string): ERC1155MintableContract {
|
||||
const tokenContractIfExists = _.find(this._dummyTokenWrappers, c => c.getContract().address === tokenAddress);
|
||||
if (_.isUndefined(tokenContractIfExists)) {
|
||||
if (tokenContractIfExists === undefined) {
|
||||
throw new Error(`Token: ${tokenAddress} was not deployed through ERC1155ProxyWrapper`);
|
||||
}
|
||||
return tokenContractIfExists.getContract();
|
||||
}
|
||||
private _validateDummyTokenContractsExistOrThrow(): void {
|
||||
if (_.isUndefined(this._dummyTokenWrappers)) {
|
||||
if (this._dummyTokenWrappers === undefined) {
|
||||
throw new Error('Dummy ERC1155 tokens not yet deployed, please call "deployDummyTokensAsync"');
|
||||
}
|
||||
}
|
||||
private _validateProxyContractExistsOrThrow(): void {
|
||||
if (_.isUndefined(this._proxyContract)) {
|
||||
if (this._proxyContract === undefined) {
|
||||
throw new Error('ERC1155 proxy contract not yet deployed, please call "deployProxyAsync"');
|
||||
}
|
||||
}
|
||||
|
@@ -133,7 +133,7 @@ export class ERC20Wrapper {
|
||||
_.forEach(balances, (balance, balanceIndex) => {
|
||||
const tokenAddress = balanceInfo[balanceIndex].tokenAddress;
|
||||
const tokenOwnerAddress = balanceInfo[balanceIndex].tokenOwnerAddress;
|
||||
if (_.isUndefined(balancesByOwner[tokenOwnerAddress])) {
|
||||
if (balancesByOwner[tokenOwnerAddress] === undefined) {
|
||||
balancesByOwner[tokenOwnerAddress] = {};
|
||||
}
|
||||
const wrappedBalance = new BigNumber(balance);
|
||||
@@ -142,7 +142,7 @@ export class ERC20Wrapper {
|
||||
return balancesByOwner;
|
||||
}
|
||||
public addDummyTokenContract(dummy: DummyERC20TokenContract): void {
|
||||
if (!_.isUndefined(this._dummyTokenContracts)) {
|
||||
if (this._dummyTokenContracts !== undefined) {
|
||||
this._dummyTokenContracts.push(dummy);
|
||||
}
|
||||
}
|
||||
@@ -160,18 +160,18 @@ export class ERC20Wrapper {
|
||||
const erc20ProxyData = assetDataUtils.decodeERC20AssetData(assetData);
|
||||
const tokenAddress = erc20ProxyData.tokenAddress;
|
||||
const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
|
||||
if (_.isUndefined(tokenContractIfExists)) {
|
||||
if (tokenContractIfExists === undefined) {
|
||||
throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
|
||||
}
|
||||
return tokenContractIfExists;
|
||||
}
|
||||
private _validateDummyTokenContractsExistOrThrow(): void {
|
||||
if (_.isUndefined(this._dummyTokenContracts)) {
|
||||
if (this._dummyTokenContracts === undefined) {
|
||||
throw new Error('Dummy ERC20 tokens not yet deployed, please call "deployDummyTokensAsync"');
|
||||
}
|
||||
}
|
||||
private _validateProxyContractExistsOrThrow(): void {
|
||||
if (_.isUndefined(this._proxyContract)) {
|
||||
if (this._proxyContract === undefined) {
|
||||
throw new Error('ERC20 proxy contract not yet deployed, please call "deployProxyAsync"');
|
||||
}
|
||||
}
|
||||
|
@@ -62,12 +62,12 @@ export class ERC721Wrapper {
|
||||
for (const i of _.times(constants.NUM_ERC721_TOKENS_TO_MINT)) {
|
||||
const tokenId = generatePseudoRandomSalt();
|
||||
await this.mintAsync(dummyTokenContract.address, tokenId, tokenOwnerAddress);
|
||||
if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress])) {
|
||||
if (this._initialTokenIdsByOwner[tokenOwnerAddress] === undefined) {
|
||||
this._initialTokenIdsByOwner[tokenOwnerAddress] = {
|
||||
[dummyTokenContract.address]: [],
|
||||
};
|
||||
}
|
||||
if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address])) {
|
||||
if (this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] === undefined) {
|
||||
this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] = [];
|
||||
}
|
||||
this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address].push(tokenId);
|
||||
@@ -189,12 +189,12 @@ export class ERC721Wrapper {
|
||||
_.forEach(tokenOwnerAddresses, (tokenOwnerAddress, ownerIndex) => {
|
||||
const tokenAddress = tokenInfo[ownerIndex].tokenAddress;
|
||||
const tokenId = tokenInfo[ownerIndex].tokenId;
|
||||
if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress])) {
|
||||
if (tokenIdsByOwner[tokenOwnerAddress] === undefined) {
|
||||
tokenIdsByOwner[tokenOwnerAddress] = {
|
||||
[tokenAddress]: [],
|
||||
};
|
||||
}
|
||||
if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress][tokenAddress])) {
|
||||
if (tokenIdsByOwner[tokenOwnerAddress][tokenAddress] === undefined) {
|
||||
tokenIdsByOwner[tokenOwnerAddress][tokenAddress] = [];
|
||||
}
|
||||
tokenIdsByOwner[tokenOwnerAddress][tokenAddress].push(tokenId);
|
||||
@@ -210,18 +210,18 @@ export class ERC721Wrapper {
|
||||
}
|
||||
private _getTokenContractFromAssetData(tokenAddress: string): DummyERC721TokenContract {
|
||||
const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
|
||||
if (_.isUndefined(tokenContractIfExists)) {
|
||||
if (tokenContractIfExists === undefined) {
|
||||
throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
|
||||
}
|
||||
return tokenContractIfExists;
|
||||
}
|
||||
private _validateDummyTokenContractsExistOrThrow(): void {
|
||||
if (_.isUndefined(this._dummyTokenContracts)) {
|
||||
if (this._dummyTokenContracts === undefined) {
|
||||
throw new Error('Dummy ERC721 tokens not yet deployed, please call "deployDummyTokensAsync"');
|
||||
}
|
||||
}
|
||||
private _validateProxyContractExistsOrThrow(): void {
|
||||
if (_.isUndefined(this._proxyContract)) {
|
||||
if (this._proxyContract === undefined) {
|
||||
throw new Error('ERC721 proxy contract not yet deployed, please call "deployProxyAsync"');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,18 @@
|
||||
[
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Make `decodeOrdersFromFillData`, `getCoordinatorApprovalHash`, and `getTransactionHash` public",
|
||||
"pr": 1729
|
||||
},
|
||||
{
|
||||
"note": "Make `assertValidTransactionOrdersApproval` internal",
|
||||
"pr": 1729
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "1.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.0.0 - _April 11, 2019_
|
||||
|
||||
* Make `decodeOrdersFromFillData`, `getCoordinatorApprovalHash`, and `getTransactionHash` public (#1729)
|
||||
* Make `assertValidTransactionOrdersApproval` internal (#1729)
|
||||
|
||||
## v1.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -21,10 +21,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": [
|
||||
"src/Coordinator.sol",
|
||||
"src/registry/CoordinatorRegistry.sol",
|
||||
"test/TestLibs.sol",
|
||||
"test/TestMixins.sol"
|
||||
]
|
||||
"contracts": ["src/Coordinator.sol", "src/registry/CoordinatorRegistry.sol"]
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ contract MixinCoordinatorApprovalVerifier is
|
||||
view
|
||||
{
|
||||
// Get the orders from the the Exchange calldata in the 0x transaction
|
||||
LibOrder.Order[] memory orders = decodeFillDataOrders(transaction.data);
|
||||
LibOrder.Order[] memory orders = decodeOrdersFromFillData(transaction.data);
|
||||
|
||||
// No approval is required for non-fill methods
|
||||
if (orders.length > 0) {
|
||||
@@ -74,6 +74,57 @@ contract MixinCoordinatorApprovalVerifier is
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Decodes the orders from Exchange calldata representing any fill method.
|
||||
/// @param data Exchange calldata representing a fill method.
|
||||
/// @return The orders from the Exchange calldata.
|
||||
function decodeOrdersFromFillData(bytes memory data)
|
||||
public
|
||||
pure
|
||||
returns (LibOrder.Order[] memory orders)
|
||||
{
|
||||
bytes4 selector = data.readBytes4(0);
|
||||
if (
|
||||
selector == FILL_ORDER_SELECTOR ||
|
||||
selector == FILL_ORDER_NO_THROW_SELECTOR ||
|
||||
selector == FILL_OR_KILL_ORDER_SELECTOR
|
||||
) {
|
||||
// Decode single order
|
||||
(LibOrder.Order memory order) = abi.decode(
|
||||
data.slice(4, data.length),
|
||||
(LibOrder.Order)
|
||||
);
|
||||
orders = new LibOrder.Order[](1);
|
||||
orders[0] = order;
|
||||
} else if (
|
||||
selector == BATCH_FILL_ORDERS_SELECTOR ||
|
||||
selector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
|
||||
selector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
|
||||
selector == MARKET_BUY_ORDERS_SELECTOR ||
|
||||
selector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
|
||||
selector == MARKET_SELL_ORDERS_SELECTOR ||
|
||||
selector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
|
||||
) {
|
||||
// Decode all orders
|
||||
// solhint-disable indent
|
||||
(orders) = abi.decode(
|
||||
data.slice(4, data.length),
|
||||
(LibOrder.Order[])
|
||||
);
|
||||
} else if (selector == MATCH_ORDERS_SELECTOR) {
|
||||
// Decode left and right orders
|
||||
(LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder) = abi.decode(
|
||||
data.slice(4, data.length),
|
||||
(LibOrder.Order, LibOrder.Order)
|
||||
);
|
||||
|
||||
// Create array of orders
|
||||
orders = new LibOrder.Order[](2);
|
||||
orders[0] = leftOrder;
|
||||
orders[1] = rightOrder;
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
|
||||
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param orders Array of order structs containing order specifications.
|
||||
@@ -89,7 +140,7 @@ contract MixinCoordinatorApprovalVerifier is
|
||||
uint256[] memory approvalExpirationTimeSeconds,
|
||||
bytes[] memory approvalSignatures
|
||||
)
|
||||
public
|
||||
internal
|
||||
view
|
||||
{
|
||||
// Verify that Ethereum tx signer is the same as the approved txOrigin
|
||||
@@ -149,55 +200,4 @@ contract MixinCoordinatorApprovalVerifier is
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Decodes the orders from Exchange calldata representing any fill method.
|
||||
/// @param data Exchange calldata representing a fill method.
|
||||
/// @return The orders from the Exchange calldata.
|
||||
function decodeFillDataOrders(bytes memory data)
|
||||
internal
|
||||
pure
|
||||
returns (LibOrder.Order[] memory orders)
|
||||
{
|
||||
bytes4 selector = data.readBytes4(0);
|
||||
if (
|
||||
selector == FILL_ORDER_SELECTOR ||
|
||||
selector == FILL_ORDER_NO_THROW_SELECTOR ||
|
||||
selector == FILL_OR_KILL_ORDER_SELECTOR
|
||||
) {
|
||||
// Decode single order
|
||||
(LibOrder.Order memory order) = abi.decode(
|
||||
data.slice(4, data.length),
|
||||
(LibOrder.Order)
|
||||
);
|
||||
orders = new LibOrder.Order[](1);
|
||||
orders[0] = order;
|
||||
} else if (
|
||||
selector == BATCH_FILL_ORDERS_SELECTOR ||
|
||||
selector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
|
||||
selector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
|
||||
selector == MARKET_BUY_ORDERS_SELECTOR ||
|
||||
selector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
|
||||
selector == MARKET_SELL_ORDERS_SELECTOR ||
|
||||
selector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
|
||||
) {
|
||||
// Decode all orders
|
||||
// solhint-disable indent
|
||||
(orders) = abi.decode(
|
||||
data.slice(4, data.length),
|
||||
(LibOrder.Order[])
|
||||
);
|
||||
} else if (selector == MATCH_ORDERS_SELECTOR) {
|
||||
// Decode left and right orders
|
||||
(LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder) = abi.decode(
|
||||
data.slice(4, data.length),
|
||||
(LibOrder.Order, LibOrder.Order)
|
||||
);
|
||||
|
||||
// Create array of orders
|
||||
orders = new LibOrder.Order[](2);
|
||||
orders[0] = leftOrder;
|
||||
orders[1] = rightOrder;
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
}
|
||||
|
@@ -42,21 +42,11 @@ contract ICoordinatorApprovalVerifier {
|
||||
public
|
||||
view;
|
||||
|
||||
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param orders Array of order structs containing order specifications.
|
||||
/// @param txOrigin Required signer of Ethereum transaction calling this function.
|
||||
/// @param transactionSignature Proof that the transaction has been signed by the signer.
|
||||
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
|
||||
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order.
|
||||
function assertValidTransactionOrdersApproval(
|
||||
LibZeroExTransaction.ZeroExTransaction memory transaction,
|
||||
LibOrder.Order[] memory orders,
|
||||
address txOrigin,
|
||||
bytes memory transactionSignature,
|
||||
uint256[] memory approvalExpirationTimeSeconds,
|
||||
bytes[] memory approvalSignatures
|
||||
)
|
||||
/// @dev Decodes the orders from Exchange calldata representing any fill method.
|
||||
/// @param data Exchange calldata representing a fill method.
|
||||
/// @return The orders from the Exchange calldata.
|
||||
function decodeOrdersFromFillData(bytes memory data)
|
||||
public
|
||||
view;
|
||||
pure
|
||||
returns (LibOrder.Order[] memory orders);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.5;
|
||||
pragma experimental "ABIEncoderV2";
|
||||
|
||||
import "./LibEIP712Domain.sol";
|
||||
|
||||
@@ -37,16 +38,16 @@ contract LibCoordinatorApproval is
|
||||
|
||||
struct CoordinatorApproval {
|
||||
address txOrigin; // Required signer of Ethereum transaction that is submitting approval.
|
||||
bytes32 transactionHash; // EIP712 hash of the transaction, using the domain separator of this contract.
|
||||
bytes32 transactionHash; // EIP712 hash of the transaction.
|
||||
bytes transactionSignature; // Signature of the 0x transaction.
|
||||
uint256 approvalExpirationTimeSeconds; // Timestamp in seconds for which the signature expires.
|
||||
uint256 approvalExpirationTimeSeconds; // Timestamp in seconds for which the approval expires.
|
||||
}
|
||||
|
||||
/// @dev Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.
|
||||
/// @param approval Coordinator approval message containing the transaction hash, transaction signature, and expiration of the approval.
|
||||
/// @return EIP712 hash of the Coordinator approval message with the domain separator of this contract.
|
||||
function getCoordinatorApprovalHash(CoordinatorApproval memory approval)
|
||||
internal
|
||||
public
|
||||
view
|
||||
returns (bytes32 approvalHash)
|
||||
{
|
||||
@@ -71,9 +72,10 @@ contract LibCoordinatorApproval is
|
||||
// Assembly for more efficiently computing:
|
||||
// keccak256(abi.encodePacked(
|
||||
// EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH,
|
||||
// approval.txOrigin,
|
||||
// approval.transactionHash,
|
||||
// keccak256(approval.transactionSignature)
|
||||
// approval.expiration,
|
||||
// approval.approvalExpirationTimeSeconds,
|
||||
// ));
|
||||
|
||||
assembly {
|
||||
|
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.5;
|
||||
pragma experimental "ABIEncoderV2";
|
||||
|
||||
import "./LibEIP712Domain.sol";
|
||||
|
||||
@@ -40,11 +41,11 @@ contract LibZeroExTransaction is
|
||||
bytes data; // AbiV2 encoded calldata.
|
||||
}
|
||||
|
||||
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of this contract.
|
||||
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @return EIP712 hash of the transaction with the domain separator of this contract.
|
||||
function getTransactionHash(ZeroExTransaction memory transaction)
|
||||
internal
|
||||
public
|
||||
view
|
||||
returns (bytes32 transactionHash)
|
||||
{
|
||||
|
@@ -26,11 +26,21 @@ import "../interfaces/ICoordinatorApprovalVerifier.sol";
|
||||
contract MCoordinatorApprovalVerifier is
|
||||
ICoordinatorApprovalVerifier
|
||||
{
|
||||
/// @dev Decodes the orders from Exchange calldata representing any fill method.
|
||||
/// @param data Exchange calldata representing a fill method.
|
||||
/// @return The orders from the Exchange calldata.
|
||||
function decodeFillDataOrders(bytes memory data)
|
||||
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param orders Array of order structs containing order specifications.
|
||||
/// @param txOrigin Required signer of Ethereum transaction calling this function.
|
||||
/// @param transactionSignature Proof that the transaction has been signed by the signer.
|
||||
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
|
||||
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order.
|
||||
function assertValidTransactionOrdersApproval(
|
||||
LibZeroExTransaction.ZeroExTransaction memory transaction,
|
||||
LibOrder.Order[] memory orders,
|
||||
address txOrigin,
|
||||
bytes memory transactionSignature,
|
||||
uint256[] memory approvalExpirationTimeSeconds,
|
||||
bytes[] memory approvalSignatures
|
||||
)
|
||||
internal
|
||||
pure
|
||||
returns (LibOrder.Order[] memory orders);
|
||||
view;
|
||||
}
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.5;
|
||||
pragma experimental "ABIEncoderV2";
|
||||
|
||||
import "../src/libs/LibConstants.sol";
|
||||
import "../src/libs/LibCoordinatorApproval.sol";
|
||||
import "../src/libs/LibZeroExTransaction.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract TestLibs is
|
||||
LibConstants,
|
||||
LibCoordinatorApproval,
|
||||
LibZeroExTransaction
|
||||
{
|
||||
constructor (address _exchange)
|
||||
public
|
||||
LibConstants(_exchange)
|
||||
{}
|
||||
|
||||
/// @dev Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.
|
||||
/// @param approval Coordinator approval message containing the transaction hash, transaction signature, and expiration of the approval.
|
||||
/// @return EIP712 hash of the Coordinator approval message with the domain separator of this contract.
|
||||
function publicGetCoordinatorApprovalHash(CoordinatorApproval memory approval)
|
||||
public
|
||||
view
|
||||
returns (bytes32 approvalHash)
|
||||
{
|
||||
approvalHash = getCoordinatorApprovalHash(approval);
|
||||
return approvalHash;
|
||||
}
|
||||
|
||||
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @return EIP712 hash of the transaction with the domain separator of the Exchange contract.
|
||||
function publicGetTransactionHash(ZeroExTransaction memory transaction)
|
||||
public
|
||||
view
|
||||
returns (bytes32 transactionHash)
|
||||
{
|
||||
transactionHash = getTransactionHash(transaction);
|
||||
return transactionHash;
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.5;
|
||||
pragma experimental "ABIEncoderV2";
|
||||
|
||||
import "../src/libs/LibConstants.sol";
|
||||
import "../src/MixinSignatureValidator.sol";
|
||||
import "../src/MixinCoordinatorApprovalVerifier.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract TestMixins is
|
||||
LibConstants,
|
||||
MixinSignatureValidator,
|
||||
MixinCoordinatorApprovalVerifier
|
||||
{
|
||||
constructor (address _exchange)
|
||||
public
|
||||
LibConstants(_exchange)
|
||||
{}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-coordinator",
|
||||
"version": "1.1.0",
|
||||
"version": "2.0.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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 +34,7 @@
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "./generated-artifacts/@(Coordinator|CoordinatorRegistry|TestLibs|TestMixins).json",
|
||||
"abis": "./generated-artifacts/@(Coordinator|CoordinatorRegistry).json",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||
},
|
||||
"repository": {
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,18 +68,18 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-asset-proxy": "^2.1.0",
|
||||
"@0x/contracts-erc20": "^2.1.0",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-asset-proxy": "^2.1.1",
|
||||
"@0x/contracts-erc20": "^2.2.0",
|
||||
"@0x/contracts-exchange": "1.0.2",
|
||||
"@0x/contracts-exchange-libs": "^2.1.0",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/contracts-exchange-libs": "^2.1.1",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
|
@@ -7,11 +7,7 @@ import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as Coordinator from '../generated-artifacts/Coordinator.json';
|
||||
import * as CoordinatorRegistry from '../generated-artifacts/CoordinatorRegistry.json';
|
||||
import * as TestLibs from '../generated-artifacts/TestLibs.json';
|
||||
import * as TestMixins from '../generated-artifacts/TestMixins.json';
|
||||
export const artifacts = {
|
||||
Coordinator: Coordinator as ContractArtifact,
|
||||
CoordinatorRegistry: CoordinatorRegistry as ContractArtifact,
|
||||
TestLibs: TestLibs as ContractArtifact,
|
||||
TestMixins: TestMixins as ContractArtifact,
|
||||
};
|
||||
|
@@ -5,5 +5,3 @@
|
||||
*/
|
||||
export * from '../generated-wrappers/coordinator';
|
||||
export * from '../generated-wrappers/coordinator_registry';
|
||||
export * from '../generated-wrappers/test_libs';
|
||||
export * from '../generated-wrappers/test_mixins';
|
||||
|
@@ -435,7 +435,7 @@ describe('Coordinator tests', () => {
|
||||
describe('cancels', () => {
|
||||
it('cancelOrder call should be successful without an approval', async () => {
|
||||
const orders = [await orderFactory.newSignedOrderAsync()];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS, orders);
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDER, orders);
|
||||
const transaction = makerTransactionFactory.newSignedTransaction(data);
|
||||
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await coordinatorContract.executeTransaction.sendTransactionAsync(
|
||||
|
@@ -4,14 +4,14 @@ import { transactionHashUtils } from '@0x/order-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
|
||||
import { artifacts, hashUtils, TestLibsContract } from '../src';
|
||||
import { artifacts, CoordinatorContract, hashUtils } from '../src';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
|
||||
describe('Libs tests', () => {
|
||||
let testLibs: TestLibsContract;
|
||||
let coordinatorContract: CoordinatorContract;
|
||||
const exchangeAddress = addressUtils.generatePseudoRandomAddress();
|
||||
|
||||
before(async () => {
|
||||
@@ -21,8 +21,8 @@ describe('Libs tests', () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
before(async () => {
|
||||
testLibs = await TestLibsContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestLibs,
|
||||
coordinatorContract = await CoordinatorContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Coordinator,
|
||||
provider,
|
||||
txDefaults,
|
||||
exchangeAddress,
|
||||
@@ -44,7 +44,7 @@ describe('Libs tests', () => {
|
||||
data: '0x1234',
|
||||
};
|
||||
const expectedTxHash = transactionHashUtils.getTransactionHashHex(tx);
|
||||
const txHash = await testLibs.publicGetTransactionHash.callAsync(tx);
|
||||
const txHash = await coordinatorContract.getTransactionHash.callAsync(tx);
|
||||
expect(expectedTxHash).to.eq(txHash);
|
||||
});
|
||||
});
|
||||
@@ -68,11 +68,11 @@ describe('Libs tests', () => {
|
||||
};
|
||||
const expectedApprovalHash = hashUtils.getApprovalHashHex(
|
||||
signedTx,
|
||||
testLibs.address,
|
||||
coordinatorContract.address,
|
||||
txOrigin,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
const approvalHash = await testLibs.publicGetCoordinatorApprovalHash.callAsync(approval);
|
||||
const approvalHash = await coordinatorContract.getCoordinatorApprovalHash.callAsync(approval);
|
||||
expect(expectedApprovalHash).to.eq(approvalHash);
|
||||
});
|
||||
});
|
||||
|
@@ -16,7 +16,7 @@ import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
|
||||
import { ApprovalFactory, artifacts, constants, exchangeDataEncoder, TestMixinsContract } from '../src';
|
||||
import { ApprovalFactory, artifacts, constants, CoordinatorContract, exchangeDataEncoder } from '../src';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -26,7 +26,7 @@ describe('Mixins tests', () => {
|
||||
let transactionSignerAddress: string;
|
||||
let approvalSignerAddress1: string;
|
||||
let approvalSignerAddress2: string;
|
||||
let mixins: TestMixinsContract;
|
||||
let mixins: CoordinatorContract;
|
||||
let transactionFactory: TransactionFactory;
|
||||
let approvalFactory1: ApprovalFactory;
|
||||
let approvalFactory2: ApprovalFactory;
|
||||
@@ -40,8 +40,8 @@ describe('Mixins tests', () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
before(async () => {
|
||||
mixins = await TestMixinsContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestMixins,
|
||||
mixins = await CoordinatorContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Coordinator,
|
||||
provider,
|
||||
txDefaults,
|
||||
exchangeAddress,
|
||||
@@ -135,6 +135,70 @@ describe('Mixins tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('decodeOrdersFromFillData', () => {
|
||||
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
|
||||
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||
const orders = [defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const decodedSignedOrders = decodedOrders.map(order => ({
|
||||
...order,
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
}));
|
||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
||||
});
|
||||
}
|
||||
for (const fnName of constants.BATCH_FILL_FN_NAMES) {
|
||||
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||
const orders = [defaultOrder, defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const decodedSignedOrders = decodedOrders.map(order => ({
|
||||
...order,
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
}));
|
||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
||||
});
|
||||
}
|
||||
for (const fnName of constants.MARKET_FILL_FN_NAMES) {
|
||||
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||
const orders = [defaultOrder, defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const decodedSignedOrders = decodedOrders.map(order => ({
|
||||
...order,
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
}));
|
||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
||||
});
|
||||
}
|
||||
for (const fnName of [constants.CANCEL_ORDER, constants.BATCH_CANCEL_ORDERS, constants.CANCEL_ORDERS_UP_TO]) {
|
||||
it(`should correctly decode the orders for ${fnName} data`, async () => {
|
||||
const orders = [defaultOrder, defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const emptyArray: any[] = [];
|
||||
expect(emptyArray).to.deep.eq(decodedOrders);
|
||||
});
|
||||
}
|
||||
it('should decode an empty array for invalid data', async () => {
|
||||
const data = '0x0123456789';
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const emptyArray: any[] = [];
|
||||
expect(emptyArray).to.deep.eq(decodedOrders);
|
||||
});
|
||||
it('should revert if data is less than 4 bytes long', async () => {
|
||||
const data = '0x010203';
|
||||
await expectContractCallFailedAsync(
|
||||
mixins.decodeOrdersFromFillData.callAsync(data),
|
||||
RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Single order approvals', () => {
|
||||
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
|
||||
it(`Should be successful: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[approver1], expiration=[valid]`, async () => {
|
||||
@@ -148,15 +212,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -181,15 +236,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -203,15 +249,6 @@ describe('Mixins tests', () => {
|
||||
const orders = [defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const transaction = transactionFactory.newSignedTransaction(data);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
approvalSignerAddress1,
|
||||
transaction.signature,
|
||||
[],
|
||||
[],
|
||||
{ from: approvalSignerAddress1 },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
approvalSignerAddress1,
|
||||
@@ -234,15 +271,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
approvalSignerAddress1,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: approvalSignerAddress1 },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
approvalSignerAddress1,
|
||||
@@ -256,15 +284,6 @@ describe('Mixins tests', () => {
|
||||
const orders = [defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const transaction = transactionFactory.newSignedTransaction(data);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
approvalSignerAddress1,
|
||||
transaction.signature,
|
||||
[],
|
||||
[],
|
||||
{ from: approvalSignerAddress1 },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
approvalSignerAddress1,
|
||||
@@ -288,18 +307,6 @@ describe('Mixins tests', () => {
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[signature],
|
||||
{ from: transactionSignerAddress },
|
||||
),
|
||||
RevertReason.InvalidApprovalSignature,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -323,18 +330,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
),
|
||||
RevertReason.ApprovalExpired,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -358,18 +353,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: approvalSignerAddress2 },
|
||||
),
|
||||
RevertReason.InvalidOrigin,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -401,15 +384,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -433,15 +407,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -458,15 +423,6 @@ describe('Mixins tests', () => {
|
||||
}));
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const transaction = transactionFactory.newSignedTransaction(data);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[],
|
||||
[],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -487,15 +443,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -521,15 +468,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
|
||||
[approval1.signature, approval2.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
transactionSignerAddress,
|
||||
@@ -543,15 +481,6 @@ describe('Mixins tests', () => {
|
||||
const orders = [defaultOrder, defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const transaction = transactionFactory.newSignedTransaction(data);
|
||||
await mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
approvalSignerAddress1,
|
||||
transaction.signature,
|
||||
[],
|
||||
[],
|
||||
{ from: approvalSignerAddress1 },
|
||||
);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
approvalSignerAddress1,
|
||||
@@ -572,18 +501,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval2.signature],
|
||||
{ from: approvalSignerAddress1 },
|
||||
),
|
||||
RevertReason.InvalidOrigin,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -600,18 +517,6 @@ describe('Mixins tests', () => {
|
||||
const orders = [defaultOrder, defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
|
||||
const transaction = transactionFactory.newSignedTransaction(data);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[],
|
||||
[],
|
||||
{ from: transactionSignerAddress },
|
||||
),
|
||||
RevertReason.InvalidApprovalSignature,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -636,18 +541,6 @@ describe('Mixins tests', () => {
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[signature],
|
||||
{ from: transactionSignerAddress },
|
||||
),
|
||||
RevertReason.InvalidApprovalSignature,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -677,18 +570,6 @@ describe('Mixins tests', () => {
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
const approvalSignature2 = `${approval2.signature.slice(0, 4)}FFFFFFFF${approval2.signature.slice(12)}`;
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
|
||||
[approval1.signature, approvalSignature2],
|
||||
{ from: transactionSignerAddress },
|
||||
),
|
||||
RevertReason.InvalidApprovalSignature,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -713,18 +594,6 @@ describe('Mixins tests', () => {
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
const approvalSignature2 = `${approval2.signature.slice(0, 4)}FFFFFFFF${approval2.signature.slice(12)}`;
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
approvalSignerAddress1,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approvalSignature2],
|
||||
{ from: approvalSignerAddress1 },
|
||||
),
|
||||
RevertReason.InvalidApprovalSignature,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -754,18 +623,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds2,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds1, approvalExpirationTimeSeconds2],
|
||||
[approval1.signature, approval2.signature],
|
||||
{ from: transactionSignerAddress },
|
||||
),
|
||||
RevertReason.ApprovalExpired,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -789,18 +646,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
approvalSignerAddress1,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval2.signature],
|
||||
{ from: approvalSignerAddress1 },
|
||||
),
|
||||
RevertReason.ApprovalExpired,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -824,18 +669,6 @@ describe('Mixins tests', () => {
|
||||
transactionSignerAddress,
|
||||
approvalExpirationTimeSeconds,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidTransactionOrdersApproval.callAsync(
|
||||
transaction,
|
||||
orders,
|
||||
transactionSignerAddress,
|
||||
transaction.signature,
|
||||
[approvalExpirationTimeSeconds],
|
||||
[approval1.signature],
|
||||
{ from: approvalSignerAddress2 },
|
||||
),
|
||||
RevertReason.InvalidOrigin,
|
||||
);
|
||||
expectContractCallFailedAsync(
|
||||
mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
@@ -851,9 +684,9 @@ describe('Mixins tests', () => {
|
||||
}
|
||||
});
|
||||
describe('cancels', () => {
|
||||
it('should allow the tx signer to call `cancelOrders` without approval', async () => {
|
||||
it('should allow the tx signer to call `cancelOrder` without approval', async () => {
|
||||
const orders = [defaultOrder];
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS, orders);
|
||||
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDER, orders);
|
||||
const transaction = transactionFactory.newSignedTransaction(data);
|
||||
await mixins.assertValidCoordinatorApprovals.callAsync(
|
||||
transaction,
|
||||
|
@@ -5,7 +5,7 @@ export const constants = {
|
||||
BATCH_FILL_FN_NAMES: ['batchFillOrders', 'batchFillOrKillOrders', 'batchFillOrdersNoThrow'],
|
||||
MARKET_FILL_FN_NAMES: ['marketBuyOrders', 'marketBuyOrdersNoThrow', 'marketSellOrders', 'marketSellOrdersNoThrow'],
|
||||
MATCH_ORDERS: 'matchOrders',
|
||||
CANCEL_ORDERS: 'cancelOrders',
|
||||
CANCEL_ORDER: 'cancelOrder',
|
||||
BATCH_CANCEL_ORDERS: 'batchCancelOrders',
|
||||
CANCEL_ORDERS_UP_TO: 'cancelOrdersUpTo',
|
||||
TIME_BUFFER: new BigNumber(1000),
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { LogDecoder, txDefaults } from '@0x/contracts-test-utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { TransactionReceiptWithDecodedLogs, ZeroExProvider } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts, CoordinatorRegistryContract } from '../../src';
|
||||
|
||||
@@ -26,7 +25,7 @@ export class CoordinatorRegistryWrapper {
|
||||
this._provider,
|
||||
txDefaults,
|
||||
);
|
||||
if (_.isUndefined(this._coordinatorRegistryContract)) {
|
||||
if (this._coordinatorRegistryContract === undefined) {
|
||||
throw new Error(`Failed to deploy Coordinator Registry contract.`);
|
||||
}
|
||||
return this._coordinatorRegistryContract;
|
||||
@@ -56,7 +55,7 @@ export class CoordinatorRegistryWrapper {
|
||||
return coordinatorEndpoint;
|
||||
}
|
||||
private _assertCoordinatorRegistryDeployed(): void {
|
||||
if (_.isUndefined(this._coordinatorRegistryContract)) {
|
||||
if (this._coordinatorRegistryContract === undefined) {
|
||||
throw new Error(
|
||||
'The Coordinator Registry contract was not deployed through the CoordinatorRegistryWrapper. Call `deployCoordinatorRegistryAsync` to deploy.',
|
||||
);
|
||||
|
@@ -37,7 +37,7 @@ export const exchangeDataEncoder = {
|
||||
orders[0].signature,
|
||||
orders[1].signature,
|
||||
);
|
||||
} else if (fnName === constants.CANCEL_ORDERS) {
|
||||
} else if (fnName === constants.CANCEL_ORDER) {
|
||||
data = exchangeInstance.cancelOrder.getABIEncodedTransactionData(orders[0]);
|
||||
} else if (fnName === constants.BATCH_CANCEL_ORDERS) {
|
||||
data = exchangeInstance.batchCancelOrders.getABIEncodedTransactionData(orders);
|
||||
|
@@ -2,11 +2,6 @@
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": [
|
||||
"generated-artifacts/Coordinator.json",
|
||||
"generated-artifacts/CoordinatorRegistry.json",
|
||||
"generated-artifacts/TestLibs.json",
|
||||
"generated-artifacts/TestMixins.json"
|
||||
],
|
||||
"files": ["generated-artifacts/Coordinator.json", "generated-artifacts/CoordinatorRegistry.json"],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "1.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "1.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc1155",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,11 +47,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -66,14 +67,14 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -36,8 +36,8 @@ export class Erc1155Wrapper {
|
||||
callbackData?: string,
|
||||
delegatedSpender?: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const spender = _.isUndefined(delegatedSpender) ? from : delegatedSpender;
|
||||
const callbackDataHex = _.isUndefined(callbackData) ? '0x' : callbackData;
|
||||
const spender = delegatedSpender === undefined ? from : delegatedSpender;
|
||||
const callbackDataHex = callbackData === undefined ? '0x' : callbackData;
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(
|
||||
await this._erc1155Contract.safeTransferFrom.sendTransactionAsync(from, to, token, value, callbackDataHex, {
|
||||
from: spender,
|
||||
@@ -53,8 +53,8 @@ export class Erc1155Wrapper {
|
||||
callbackData?: string,
|
||||
delegatedSpender?: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const spender = _.isUndefined(delegatedSpender) ? from : delegatedSpender;
|
||||
const callbackDataHex = _.isUndefined(callbackData) ? '0x' : callbackData;
|
||||
const spender = delegatedSpender === undefined ? from : delegatedSpender;
|
||||
const callbackDataHex = callbackData === undefined ? '0x' : callbackData;
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(
|
||||
await this._erc1155Contract.safeBatchTransferFrom.sendTransactionAsync(
|
||||
from,
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "2.2.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added UntransferrableDummyERC20Token",
|
||||
"pr": 1714
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.2.0 - _April 11, 2019_
|
||||
|
||||
* Added UntransferrableDummyERC20Token (#1714)
|
||||
|
||||
## v2.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -32,6 +32,7 @@
|
||||
"src/interfaces/IEtherToken.sol",
|
||||
"test/DummyERC20Token.sol",
|
||||
"test/DummyMultipleReturnERC20Token.sol",
|
||||
"test/DummyNoReturnERC20Token.sol"
|
||||
"test/DummyNoReturnERC20Token.sol",
|
||||
"test/UntransferrableDummyERC20Token.sol"
|
||||
]
|
||||
}
|
||||
|
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.5;
|
||||
|
||||
import "./DummyERC20Token.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract UntransferrableDummyERC20Token is
|
||||
DummyERC20Token
|
||||
{
|
||||
constructor (
|
||||
string memory _name,
|
||||
string memory _symbol,
|
||||
uint256 _decimals,
|
||||
uint256 _totalSupply
|
||||
)
|
||||
public
|
||||
DummyERC20Token(
|
||||
_name,
|
||||
_symbol,
|
||||
_decimals,
|
||||
_totalSupply
|
||||
)
|
||||
{}
|
||||
|
||||
/// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
|
||||
/// @param _from The address of the sender
|
||||
/// @param _to The address of the recipient
|
||||
/// @param _value The amount of token to be transferred
|
||||
function transferFrom(
|
||||
address _from,
|
||||
address _to,
|
||||
uint256 _value
|
||||
)
|
||||
external
|
||||
returns (bool)
|
||||
{
|
||||
require(
|
||||
false,
|
||||
"TRANSFER_DISABLED"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,14 +68,14 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-exchange-libs": "^2.1.0",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-exchange-libs": "^2.1.1",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "2.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc721",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,13 +68,13 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "2.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange-forwarder",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,13 +47,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contract-wrappers": "^8.0.5",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contract-wrappers": "^9.0.0",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -68,19 +69,19 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-asset-proxy": "^2.1.0",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-asset-proxy": "^2.1.1",
|
||||
"@0x/contracts-erc20": "1.0.8",
|
||||
"@0x/contracts-erc721": "1.0.8",
|
||||
"@0x/contracts-exchange": "1.0.2",
|
||||
"@0x/contracts-exchange-libs": "1.0.2",
|
||||
"@0x/contracts-utils": "2.0.1",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -76,8 +76,8 @@ export class ForwarderWrapper {
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = ForwarderWrapper._createOptimizedOrders(orders);
|
||||
const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
|
||||
const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
|
||||
const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
|
||||
const feePercentage = opts.feePercentage === undefined ? constants.ZERO_AMOUNT : opts.feePercentage;
|
||||
const feeRecipient = opts.feeRecipient === undefined ? constants.NULL_ADDRESS : opts.feeRecipient;
|
||||
const txHash = await this._forwarderContract.marketSellOrdersWithEth.sendTransactionAsync(
|
||||
params.orders,
|
||||
params.signatures,
|
||||
@@ -99,8 +99,8 @@ export class ForwarderWrapper {
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = ForwarderWrapper._createOptimizedOrders(orders);
|
||||
const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
|
||||
const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
|
||||
const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
|
||||
const feePercentage = opts.feePercentage === undefined ? constants.ZERO_AMOUNT : opts.feePercentage;
|
||||
const feeRecipient = opts.feeRecipient === undefined ? constants.NULL_ADDRESS : opts.feeRecipient;
|
||||
const txHash = await this._forwarderContract.marketBuyOrdersWithEth.sendTransactionAsync(
|
||||
params.orders,
|
||||
makerAssetFillAmount,
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "2.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange-libs",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,14 +68,14 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "2.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,19 +68,19 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-asset-proxy": "^2.1.0",
|
||||
"@0x/contracts-erc1155": "^1.1.0",
|
||||
"@0x/contracts-erc20": "^2.1.0",
|
||||
"@0x/contracts-erc721": "^2.1.0",
|
||||
"@0x/contracts-exchange-libs": "^2.1.0",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-asset-proxy": "^2.1.1",
|
||||
"@0x/contracts-erc1155": "^1.1.1",
|
||||
"@0x/contracts-erc20": "^2.2.0",
|
||||
"@0x/contracts-erc721": "^2.1.1",
|
||||
"@0x/contracts-exchange-libs": "^2.1.1",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
|
@@ -437,7 +437,7 @@ export class FillOrderCombinatorialUtils {
|
||||
lazyStore: BalanceAndProxyAllowanceLazyStore,
|
||||
fillRevertReasonIfExists: RevertReason | undefined,
|
||||
): Promise<void> {
|
||||
if (!_.isUndefined(fillRevertReasonIfExists)) {
|
||||
if (fillRevertReasonIfExists !== undefined) {
|
||||
return expectTransactionFailedAsync(
|
||||
this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }),
|
||||
fillRevertReasonIfExists,
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "3.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "3.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-extensions",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,13 +47,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contract-wrappers": "^8.0.5",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contract-wrappers": "^9.0.0",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -68,19 +69,19 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-asset-proxy": "^2.1.0",
|
||||
"@0x/contracts-erc20": "^2.1.0",
|
||||
"@0x/contracts-erc721": "^2.1.0",
|
||||
"@0x/contracts-exchange": "^2.1.0",
|
||||
"@0x/contracts-exchange-libs": "^2.1.0",
|
||||
"@0x/contracts-utils": "^3.1.0",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-asset-proxy": "^2.1.1",
|
||||
"@0x/contracts-erc20": "^2.2.0",
|
||||
"@0x/contracts-erc721": "^2.1.1",
|
||||
"@0x/contracts-exchange": "^2.1.1",
|
||||
"@0x/contracts-exchange-libs": "^2.1.1",
|
||||
"@0x/contracts-utils": "^3.1.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -12,7 +12,6 @@ import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts, BalanceThresholdFilterContract } from '../../src';
|
||||
|
||||
@@ -264,7 +263,7 @@ export class BalanceThresholdWrapper {
|
||||
gas?: number,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const signedExchangeTx = this._signerTransactionFactory.newSignedTransaction(abiEncodedExchangeTxData);
|
||||
const txOpts = _.isUndefined(gas) ? { from } : { from, gas };
|
||||
const txOpts = gas === undefined ? { from } : { from, gas };
|
||||
const txHash = await this._balanceThresholdFilter.executeTransaction.sendTransactionAsync(
|
||||
signedExchangeTx.salt,
|
||||
signedExchangeTx.signerAddress,
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "3.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "3.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.0 - _March 21, 2019_
|
||||
|
||||
* Run Web3ProviderEngine without excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-multisig",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../packages/abi-gen-templates/contract.handlebars --partials '../../packages/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
@@ -67,15 +68,15 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contracts-asset-proxy": "^2.1.0",
|
||||
"@0x/contracts-erc20": "^2.1.0",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contracts-asset-proxy": "^2.1.1",
|
||||
"@0x/contracts-erc20": "^2.2.0",
|
||||
"@0x/contracts-utils": "2.0.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -70,7 +70,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
REQUIRED_APPROVALS,
|
||||
secondsTimeLocked,
|
||||
);
|
||||
expect(_.isUndefined((multiSig as any).external_call)).to.be.equal(true);
|
||||
expect((multiSig as any).external_call === undefined).to.be.equal(true);
|
||||
});
|
||||
});
|
||||
describe('confirmTransaction', () => {
|
||||
@@ -271,7 +271,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
|
||||
const blockNum = await web3Wrapper.getBlockNumberAsync();
|
||||
const blockInfo = await web3Wrapper.getBlockIfExistsAsync(blockNum);
|
||||
if (_.isUndefined(blockInfo)) {
|
||||
if (blockInfo === undefined) {
|
||||
throw new Error(`Unexpectedly failed to fetch block at #${blockNum}`);
|
||||
}
|
||||
const timestamp = new BigNumber(blockInfo.timestamp);
|
||||
|
@@ -3,7 +3,6 @@ import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
@@ -23,7 +22,7 @@ export class AssetProxyOwnerWrapper {
|
||||
from: string,
|
||||
opts: { value?: BigNumber } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
|
||||
const value = opts.value === undefined ? new BigNumber(0) : opts.value;
|
||||
const txHash = await this._assetProxyOwner.submitTransaction.sendTransactionAsync(destination, value, data, {
|
||||
from,
|
||||
});
|
||||
|
@@ -2,7 +2,6 @@ import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
@@ -22,7 +21,7 @@ export class MultiSigWrapper {
|
||||
from: string,
|
||||
opts: { value?: BigNumber } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
|
||||
const value = opts.value === undefined ? new BigNumber(0) : opts.value;
|
||||
const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, {
|
||||
from,
|
||||
});
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "3.1.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"timestamp": 1553183790,
|
||||
"version": "3.1.1",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.2 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.1 - _March 21, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "3.1.1",
|
||||
"version": "3.1.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -17,6 +17,7 @@
|
||||
"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",
|
||||
"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",
|
||||
@@ -40,19 +41,19 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/sol-coverage": "^3.0.2",
|
||||
"@0x/sol-profiler": "^3.1.4",
|
||||
"@0x/sol-trace": "^2.0.10",
|
||||
"@0x/subproviders": "^4.0.4",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/sol-coverage": "^3.0.3",
|
||||
"@0x/sol-profiler": "^3.1.5",
|
||||
"@0x/sol-trace": "^2.0.11",
|
||||
"@0x/subproviders": "^4.0.5",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"@types/lodash": "4.14.104",
|
||||
@@ -62,7 +63,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethers": "~4.0.4",
|
||||
"js-combinatorics": "^0.5.3",
|
||||
|
@@ -24,7 +24,7 @@ export type sendTransactionResult = Promise<TransactionReceipt | TransactionRece
|
||||
* node.
|
||||
*/
|
||||
async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: string): Promise<string> {
|
||||
if (_.isUndefined(nodeType)) {
|
||||
if (nodeType === undefined) {
|
||||
nodeType = await web3Wrapper.getNodeTypeAsync();
|
||||
}
|
||||
switch (nodeType) {
|
||||
@@ -99,7 +99,7 @@ export async function expectTransactionFailedAsync(p: sendTransactionResult, rea
|
||||
_.noop(e);
|
||||
});
|
||||
|
||||
if (_.isUndefined(nodeType)) {
|
||||
if (nodeType === undefined) {
|
||||
nodeType = await web3Wrapper.getNodeTypeAsync();
|
||||
}
|
||||
switch (nodeType) {
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from './constants';
|
||||
import { web3Wrapper } from './web3_wrapper';
|
||||
|
||||
@@ -13,7 +11,7 @@ let firstAccount: string | undefined;
|
||||
* reject if the time could not be increased.
|
||||
*/
|
||||
export async function increaseTimeAndMineBlockAsync(seconds: number): Promise<number> {
|
||||
if (_.isUndefined(firstAccount)) {
|
||||
if (firstAccount === undefined) {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
firstAccount = accounts[0];
|
||||
}
|
||||
@@ -36,7 +34,7 @@ export async function increaseTimeAndMineBlockAsync(seconds: number): Promise<nu
|
||||
*/
|
||||
export async function getLatestBlockTimestampAsync(): Promise<number> {
|
||||
const currentBlockIfExists = await web3Wrapper.getBlockIfExistsAsync('latest');
|
||||
if (_.isUndefined(currentBlockIfExists)) {
|
||||
if (currentBlockIfExists === undefined) {
|
||||
throw new Error(`Unable to fetch latest block.`);
|
||||
}
|
||||
return currentBlockIfExists.timestamp;
|
||||
|
@@ -1,12 +1,10 @@
|
||||
import { devConstants } from '@0x/dev-utils';
|
||||
import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-coverage';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
let coverageSubprovider: CoverageSubprovider;
|
||||
|
||||
export const coverage = {
|
||||
getCoverageSubproviderSingleton(): CoverageSubprovider {
|
||||
if (_.isUndefined(coverageSubprovider)) {
|
||||
if (coverageSubprovider === undefined) {
|
||||
coverageSubprovider = coverage._getCoverageSubprovider();
|
||||
}
|
||||
return coverageSubprovider;
|
||||
|
@@ -37,7 +37,7 @@ export class LogDecoder {
|
||||
public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
|
||||
const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
|
||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||
if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) {
|
||||
if ((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args === undefined) {
|
||||
throw new Error(`Unable to decode log: ${JSON.stringify(log)}`);
|
||||
}
|
||||
LogDecoder.wrapLogBigNumbers(logWithDecodedArgsOrLog);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { devConstants } from '@0x/dev-utils';
|
||||
import { ProfilerSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-profiler';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
let profilerSubprovider: ProfilerSubprovider;
|
||||
|
||||
@@ -12,7 +11,7 @@ export const profiler = {
|
||||
profiler.getProfilerSubproviderSingleton().stop();
|
||||
},
|
||||
getProfilerSubproviderSingleton(): ProfilerSubprovider {
|
||||
if (_.isUndefined(profilerSubprovider)) {
|
||||
if (profilerSubprovider === undefined) {
|
||||
profilerSubprovider = profiler._getProfilerSubprovider();
|
||||
}
|
||||
return profilerSubprovider;
|
||||
|
@@ -1,12 +1,11 @@
|
||||
import { devConstants } from '@0x/dev-utils';
|
||||
import { RevertTraceSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-trace';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
let revertTraceSubprovider: RevertTraceSubprovider;
|
||||
|
||||
export const revertTrace = {
|
||||
getRevertTraceSubproviderSingleton(): RevertTraceSubprovider {
|
||||
if (_.isUndefined(revertTraceSubprovider)) {
|
||||
if (revertTraceSubprovider === undefined) {
|
||||
revertTraceSubprovider = revertTrace._getRevertTraceSubprovider();
|
||||
}
|
||||
return revertTraceSubprovider;
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "3.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "3.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.0 - _March 21, 2019_
|
||||
|
||||
* Added `startProviderEngine` to `providerUtils`. Preventing excess block polling (#1695)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"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",
|
||||
@@ -46,12 +47,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/contracts-gen": "^1.0.7",
|
||||
"@0x/contracts-test-utils": "^3.1.1",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/sol-compiler": "^3.1.5",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/contracts-gen": "^1.0.8",
|
||||
"@0x/contracts-test-utils": "^3.1.2",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/sol-compiler": "^3.1.6",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
@@ -68,14 +69,14 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
|
@@ -10,6 +10,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"deps_versions:ci": "node ./packages/monorepo-scripts/lib/deps_versions.js",
|
||||
"fix": "wsrun fix $PKG --fast-exit --parallel --exclude-missing",
|
||||
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
|
||||
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
||||
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
||||
|
@@ -1,10 +1,10 @@
|
||||
# Blacklist all files
|
||||
.*
|
||||
tsconfig.json
|
||||
webpack.config.js
|
||||
yarn-error.log
|
||||
test/
|
||||
/src/
|
||||
/abi-gen-templates/
|
||||
/generated_docs/
|
||||
/scripts/
|
||||
/lib/src/monorepo_scripts/
|
||||
*
|
||||
# Whitelist lib
|
||||
!lib/**/*
|
||||
# Blacklist tests and publish scripts
|
||||
/lib/test/*
|
||||
/lib/monorepo_scripts/
|
||||
# Package specific ignore
|
||||
!_bundles/**/*
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "6.0.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"timestamp": 1553183790,
|
||||
"version": "6.0.5",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.0.6 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.0.5 - _March 21, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "0x.js",
|
||||
"version": "6.0.5",
|
||||
"version": "6.0.6",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -19,6 +19,7 @@
|
||||
"build:ci": "yarn build:commonjs",
|
||||
"build:all": "run-p build:umd:prod build:commonjs",
|
||||
"lint": "tslint --format stylish --project .",
|
||||
"fix": "tslint --fix --format stylish --project .",
|
||||
"test:circleci": "run-s test:coverage",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
@@ -42,11 +43,11 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen-wrappers": "^4.1.0",
|
||||
"@0x/contract-addresses": "^2.3.0",
|
||||
"@0x/dev-utils": "^2.2.0",
|
||||
"@0x/migrations": "^4.1.0",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/abi-gen-wrappers": "^4.2.0",
|
||||
"@0x/contract-addresses": "^2.3.1",
|
||||
"@0x/dev-utils": "^2.2.1",
|
||||
"@0x/migrations": "^4.1.1",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "*",
|
||||
@@ -72,18 +73,18 @@
|
||||
"webpack": "^4.20.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^2.0.8",
|
||||
"@0x/base-contract": "^5.0.4",
|
||||
"@0x/contract-wrappers": "^8.0.5",
|
||||
"@0x/order-utils": "^7.1.1",
|
||||
"@0x/order-watcher": "^4.0.5",
|
||||
"@0x/subproviders": "^4.0.4",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/typescript-typings": "^4.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"@0x/assert": "^2.0.9",
|
||||
"@0x/base-contract": "^5.0.5",
|
||||
"@0x/contract-wrappers": "^9.0.0",
|
||||
"@0x/order-utils": "^7.2.0",
|
||||
"@0x/order-watcher": "^4.0.6",
|
||||
"@0x/subproviders": "^4.0.5",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/typescript-typings": "^4.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"ethers": "~4.0.4",
|
||||
"lodash": "^4.17.11",
|
||||
"web3-provider-engine": "14.0.6"
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "2.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"timestamp": 1551130135,
|
||||
"version": "2.0.1",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.0.2 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.1 - _February 25, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -7,7 +7,6 @@ import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
{{#if events}}
|
||||
@@ -46,7 +45,7 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
{{> typed_params inputs=ctor.inputs}}
|
||||
): Promise<{{contractName}}Contract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/abi-gen-templates",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
9
packages/abi-gen-wrappers/.npmignore
Normal file
9
packages/abi-gen-wrappers/.npmignore
Normal file
@@ -0,0 +1,9 @@
|
||||
# Blacklist all files
|
||||
.*
|
||||
*
|
||||
# Whitelist lib
|
||||
!lib/**/*
|
||||
# Blacklist tests and publish scripts
|
||||
/lib/test/*
|
||||
/lib/monorepo_scripts/
|
||||
# Package specific ignore
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "4.2.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added IAssetProxy wrapper",
|
||||
"pr": 1714
|
||||
}
|
||||
],
|
||||
"timestamp": 1554997931
|
||||
},
|
||||
{
|
||||
"version": "4.1.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.2.0 - _April 11, 2019_
|
||||
|
||||
* Added IAssetProxy wrapper (#1714)
|
||||
|
||||
## v4.1.0 - _March 21, 2019_
|
||||
|
||||
* Add Coordinator and CoordinatorRegistry contract wrappers (#1689)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/abi-gen-wrappers",
|
||||
"version": "4.1.0",
|
||||
"version": "4.2.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -13,12 +13,13 @@
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"lint": "tslint --format stylish --project .",
|
||||
"fix": "tslint --fix --format stylish --project .",
|
||||
"pre_build": "yarn generate_contract_wrappers",
|
||||
"clean": "shx rm -rf lib wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
|
||||
},
|
||||
"config": {
|
||||
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry).json"
|
||||
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -30,19 +31,19 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.0.8",
|
||||
"@0x/abi-gen-templates": "^2.0.1",
|
||||
"@0x/tslint-config": "^3.0.0",
|
||||
"@0x/types": "^2.2.1",
|
||||
"@0x/utils": "^4.3.0",
|
||||
"@0x/web3-wrapper": "^6.0.4",
|
||||
"ethereum-types": "^2.1.1",
|
||||
"@0x/abi-gen": "^2.0.9",
|
||||
"@0x/abi-gen-templates": "^2.0.2",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@0x/types": "^2.2.2",
|
||||
"@0x/utils": "^4.3.1",
|
||||
"@0x/web3-wrapper": "^6.0.5",
|
||||
"ethereum-types": "^2.1.2",
|
||||
"ethers": "~4.0.4",
|
||||
"lodash": "^4.17.11",
|
||||
"shx": "^0.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.0.4"
|
||||
"@0x/base-contract": "^5.0.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1426,7 +1426,7 @@ export class AssetProxyOwnerContract extends BaseContract {
|
||||
_required: BigNumber,
|
||||
_secondsTimeLocked: BigNumber,
|
||||
): Promise<AssetProxyOwnerContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -263,7 +263,7 @@ export class CoordinatorContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -136,7 +136,7 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -760,7 +760,7 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_decimals: BigNumber,
|
||||
_totalSupply: BigNumber,
|
||||
): Promise<DummyERC20TokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -950,7 +950,7 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
): Promise<DummyERC721TokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -200,7 +200,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -486,7 +486,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -389,7 +389,7 @@ export class ERC20TokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20TokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -486,7 +486,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -624,7 +624,7 @@ export class ERC721TokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721TokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -2229,7 +2229,7 @@ export class ExchangeContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_zrxAssetData: string,
|
||||
): Promise<ExchangeContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -461,7 +461,7 @@ export class ForwarderContract extends BaseContract {
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -0,0 +1,534 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class IAssetProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddressAtIndex = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
index
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public transferFrom = {
|
||||
async sendTransactionAsync(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string[]
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IAssetProxyContract> {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IAssetProxyContract> {
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new IAssetProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
|
||||
super('IAssetProxy', abi, address, supportedProvider, txDefaults);
|
||||
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
@@ -52,7 +52,7 @@ export class IValidatorContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IValidatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
@@ -50,7 +50,7 @@ export class IWalletContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IWalletContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user