ERC20BridgeSampler: Unlock full sampling on Kovan (#2459)
* `@0x/contracts-utils`: Update kovan addresses in `DeploymentConstants` * `@0x/contracts-erc20-bridge-sampler`: Make source IDs static on all networks, not inherited from `DeploymentConstants`. * `@0x/contract-addresses`: Update `ERC20BridgeSampler` addresses on mainnet and kovan. Co-authored-by: Lawrence Forman <me@merklejerk.com>
This commit is contained in:
parent
277a0adac9
commit
cb69921202
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "1.2.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Make source IDs static on all networks, not inherited from `DeploymentConstants`.",
|
||||||
|
"pr": 2459
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -40,6 +40,9 @@ contract ERC20BridgeSampler is
|
|||||||
uint256 constant internal KYBER_SAMPLE_CALL_GAS = 1500e3;
|
uint256 constant internal KYBER_SAMPLE_CALL_GAS = 1500e3;
|
||||||
uint256 constant internal UNISWAP_SAMPLE_CALL_GAS = 150e3;
|
uint256 constant internal UNISWAP_SAMPLE_CALL_GAS = 150e3;
|
||||||
uint256 constant internal ETH2DAI_SAMPLE_CALL_GAS = 1000e3;
|
uint256 constant internal ETH2DAI_SAMPLE_CALL_GAS = 1000e3;
|
||||||
|
address constant private UNISWAP_SOURCE = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
|
||||||
|
address constant private ETH2DAI_SOURCE = 0x39755357759cE0d7f32dC8dC45414CCa409AE24e;
|
||||||
|
address constant private KYBER_SOURCE = 0x818E6FECD516Ecc3849DAf6845e3EC868087B755;
|
||||||
|
|
||||||
/// @dev Query batches of native orders and sample sell quotes on multiple DEXes at once.
|
/// @dev Query batches of native orders and sample sell quotes on multiple DEXes at once.
|
||||||
/// @param orders Batches of Native orders to query.
|
/// @param orders Batches of Native orders to query.
|
||||||
@ -606,13 +609,13 @@ contract ERC20BridgeSampler is
|
|||||||
view
|
view
|
||||||
returns (uint256[] memory makerTokenAmounts)
|
returns (uint256[] memory makerTokenAmounts)
|
||||||
{
|
{
|
||||||
if (source == _getEth2DaiAddress()) {
|
if (source == ETH2DAI_SOURCE) {
|
||||||
return sampleSellsFromEth2Dai(takerToken, makerToken, takerTokenAmounts);
|
return sampleSellsFromEth2Dai(takerToken, makerToken, takerTokenAmounts);
|
||||||
}
|
}
|
||||||
if (source == _getUniswapExchangeFactoryAddress()) {
|
if (source == UNISWAP_SOURCE) {
|
||||||
return sampleSellsFromUniswap(takerToken, makerToken, takerTokenAmounts);
|
return sampleSellsFromUniswap(takerToken, makerToken, takerTokenAmounts);
|
||||||
}
|
}
|
||||||
if (source == _getKyberNetworkProxyAddress()) {
|
if (source == KYBER_SOURCE) {
|
||||||
return sampleSellsFromKyberNetwork(takerToken, makerToken, takerTokenAmounts);
|
return sampleSellsFromKyberNetwork(takerToken, makerToken, takerTokenAmounts);
|
||||||
}
|
}
|
||||||
revert("ERC20BridgeSampler/UNSUPPORTED_SOURCE");
|
revert("ERC20BridgeSampler/UNSUPPORTED_SOURCE");
|
||||||
@ -634,10 +637,10 @@ contract ERC20BridgeSampler is
|
|||||||
view
|
view
|
||||||
returns (uint256[] memory takerTokenAmounts)
|
returns (uint256[] memory takerTokenAmounts)
|
||||||
{
|
{
|
||||||
if (source == _getEth2DaiAddress()) {
|
if (source == ETH2DAI_SOURCE) {
|
||||||
return sampleBuysFromEth2Dai(takerToken, makerToken, makerTokenAmounts);
|
return sampleBuysFromEth2Dai(takerToken, makerToken, makerTokenAmounts);
|
||||||
}
|
}
|
||||||
if (source == _getUniswapExchangeFactoryAddress()) {
|
if (source == UNISWAP_SOURCE) {
|
||||||
return sampleBuysFromUniswap(takerToken, makerToken, makerTokenAmounts);
|
return sampleBuysFromUniswap(takerToken, makerToken, makerTokenAmounts);
|
||||||
}
|
}
|
||||||
revert("ERC20BridgeSampler/UNSUPPORTED_SOURCE");
|
revert("ERC20BridgeSampler/UNSUPPORTED_SOURCE");
|
||||||
|
@ -15,7 +15,6 @@ import { TestERC20BridgeSamplerContract } from './wrappers';
|
|||||||
|
|
||||||
blockchainTests('erc20-bridge-sampler', env => {
|
blockchainTests('erc20-bridge-sampler', env => {
|
||||||
let testContract: TestERC20BridgeSamplerContract;
|
let testContract: TestERC20BridgeSamplerContract;
|
||||||
let allSources: { [name: string]: string };
|
|
||||||
const RATE_DENOMINATOR = constants.ONE_ETHER;
|
const RATE_DENOMINATOR = constants.ONE_ETHER;
|
||||||
const MIN_RATE = new BigNumber('0.01');
|
const MIN_RATE = new BigNumber('0.01');
|
||||||
const MAX_RATE = new BigNumber('100');
|
const MAX_RATE = new BigNumber('100');
|
||||||
@ -30,6 +29,11 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const INVALID_ASSET_DATA = hexUtils.random(37);
|
const INVALID_ASSET_DATA = hexUtils.random(37);
|
||||||
const SELL_SOURCES = ['Eth2Dai', 'Kyber', 'Uniswap'];
|
const SELL_SOURCES = ['Eth2Dai', 'Kyber', 'Uniswap'];
|
||||||
const BUY_SOURCES = ['Eth2Dai', 'Uniswap'];
|
const BUY_SOURCES = ['Eth2Dai', 'Uniswap'];
|
||||||
|
const SOURCE_IDS: { [source: string]: string } = {
|
||||||
|
Uniswap: '0xc0a47dfe034b400b47bdad5fecda2621de6c4d95',
|
||||||
|
Eth2Dai: '0x39755357759ce0d7f32dc8dc45414cca409ae24e',
|
||||||
|
Kyber: '0x818e6fecd516ecc3849daf6845e3ec868087b755',
|
||||||
|
};
|
||||||
const EMPTY_ORDERS_ERROR = 'ERC20BridgeSampler/EMPTY_ORDERS';
|
const EMPTY_ORDERS_ERROR = 'ERC20BridgeSampler/EMPTY_ORDERS';
|
||||||
const UNSUPPORTED_ASSET_PROXY_ERROR = 'ERC20BridgeSampler/UNSUPPORTED_ASSET_PROXY';
|
const UNSUPPORTED_ASSET_PROXY_ERROR = 'ERC20BridgeSampler/UNSUPPORTED_ASSET_PROXY';
|
||||||
const INVALID_ASSET_DATA_ERROR = 'ERC20BridgeSampler/INVALID_ASSET_DATA';
|
const INVALID_ASSET_DATA_ERROR = 'ERC20BridgeSampler/INVALID_ASSET_DATA';
|
||||||
@ -45,14 +49,6 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
allSources = _.zipObject(
|
|
||||||
['Uniswap', 'Eth2Dai', 'Kyber'],
|
|
||||||
[
|
|
||||||
await testContract.uniswap().callAsync(),
|
|
||||||
await testContract.eth2Dai().callAsync(),
|
|
||||||
await testContract.kyber().callAsync(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getPackedHash(...args: string[]): string {
|
function getPackedHash(...args: string[]): string {
|
||||||
@ -340,7 +336,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const takerTokenAmounts = getSampleAmounts(TAKER_TOKEN);
|
const takerTokenAmounts = getSampleAmounts(TAKER_TOKEN);
|
||||||
const expectedFillableAmounts = ORDERS.map(getDeterministicFillableTakerAssetAmount);
|
const expectedFillableAmounts = ORDERS.map(getDeterministicFillableTakerAssetAmount);
|
||||||
const [orderInfos] = await testContract
|
const [orderInfos] = await testContract
|
||||||
.queryOrdersAndSampleSells(ORDERS, SIGNATURES, SELL_SOURCES.map(n => allSources[n]), takerTokenAmounts)
|
.queryOrdersAndSampleSells(ORDERS, SIGNATURES, SELL_SOURCES.map(n => SOURCE_IDS[n]), takerTokenAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(orderInfos).to.deep.eq(expectedFillableAmounts);
|
expect(orderInfos).to.deep.eq(expectedFillableAmounts);
|
||||||
});
|
});
|
||||||
@ -349,14 +345,14 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const sampleAmounts = getSampleAmounts(TAKER_TOKEN);
|
const sampleAmounts = getSampleAmounts(TAKER_TOKEN);
|
||||||
const expectedQuotes = getDeterministicSellQuotes(TAKER_TOKEN, MAKER_TOKEN, SELL_SOURCES, sampleAmounts);
|
const expectedQuotes = getDeterministicSellQuotes(TAKER_TOKEN, MAKER_TOKEN, SELL_SOURCES, sampleAmounts);
|
||||||
const [, quotes] = await testContract
|
const [, quotes] = await testContract
|
||||||
.queryOrdersAndSampleSells(ORDERS, SIGNATURES, SELL_SOURCES.map(n => allSources[n]), sampleAmounts)
|
.queryOrdersAndSampleSells(ORDERS, SIGNATURES, SELL_SOURCES.map(n => SOURCE_IDS[n]), sampleAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(expectedQuotes);
|
expect(quotes).to.deep.eq(expectedQuotes);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws if no orders are passed in', async () => {
|
it('throws if no orders are passed in', async () => {
|
||||||
const tx = testContract
|
const tx = testContract
|
||||||
.queryOrdersAndSampleSells([], [], SELL_SOURCES.map(n => allSources[n]), getSampleAmounts(TAKER_TOKEN))
|
.queryOrdersAndSampleSells([], [], SELL_SOURCES.map(n => SOURCE_IDS[n]), getSampleAmounts(TAKER_TOKEN))
|
||||||
.callAsync();
|
.callAsync();
|
||||||
return expect(tx).to.revertWith(EMPTY_ORDERS_ERROR);
|
return expect(tx).to.revertWith(EMPTY_ORDERS_ERROR);
|
||||||
});
|
});
|
||||||
@ -366,7 +362,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
.queryOrdersAndSampleSells(
|
.queryOrdersAndSampleSells(
|
||||||
ORDERS,
|
ORDERS,
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
[...SELL_SOURCES.map(n => allSources[n]), randomAddress()],
|
[...SELL_SOURCES.map(n => SOURCE_IDS[n]), randomAddress()],
|
||||||
getSampleAmounts(TAKER_TOKEN),
|
getSampleAmounts(TAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -381,7 +377,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
makerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
makerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
SELL_SOURCES.map(n => allSources[n]),
|
SELL_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(TAKER_TOKEN),
|
getSampleAmounts(TAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -396,7 +392,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
takerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
takerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
SELL_SOURCES.map(n => allSources[n]),
|
SELL_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(TAKER_TOKEN),
|
getSampleAmounts(TAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -411,7 +407,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
makerAssetData: INVALID_ASSET_DATA,
|
makerAssetData: INVALID_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
SELL_SOURCES.map(n => allSources[n]),
|
SELL_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(TAKER_TOKEN),
|
getSampleAmounts(TAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -426,7 +422,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
takerAssetData: INVALID_ASSET_DATA,
|
takerAssetData: INVALID_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
SELL_SOURCES.map(n => allSources[n]),
|
SELL_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(TAKER_TOKEN),
|
getSampleAmounts(TAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -446,7 +442,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const takerTokenAmounts = getSampleAmounts(MAKER_TOKEN);
|
const takerTokenAmounts = getSampleAmounts(MAKER_TOKEN);
|
||||||
const expectedFillableAmounts = ORDERS.map(getDeterministicFillableMakerAssetAmount);
|
const expectedFillableAmounts = ORDERS.map(getDeterministicFillableMakerAssetAmount);
|
||||||
const [orderInfos] = await testContract
|
const [orderInfos] = await testContract
|
||||||
.queryOrdersAndSampleBuys(ORDERS, SIGNATURES, BUY_SOURCES.map(n => allSources[n]), takerTokenAmounts)
|
.queryOrdersAndSampleBuys(ORDERS, SIGNATURES, BUY_SOURCES.map(n => SOURCE_IDS[n]), takerTokenAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(orderInfos).to.deep.eq(expectedFillableAmounts);
|
expect(orderInfos).to.deep.eq(expectedFillableAmounts);
|
||||||
});
|
});
|
||||||
@ -455,14 +451,14 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const sampleAmounts = getSampleAmounts(MAKER_TOKEN);
|
const sampleAmounts = getSampleAmounts(MAKER_TOKEN);
|
||||||
const expectedQuotes = getDeterministicBuyQuotes(TAKER_TOKEN, MAKER_TOKEN, BUY_SOURCES, sampleAmounts);
|
const expectedQuotes = getDeterministicBuyQuotes(TAKER_TOKEN, MAKER_TOKEN, BUY_SOURCES, sampleAmounts);
|
||||||
const [, quotes] = await testContract
|
const [, quotes] = await testContract
|
||||||
.queryOrdersAndSampleBuys(ORDERS, SIGNATURES, BUY_SOURCES.map(n => allSources[n]), sampleAmounts)
|
.queryOrdersAndSampleBuys(ORDERS, SIGNATURES, BUY_SOURCES.map(n => SOURCE_IDS[n]), sampleAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(expectedQuotes);
|
expect(quotes).to.deep.eq(expectedQuotes);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws if no orders are passed in', async () => {
|
it('throws if no orders are passed in', async () => {
|
||||||
const tx = testContract
|
const tx = testContract
|
||||||
.queryOrdersAndSampleBuys([], [], BUY_SOURCES.map(n => allSources[n]), getSampleAmounts(MAKER_TOKEN))
|
.queryOrdersAndSampleBuys([], [], BUY_SOURCES.map(n => SOURCE_IDS[n]), getSampleAmounts(MAKER_TOKEN))
|
||||||
.callAsync();
|
.callAsync();
|
||||||
return expect(tx).to.revertWith(EMPTY_ORDERS_ERROR);
|
return expect(tx).to.revertWith(EMPTY_ORDERS_ERROR);
|
||||||
});
|
});
|
||||||
@ -472,7 +468,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
.queryOrdersAndSampleBuys(
|
.queryOrdersAndSampleBuys(
|
||||||
ORDERS,
|
ORDERS,
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
[...BUY_SOURCES.map(n => allSources[n]), randomAddress()],
|
[...BUY_SOURCES.map(n => SOURCE_IDS[n]), randomAddress()],
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -485,7 +481,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
.queryOrdersAndSampleBuys(
|
.queryOrdersAndSampleBuys(
|
||||||
ORDERS,
|
ORDERS,
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
sources.map(n => allSources[n]),
|
sources.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -500,7 +496,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
makerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
makerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
BUY_SOURCES.map(n => allSources[n]),
|
BUY_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -515,7 +511,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
takerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
takerAssetData: INVALID_ASSET_PROXY_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
BUY_SOURCES.map(n => allSources[n]),
|
BUY_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -530,7 +526,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
makerAssetData: INVALID_ASSET_DATA,
|
makerAssetData: INVALID_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
BUY_SOURCES.map(n => allSources[n]),
|
BUY_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -545,7 +541,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
takerAssetData: INVALID_ASSET_DATA,
|
takerAssetData: INVALID_ASSET_DATA,
|
||||||
})),
|
})),
|
||||||
SIGNATURES,
|
SIGNATURES,
|
||||||
BUY_SOURCES.map(n => allSources[n]),
|
BUY_SOURCES.map(n => SOURCE_IDS[n]),
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
)
|
)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
@ -561,7 +557,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
it('returns empty quotes with no sample amounts', async () => {
|
it('returns empty quotes with no sample amounts', async () => {
|
||||||
const emptyQuotes = _.times(SELL_SOURCES.length, () => []);
|
const emptyQuotes = _.times(SELL_SOURCES.length, () => []);
|
||||||
const quotes = await testContract
|
const quotes = await testContract
|
||||||
.sampleSells(SELL_SOURCES.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, [])
|
.sampleSells(SELL_SOURCES.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, [])
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(emptyQuotes);
|
expect(quotes).to.deep.eq(emptyQuotes);
|
||||||
});
|
});
|
||||||
@ -570,7 +566,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const sampleAmounts = getSampleAmounts(TAKER_TOKEN);
|
const sampleAmounts = getSampleAmounts(TAKER_TOKEN);
|
||||||
const expectedQuotes = getDeterministicSellQuotes(TAKER_TOKEN, MAKER_TOKEN, SELL_SOURCES, sampleAmounts);
|
const expectedQuotes = getDeterministicSellQuotes(TAKER_TOKEN, MAKER_TOKEN, SELL_SOURCES, sampleAmounts);
|
||||||
const quotes = await testContract
|
const quotes = await testContract
|
||||||
.sampleSells(SELL_SOURCES.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
.sampleSells(SELL_SOURCES.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(expectedQuotes);
|
expect(quotes).to.deep.eq(expectedQuotes);
|
||||||
});
|
});
|
||||||
@ -580,7 +576,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const sources = _.sampleSize(SELL_SOURCES, 1);
|
const sources = _.sampleSize(SELL_SOURCES, 1);
|
||||||
const expectedQuotes = getDeterministicSellQuotes(TAKER_TOKEN, MAKER_TOKEN, sources, sampleAmounts);
|
const expectedQuotes = getDeterministicSellQuotes(TAKER_TOKEN, MAKER_TOKEN, sources, sampleAmounts);
|
||||||
const quotes = await testContract
|
const quotes = await testContract
|
||||||
.sampleSells(sources.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
.sampleSells(sources.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(expectedQuotes);
|
expect(quotes).to.deep.eq(expectedQuotes);
|
||||||
});
|
});
|
||||||
@ -588,7 +584,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
it('throws with an unsupported source', async () => {
|
it('throws with an unsupported source', async () => {
|
||||||
const tx = testContract
|
const tx = testContract
|
||||||
.sampleSells(
|
.sampleSells(
|
||||||
[...SELL_SOURCES.map(n => allSources[n]), randomAddress()],
|
[...SELL_SOURCES.map(n => SOURCE_IDS[n]), randomAddress()],
|
||||||
TAKER_TOKEN,
|
TAKER_TOKEN,
|
||||||
MAKER_TOKEN,
|
MAKER_TOKEN,
|
||||||
getSampleAmounts(TAKER_TOKEN),
|
getSampleAmounts(TAKER_TOKEN),
|
||||||
@ -606,7 +602,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
it('returns empty quotes with no sample amounts', async () => {
|
it('returns empty quotes with no sample amounts', async () => {
|
||||||
const emptyQuotes = _.times(BUY_SOURCES.length, () => []);
|
const emptyQuotes = _.times(BUY_SOURCES.length, () => []);
|
||||||
const quotes = await testContract
|
const quotes = await testContract
|
||||||
.sampleBuys(BUY_SOURCES.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, [])
|
.sampleBuys(BUY_SOURCES.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, [])
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(emptyQuotes);
|
expect(quotes).to.deep.eq(emptyQuotes);
|
||||||
});
|
});
|
||||||
@ -615,7 +611,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const sampleAmounts = getSampleAmounts(MAKER_TOKEN);
|
const sampleAmounts = getSampleAmounts(MAKER_TOKEN);
|
||||||
const expectedQuotes = getDeterministicBuyQuotes(TAKER_TOKEN, MAKER_TOKEN, BUY_SOURCES, sampleAmounts);
|
const expectedQuotes = getDeterministicBuyQuotes(TAKER_TOKEN, MAKER_TOKEN, BUY_SOURCES, sampleAmounts);
|
||||||
const quotes = await testContract
|
const quotes = await testContract
|
||||||
.sampleBuys(BUY_SOURCES.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
.sampleBuys(BUY_SOURCES.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(expectedQuotes);
|
expect(quotes).to.deep.eq(expectedQuotes);
|
||||||
});
|
});
|
||||||
@ -625,7 +621,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
const sources = _.sampleSize(BUY_SOURCES, 1);
|
const sources = _.sampleSize(BUY_SOURCES, 1);
|
||||||
const expectedQuotes = getDeterministicBuyQuotes(TAKER_TOKEN, MAKER_TOKEN, sources, sampleAmounts);
|
const expectedQuotes = getDeterministicBuyQuotes(TAKER_TOKEN, MAKER_TOKEN, sources, sampleAmounts);
|
||||||
const quotes = await testContract
|
const quotes = await testContract
|
||||||
.sampleBuys(sources.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
.sampleBuys(sources.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, sampleAmounts)
|
||||||
.callAsync();
|
.callAsync();
|
||||||
expect(quotes).to.deep.eq(expectedQuotes);
|
expect(quotes).to.deep.eq(expectedQuotes);
|
||||||
});
|
});
|
||||||
@ -633,7 +629,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
it('throws with an unsupported source', async () => {
|
it('throws with an unsupported source', async () => {
|
||||||
const tx = testContract
|
const tx = testContract
|
||||||
.sampleBuys(
|
.sampleBuys(
|
||||||
[...BUY_SOURCES.map(n => allSources[n]), randomAddress()],
|
[...BUY_SOURCES.map(n => SOURCE_IDS[n]), randomAddress()],
|
||||||
TAKER_TOKEN,
|
TAKER_TOKEN,
|
||||||
MAKER_TOKEN,
|
MAKER_TOKEN,
|
||||||
getSampleAmounts(MAKER_TOKEN),
|
getSampleAmounts(MAKER_TOKEN),
|
||||||
@ -645,7 +641,7 @@ blockchainTests('erc20-bridge-sampler', env => {
|
|||||||
it('throws if kyber is passed in as a source', async () => {
|
it('throws if kyber is passed in as a source', async () => {
|
||||||
const sources = [...BUY_SOURCES, 'Kyber'];
|
const sources = [...BUY_SOURCES, 'Kyber'];
|
||||||
const tx = testContract
|
const tx = testContract
|
||||||
.sampleBuys(sources.map(n => allSources[n]), TAKER_TOKEN, MAKER_TOKEN, getSampleAmounts(MAKER_TOKEN))
|
.sampleBuys(sources.map(n => SOURCE_IDS[n]), TAKER_TOKEN, MAKER_TOKEN, getSampleAmounts(MAKER_TOKEN))
|
||||||
.callAsync();
|
.callAsync();
|
||||||
return expect(tx).to.revertWith(UNSUPPORTED_SOURCE_ERROR);
|
return expect(tx).to.revertWith(UNSUPPORTED_SOURCE_ERROR);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "4.2.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Update kovan addresses in `DeploymentConstants`",
|
||||||
|
"pr": 2459
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -26,22 +26,30 @@ contract DeploymentConstants {
|
|||||||
// address constant private WETH_ADDRESS = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;
|
// address constant private WETH_ADDRESS = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;
|
||||||
/// @dev Mainnet address of the KyberNeworkProxy contract.
|
/// @dev Mainnet address of the KyberNeworkProxy contract.
|
||||||
address constant private KYBER_NETWORK_PROXY_ADDRESS = 0x818E6FECD516Ecc3849DAf6845e3EC868087B755;
|
address constant private KYBER_NETWORK_PROXY_ADDRESS = 0x818E6FECD516Ecc3849DAf6845e3EC868087B755;
|
||||||
|
// /// @dev Kovan address of the KyberNeworkProxy contract.
|
||||||
|
// address constant private KYBER_NETWORK_PROXY_ADDRESS = 0x692f391bCc85cefCe8C237C01e1f636BbD70EA4D;
|
||||||
/// @dev Mainnet address of the `UniswapExchangeFactory` contract.
|
/// @dev Mainnet address of the `UniswapExchangeFactory` contract.
|
||||||
address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
|
address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
|
||||||
|
// /// @dev Kovan address of the `UniswapExchangeFactory` contract.
|
||||||
|
// address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xD3E51Ef092B2845f10401a0159B2B96e8B6c3D30;
|
||||||
/// @dev Mainnet address of the Eth2Dai `MatchingMarket` contract.
|
/// @dev Mainnet address of the Eth2Dai `MatchingMarket` contract.
|
||||||
address constant private ETH2DAI_ADDRESS = 0x39755357759cE0d7f32dC8dC45414CCa409AE24e;
|
address constant private ETH2DAI_ADDRESS = 0x39755357759cE0d7f32dC8dC45414CCa409AE24e;
|
||||||
|
// /// @dev Kovan address of the Eth2Dai `MatchingMarket` contract.
|
||||||
|
// address constant private ETH2DAI_ADDRESS = 0x4A6bC4e803c62081ffEbCc8d227B5a87a58f1F8F ;
|
||||||
/// @dev Mainnet address of the `ERC20BridgeProxy` contract
|
/// @dev Mainnet address of the `ERC20BridgeProxy` contract
|
||||||
address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x8ED95d1746bf1E4dAb58d8ED4724f1Ef95B20Db0;
|
address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0x8ED95d1746bf1E4dAb58d8ED4724f1Ef95B20Db0;
|
||||||
// /// @dev Kovan address of the `ERC20BridgeProxy` contract
|
// /// @dev Kovan address of the `ERC20BridgeProxy` contract
|
||||||
// address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0xFb2DD2A1366dE37f7241C83d47DA58fd503E2C64;
|
// address constant private ERC20_BRIDGE_PROXY_ADDRESS = 0xFb2DD2A1366dE37f7241C83d47DA58fd503E2C64;
|
||||||
///@dev Mainnet address of the `Dai` (multi-collateral) contract
|
///@dev Mainnet address of the `Dai` (multi-collateral) contract
|
||||||
address constant private DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
|
address constant private DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
|
||||||
|
// ///@dev Kovan address of the `Dai` (multi-collateral) contract
|
||||||
|
// address constant private DAI_ADDRESS = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;
|
||||||
/// @dev Mainnet address of the `Chai` contract
|
/// @dev Mainnet address of the `Chai` contract
|
||||||
address constant private CHAI_ADDRESS = 0x06AF07097C9Eeb7fD685c692751D5C66dB49c215;
|
address constant private CHAI_ADDRESS = 0x06AF07097C9Eeb7fD685c692751D5C66dB49c215;
|
||||||
/// @dev Mainnet address of the 0x DevUtils contract.
|
/// @dev Mainnet address of the 0x DevUtils contract.
|
||||||
address constant private DEV_UTILS_ADDRESS = 0xcCc2431a7335F21d9268bA62F0B32B0f2EFC463f;
|
address constant private DEV_UTILS_ADDRESS = 0xcCc2431a7335F21d9268bA62F0B32B0f2EFC463f;
|
||||||
// /// @dev Kovan address of the 0x DevUtils contract.
|
// /// @dev Kovan address of the 0x DevUtils contract.
|
||||||
// address constant private DEV_UTILS_ADDRESS = 0x56A8Da16fd8a65768c97913402212EAB60531BaE;
|
// address constant private DEV_UTILS_ADDRESS = 0x161793Cdca4fF9E766A706c2C49c36AC1340bbcd;
|
||||||
/// @dev Kyber ETH pseudo-address.
|
/// @dev Kyber ETH pseudo-address.
|
||||||
address constant internal KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
address constant internal KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
||||||
/// @dev Mainnet address of the dYdX contract.
|
/// @dev Mainnet address of the dYdX contract.
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "4.4.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Update `ERC20BridgeSampler` on mainnet and kovan.",
|
||||||
|
"pr": 2459
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"devUtils": "0x161793cdca4ff9e766a706c2c49c36ac1340bbcd",
|
"devUtils": "0x161793cdca4ff9e766a706c2c49c36ac1340bbcd",
|
||||||
"erc20BridgeProxy": "0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0",
|
"erc20BridgeProxy": "0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0",
|
||||||
"uniswapBridge": "0x533344cfdf2a3e911e2cf4c6f5ed08e791f5355f",
|
"uniswapBridge": "0x533344cfdf2a3e911e2cf4c6f5ed08e791f5355f",
|
||||||
"erc20BridgeSampler": "0x25840bf3582cb9e5acabbf45148b3092ac3f6b56",
|
"erc20BridgeSampler": "0x19b883391f61ae82d282a93f829353fdc5920f7f",
|
||||||
"kyberBridge": "0xf342f3a80fdc9b48713d58fe97e17f5cc764ee62",
|
"kyberBridge": "0xf342f3a80fdc9b48713d58fe97e17f5cc764ee62",
|
||||||
"eth2DaiBridge": "0xe97ea901d034ba2e018155264f77c417ce7717f9",
|
"eth2DaiBridge": "0xe97ea901d034ba2e018155264f77c417ce7717f9",
|
||||||
"chaiBridge": "0x77c31eba23043b9a72d13470f3a3a311344d7438",
|
"chaiBridge": "0x77c31eba23043b9a72d13470f3a3a311344d7438",
|
||||||
@ -112,10 +112,10 @@
|
|||||||
"staking": "0x32b06d5611a03737a5f1834a24ccd641033fd89c",
|
"staking": "0x32b06d5611a03737a5f1834a24ccd641033fd89c",
|
||||||
"stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34",
|
"stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34",
|
||||||
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64",
|
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64",
|
||||||
"uniswapBridge": "0x0000000000000000000000000000000000000000",
|
"uniswapBridge": "0x8224aa8fe5c9f07d5a59c735386ff6cc6aaeb568",
|
||||||
"eth2DaiBridge": "0x0000000000000000000000000000000000000000",
|
"eth2DaiBridge": "0xd5a01c9b4e154d483aa57012a1115613df0032b1",
|
||||||
"erc20BridgeSampler": "0x8c9f255253bcf2c9539c887fee4d71c69fd035b9",
|
"erc20BridgeSampler": "0x476898f5aCf513d35d655F8128cE647a6D590094",
|
||||||
"kyberBridge": "0x0000000000000000000000000000000000000000",
|
"kyberBridge": "0xde7b2747624a647600fdb349184d0448ab954929",
|
||||||
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
||||||
"dydxBridge": "0x0000000000000000000000000000000000000000"
|
"dydxBridge": "0x0000000000000000000000000000000000000000"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user