Compare commits

...

11 Commits

Author SHA1 Message Date
Github Actions
ba09a0b2bf Publish
- @0x/contracts-erc20@3.3.20
 - @0x/contracts-test-utils@5.4.11
 - @0x/contracts-treasury@1.4.0
 - @0x/contracts-utils@4.8.1
 - @0x/contracts-zero-ex@0.28.5
 - @0x/asset-swapper@16.27.4
 - @0x/contract-artifacts@3.15.1
 - @0x/contract-wrappers@13.17.7
 - @0x/migrations@8.1.6
 - @0x/protocol-utils@1.9.0
2021-09-15 12:58:17 +00:00
Github Actions
b2d54f0238 Updated CHANGELOGS & MD docs 2021-09-15 12:58:13 +00:00
Daniel Pyrathon
4a3096495b Mocked RFQ (#326) 2021-09-15 08:39:10 -04:00
Lawrence Forman
23f6e9e53c fix mixed @0x deps (#328)
Co-authored-by: Lawrence Forman <me@merklejerk.com>
2021-09-15 00:01:15 -04:00
Cece Z
d7dbc0576d Support cast vote by signature in ZrxTreasury (#297)
* Support cast vote by signature in ZrxTreasury

* Address comments and fix existing tests

* test that doesnt work

* test file format

* updates

* address some of the comments

* Remove unused const

* get rid of vote_factory

* unit test for castVoteBySignature p1

* unit test for castVoteBySignature p2

* Add version to domain, and one more test

* unit test for castVoteBySignature p3

* unit test for castVoteBySignature p4

* bump utils version

* remove debug code

* address some comments

* address more pr comments

* move Vote class to protocol-utils

* Address pr comments and update changelogs
2021-09-14 16:12:51 -04:00
Github Actions
15fb00e958 Publish
- @0x/asset-swapper@16.27.3
2021-09-14 19:04:09 +00:00
Github Actions
1d9295cc94 Updated CHANGELOGS & MD docs 2021-09-14 19:04:05 +00:00
Daniel Pyrathon
79f36cf6fb fix: Remove API key whitelist field (#323)
* Refactor integrator ID and add Prometheus metrics

* Update packages/asset-swapper/src/swap_quoter.ts

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>

* Update packages/asset-swapper/src/swap_quoter.ts

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>

* Update packages/asset-swapper/src/swap_quoter.ts

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>

* Added documentation and fixed some minor requests

* Added more metrics

* more docs

* lint fix

* added new Integrator ID addition

* refactor tests

* Refactor new types

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>
2021-09-14 14:43:02 -04:00
Github Actions
6ce4458a5d Publish
- @0x/asset-swapper@16.27.2
2021-09-14 17:13:46 +00:00
Github Actions
fad6e65c07 Updated CHANGELOGS & MD docs 2021-09-14 17:13:42 +00:00
Daniel Pyrathon
840c85373e fix: Refactor integrator ID and add Prometheus metrics (#322)
* Refactor integrator ID and add Prometheus metrics

* Update packages/asset-swapper/src/swap_quoter.ts

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>

* Update packages/asset-swapper/src/swap_quoter.ts

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>

* Update packages/asset-swapper/src/swap_quoter.ts

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>

* Added documentation and fixed some minor requests

* Added more metrics

* more docs

* lint fix

* added new Integrator ID addition

* refactor tests

Co-authored-by: David Walsh <5778036+rhinodavid@users.noreply.github.com>
2021-09-14 12:45:41 -04:00
47 changed files with 986 additions and 298 deletions

3
.gitignore vendored
View File

@@ -75,8 +75,9 @@ generated_docs/
TODO.md TODO.md
# VSCode file # IDE file
.vscode .vscode
.idea
# generated contract artifacts/ # generated contract artifacts/
contracts/broker/generated-artifacts/ contracts/broker/generated-artifacts/

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "3.3.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1631120757, "timestamp": 1631120757,
"version": "3.3.19", "version": "3.3.19",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v3.3.20 - _September 15, 2021_
* Dependencies updated
## v3.3.19 - _September 8, 2021_ ## v3.3.19 - _September 8, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contracts-erc20", "name": "@0x/contracts-erc20",
"version": "3.3.19", "version": "3.3.20",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -51,18 +51,18 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens", "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": { "devDependencies": {
"@0x/abi-gen": "^5.6.0", "@0x/abi-gen": "^5.6.2",
"@0x/contracts-gen": "^2.0.38", "@0x/contracts-gen": "^2.0.40",
"@0x/contracts-test-utils": "^5.4.10", "@0x/contracts-test-utils": "^5.4.11",
"@0x/contracts-utils": "^4.8.0", "@0x/contracts-utils": "^4.8.1",
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/ts-doc-gen": "^0.0.28", "@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@types/node": "12.12.54", "@types/node": "12.12.54",
@@ -70,7 +70,7 @@
"chai-as-promised": "^7.1.0", "chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0", "chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1", "dirty-chai": "^2.0.1",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"make-promises-safe": "^1.1.0", "make-promises-safe": "^1.1.0",
"mocha": "^6.2.0", "mocha": "^6.2.0",
@@ -82,7 +82,7 @@
"typescript": "4.2.2" "typescript": "4.2.2"
}, },
"dependencies": { "dependencies": {
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"ethers": "~4.0.4" "ethers": "~4.0.4"
}, },
"publishConfig": { "publishConfig": {

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "5.4.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1630459879, "timestamp": 1630459879,
"version": "5.4.10", "version": "5.4.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v5.4.11 - _September 15, 2021_
* Dependencies updated
## v5.4.10 - _September 1, 2021_ ## v5.4.10 - _September 1, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contracts-test-utils", "name": "@0x/contracts-test-utils",
"version": "5.4.10", "version": "5.4.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -34,7 +34,7 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils", "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
"devDependencies": { "devDependencies": {
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"shx": "^0.2.2", "shx": "^0.2.2",
@@ -42,20 +42,20 @@
"typescript": "4.2.2" "typescript": "4.2.2"
}, },
"dependencies": { "dependencies": {
"@0x/assert": "^3.0.27", "@0x/assert": "^3.0.29",
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/json-schemas": "^6.1.3", "@0x/json-schemas": "^6.3.0",
"@0x/order-utils": "^10.4.28", "@0x/order-utils": "^10.4.28",
"@0x/sol-coverage": "^4.0.37", "@0x/sol-coverage": "^4.0.39",
"@0x/sol-profiler": "^4.1.27", "@0x/sol-profiler": "^4.1.29",
"@0x/sol-trace": "^3.0.37", "@0x/sol-trace": "^3.0.39",
"@0x/subproviders": "^6.5.3", "@0x/subproviders": "^6.6.0",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"@types/bn.js": "^4.11.0", "@types/bn.js": "^4.11.0",
"@types/js-combinatorics": "^0.5.29", "@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
@@ -67,7 +67,7 @@
"chai-bignumber": "^3.0.0", "chai-bignumber": "^3.0.0",
"decimal.js": "^10.2.0", "decimal.js": "^10.2.0",
"dirty-chai": "^2.0.1", "dirty-chai": "^2.0.1",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"ethereumjs-util": "^7.0.10", "ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4", "ethers": "~4.0.4",
"js-combinatorics": "^0.5.3", "js-combinatorics": "^0.5.3",

View File

@@ -1,4 +1,13 @@
[ [
{
"version": "1.4.0",
"changes": [
{
"note": "Support cast vote by signature in Treasury"
}
],
"timestamp": 1631710679
},
{ {
"timestamp": 1631120757, "timestamp": 1631120757,
"version": "1.3.5", "version": "1.3.5",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.4.0 - _September 15, 2021_
* Support cast vote by signature in Treasury
## v1.3.5 - _September 8, 2021_ ## v1.3.5 - _September 8, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -136,8 +136,9 @@ interface IZrxTreasury {
returns (uint256 proposalId); returns (uint256 proposalId);
/// @dev Casts a vote for the given proposal. Only callable /// @dev Casts a vote for the given proposal. Only callable
/// during the voting period for that proposal. See /// during the voting period for that proposal.
/// `getVotingPower` for how voting power is computed. /// One address can only vote once.
/// See `getVotingPower` for how voting power is computed.
/// @param proposalId The ID of the proposal to vote on. /// @param proposalId The ID of the proposal to vote on.
/// @param support Whether to support the proposal or not. /// @param support Whether to support the proposal or not.
/// @param operatedPoolIds The pools operated by `msg.sender`. The /// @param operatedPoolIds The pools operated by `msg.sender`. The
@@ -150,6 +151,28 @@ interface IZrxTreasury {
) )
external; external;
/// @dev Casts a vote for the given proposal, by signature.
/// Only callable during the voting period for that proposal.
/// One address/voter can only vote once.
/// See `getVotingPower` for how voting power is computed.
/// @param proposalId The ID of the proposal to vote on.
/// @param support Whether to support the proposal or not.
/// @param operatedPoolIds The pools operated by the signer. The
/// ZRX currently delegated to those pools will be accounted
/// for in the voting power.
/// @param v the v field of the signature
/// @param r the r field of the signature
/// @param s the s field of the signature
function castVoteBySignature(
uint256 proposalId,
bool support,
bytes32[] memory operatedPoolIds,
uint8 v,
bytes32 r,
bytes32 s
)
external;
/// @dev Executes a proposal that has passed and is /// @dev Executes a proposal that has passed and is
/// currently executable. /// currently executable.
/// @param proposalId The ID of the proposal to execute. /// @param proposalId The ID of the proposal to execute.

View File

@@ -34,11 +34,25 @@ contract ZrxTreasury is
using LibRichErrorsV06 for bytes; using LibRichErrorsV06 for bytes;
using LibBytesV06 for bytes; using LibBytesV06 for bytes;
/// Contract name
string private constant CONTRACT_NAME = "Zrx Treasury";
/// Contract version
string private constant CONTRACT_VERSION = "1.0.0";
/// The EIP-712 typehash for the contract's domain
bytes32 private constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
/// The EIP-712 typehash for the vote struct
bytes32 private constant VOTE_TYPEHASH = keccak256("TreasuryVote(uint256 proposalId,bool support,bytes32[] operatedPoolIds)");
// Immutables // Immutables
IStaking public immutable override stakingProxy; IStaking public immutable override stakingProxy;
DefaultPoolOperator public immutable override defaultPoolOperator; DefaultPoolOperator public immutable override defaultPoolOperator;
bytes32 public immutable override defaultPoolId; bytes32 public immutable override defaultPoolId;
uint256 public immutable override votingPeriod; uint256 public immutable override votingPeriod;
bytes32 immutable domainSeparator;
uint256 public override proposalThreshold; uint256 public override proposalThreshold;
uint256 public override quorumThreshold; uint256 public override quorumThreshold;
@@ -67,6 +81,15 @@ contract ZrxTreasury is
defaultPoolId = params.defaultPoolId; defaultPoolId = params.defaultPoolId;
IStaking.Pool memory defaultPool = stakingProxy_.getStakingPool(params.defaultPoolId); IStaking.Pool memory defaultPool = stakingProxy_.getStakingPool(params.defaultPoolId);
defaultPoolOperator = DefaultPoolOperator(defaultPool.operator); defaultPoolOperator = DefaultPoolOperator(defaultPool.operator);
domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(CONTRACT_NAME)),
_getChainId(),
keccak256(bytes(CONTRACT_VERSION)),
address(this)
)
);
} }
// solhint-disable // solhint-disable
@@ -105,7 +128,7 @@ contract ZrxTreasury is
/// be executed if it passes. Must be at least two epochs /// be executed if it passes. Must be at least two epochs
/// from the current epoch. /// from the current epoch.
/// @param description A text description for the proposal. /// @param description A text description for the proposal.
/// @param operatedPoolIds The pools operated by `msg.sender`. The /// @param operatedPoolIds The pools operated by the signer. The
/// ZRX currently delegated to those pools will be accounted /// ZRX currently delegated to those pools will be accounted
/// for in the voting power. /// for in the voting power.
/// @return proposalId The ID of the newly created proposal. /// @return proposalId The ID of the newly created proposal.
@@ -150,8 +173,9 @@ contract ZrxTreasury is
} }
/// @dev Casts a vote for the given proposal. Only callable /// @dev Casts a vote for the given proposal. Only callable
/// during the voting period for that proposal. See /// during the voting period for that proposal.
/// `getVotingPower` for how voting power is computed. /// One address can only vote once.
/// See `getVotingPower` for how voting power is computed.
/// @param proposalId The ID of the proposal to vote on. /// @param proposalId The ID of the proposal to vote on.
/// @param support Whether to support the proposal or not. /// @param support Whether to support the proposal or not.
/// @param operatedPoolIds The pools operated by `msg.sender`. The /// @param operatedPoolIds The pools operated by `msg.sender`. The
@@ -165,43 +189,39 @@ contract ZrxTreasury is
public public
override override
{ {
if (proposalId >= proposalCount()) { return _castVote(msg.sender, proposalId, support, operatedPoolIds);
revert("castVote/INVALID_PROPOSAL_ID");
}
if (hasVoted[proposalId][msg.sender]) {
revert("castVote/ALREADY_VOTED");
} }
Proposal memory proposal = proposals[proposalId]; /// @dev Casts a vote for the given proposal, by signature.
if ( /// Only callable during the voting period for that proposal.
proposal.voteEpoch != stakingProxy.currentEpoch() || /// One address/voter can only vote once.
_hasVoteEnded(proposal.voteEpoch) /// See `getVotingPower` for how voting power is computed.
) { /// @param proposalId The ID of the proposal to vote on.
revert("castVote/VOTING_IS_CLOSED"); /// @param support Whether to support the proposal or not.
} /// @param operatedPoolIds The pools operated by voter. The
/// ZRX currently delegated to those pools will be accounted
uint256 votingPower = getVotingPower(msg.sender, operatedPoolIds); /// for in the voting power.
if (votingPower == 0) { /// @param v the v field of the signature
revert("castVote/NO_VOTING_POWER"); /// @param r the r field of the signature
} /// @param s the s field of the signature
function castVoteBySignature(
if (support) { uint256 proposalId,
proposals[proposalId].votesFor = proposals[proposalId].votesFor bool support,
.safeAdd(votingPower); bytes32[] memory operatedPoolIds,
hasVoted[proposalId][msg.sender] = true; uint8 v,
} else { bytes32 r,
proposals[proposalId].votesAgainst = proposals[proposalId].votesAgainst bytes32 s
.safeAdd(votingPower); )
hasVoted[proposalId][msg.sender] = true; public
} override
{
emit VoteCast( bytes32 structHash = keccak256(
msg.sender, abi.encode(VOTE_TYPEHASH, proposalId, support, keccak256(abi.encodePacked(operatedPoolIds)))
operatedPoolIds,
proposalId,
support,
votingPower
); );
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
return _castVote(signatory, proposalId, support, operatedPoolIds);
} }
/// @dev Executes a proposal that has passed and is /// @dev Executes a proposal that has passed and is
@@ -373,4 +393,60 @@ contract ZrxTreasury is
.safeAdd(votingPeriod); .safeAdd(votingPeriod);
return block.timestamp > voteEndTime; return block.timestamp > voteEndTime;
} }
/// @dev Casts a vote for the given proposal. Only callable
/// during the voting period for that proposal. See
/// `getVotingPower` for how voting power is computed.
function _castVote(
address voter,
uint256 proposalId,
bool support,
bytes32[] memory operatedPoolIds
)
private
{
if (proposalId >= proposalCount()) {
revert("_castVote/INVALID_PROPOSAL_ID");
}
if (hasVoted[proposalId][voter]) {
revert("_castVote/ALREADY_VOTED");
}
Proposal memory proposal = proposals[proposalId];
if (
proposal.voteEpoch != stakingProxy.currentEpoch() ||
_hasVoteEnded(proposal.voteEpoch)
) {
revert("_castVote/VOTING_IS_CLOSED");
}
uint256 votingPower = getVotingPower(voter, operatedPoolIds);
if (votingPower == 0) {
revert("_castVote/NO_VOTING_POWER");
}
if (support) {
proposals[proposalId].votesFor = proposals[proposalId].votesFor
.safeAdd(votingPower);
} else {
proposals[proposalId].votesAgainst = proposals[proposalId].votesAgainst
.safeAdd(votingPower);
}
hasVoted[proposalId][voter] = true;
emit VoteCast(
voter,
operatedPoolIds,
proposalId,
support,
votingPower
);
}
/// @dev Gets the Ethereum chain id
function _getChainId() private pure returns (uint256) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contracts-treasury", "name": "@0x/contracts-treasury",
"version": "1.3.5", "version": "1.4.0",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -46,14 +46,14 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury", "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": { "devDependencies": {
"@0x/abi-gen": "^5.6.0", "@0x/abi-gen": "^5.6.2",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/contracts-asset-proxy": "^3.7.19", "@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "^3.3.19", "@0x/contracts-erc20": "^3.3.20",
"@0x/contracts-gen": "^2.0.38", "@0x/contracts-gen": "^2.0.40",
"@0x/contracts-staking": "^2.0.45", "@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.10", "@0x/contracts-test-utils": "^5.4.11",
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/ts-doc-gen": "^0.0.28", "@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@types/isomorphic-fetch": "^0.0.35", "@types/isomorphic-fetch": "^0.0.35",
@@ -72,14 +72,14 @@
"typescript": "4.2.2" "typescript": "4.2.2"
}, },
"dependencies": { "dependencies": {
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/protocol-utils": "^1.8.4", "@0x/protocol-utils": "^1.9.0",
"@0x/subproviders": "^6.5.3", "@0x/subproviders": "^6.6.0",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"ethereumjs-util": "^7.0.10" "ethereumjs-util": "^7.0.10"
}, },
"publishConfig": { "publishConfig": {

View File

@@ -17,8 +17,9 @@ import {
randomAddress, randomAddress,
verifyEventsFromLogs, verifyEventsFromLogs,
} from '@0x/contracts-test-utils'; } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils'; import { TreasuryVote } from '@0x/protocol-utils';
import * as _ from 'lodash'; import { BigNumber, hexUtils } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { artifacts } from './artifacts'; import { artifacts } from './artifacts';
import { DefaultPoolOperatorContract, ZrxTreasuryContract, ZrxTreasuryEvents } from './wrappers'; import { DefaultPoolOperatorContract, ZrxTreasuryContract, ZrxTreasuryEvents } from './wrappers';
@@ -55,6 +56,8 @@ blockchainTests.resets('Treasury governance', env => {
let nonDefaultPoolId: string; let nonDefaultPoolId: string;
let poolOperator: string; let poolOperator: string;
let delegator: string; let delegator: string;
let relayer: string;
let delegatorPrivateKey: string;
let actions: ProposedAction[]; let actions: ProposedAction[];
async function deployStakingAsync(): Promise<void> { async function deployStakingAsync(): Promise<void> {
@@ -105,7 +108,10 @@ blockchainTests.resets('Treasury governance', env => {
} }
before(async () => { before(async () => {
[admin, poolOperator, delegator] = await env.getAccountAddressesAsync(); const accounts = await env.getAccountAddressesAsync();
[admin, poolOperator, delegator, relayer] = accounts;
delegatorPrivateKey = hexUtils.toHex(constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(delegator)]);
zrx = await DummyERC20TokenContract.deployFrom0xArtifactAsync( zrx = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
erc20Artifacts.DummyERC20Token, erc20Artifacts.DummyERC20Token,
env.provider, env.provider,
@@ -399,7 +405,7 @@ blockchainTests.resets('Treasury governance', env => {
expect(await treasury.proposalCount().callAsync()).to.bignumber.equal(1); expect(await treasury.proposalCount().callAsync()).to.bignumber.equal(1);
}); });
}); });
describe('castVote()', () => { describe('castVote() and castVoteBySignature()', () => {
const VOTE_PROPOSAL_ID = new BigNumber(0); const VOTE_PROPOSAL_ID = new BigNumber(0);
const DELEGATOR_VOTING_POWER = new BigNumber(420); const DELEGATOR_VOTING_POWER = new BigNumber(420);
@@ -418,17 +424,18 @@ blockchainTests.resets('Treasury governance', env => {
.propose(actions, currentEpoch.plus(2), PROPOSAL_DESCRIPTION, []) .propose(actions, currentEpoch.plus(2), PROPOSAL_DESCRIPTION, [])
.awaitTransactionSuccessAsync({ from: delegator }); .awaitTransactionSuccessAsync({ from: delegator });
}); });
// castVote()
it('Cannot vote on invalid proposalId', async () => { it('Cannot vote on invalid proposalId', async () => {
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
const tx = treasury const tx = treasury
.castVote(INVALID_PROPOSAL_ID, true, []) .castVote(INVALID_PROPOSAL_ID, true, [])
.awaitTransactionSuccessAsync({ from: delegator }); .awaitTransactionSuccessAsync({ from: delegator });
return expect(tx).to.revertWith('castVote/INVALID_PROPOSAL_ID'); return expect(tx).to.revertWith('_castVote/INVALID_PROPOSAL_ID');
}); });
it('Cannot vote before voting period starts', async () => { it('Cannot vote before voting period starts', async () => {
const tx = treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator }); const tx = treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator });
return expect(tx).to.revertWith('castVote/VOTING_IS_CLOSED'); return expect(tx).to.revertWith('_castVote/VOTING_IS_CLOSED');
}); });
it('Cannot vote after voting period ends', async () => { it('Cannot vote after voting period ends', async () => {
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
@@ -436,14 +443,14 @@ blockchainTests.resets('Treasury governance', env => {
await env.web3Wrapper.increaseTimeAsync(TREASURY_PARAMS.votingPeriod.plus(1).toNumber()); await env.web3Wrapper.increaseTimeAsync(TREASURY_PARAMS.votingPeriod.plus(1).toNumber());
await env.web3Wrapper.mineBlockAsync(); await env.web3Wrapper.mineBlockAsync();
const tx = treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator }); const tx = treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator });
return expect(tx).to.revertWith('castVote/VOTING_IS_CLOSED'); return expect(tx).to.revertWith('_castVote/VOTING_IS_CLOSED');
}); });
it('Cannot vote twice on same proposal', async () => { it('Cannot vote twice on same proposal', async () => {
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
await treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator }); await treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator });
const tx = treasury.castVote(VOTE_PROPOSAL_ID, false, []).awaitTransactionSuccessAsync({ from: delegator }); const tx = treasury.castVote(VOTE_PROPOSAL_ID, false, []).awaitTransactionSuccessAsync({ from: delegator });
return expect(tx).to.revertWith('castVote/ALREADY_VOTED'); return expect(tx).to.revertWith('_castVote/ALREADY_VOTED');
}); });
it('Can cast a valid vote', async () => { it('Can cast a valid vote', async () => {
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
@@ -465,6 +472,109 @@ blockchainTests.resets('Treasury governance', env => {
ZrxTreasuryEvents.VoteCast, ZrxTreasuryEvents.VoteCast,
); );
}); });
// castVoteBySignature()
it('Cannot vote by signature on invalid proposalId', async () => {
await fastForwardToNextEpochAsync();
await fastForwardToNextEpochAsync();
const vote = new TreasuryVote({
proposalId: INVALID_PROPOSAL_ID,
verifyingContract: admin,
});
const signature = vote.getSignatureWithKey(delegatorPrivateKey);
const tx = treasury
.castVoteBySignature(INVALID_PROPOSAL_ID, true, [], signature.v, signature.r, signature.s)
.awaitTransactionSuccessAsync({ from: relayer });
return expect(tx).to.revertWith('_castVote/INVALID_PROPOSAL_ID');
});
it('Cannot vote by signature before voting period starts', async () => {
const vote = new TreasuryVote({
proposalId: VOTE_PROPOSAL_ID,
verifyingContract: admin,
});
const signature = vote.getSignatureWithKey(delegatorPrivateKey);
const tx = treasury
.castVoteBySignature(VOTE_PROPOSAL_ID, true, [], signature.v, signature.r, signature.s)
.awaitTransactionSuccessAsync({ from: relayer });
return expect(tx).to.revertWith('_castVote/VOTING_IS_CLOSED');
});
it('Cannot vote by signature after voting period ends', async () => {
await fastForwardToNextEpochAsync();
await fastForwardToNextEpochAsync();
await env.web3Wrapper.increaseTimeAsync(TREASURY_PARAMS.votingPeriod.plus(1).toNumber());
await env.web3Wrapper.mineBlockAsync();
const vote = new TreasuryVote({
proposalId: VOTE_PROPOSAL_ID,
verifyingContract: admin,
});
const signature = vote.getSignatureWithKey(delegatorPrivateKey);
const tx = treasury
.castVoteBySignature(VOTE_PROPOSAL_ID, true, [], signature.v, signature.r, signature.s)
.awaitTransactionSuccessAsync({ from: relayer });
return expect(tx).to.revertWith('_castVote/VOTING_IS_CLOSED');
});
it('Can recover the address from signature correctly', async () => {
const vote = new TreasuryVote({
proposalId: VOTE_PROPOSAL_ID,
verifyingContract: admin,
});
const signature = vote.getSignatureWithKey(delegatorPrivateKey);
const publicKey = ethUtil.ecrecover(
ethUtil.toBuffer(vote.getEIP712Hash()),
signature.v,
ethUtil.toBuffer(signature.r),
ethUtil.toBuffer(signature.s),
);
const address = ethUtil.publicToAddress(publicKey);
expect(ethUtil.bufferToHex(address)).to.be.equal(delegator);
});
it('Can cast a valid vote by signature', async () => {
await fastForwardToNextEpochAsync();
await fastForwardToNextEpochAsync();
const vote = new TreasuryVote({
proposalId: VOTE_PROPOSAL_ID,
verifyingContract: treasury.address,
chainId: 1337,
support: false,
});
const signature = vote.getSignatureWithKey(delegatorPrivateKey);
const tx = await treasury
.castVoteBySignature(VOTE_PROPOSAL_ID, false, [], signature.v, signature.r, signature.s)
.awaitTransactionSuccessAsync({ from: relayer });
verifyEventsFromLogs(
tx.logs,
[
{
voter: delegator,
operatedPoolIds: [],
proposalId: VOTE_PROPOSAL_ID,
support: vote.support,
votingPower: DELEGATOR_VOTING_POWER,
},
],
ZrxTreasuryEvents.VoteCast,
);
});
it('Cannot vote by signature twice on same proposal', async () => {
await fastForwardToNextEpochAsync();
await fastForwardToNextEpochAsync();
await treasury.castVote(VOTE_PROPOSAL_ID, true, []).awaitTransactionSuccessAsync({ from: delegator });
const secondVote = new TreasuryVote({
proposalId: VOTE_PROPOSAL_ID,
verifyingContract: treasury.address,
chainId: 1337,
support: false,
});
const signature = secondVote.getSignatureWithKey(delegatorPrivateKey);
const secondVoteTx = treasury
.castVoteBySignature(VOTE_PROPOSAL_ID, false, [], signature.v, signature.r, signature.s)
.awaitTransactionSuccessAsync({ from: relayer });
return expect(secondVoteTx).to.revertWith('_castVote/ALREADY_VOTED');
});
}); });
describe('execute()', () => { describe('execute()', () => {
let passedProposalId: BigNumber; let passedProposalId: BigNumber;
@@ -473,7 +583,7 @@ blockchainTests.resets('Treasury governance', env => {
let ongoingVoteProposalId: BigNumber; let ongoingVoteProposalId: BigNumber;
before(async () => { before(async () => {
// OPerator has enough ZRX to create and pass a proposal // Operator has enough ZRX to create and pass a proposal
await staking.stake(TREASURY_PARAMS.quorumThreshold).awaitTransactionSuccessAsync({ from: poolOperator }); await staking.stake(TREASURY_PARAMS.quorumThreshold).awaitTransactionSuccessAsync({ from: poolOperator });
await staking await staking
.moveStake( .moveStake(
@@ -549,7 +659,7 @@ blockchainTests.resets('Treasury governance', env => {
}); });
it('Cannot execute before or after the execution epoch', async () => { it('Cannot execute before or after the execution epoch', async () => {
const tooEarly = treasury.execute(passedProposalId, actions).awaitTransactionSuccessAsync(); const tooEarly = treasury.execute(passedProposalId, actions).awaitTransactionSuccessAsync();
expect(tooEarly).to.revertWith('_assertProposalExecutable/CANNOT_EXECUTE_THIS_EPOCH'); await expect(tooEarly).to.revertWith('_assertProposalExecutable/CANNOT_EXECUTE_THIS_EPOCH');
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();
// Proposal 0 is executable here // Proposal 0 is executable here
await fastForwardToNextEpochAsync(); await fastForwardToNextEpochAsync();

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "4.8.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"version": "4.8.0", "version": "4.8.0",
"changes": [ "changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v4.8.1 - _September 15, 2021_
* Dependencies updated
## v4.8.0 - _September 8, 2021_ ## v4.8.0 - _September 8, 2021_
* Added FundRecoveryFeature to the 0x EP (#306) * Added FundRecoveryFeature to the 0x EP (#306)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contracts-utils", "name": "@0x/contracts-utils",
"version": "4.8.0", "version": "4.8.1",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -50,15 +50,15 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils", "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
"devDependencies": { "devDependencies": {
"@0x/abi-gen": "^5.6.0", "@0x/abi-gen": "^5.6.2",
"@0x/contracts-gen": "^2.0.38", "@0x/contracts-gen": "^2.0.40",
"@0x/contracts-test-utils": "^5.4.10", "@0x/contracts-test-utils": "^5.4.11",
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/order-utils": "^10.4.28", "@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"@types/bn.js": "^4.11.0", "@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
@@ -79,11 +79,11 @@
"typescript": "4.2.2" "typescript": "4.2.2"
}, },
"dependencies": { "dependencies": {
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"bn.js": "^4.11.8", "bn.js": "^4.11.8",
"ethereum-types": "^3.5.0" "ethereum-types": "^3.6.0"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "0.28.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1631120757, "timestamp": 1631120757,
"version": "0.28.4", "version": "0.28.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v0.28.5 - _September 15, 2021_
* Dependencies updated
## v0.28.4 - _September 8, 2021_ ## v0.28.4 - _September 8, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contracts-zero-ex", "name": "@0x/contracts-zero-ex",
"version": "0.28.4", "version": "0.28.5",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -55,14 +55,14 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex", "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": { "devDependencies": {
"@0x/abi-gen": "^5.6.0", "@0x/abi-gen": "^5.6.2",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/contracts-erc20": "^3.3.19", "@0x/contracts-erc20": "^3.3.20",
"@0x/contracts-gen": "^2.0.38", "@0x/contracts-gen": "^2.0.40",
"@0x/contracts-test-utils": "^5.4.10", "@0x/contracts-test-utils": "^5.4.11",
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/order-utils": "^10.4.28", "@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/ts-doc-gen": "^0.0.28", "@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@types/isomorphic-fetch": "^0.0.35", "@types/isomorphic-fetch": "^0.0.35",
@@ -82,14 +82,14 @@
"typescript": "4.2.2" "typescript": "4.2.2"
}, },
"dependencies": { "dependencies": {
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/protocol-utils": "^1.8.4", "@0x/protocol-utils": "^1.9.0",
"@0x/subproviders": "^6.5.3", "@0x/subproviders": "^6.6.0",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"ethereumjs-util": "^7.0.10", "ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4" "ethers": "~4.0.4"
}, },

View File

@@ -46,7 +46,7 @@
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;", "test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;",
"bundlewatch": "bundlewatch", "bundlewatch": "bundlewatch",
"lint": "wsrun --fast-exit --parallel --exclude-missing -p $PKG -c lint", "lint": "wsrun --fast-exit --parallel --exclude-missing -p $PKG -c lint",
"upgrade_org_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x|ethereum-types'", "upgrade_org_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x/|ethereum-types'",
"upgrade_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js", "upgrade_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js",
"verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio" "verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio"
}, },

View File

@@ -1,4 +1,31 @@
[ [
{
"timestamp": 1631710679,
"version": "16.27.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1631646242,
"version": "16.27.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1631639620,
"version": "16.27.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"version": "16.27.1", "version": "16.27.1",
"changes": [ "changes": [

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v16.27.4 - _September 15, 2021_
* Dependencies updated
## v16.27.3 - _September 14, 2021_
* Dependencies updated
## v16.27.2 - _September 14, 2021_
* Dependencies updated
## v16.27.1 - _September 8, 2021_ ## v16.27.1 - _September 8, 2021_
* Fix ApproximateBuys sampler to terminate if the buy amount is not met (#319) * Fix ApproximateBuys sampler to terminate if the buy amount is not met (#319)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/asset-swapper", "name": "@0x/asset-swapper",
"version": "16.27.1", "version": "16.27.4",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -58,20 +58,20 @@
"registry": "git@github.com:0xProject/gitpkg-registry.git" "registry": "git@github.com:0xProject/gitpkg-registry.git"
}, },
"dependencies": { "dependencies": {
"@0x/assert": "^3.0.27", "@0x/assert": "^3.0.29",
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/contract-wrappers": "^13.17.6", "@0x/contract-wrappers": "^13.17.7",
"@0x/contracts-erc20": "^3.3.19", "@0x/contracts-erc20": "^3.3.20",
"@0x/contracts-zero-ex": "^0.27.0", "@0x/contracts-zero-ex": "^0.27.1",
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/json-schemas": "^6.1.3", "@0x/json-schemas": "^6.3.0",
"@0x/protocol-utils": "^1.8.4", "@0x/protocol-utils": "^1.9.0",
"@0x/quote-server": "^6.0.2", "@0x/quote-server": "^6.0.6",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"@balancer-labs/sor": "0.3.2", "@balancer-labs/sor": "0.3.2",
"@bancor/sdk": "0.2.9", "@bancor/sdk": "0.2.9",
"@ethersproject/abi": "^5.0.1", "@ethersproject/abi": "^5.0.1",
@@ -83,7 +83,7 @@
"axios-mock-adapter": "^1.19.0", "axios-mock-adapter": "^1.19.0",
"cream-sor": "^0.3.3", "cream-sor": "^0.3.3",
"decimal.js": "^10.2.0", "decimal.js": "^10.2.0",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"ethereumjs-util": "^7.0.10", "ethereumjs-util": "^7.0.10",
"fast-abi": "^0.0.2", "fast-abi": "^0.0.2",
"graphql": "^15.4.0", "graphql": "^15.4.0",
@@ -92,20 +92,20 @@
"lodash": "^4.17.11" "lodash": "^4.17.11"
}, },
"devDependencies": { "devDependencies": {
"@0x/abi-gen": "^5.6.0", "@0x/abi-gen": "^5.6.2",
"@0x/contracts-asset-proxy": "^3.7.19", "@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-exchange": "^3.2.38", "@0x/contracts-exchange": "^3.2.38",
"@0x/contracts-exchange-libs": "^4.3.37", "@0x/contracts-exchange-libs": "^4.3.37",
"@0x/contracts-gen": "^2.0.38", "@0x/contracts-gen": "^2.0.40",
"@0x/contracts-test-utils": "^5.4.10", "@0x/contracts-test-utils": "^5.4.11",
"@0x/contracts-utils": "^4.8.0", "@0x/contracts-utils": "^4.8.1",
"@0x/mesh-rpc-client": "^9.4.2", "@0x/mesh-rpc-client": "^9.4.2",
"@0x/migrations": "^8.1.5", "@0x/migrations": "^8.1.6",
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/subproviders": "^6.5.3", "@0x/subproviders": "^6.6.0",
"@0x/ts-doc-gen": "^0.0.28", "@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@types/node": "12.12.54", "@types/node": "12.12.54",

View File

@@ -50,7 +50,7 @@ const DEFAULT_SWAP_QUOTER_OPTS: SwapQuoterOpts = {
samplerGasLimit: 500e6, samplerGasLimit: 500e6,
ethGasStationUrl: ETH_GAS_STATION_API_URL, ethGasStationUrl: ETH_GAS_STATION_API_URL,
rfqt: { rfqt: {
takerApiKeyWhitelist: [], integratorsWhitelist: [],
makerAssetOfferings: {}, makerAssetOfferings: {},
txOriginBlacklist: new Set(), txOriginBlacklist: new Set(),
}, },

View File

@@ -88,6 +88,7 @@ export {
ExchangeProxyContractOpts, ExchangeProxyContractOpts,
ExchangeProxyRefundReceiver, ExchangeProxyRefundReceiver,
GetExtensionContractTypeOpts, GetExtensionContractTypeOpts,
Integrator,
LogFunction, LogFunction,
MarketBuySwapQuote, MarketBuySwapQuote,
MarketOperation, MarketOperation,

View File

@@ -75,6 +75,7 @@ export class SwapQuoter {
private readonly _marketOperationUtils: MarketOperationUtils; private readonly _marketOperationUtils: MarketOperationUtils;
private readonly _rfqtOptions?: SwapQuoterRfqOpts; private readonly _rfqtOptions?: SwapQuoterRfqOpts;
private readonly _quoteRequestorHttpClient: AxiosInstance; private readonly _quoteRequestorHttpClient: AxiosInstance;
private readonly _integratorIdsSet: Set<string>;
/** /**
* Instantiates a new SwapQuoter instance * Instantiates a new SwapQuoter instance
@@ -164,6 +165,9 @@ export class SwapQuoter {
httpsAgent: new HttpsAgent({ keepAlive: true, timeout: KEEP_ALIVE_TTL }), httpsAgent: new HttpsAgent({ keepAlive: true, timeout: KEEP_ALIVE_TTL }),
...(rfqt ? rfqt.axiosInstanceOpts : {}), ...(rfqt ? rfqt.axiosInstanceOpts : {}),
}); });
const integratorIds = this._rfqtOptions?.integratorsWhitelist.map(integrator => integrator.integratorId) || [];
this._integratorIdsSet = new Set(integratorIds);
} }
public async getBatchMarketBuySwapQuoteAsync( public async getBatchMarketBuySwapQuoteAsync(
@@ -414,12 +418,11 @@ export class SwapQuoter {
return isOpenOrder && !willOrderExpire && isFeeTypeAllowed; return isOpenOrder && !willOrderExpire && isFeeTypeAllowed;
}; // tslint:disable-line:semicolon }; // tslint:disable-line:semicolon
private _isApiKeyWhitelisted(apiKey: string | undefined): boolean { private _isIntegratorIdWhitelisted(integratorId: string | undefined): boolean {
if (!apiKey) { if (!integratorId) {
return false; return false;
} }
const whitelistedApiKeys = this._rfqtOptions ? this._rfqtOptions.takerApiKeyWhitelist : []; return this._integratorIdsSet.has(integratorId);
return whitelistedApiKeys.includes(apiKey);
} }
private _isTxOriginBlacklisted(txOrigin: string | undefined): boolean { private _isTxOriginBlacklisted(txOrigin: string | undefined): boolean {
@@ -438,19 +441,19 @@ export class SwapQuoter {
return rfqt; return rfqt;
} }
// tslint:disable-next-line: boolean-naming // tslint:disable-next-line: boolean-naming
const { apiKey, nativeExclusivelyRFQ, intentOnFilling, txOrigin } = rfqt; const { integrator, nativeExclusivelyRFQ, intentOnFilling, txOrigin } = rfqt;
// If RFQ-T is enabled and `nativeExclusivelyRFQ` is set, then `ERC20BridgeSource.Native` should // If RFQ-T is enabled and `nativeExclusivelyRFQ` is set, then `ERC20BridgeSource.Native` should
// never be excluded. // never be excluded.
if (nativeExclusivelyRFQ === true && !sourceFilters.isAllowed(ERC20BridgeSource.Native)) { if (nativeExclusivelyRFQ === true && !sourceFilters.isAllowed(ERC20BridgeSource.Native)) {
throw new Error('Native liquidity cannot be excluded if "rfqt.nativeExclusivelyRFQ" is set'); throw new Error('Native liquidity cannot be excluded if "rfqt.nativeExclusivelyRFQ" is set');
} }
// If an API key was provided, but the key is not whitelisted, raise a warning and disable RFQ // If an integrator ID was provided, but the ID is not whitelisted, raise a warning and disable RFQ
if (!this._isApiKeyWhitelisted(apiKey)) { if (!this._isIntegratorIdWhitelisted(integrator.integratorId)) {
if (this._rfqtOptions && this._rfqtOptions.warningLogger) { if (this._rfqtOptions && this._rfqtOptions.warningLogger) {
this._rfqtOptions.warningLogger( this._rfqtOptions.warningLogger(
{ {
apiKey, ...integrator,
}, },
'Attempt at using an RFQ API key that is not whitelisted. Disabling RFQ for the request lifetime.', 'Attempt at using an RFQ API key that is not whitelisted. Disabling RFQ for the request lifetime.',
); );
@@ -474,7 +477,7 @@ export class SwapQuoter {
// Otherwise check other RFQ options // Otherwise check other RFQ options
if ( if (
intentOnFilling && // The requestor is asking for a firm quote intentOnFilling && // The requestor is asking for a firm quote
this._isApiKeyWhitelisted(apiKey) && // A valid API key was provided this._isIntegratorIdWhitelisted(integrator.integratorId) && // A valid API key was provided
sourceFilters.isAllowed(ERC20BridgeSource.Native) // Native liquidity is not excluded sourceFilters.isAllowed(ERC20BridgeSource.Native) // Native liquidity is not excluded
) { ) {
if (!txOrigin || txOrigin === constants.NULL_ADDRESS) { if (!txOrigin || txOrigin === constants.NULL_ADDRESS) {

View File

@@ -243,8 +243,7 @@ export interface RfqmRequestOptions extends RfqRequestOpts {
export interface RfqRequestOpts { export interface RfqRequestOpts {
takerAddress: string; takerAddress: string;
txOrigin: string; txOrigin: string;
apiKey: string; integrator: Integrator;
apiKeyWhitelist?: string[];
intentOnFilling: boolean; intentOnFilling: boolean;
isIndicative?: boolean; isIndicative?: boolean;
makerEndpointMaxResponseTimeMs?: number; makerEndpointMaxResponseTimeMs?: number;
@@ -294,8 +293,14 @@ export interface RfqFirmQuoteValidator {
getRfqtTakerFillableAmountsAsync(quotes: RfqOrder[]): Promise<BigNumber[]>; getRfqtTakerFillableAmountsAsync(quotes: RfqOrder[]): Promise<BigNumber[]>;
} }
export interface Integrator {
integratorId: string;
label: string;
whitelistIntegratorUrls?: string[];
}
export interface SwapQuoterRfqOpts { export interface SwapQuoterRfqOpts {
takerApiKeyWhitelist: string[]; integratorsWhitelist: Integrator[];
makerAssetOfferings: RfqMakerAssetOfferings; makerAssetOfferings: RfqMakerAssetOfferings;
txOriginBlacklist: Set<string>; txOriginBlacklist: Set<string>;
altRfqCreds?: { altRfqCreds?: {

View File

@@ -14,6 +14,7 @@ import { constants } from '../constants';
import { import {
AltQuoteModel, AltQuoteModel,
AltRfqMakerAssetOfferings, AltRfqMakerAssetOfferings,
Integrator,
LogFunction, LogFunction,
MarketOperation, MarketOperation,
RfqMakerAssetOfferings, RfqMakerAssetOfferings,
@@ -61,6 +62,31 @@ export interface MetricsProxy {
* @param expirationTimeSeconds the expiration time in seconds * @param expirationTimeSeconds the expiration time in seconds
*/ */
incrementFillRatioWarningCounter(isLastLook: boolean, maker: string): void; incrementFillRatioWarningCounter(isLastLook: boolean, maker: string): void;
/**
* Logs the outcome of a network (HTTP) interaction with a market maker.
*
* @param interaction.isLastLook true if the request is RFQM
* @param interaction.integrator the integrator that is requesting the RFQ quote
* @param interaction.url the URL of the market maker
* @param interaction.quoteType indicative or firm quote
* @param interaction.statusCode the statusCode returned by a market maker
* @param interaction.latencyMs the latency of the HTTP request (in ms)
* @param interaction.included if a firm quote that was returned got included in the next step of processing.
* NOTE: this does not mean that the request returned a valid fillable order. It just
* means that the network response was successful.
*/
logRfqMakerNetworkInteraction(interaction: {
isLastLook: boolean;
integrator: Integrator;
url: string;
quoteType: 'firm' | 'indicative';
statusCode: number | undefined;
latencyMs: number;
included: boolean;
sellTokenAddress: string;
buyTokenAddress: string;
}): void;
} }
/** /**
@@ -188,7 +214,7 @@ export class QuoteRequestor {
* @returns a list of TypedMakerUrl instances * @returns a list of TypedMakerUrl instances
*/ */
public static getTypedMakerUrlsAndWhitelist( public static getTypedMakerUrlsAndWhitelist(
options: Pick<RfqmRequestOptions, 'apiKeyWhitelist' | 'altRfqAssetOfferings'>, options: Pick<RfqmRequestOptions, 'integrator' | 'altRfqAssetOfferings'>,
assetOfferings: RfqMakerAssetOfferings, assetOfferings: RfqMakerAssetOfferings,
): TypedMakerUrl[] { ): TypedMakerUrl[] {
const standardUrls = Object.keys(assetOfferings).map( const standardUrls = Object.keys(assetOfferings).map(
@@ -207,8 +233,8 @@ export class QuoteRequestor {
let typedMakerUrls = standardUrls.concat(altUrls); let typedMakerUrls = standardUrls.concat(altUrls);
// If there is a whitelist, only allow approved maker URLs // If there is a whitelist, only allow approved maker URLs
if (options.apiKeyWhitelist !== undefined) { if (options.integrator.whitelistIntegratorUrls !== undefined) {
const whitelist = new Set(options.apiKeyWhitelist.map(key => key.toLowerCase())); const whitelist = new Set(options.integrator.whitelistIntegratorUrls.map(key => key.toLowerCase()));
typedMakerUrls = typedMakerUrls.filter(makerUrl => whitelist.has(makerUrl.url.toLowerCase())); typedMakerUrls = typedMakerUrls.filter(makerUrl => whitelist.has(makerUrl.url.toLowerCase()));
} }
return typedMakerUrls; return typedMakerUrls;
@@ -453,7 +479,20 @@ export class QuoteRequestor {
// filter out requests to skip // filter out requests to skip
const isBlacklisted = rfqMakerBlacklist.isMakerBlacklisted(typedMakerUrl.url); const isBlacklisted = rfqMakerBlacklist.isMakerBlacklisted(typedMakerUrl.url);
const partialLogEntry = { url: typedMakerUrl.url, quoteType, requestParams, isBlacklisted }; const partialLogEntry = { url: typedMakerUrl.url, quoteType, requestParams, isBlacklisted };
const { isLastLook, integrator } = options;
const { sellTokenAddress, buyTokenAddress } = requestParams;
if (isBlacklisted) { if (isBlacklisted) {
this._metrics?.logRfqMakerNetworkInteraction({
isLastLook: false,
url: typedMakerUrl.url,
quoteType,
statusCode: undefined,
sellTokenAddress,
buyTokenAddress,
latencyMs: 0,
included: false,
integrator,
});
this._infoLogger({ rfqtMakerInteraction: { ...partialLogEntry } }); this._infoLogger({ rfqtMakerInteraction: { ...partialLogEntry } });
return; return;
} else if ( } else if (
@@ -472,18 +511,32 @@ export class QuoteRequestor {
try { try {
if (typedMakerUrl.pairType === RfqPairType.Standard) { if (typedMakerUrl.pairType === RfqPairType.Standard) {
const response = await this._quoteRequestorHttpClient.get(`${typedMakerUrl.url}/${quotePath}`, { const response = await this._quoteRequestorHttpClient.get(`${typedMakerUrl.url}/${quotePath}`, {
headers: { '0x-api-key': options.apiKey }, headers: {
'0x-api-key': options.integrator.integratorId,
'0x-integrator-id': options.integrator.integratorId,
},
params: requestParams, params: requestParams,
timeout: timeoutMs, timeout: timeoutMs,
cancelToken: cancelTokenSource.token, cancelToken: cancelTokenSource.token,
}); });
const latencyMs = Date.now() - timeBeforeAwait; const latencyMs = Date.now() - timeBeforeAwait;
this._metrics?.logRfqMakerNetworkInteraction({
isLastLook: isLastLook || false,
url: typedMakerUrl.url,
quoteType,
statusCode: response.status,
sellTokenAddress,
buyTokenAddress,
latencyMs,
included: true,
integrator,
});
this._infoLogger({ this._infoLogger({
rfqtMakerInteraction: { rfqtMakerInteraction: {
...partialLogEntry, ...partialLogEntry,
response: { response: {
included: true, included: true,
apiKey: options.apiKey, apiKey: options.integrator.integratorId,
takerAddress: requestParams.takerAddress, takerAddress: requestParams.takerAddress,
txOrigin: requestParams.txOrigin, txOrigin: requestParams.txOrigin,
statusCode: response.status, statusCode: response.status,
@@ -501,7 +554,7 @@ export class QuoteRequestor {
typedMakerUrl.url, typedMakerUrl.url,
this._altRfqCreds.altRfqApiKey, this._altRfqCreds.altRfqApiKey,
this._altRfqCreds.altRfqProfile, this._altRfqCreds.altRfqProfile,
options.apiKey, options.integrator.integratorId,
quoteType === 'firm' ? AltQuoteModel.Firm : AltQuoteModel.Indicative, quoteType === 'firm' ? AltQuoteModel.Firm : AltQuoteModel.Indicative,
makerToken, makerToken,
takerToken, takerToken,
@@ -514,12 +567,23 @@ export class QuoteRequestor {
); );
const latencyMs = Date.now() - timeBeforeAwait; const latencyMs = Date.now() - timeBeforeAwait;
this._metrics?.logRfqMakerNetworkInteraction({
isLastLook: isLastLook || false,
url: typedMakerUrl.url,
quoteType,
statusCode: quote.status,
sellTokenAddress,
buyTokenAddress,
latencyMs,
included: true,
integrator,
});
this._infoLogger({ this._infoLogger({
rfqtMakerInteraction: { rfqtMakerInteraction: {
...partialLogEntry, ...partialLogEntry,
response: { response: {
included: true, included: true,
apiKey: options.apiKey, apiKey: options.integrator.integratorId,
takerAddress: requestParams.takerAddress, takerAddress: requestParams.takerAddress,
txOrigin: requestParams.txOrigin, txOrigin: requestParams.txOrigin,
statusCode: quote.status, statusCode: quote.status,
@@ -533,12 +597,23 @@ export class QuoteRequestor {
} catch (err) { } catch (err) {
// log error if any // log error if any
const latencyMs = Date.now() - timeBeforeAwait; const latencyMs = Date.now() - timeBeforeAwait;
this._metrics?.logRfqMakerNetworkInteraction({
isLastLook: isLastLook || false,
url: typedMakerUrl.url,
quoteType,
statusCode: err.response?.status,
sellTokenAddress,
buyTokenAddress,
latencyMs,
included: false,
integrator,
});
this._infoLogger({ this._infoLogger({
rfqtMakerInteraction: { rfqtMakerInteraction: {
...partialLogEntry, ...partialLogEntry,
response: { response: {
included: false, included: false,
apiKey: options.apiKey, apiKey: options.integrator.integratorId,
takerAddress: requestParams.takerAddress, takerAddress: requestParams.takerAddress,
txOrigin: requestParams.txOrigin, txOrigin: requestParams.txOrigin,
statusCode: err.response ? err.response.status : undefined, statusCode: err.response ? err.response.status : undefined,
@@ -549,7 +624,7 @@ export class QuoteRequestor {
rfqMakerBlacklist.logTimeoutOrLackThereof(typedMakerUrl.url, latencyMs >= timeoutMs); rfqMakerBlacklist.logTimeoutOrLackThereof(typedMakerUrl.url, latencyMs >= timeoutMs);
this._warningLogger( this._warningLogger(
convertIfAxiosError(err), convertIfAxiosError(err),
`Failed to get RFQ-T ${quoteType} quote from market maker endpoint ${typedMakerUrl.url} for API key ${options.apiKey} for taker address ${options.takerAddress} and tx origin ${options.txOrigin}`, `Failed to get RFQ-T ${quoteType} quote from market maker endpoint ${typedMakerUrl.url} for integrator ${options.integrator.integratorId} (${options.integrator.label}) for taker address ${options.takerAddress} and tx origin ${options.txOrigin}`,
); );
return; return;
} }

View File

@@ -28,7 +28,11 @@ export const rfqtMocker = {
// Mock out RFQT responses // Mock out RFQT responses
for (const mockedResponse of mockedResponses) { for (const mockedResponse of mockedResponses) {
const { endpoint, requestApiKey, requestParams, responseData, responseCode } = mockedResponse; const { endpoint, requestApiKey, requestParams, responseData, responseCode } = mockedResponse;
const requestHeaders = { Accept: 'application/json, text/plain, */*', '0x-api-key': requestApiKey }; const requestHeaders = {
Accept: 'application/json, text/plain, */*',
'0x-api-key': requestApiKey,
'0x-integrator-id': requestApiKey,
};
mockedAxios mockedAxios
.onGet(`${endpoint}/${quoteType}`, { params: requestParams }, requestHeaders) .onGet(`${endpoint}/${quoteType}`, { params: requestParams }, requestHeaders)
.replyOnce(responseCode, responseData); .replyOnce(responseCode, responseData);

View File

@@ -16,7 +16,7 @@ import * as _ from 'lodash';
import * as TypeMoq from 'typemoq'; import * as TypeMoq from 'typemoq';
import { MarketOperation, QuoteRequestor, RfqRequestOpts, SignedNativeOrder } from '../src'; import { MarketOperation, QuoteRequestor, RfqRequestOpts, SignedNativeOrder } from '../src';
import { NativeOrderWithFillableAmounts } from '../src/types'; import { Integrator, NativeOrderWithFillableAmounts } from '../src/types';
import { MarketOperationUtils } from '../src/utils/market_operation_utils/'; import { MarketOperationUtils } from '../src/utils/market_operation_utils/';
import { import {
BUY_SOURCE_FILTER_BY_CHAIN_ID, BUY_SOURCE_FILTER_BY_CHAIN_ID,
@@ -62,6 +62,10 @@ const SELL_SOURCES = SELL_SOURCE_FILTER_BY_CHAIN_ID[ChainId.Mainnet].sources;
const TOKEN_ADJACENCY_GRAPH: TokenAdjacencyGraph = { default: [] }; const TOKEN_ADJACENCY_GRAPH: TokenAdjacencyGraph = { default: [] };
const SIGNATURE = { v: 1, r: NULL_BYTES, s: NULL_BYTES, signatureType: SignatureType.EthSign }; const SIGNATURE = { v: 1, r: NULL_BYTES, s: NULL_BYTES, signatureType: SignatureType.EthSign };
const FOO_INTEGRATOR: Integrator = {
integratorId: 'foo',
label: 'foo',
};
/** /**
* gets the orders required for a market sell operation by (potentially) merging native orders with * gets the orders required for a market sell operation by (potentially) merging native orders with
@@ -745,7 +749,7 @@ describe('MarketOperationUtils tests', () => {
feeSchedule, feeSchedule,
rfqt: { rfqt: {
isIndicative: false, isIndicative: false,
apiKey: 'foo', integrator: FOO_INTEGRATOR,
takerAddress: randomAddress(), takerAddress: randomAddress(),
txOrigin: randomAddress(), txOrigin: randomAddress(),
intentOnFilling: true, intentOnFilling: true,
@@ -790,7 +794,7 @@ describe('MarketOperationUtils tests', () => {
...DEFAULT_OPTS, ...DEFAULT_OPTS,
rfqt: { rfqt: {
isIndicative: false, isIndicative: false,
apiKey: 'foo', integrator: FOO_INTEGRATOR,
takerAddress: randomAddress(), takerAddress: randomAddress(),
intentOnFilling: true, intentOnFilling: true,
txOrigin: randomAddress(), txOrigin: randomAddress(),
@@ -837,7 +841,7 @@ describe('MarketOperationUtils tests', () => {
...DEFAULT_OPTS, ...DEFAULT_OPTS,
rfqt: { rfqt: {
isIndicative: true, isIndicative: true,
apiKey: 'foo', integrator: FOO_INTEGRATOR,
takerAddress: randomAddress(), takerAddress: randomAddress(),
txOrigin: randomAddress(), txOrigin: randomAddress(),
intentOnFilling: true, intentOnFilling: true,
@@ -896,7 +900,10 @@ describe('MarketOperationUtils tests', () => {
...DEFAULT_OPTS, ...DEFAULT_OPTS,
rfqt: { rfqt: {
isIndicative: false, isIndicative: false,
apiKey: 'foo', integrator: {
integratorId: 'foo',
label: 'foo',
},
takerAddress: randomAddress(), takerAddress: randomAddress(),
intentOnFilling: true, intentOnFilling: true,
txOrigin: randomAddress(), txOrigin: randomAddress(),
@@ -954,7 +961,7 @@ describe('MarketOperationUtils tests', () => {
...DEFAULT_OPTS, ...DEFAULT_OPTS,
rfqt: { rfqt: {
isIndicative: false, isIndicative: false,
apiKey: 'foo', integrator: FOO_INTEGRATOR,
takerAddress: randomAddress(), takerAddress: randomAddress(),
txOrigin: randomAddress(), txOrigin: randomAddress(),
intentOnFilling: true, intentOnFilling: true,

View File

@@ -240,7 +240,10 @@ describe('QuoteRequestor', async () => {
MarketOperation.Sell, MarketOperation.Sell,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
intentOnFilling: true, intentOnFilling: true,
@@ -435,7 +438,10 @@ describe('QuoteRequestor', async () => {
MarketOperation.Sell, MarketOperation.Sell,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
intentOnFilling: true, intentOnFilling: true,
@@ -551,7 +557,10 @@ describe('QuoteRequestor', async () => {
MarketOperation.Sell, MarketOperation.Sell,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
intentOnFilling: true, intentOnFilling: true,
@@ -675,7 +684,10 @@ describe('QuoteRequestor', async () => {
MarketOperation.Sell, MarketOperation.Sell,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
intentOnFilling: true, intentOnFilling: true,
@@ -762,7 +774,10 @@ describe('QuoteRequestor', async () => {
MarketOperation.Sell, MarketOperation.Sell,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
intentOnFilling: true, intentOnFilling: true,
@@ -823,7 +838,10 @@ describe('QuoteRequestor', async () => {
MarketOperation.Buy, MarketOperation.Buy,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
intentOnFilling: true, intentOnFilling: true,
@@ -844,7 +862,11 @@ describe('QuoteRequestor', async () => {
const [apiKeyWhitelist, results] = test; const [apiKeyWhitelist, results] = test;
const response = QuoteRequestor.getTypedMakerUrlsAndWhitelist( const response = QuoteRequestor.getTypedMakerUrlsAndWhitelist(
{ {
apiKeyWhitelist, integrator: {
integratorId: 'foo',
label: 'bar',
whitelistIntegratorUrls: apiKeyWhitelist,
},
altRfqAssetOfferings: {}, altRfqAssetOfferings: {},
}, },
{ {
@@ -1088,7 +1110,10 @@ describe('QuoteRequestor', async () => {
altScenario.requestedOperation, altScenario.requestedOperation,
undefined, undefined,
{ {
apiKey, integrator: {
integratorId: apiKey,
label: 'foo',
},
takerAddress, takerAddress,
txOrigin, txOrigin,
intentOnFilling: true, intentOnFilling: true,

View File

@@ -48,7 +48,11 @@ export const testHelpers = {
// Mock out Standard RFQ-T/M responses // Mock out Standard RFQ-T/M responses
for (const mockedResponse of standardMockedResponses) { for (const mockedResponse of standardMockedResponses) {
const { endpoint, requestApiKey, requestParams, responseData, responseCode } = mockedResponse; const { endpoint, requestApiKey, requestParams, responseData, responseCode } = mockedResponse;
const requestHeaders = { Accept: 'application/json, text/plain, */*', '0x-api-key': requestApiKey }; const requestHeaders = {
Accept: 'application/json, text/plain, */*',
'0x-api-key': requestApiKey,
'0x-integrator-id': requestApiKey,
};
if (mockedResponse.callback !== undefined) { if (mockedResponse.callback !== undefined) {
mockedAxios mockedAxios
.onGet(`${endpoint}/${quoteType}`, { params: requestParams }, requestHeaders) .onGet(`${endpoint}/${quoteType}`, { params: requestParams }, requestHeaders)

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "3.15.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"version": "3.15.0", "version": "3.15.0",
"changes": [ "changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v3.15.1 - _September 15, 2021_
* Dependencies updated
## v3.15.0 - _June 2, 2021_ ## v3.15.0 - _June 2, 2021_
* Update artifacts (#237) * Update artifacts (#237)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contract-artifacts", "name": "@0x/contract-artifacts",
"version": "3.15.0", "version": "3.15.1",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -30,7 +30,7 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-artifacts", "homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-artifacts",
"devDependencies": { "devDependencies": {
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"chai": "^4.0.1", "chai": "^4.0.1",
"lodash": "^4.17.11", "lodash": "^4.17.11",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "13.17.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1630459879, "timestamp": 1630459879,
"version": "13.17.6", "version": "13.17.6",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v13.17.7 - _September 15, 2021_
* Dependencies updated
## v13.17.6 - _September 1, 2021_ ## v13.17.6 - _September 1, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/contract-wrappers", "name": "@0x/contract-wrappers",
"version": "13.17.6", "version": "13.17.7",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -55,14 +55,14 @@
"typescript": "4.2.2" "typescript": "4.2.2"
}, },
"dependencies": { "dependencies": {
"@0x/assert": "^3.0.27", "@0x/assert": "^3.0.29",
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/json-schemas": "^6.1.3", "@0x/json-schemas": "^6.3.0",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"ethers": "~4.0.4" "ethers": "~4.0.4"
}, },
"publishConfig": { "publishConfig": {

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1631710679,
"version": "8.1.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1631120757, "timestamp": 1631120757,
"version": "8.1.5", "version": "8.1.5",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v8.1.6 - _September 15, 2021_
* Dependencies updated
## v8.1.5 - _September 8, 2021_ ## v8.1.5 - _September 8, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/migrations", "name": "@0x/migrations",
"version": "8.1.5", "version": "8.1.6",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -48,10 +48,10 @@
"registry": "git@github.com:0xProject/gitpkg-registry.git" "registry": "git@github.com:0xProject/gitpkg-registry.git"
}, },
"devDependencies": { "devDependencies": {
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/ts-doc-gen": "^0.0.28", "@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@types/yargs": "^11.0.0", "@types/yargs": "^11.0.0",
"chai": "^4.0.1", "chai": "^4.0.1",
"dirty-chai": "^2.0.1", "dirty-chai": "^2.0.1",
@@ -67,29 +67,29 @@
"yargs": "^10.0.3" "yargs": "^10.0.3"
}, },
"dependencies": { "dependencies": {
"@0x/base-contract": "^6.4.0", "@0x/base-contract": "^6.4.2",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/contracts-asset-proxy": "^3.7.19", "@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-coordinator": "^3.1.38", "@0x/contracts-coordinator": "^3.1.38",
"@0x/contracts-dev-utils": "^1.3.36", "@0x/contracts-dev-utils": "^1.3.36",
"@0x/contracts-erc1155": "^2.1.37", "@0x/contracts-erc1155": "^2.1.37",
"@0x/contracts-erc20": "^3.3.19", "@0x/contracts-erc20": "^3.3.20",
"@0x/contracts-erc721": "^3.1.37", "@0x/contracts-erc721": "^3.1.37",
"@0x/contracts-exchange": "^3.2.38", "@0x/contracts-exchange": "^3.2.38",
"@0x/contracts-exchange-forwarder": "^4.2.38", "@0x/contracts-exchange-forwarder": "^4.2.38",
"@0x/contracts-extensions": "^6.2.32", "@0x/contracts-extensions": "^6.2.32",
"@0x/contracts-multisig": "^4.1.38", "@0x/contracts-multisig": "^4.1.38",
"@0x/contracts-staking": "^2.0.45", "@0x/contracts-staking": "^2.0.45",
"@0x/contracts-utils": "^4.8.0", "@0x/contracts-utils": "^4.8.1",
"@0x/contracts-zero-ex": "^0.28.4", "@0x/contracts-zero-ex": "^0.28.5",
"@0x/sol-compiler": "^4.7.3", "@0x/sol-compiler": "^4.7.5",
"@0x/subproviders": "^6.5.3", "@0x/subproviders": "^6.6.0",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-app-eth": "^4.3.0",
"@types/web3-provider-engine": "^14.0.0", "@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"ethereumjs-util": "^7.1.0", "ethereumjs-util": "^7.1.0",
"ethers": "~4.0.4", "ethers": "~4.0.4",
"lodash": "^4.17.11" "lodash": "^4.17.11"

View File

@@ -1,4 +1,13 @@
[ [
{
"version": "1.9.0",
"changes": [
{
"note": "Add 'TreasuryVote' class"
}
],
"timestamp": 1631710679
},
{ {
"timestamp": 1630459879, "timestamp": 1630459879,
"version": "1.8.4", "version": "1.8.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.9.0 - _September 15, 2021_
* Add 'TreasuryVote' class
## v1.8.4 - _September 1, 2021_ ## v1.8.4 - _September 1, 2021_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0x/protocol-utils", "name": "@0x/protocol-utils",
"version": "1.8.4", "version": "1.9.0",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -41,17 +41,17 @@
}, },
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/protocol-utils", "homepage": "https://github.com/0xProject/protocol/tree/main/packages/protocol-utils",
"devDependencies": { "devDependencies": {
"@0x/dev-utils": "^4.2.7", "@0x/dev-utils": "^4.2.9",
"@0x/ts-doc-gen": "^0.0.28", "@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4", "@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3", "@0x/types": "^3.3.4",
"@0x/typescript-typings": "^5.2.0", "@0x/typescript-typings": "^5.2.1",
"@types/bn.js": "^4.11.0", "@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7", "@types/mocha": "^5.2.7",
"@types/node": "12.12.54", "@types/node": "12.12.54",
"@types/web3-provider-engine": "^14.0.0", "@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^3.5.0", "ethereum-types": "^3.6.0",
"mocha": "^6.2.0", "mocha": "^6.2.0",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"shx": "^0.2.2", "shx": "^0.2.2",
@@ -62,13 +62,13 @@
"web3-provider-engine": "14.0.6" "web3-provider-engine": "14.0.6"
}, },
"dependencies": { "dependencies": {
"@0x/assert": "^3.0.27", "@0x/assert": "^3.0.29",
"@0x/contract-addresses": "^6.7.0", "@0x/contract-addresses": "^6.7.0",
"@0x/contract-wrappers": "^13.17.6", "@0x/contract-wrappers": "^13.17.7",
"@0x/json-schemas": "^6.1.3", "@0x/json-schemas": "^6.3.0",
"@0x/subproviders": "^6.5.3", "@0x/subproviders": "^6.6.0",
"@0x/utils": "^6.4.3", "@0x/utils": "^6.4.4",
"@0x/web3-wrapper": "^7.5.3", "@0x/web3-wrapper": "^7.6.0",
"chai": "^4.0.1", "chai": "^4.0.1",
"ethereumjs-util": "^7.0.10", "ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4", "ethers": "~4.0.4",

View File

@@ -9,3 +9,4 @@ export * from './signature_utils';
export * from './transformer_utils'; export * from './transformer_utils';
export * from './constants'; export * from './constants';
export * from './vip_utils'; export * from './vip_utils';
export * from './treasury_votes';

View File

@@ -0,0 +1,85 @@
import { BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { ZERO } from './constants';
import { EIP712_DOMAIN_PARAMETERS, getTypeHash } from './eip712_utils';
import { eip712SignHashWithKey, Signature } from './signature_utils';
const VOTE_DEFAULT_VALUES = {
proposalId: ZERO,
support: false,
operatedPoolIds: [] as string[],
chainId: 1,
version: '1.0.0',
verifyingContract: NULL_ADDRESS,
};
export type TreasuryVoteFields = typeof VOTE_DEFAULT_VALUES;
export class TreasuryVote {
public static readonly CONTRACT_NAME = 'Zrx Treasury';
public static readonly MESSAGE_STRUCT_NAME = 'TreasuryVote';
public static readonly MESSAGE_STRUCT_ABI = [
{ type: 'uint256', name: 'proposalId' },
{ type: 'bool', name: 'support' },
{ type: 'bytes32[]', name: 'operatedPoolIds' },
];
public static readonly MESSAGE_TYPE_HASH = getTypeHash(
TreasuryVote.MESSAGE_STRUCT_NAME,
TreasuryVote.MESSAGE_STRUCT_ABI,
);
public static readonly DOMAIN_STRUCT_NAME = 'EIP712Domain';
public static readonly DOMAIN_TYPE_HASH = getTypeHash(TreasuryVote.DOMAIN_STRUCT_NAME, EIP712_DOMAIN_PARAMETERS);
public proposalId: BigNumber;
public support: boolean;
public operatedPoolIds: string[];
public chainId: number;
public version: string;
public verifyingContract: string;
constructor(fields: Partial<TreasuryVoteFields> = {}) {
const _fields = { ...VOTE_DEFAULT_VALUES, ...fields };
this.proposalId = _fields.proposalId;
this.support = _fields.support;
this.operatedPoolIds = _fields.operatedPoolIds;
this.chainId = _fields.chainId;
this.version = _fields.version;
this.verifyingContract = _fields.verifyingContract;
}
public getDomainHash(): string {
return hexUtils.hash(
hexUtils.concat(
hexUtils.leftPad(TreasuryVote.DOMAIN_TYPE_HASH),
hexUtils.hash(hexUtils.toHex(Buffer.from(TreasuryVote.CONTRACT_NAME))),
hexUtils.leftPad(this.chainId),
hexUtils.hash(hexUtils.toHex(Buffer.from(this.version))),
hexUtils.leftPad(this.verifyingContract),
),
);
}
public getStructHash(): string {
return hexUtils.hash(
hexUtils.concat(
hexUtils.leftPad(TreasuryVote.MESSAGE_TYPE_HASH),
hexUtils.leftPad(this.proposalId),
hexUtils.leftPad(this.support ? 1 : 0),
hexUtils.hash(
ethUtil.toBuffer(hexUtils.concat(...this.operatedPoolIds.map(id => hexUtils.leftPad(id)))),
),
),
);
}
public getEIP712Hash(): string {
return hexUtils.hash(hexUtils.toHex(hexUtils.concat('0x1901', this.getDomainHash(), this.getStructHash())));
}
public getSignatureWithKey(privateKey: string): Signature {
return eip712SignHashWithKey(this.getEIP712Hash(), privateKey);
}
}

276
yarn.lock
View File

@@ -643,19 +643,20 @@
npmlog "^4.1.2" npmlog "^4.1.2"
write-file-atomic "^2.3.0" write-file-atomic "^2.3.0"
"@0x/abi-gen@^5.6.0": "@0x/abi-gen@^5.6.2":
version "5.6.0" version "5.6.2"
resolved "https://registry.yarnpkg.com/@0x/abi-gen/-/abi-gen-5.6.0.tgz#2b022efe77a35f5589624633d880d794d0a16bde" resolved "https://registry.yarnpkg.com/@0x/abi-gen/-/abi-gen-5.6.2.tgz#a31b26b93b061ceb8513424d622119c78b3ed0e9"
integrity sha512-G+B9/VEfsOc8IOgUgkIdFiC+0RNg1DTR921WOxOxcvLsls9m9lBudl7hFrU03N1QdbFFP08e+HDj1kS2Q+SzEQ==
dependencies: dependencies:
"@0x/types" "^3.3.3" "@0x/types" "^3.3.4"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.3" "@0x/utils" "^6.4.4"
"@types/node" "12.12.54" "@types/node" "12.12.54"
"@types/toposort" "^2.0.1" "@types/toposort" "^2.0.1"
chalk "^2.3.0" chalk "^2.3.0"
change-case "^3.0.2" change-case "^3.0.2"
cli-format "^3.0.9" cli-format "^3.0.9"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
glob "^7.1.2" glob "^7.1.2"
handlebars "^4.1.2" handlebars "^4.1.2"
lodash "^4.17.11" lodash "^4.17.11"
@@ -676,6 +677,18 @@
lodash "^4.17.11" lodash "^4.17.11"
valid-url "^1.0.9" valid-url "^1.0.9"
"@0x/assert@^3.0.29":
version "3.0.29"
resolved "https://registry.yarnpkg.com/@0x/assert/-/assert-3.0.29.tgz#604e415b943140a1577c9389b04766909a60b589"
integrity sha512-EiF8TwCtM17KFcLy2FYVzu3+7K51VyUNs9ZQ/Wf8tWDeTWrIh1ixKGsNtRnL9sR5SPqOLwKR3lbGn+zPlxw+Yw==
dependencies:
"@0x/json-schemas" "^6.3.0"
"@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.4"
"@types/node" "12.12.54"
lodash "^4.17.11"
valid-url "^1.0.9"
"@0x/assert@^3.0.6": "@0x/assert@^3.0.6":
version "3.0.21" version "3.0.21"
resolved "https://registry.yarnpkg.com/@0x/assert/-/assert-3.0.21.tgz#b385868d1833625912fd9173a2477be5a4090aed" resolved "https://registry.yarnpkg.com/@0x/assert/-/assert-3.0.21.tgz#b385868d1833625912fd9173a2477be5a4090aed"
@@ -704,6 +717,24 @@
js-sha3 "^0.7.0" js-sha3 "^0.7.0"
uuid "^3.3.2" uuid "^3.3.2"
"@0x/base-contract@^6.4.2":
version "6.4.2"
resolved "https://registry.yarnpkg.com/@0x/base-contract/-/base-contract-6.4.2.tgz#d87cb5416613d29d2ec71c60d4a7c6cdd5c48694"
integrity sha512-lcmsXGJ2ImiO1tJoWefYiQ8/WRSdQ4BPA8XulYqVQ4su6PYjLa1XvU91zM779QrIPeRo8fL7FUvGE7CkyG/gwA==
dependencies:
"@0x/assert" "^3.0.29"
"@0x/json-schemas" "^6.3.0"
"@0x/utils" "^6.4.4"
"@0x/web3-wrapper" "^7.6.0"
"@types/node" "12.12.54"
ethereumjs-account "^3.0.0"
ethereumjs-blockstream "^7.0.0"
ethereumjs-util "^7.1.0"
ethereumjs-vm "^4.2.0"
ethers "~4.0.4"
js-sha3 "^0.7.0"
uuid "^3.3.2"
"@0x/contracts-asset-proxy@^3.7.19": "@0x/contracts-asset-proxy@^3.7.19":
version "3.7.19" version "3.7.19"
resolved "https://registry.yarnpkg.com/@0x/contracts-asset-proxy/-/contracts-asset-proxy-3.7.19.tgz#ee621a233f4d77b439c74c5b8d70db2e1ed001c4" resolved "https://registry.yarnpkg.com/@0x/contracts-asset-proxy/-/contracts-asset-proxy-3.7.19.tgz#ee621a233f4d77b439c74c5b8d70db2e1ed001c4"
@@ -804,17 +835,18 @@
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.0"
ethereum-types "^3.5.0" ethereum-types "^3.5.0"
"@0x/contracts-gen@^2.0.38": "@0x/contracts-gen@^2.0.40":
version "2.0.38" version "2.0.40"
resolved "https://registry.yarnpkg.com/@0x/contracts-gen/-/contracts-gen-2.0.38.tgz#6f2977e2bcb299b5e8a32f45d7eca73d19e34c50" resolved "https://registry.yarnpkg.com/@0x/contracts-gen/-/contracts-gen-2.0.40.tgz#526c25991125b5a4deb745e470b3c64cd8673095"
integrity sha512-Luj6R4DtPI7KHr3tUSdarudNiySd6GY1mvfhu8566K76oq4aK1no1hf0pyvy9tQLJDViNePP8Ad5KcEmC89sAg==
dependencies: dependencies:
"@0x/sol-compiler" "^4.7.3" "@0x/sol-compiler" "^4.7.5"
"@0x/sol-resolver" "^3.1.8" "@0x/sol-resolver" "^3.1.9"
"@0x/types" "^3.3.3" "@0x/types" "^3.3.4"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.3" "@0x/utils" "^6.4.4"
"@types/node" "12.12.54" "@types/node" "12.12.54"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
lodash "^4.17.11" lodash "^4.17.11"
mkdirp "^0.5.1" mkdirp "^0.5.1"
prettier "^1.16.3" prettier "^1.16.3"
@@ -839,9 +871,10 @@
ethereum-types "^3.5.0" ethereum-types "^3.5.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.0.10"
"@0x/contracts-zero-ex@^0.27.0": "@0x/contracts-zero-ex@^0.27.1":
version "0.27.1" version "0.27.1"
resolved "https://registry.yarnpkg.com/@0x/contracts-zero-ex/-/contracts-zero-ex-0.27.1.tgz#968fe9d8134972cb464f7c4a33c4e4089ba9218e" resolved "https://registry.yarnpkg.com/@0x/contracts-zero-ex/-/contracts-zero-ex-0.27.1.tgz#968fe9d8134972cb464f7c4a33c4e4089ba9218e"
integrity sha512-IDc0pmMtl/92hkhOqlu+dDyIvLtGtwjjE/kdS6x+jwOyNG8sn5sbkwZ3u3PbHk72dND7E0I7BBY9VEXTB1PY/Q==
dependencies: dependencies:
"@0x/base-contract" "^6.4.0" "@0x/base-contract" "^6.4.0"
"@0x/protocol-utils" "^1.8.1" "@0x/protocol-utils" "^1.8.1"
@@ -853,22 +886,23 @@
ethereum-types "^3.5.0" ethereum-types "^3.5.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.0.10"
"@0x/dev-utils@^4.2.7": "@0x/dev-utils@^4.2.9":
version "4.2.7" version "4.2.9"
resolved "https://registry.yarnpkg.com/@0x/dev-utils/-/dev-utils-4.2.7.tgz#9c85a134cace5a423a75221241fd687df81f3bbc" resolved "https://registry.yarnpkg.com/@0x/dev-utils/-/dev-utils-4.2.9.tgz#b048b139b0055ef3702682c42ccc2a3788a49f5d"
integrity sha512-juIjVvky0umt7Tmzhz2PF7e7pQEe1hbrV2XyB5tocRQVAsTD+TuwTG9VVKULQUptX+B/mF1mjb3WwEQV6y/yTQ==
dependencies: dependencies:
"@0x/subproviders" "^6.5.3" "@0x/subproviders" "^6.6.0"
"@0x/types" "^3.3.3" "@0x/types" "^3.3.4"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.3" "@0x/utils" "^6.4.4"
"@0x/web3-wrapper" "^7.5.3" "@0x/web3-wrapper" "^7.6.0"
"@types/node" "12.12.54" "@types/node" "12.12.54"
"@types/web3-provider-engine" "^14.0.0" "@types/web3-provider-engine" "^14.0.0"
chai "^4.0.1" chai "^4.0.1"
chai-as-promised "^7.1.0" chai-as-promised "^7.1.0"
chai-bignumber "^3.0.0" chai-bignumber "^3.0.0"
dirty-chai "^2.0.1" dirty-chai "^2.0.1"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
lodash "^4.17.11" lodash "^4.17.11"
web3-provider-engine "14.0.6" web3-provider-engine "14.0.6"
@@ -890,6 +924,16 @@
ajv "^6.12.5" ajv "^6.12.5"
lodash.values "^4.3.0" lodash.values "^4.3.0"
"@0x/json-schemas@^6.3.0":
version "6.3.0"
resolved "https://registry.yarnpkg.com/@0x/json-schemas/-/json-schemas-6.3.0.tgz#b7addf8167af492f6667561caa9a62b3ec567696"
integrity sha512-cygnTxvJhLYcDeI05Olp4CN0BKQRs2rC3L0gRCU+mV/IMDNYlkKqNluHmzoHLBleN55uLZZZybSLOsbE5HfIlQ==
dependencies:
"@0x/typescript-typings" "^5.2.1"
"@types/node" "12.12.54"
ajv "^6.12.5"
lodash.values "^4.3.0"
"@0x/mesh-rpc-client@^9.4.2": "@0x/mesh-rpc-client@^9.4.2":
version "9.4.2" version "9.4.2"
resolved "https://registry.yarnpkg.com/@0x/mesh-rpc-client/-/mesh-rpc-client-9.4.2.tgz#6f9690fb1cb37fb0c2fd3907241af0e543c78451" resolved "https://registry.yarnpkg.com/@0x/mesh-rpc-client/-/mesh-rpc-client-9.4.2.tgz#6f9690fb1cb37fb0c2fd3907241af0e543c78451"
@@ -944,9 +988,10 @@
ethers "~4.0.4" ethers "~4.0.4"
lodash "^4.17.11" lodash "^4.17.11"
"@0x/quote-server@^6.0.2": "@0x/quote-server@^6.0.6":
version "6.0.2" version "6.0.6"
resolved "https://registry.yarnpkg.com/@0x/quote-server/-/quote-server-6.0.2.tgz#cb99e00c737e0f97a2a32bc7e7be6db65243c3af" resolved "https://registry.yarnpkg.com/@0x/quote-server/-/quote-server-6.0.6.tgz#0f0bf50647efc4bff039a491689974af7e8c5776"
integrity sha512-ubugDwCFDhOv8R8LWO4Z9BmWfm/KjbB92bg1nEHw2HzosOk1rLkQWnPCJGqbMzxHlt3EtLxXPrrZE2IxWBKgwQ==
dependencies: dependencies:
"@0x/json-schemas" "^6.0.1" "@0x/json-schemas" "^6.0.1"
"@0x/order-utils" "^10.2.4" "@0x/order-utils" "^10.2.4"
@@ -957,23 +1002,24 @@
express-async-handler "^1.1.4" express-async-handler "^1.1.4"
http-status-codes "^1.4.0" http-status-codes "^1.4.0"
"@0x/sol-compiler@^4.7.3": "@0x/sol-compiler@^4.7.5":
version "4.7.3" version "4.7.5"
resolved "https://registry.yarnpkg.com/@0x/sol-compiler/-/sol-compiler-4.7.3.tgz#d994661bc9c06a0a63b0e2f77ee6511d3cef488e" resolved "https://registry.yarnpkg.com/@0x/sol-compiler/-/sol-compiler-4.7.5.tgz#f744f836786f44747cfd23eb167067ce6f348136"
integrity sha512-vVsMNFLsR7ORuriZXCWloEhDZh3loaTkiFgFI3zTne7wOCwyMntZkgA7uij/iyOGrZW0XEbxAA+QjAYenroRfQ==
dependencies: dependencies:
"@0x/assert" "^3.0.27" "@0x/assert" "^3.0.29"
"@0x/json-schemas" "^6.1.3" "@0x/json-schemas" "^6.3.0"
"@0x/sol-resolver" "^3.1.8" "@0x/sol-resolver" "^3.1.9"
"@0x/types" "^3.3.3" "@0x/types" "^3.3.4"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.3" "@0x/utils" "^6.4.4"
"@0x/web3-wrapper" "^7.5.3" "@0x/web3-wrapper" "^7.6.0"
"@types/node" "12.12.54" "@types/node" "12.12.54"
"@types/yargs" "^11.0.0" "@types/yargs" "^11.0.0"
chalk "^2.3.0" chalk "^2.3.0"
chokidar "^3.0.2" chokidar "^3.0.2"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.1.0"
lodash "^4.17.11" lodash "^4.17.11"
mkdirp "^0.5.1" mkdirp "^0.5.1"
pluralize "^7.0.0" pluralize "^7.0.0"
@@ -985,74 +1031,79 @@
web3-eth-abi "^1.0.0-beta.24" web3-eth-abi "^1.0.0-beta.24"
yargs "^10.0.3" yargs "^10.0.3"
"@0x/sol-coverage@^4.0.37": "@0x/sol-coverage@^4.0.39":
version "4.0.37" version "4.0.39"
resolved "https://registry.yarnpkg.com/@0x/sol-coverage/-/sol-coverage-4.0.37.tgz#951363f1497cc65edf9bc76f37ac7824667e2c2b" resolved "https://registry.yarnpkg.com/@0x/sol-coverage/-/sol-coverage-4.0.39.tgz#27db909a3f35c625bbf271fa7ecd693eb880ed53"
integrity sha512-mARTgkNX4xkY8UVeYO1oQ0+iY9OJyeRHZbuiWizdeCRuoZth7qk8F1xbywZTCPyo6Pa4zmusi7poKRfHIFTFHA==
dependencies: dependencies:
"@0x/sol-tracing-utils" "^7.2.3" "@0x/sol-tracing-utils" "^7.2.5"
"@0x/subproviders" "^6.5.3" "@0x/subproviders" "^6.6.0"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@types/minimatch" "^3.0.3" "@types/minimatch" "^3.0.3"
"@types/node" "12.12.54" "@types/node" "12.12.54"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
lodash "^4.17.11" lodash "^4.17.11"
minimatch "^3.0.4" minimatch "^3.0.4"
web3-provider-engine "14.0.6" web3-provider-engine "14.0.6"
"@0x/sol-profiler@^4.1.27": "@0x/sol-profiler@^4.1.29":
version "4.1.27" version "4.1.29"
resolved "https://registry.yarnpkg.com/@0x/sol-profiler/-/sol-profiler-4.1.27.tgz#2bd14882dd204a7465b494149877daa16d86208d" resolved "https://registry.yarnpkg.com/@0x/sol-profiler/-/sol-profiler-4.1.29.tgz#e77e0ae50541e8acaf7cecb5378a60efd4282f11"
integrity sha512-4CbrNan9xF3auv0ZwjsoajgpqLO23eqcq1u9seSVriNs5IGxEOq4U5xxofvFIMaS0NQXnHJobuUT2qRayBbgkw==
dependencies: dependencies:
"@0x/sol-tracing-utils" "^7.2.3" "@0x/sol-tracing-utils" "^7.2.5"
"@0x/subproviders" "^6.5.3" "@0x/subproviders" "^6.6.0"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.3" "@0x/utils" "^6.4.4"
"@types/node" "12.12.54" "@types/node" "12.12.54"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.1.0"
lodash "^4.17.11" lodash "^4.17.11"
web3-provider-engine "14.0.6" web3-provider-engine "14.0.6"
"@0x/sol-resolver@^3.1.8": "@0x/sol-resolver@^3.1.9":
version "3.1.8" version "3.1.9"
resolved "https://registry.yarnpkg.com/@0x/sol-resolver/-/sol-resolver-3.1.8.tgz#eaaaf17052e88213e55daf2c6e39a585cc16fa0a" resolved "https://registry.yarnpkg.com/@0x/sol-resolver/-/sol-resolver-3.1.9.tgz#525c545c4ff4d0ff2ff99e433b2405778abe0693"
integrity sha512-N+GxAqtHzEgVsnj9k4yeE7xRqE2ymR+yo98j0s2VC8icjecVqm6LtqQpEpdPULEg20vA0aPdU/XY2q0xiCDpLg==
dependencies: dependencies:
"@0x/types" "^3.3.3" "@0x/types" "^3.3.4"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@types/node" "12.12.54" "@types/node" "12.12.54"
lodash "^4.17.11" lodash "^4.17.11"
"@0x/sol-trace@^3.0.37": "@0x/sol-trace@^3.0.39":
version "3.0.37" version "3.0.39"
resolved "https://registry.yarnpkg.com/@0x/sol-trace/-/sol-trace-3.0.37.tgz#915a1c7c4869f9a95994fdb24878997d5bc39450" resolved "https://registry.yarnpkg.com/@0x/sol-trace/-/sol-trace-3.0.39.tgz#caca4fbf049eda25185c09ab00c23cf37d44d9a2"
integrity sha512-Dg+jPjCnSmWL4t/tq/kQY8NOnAWy/g4HjFQYyL6uz8ioJ4gvCCV+2UADATb2OA7bqrvtbADJrw7icJ+/laqXuA==
dependencies: dependencies:
"@0x/sol-tracing-utils" "^7.2.3" "@0x/sol-tracing-utils" "^7.2.5"
"@0x/subproviders" "^6.5.3" "@0x/subproviders" "^6.6.0"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@types/node" "12.12.54" "@types/node" "12.12.54"
chalk "^2.3.0" chalk "^2.3.0"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.1.0"
lodash "^4.17.11" lodash "^4.17.11"
loglevel "^1.6.1" loglevel "^1.6.1"
web3-provider-engine "14.0.6" web3-provider-engine "14.0.6"
"@0x/sol-tracing-utils@^7.2.3": "@0x/sol-tracing-utils@^7.2.5":
version "7.2.3" version "7.2.5"
resolved "https://registry.yarnpkg.com/@0x/sol-tracing-utils/-/sol-tracing-utils-7.2.3.tgz#2a24969943315af4f86ceab12ad8bc34433069e5" resolved "https://registry.yarnpkg.com/@0x/sol-tracing-utils/-/sol-tracing-utils-7.2.5.tgz#19ced9ecf6811dab4133ea9acf4dfdd0987b14fd"
integrity sha512-ptffYU/KigOipFGwxWHqToQ/pbkbCyODBcxVTKeEW4MFlHeRMDRHypDM13VFAyAxqQwzvOfk22xeuLVUsKwPVQ==
dependencies: dependencies:
"@0x/dev-utils" "^4.2.7" "@0x/dev-utils" "^4.2.9"
"@0x/sol-compiler" "^4.7.3" "@0x/sol-compiler" "^4.7.5"
"@0x/sol-resolver" "^3.1.8" "@0x/sol-resolver" "^3.1.9"
"@0x/subproviders" "^6.5.3" "@0x/subproviders" "^6.6.0"
"@0x/typescript-typings" "^5.2.0" "@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.3" "@0x/utils" "^6.4.4"
"@0x/web3-wrapper" "^7.5.3" "@0x/web3-wrapper" "^7.6.0"
"@types/node" "12.12.54" "@types/node" "12.12.54"
"@types/solidity-parser-antlr" "^0.2.3" "@types/solidity-parser-antlr" "^0.2.3"
chalk "^2.3.0" chalk "^2.3.0"
ethereum-types "^3.5.0" ethereum-types "^3.6.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.1.0"
ethers "~4.0.4" ethers "~4.0.4"
glob "^7.1.2" glob "^7.1.2"
istanbul "^0.4.5" istanbul "^0.4.5"
@@ -1093,6 +1144,36 @@
optionalDependencies: optionalDependencies:
"@ledgerhq/hw-transport-node-hid" "^4.3.0" "@ledgerhq/hw-transport-node-hid" "^4.3.0"
"@0x/subproviders@^6.6.0":
version "6.6.0"
resolved "https://registry.yarnpkg.com/@0x/subproviders/-/subproviders-6.6.0.tgz#1743d44ae5e2be9ec48caddbf0f1a580f1672d32"
integrity sha512-fQ4efPH/io+TAYEsZuYj9YpoAy0fGWx8QZaWeNstxFT2Miph2aq4Bh+GGrQcXSjNx+prgdBDAGePJvtGP8Qs3Q==
dependencies:
"@0x/assert" "^3.0.29"
"@0x/types" "^3.3.4"
"@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.4"
"@0x/web3-wrapper" "^7.6.0"
"@ethereumjs/common" "^2.4.0"
"@ethereumjs/tx" "^3.3.0"
"@ledgerhq/hw-app-eth" "^4.3.0"
"@ledgerhq/hw-transport-u2f" "4.24.0"
"@types/hdkey" "^0.7.0"
"@types/node" "12.12.54"
"@types/web3-provider-engine" "^14.0.0"
bip39 "^2.5.0"
bn.js "^4.11.8"
ethereum-types "^3.6.0"
ethereumjs-util "^7.1.0"
ganache-core "^2.13.2"
hdkey "^0.7.1"
json-rpc-error "2.0.0"
lodash "^4.17.11"
semaphore-async-await "^1.5.1"
web3-provider-engine "14.0.6"
optionalDependencies:
"@ledgerhq/hw-transport-node-hid" "^4.3.0"
"@0x/ts-doc-gen@^0.0.28": "@0x/ts-doc-gen@^0.0.28":
version "0.0.28" version "0.0.28"
resolved "https://registry.yarnpkg.com/@0x/ts-doc-gen/-/ts-doc-gen-0.0.28.tgz#075f53268e99ece6448515a3347b1d51fe92365f" resolved "https://registry.yarnpkg.com/@0x/ts-doc-gen/-/ts-doc-gen-0.0.28.tgz#075f53268e99ece6448515a3347b1d51fe92365f"
@@ -1284,6 +1365,21 @@
ethers "~4.0.4" ethers "~4.0.4"
lodash "^4.17.11" lodash "^4.17.11"
"@0x/web3-wrapper@^7.6.0":
version "7.6.0"
resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-7.6.0.tgz#34ae5e32affc02ed425c7bb3402a26fd7880c999"
integrity sha512-yxvTT/w5PFfnbKZ9Xvt412fyhVfiNQ0ugFbJYr+X+Xye+Q9vZzzbfc2a3bJSO7w/HkZx7vND071F/jtqU1JsEg==
dependencies:
"@0x/assert" "^3.0.29"
"@0x/json-schemas" "^6.3.0"
"@0x/typescript-typings" "^5.2.1"
"@0x/utils" "^6.4.4"
"@types/node" "12.12.54"
ethereum-types "^3.6.0"
ethereumjs-util "^7.1.0"
ethers "~4.0.4"
lodash "^4.17.11"
"@0xproject/npm-cli-login@^0.0.11": "@0xproject/npm-cli-login@^0.0.11":
version "0.0.11" version "0.0.11"
resolved "https://registry.yarnpkg.com/@0xproject/npm-cli-login/-/npm-cli-login-0.0.11.tgz#3f1ec06112ce62aad300ff0575358f68aeecde2e" resolved "https://registry.yarnpkg.com/@0xproject/npm-cli-login/-/npm-cli-login-0.0.11.tgz#3f1ec06112ce62aad300ff0575358f68aeecde2e"
@@ -1353,6 +1449,14 @@
crc-32 "^1.2.0" crc-32 "^1.2.0"
ethereumjs-util "^7.0.9" ethereumjs-util "^7.0.9"
"@ethereumjs/common@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.4.0.tgz#2d67f6e6ba22246c5c89104e6b9a119fb3039766"
integrity sha512-UdkhFWzWcJCZVsj1O/H8/oqj/0RVYjLc1OhPjBrQdALAkQHpCp8xXI4WLnuGTADqTdJZww0NtgwG+TRPkXt27w==
dependencies:
crc-32 "^1.2.0"
ethereumjs-util "^7.1.0"
"@ethereumjs/tx@^3.1.3": "@ethereumjs/tx@^3.1.3":
version "3.1.4" version "3.1.4"
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.1.4.tgz#04cf9e9406da5f04a1a26c458744641f4b4b8dd0" resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.1.4.tgz#04cf9e9406da5f04a1a26c458744641f4b4b8dd0"
@@ -1360,6 +1464,14 @@
"@ethereumjs/common" "^2.2.0" "@ethereumjs/common" "^2.2.0"
ethereumjs-util "^7.0.10" ethereumjs-util "^7.0.10"
"@ethereumjs/tx@^3.3.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.0.tgz#14ed1b7fa0f28e1cd61e3ecbdab824205f6a4378"
integrity sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==
dependencies:
"@ethereumjs/common" "^2.4.0"
ethereumjs-util "^7.1.0"
"@ethersproject/abi@5.0.0-beta.153": "@ethersproject/abi@5.0.0-beta.153":
version "5.0.0-beta.153" version "5.0.0-beta.153"
resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz#43a37172b33794e4562999f6e2d555b7599a8eee" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz#43a37172b33794e4562999f6e2d555b7599a8eee"