@0x/contract-wrappers
: Regenerate ERC20BridgeSampler
wrapper.
This commit is contained in:
parent
bcee7546ae
commit
b6700af6a8
@ -5,6 +5,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Add `IZeroEx` wrapper",
|
"note": "Add `IZeroEx` wrapper",
|
||||||
"pr": 2626
|
"pr": 2626
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Update `ERC20BridgeSampler` wrapper",
|
||||||
|
"pr": 2633
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -381,8 +381,22 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
constant: true,
|
constant: true,
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
name: 'curveAddress',
|
name: 'curveInfo',
|
||||||
type: 'address',
|
type: 'tuple',
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
name: 'poolAddress',
|
||||||
|
type: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'sellQuoteFunctionSelector',
|
||||||
|
type: 'bytes4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'buyQuoteFunctionSelector',
|
||||||
|
type: 'bytes4',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'fromTokenIdx',
|
name: 'fromTokenIdx',
|
||||||
@ -450,20 +464,6 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
name: 'makerTokenAmounts',
|
name: 'makerTokenAmounts',
|
||||||
type: 'uint256[]',
|
type: 'uint256[]',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'opts',
|
|
||||||
type: 'tuple',
|
|
||||||
components: [
|
|
||||||
{
|
|
||||||
name: 'targetSlippageBps',
|
|
||||||
type: 'uint256',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'maxIterations',
|
|
||||||
type: 'uint256',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
name: 'sampleBuysFromKyberNetwork',
|
name: 'sampleBuysFromKyberNetwork',
|
||||||
outputs: [
|
outputs: [
|
||||||
@ -495,20 +495,6 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
name: 'makerTokenAmounts',
|
name: 'makerTokenAmounts',
|
||||||
type: 'uint256[]',
|
type: 'uint256[]',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'opts',
|
|
||||||
type: 'tuple',
|
|
||||||
components: [
|
|
||||||
{
|
|
||||||
name: 'targetSlippageBps',
|
|
||||||
type: 'uint256',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'maxIterations',
|
|
||||||
type: 'uint256',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
name: 'sampleBuysFromLiquidityProviderRegistry',
|
name: 'sampleBuysFromLiquidityProviderRegistry',
|
||||||
outputs: [
|
outputs: [
|
||||||
@ -575,8 +561,22 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
constant: true,
|
constant: true,
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
name: 'curveAddress',
|
name: 'curveInfo',
|
||||||
type: 'address',
|
type: 'tuple',
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
name: 'poolAddress',
|
||||||
|
type: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'sellQuoteFunctionSelector',
|
||||||
|
type: 'bytes4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'buyQuoteFunctionSelector',
|
||||||
|
type: 'bytes4',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'fromTokenIdx',
|
name: 'fromTokenIdx',
|
||||||
@ -1060,24 +1060,24 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sample buy quotes from Curve.
|
* Sample buy quotes from Curve.
|
||||||
* @param curveAddress Address of the Curve contract.
|
* @param curveInfo Curve information specific to this token pair.
|
||||||
* @param fromTokenIdx Index of the taker token (what to sell).
|
* @param fromTokenIdx Index of the taker token (what to sell).
|
||||||
* @param toTokenIdx Index of the maker token (what to buy).
|
* @param toTokenIdx Index of the maker token (what to buy).
|
||||||
* @param makerTokenAmounts Maker token buy amount for each sample.
|
* @param makerTokenAmounts Maker token buy amount for each sample.
|
||||||
* @returns takerTokenAmounts Taker amounts sold at each maker token amount.
|
* @returns takerTokenAmounts Taker amounts sold at each maker token amount.
|
||||||
*/
|
*/
|
||||||
public sampleBuysFromCurve(
|
public sampleBuysFromCurve(
|
||||||
curveAddress: string,
|
curveInfo: { poolAddress: string; sellQuoteFunctionSelector: string; buyQuoteFunctionSelector: string },
|
||||||
fromTokenIdx: BigNumber,
|
fromTokenIdx: BigNumber,
|
||||||
toTokenIdx: BigNumber,
|
toTokenIdx: BigNumber,
|
||||||
makerTokenAmounts: BigNumber[],
|
makerTokenAmounts: BigNumber[],
|
||||||
): ContractFunctionObj<BigNumber[]> {
|
): ContractFunctionObj<BigNumber[]> {
|
||||||
const self = (this as any) as ERC20BridgeSamplerContract;
|
const self = (this as any) as ERC20BridgeSamplerContract;
|
||||||
assert.isString('curveAddress', curveAddress);
|
|
||||||
assert.isBigNumber('fromTokenIdx', fromTokenIdx);
|
assert.isBigNumber('fromTokenIdx', fromTokenIdx);
|
||||||
assert.isBigNumber('toTokenIdx', toTokenIdx);
|
assert.isBigNumber('toTokenIdx', toTokenIdx);
|
||||||
assert.isArray('makerTokenAmounts', makerTokenAmounts);
|
assert.isArray('makerTokenAmounts', makerTokenAmounts);
|
||||||
const functionSignature = 'sampleBuysFromCurve(address,int128,int128,uint256[])';
|
const functionSignature = 'sampleBuysFromCurve((address,bytes4,bytes4),int128,int128,uint256[])';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
||||||
@ -1092,7 +1092,7 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
},
|
},
|
||||||
getABIEncodedTransactionData(): string {
|
getABIEncodedTransactionData(): string {
|
||||||
return self._strictEncodeArguments(functionSignature, [
|
return self._strictEncodeArguments(functionSignature, [
|
||||||
curveAddress.toLowerCase(),
|
curveInfo,
|
||||||
fromTokenIdx,
|
fromTokenIdx,
|
||||||
toTokenIdx,
|
toTokenIdx,
|
||||||
makerTokenAmounts,
|
makerTokenAmounts,
|
||||||
@ -1142,21 +1142,18 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
* @param takerToken Address of the taker token (what to sell).
|
* @param takerToken Address of the taker token (what to sell).
|
||||||
* @param makerToken Address of the maker token (what to buy).
|
* @param makerToken Address of the maker token (what to buy).
|
||||||
* @param makerTokenAmounts Maker token buy amount for each sample.
|
* @param makerTokenAmounts Maker token buy amount for each sample.
|
||||||
* @param opts `FakeBuyOptions` specifying target slippage and max iterations.
|
|
||||||
* @returns takerTokenAmounts Taker amounts sold at each maker token amount.
|
* @returns takerTokenAmounts Taker amounts sold at each maker token amount.
|
||||||
*/
|
*/
|
||||||
public sampleBuysFromKyberNetwork(
|
public sampleBuysFromKyberNetwork(
|
||||||
takerToken: string,
|
takerToken: string,
|
||||||
makerToken: string,
|
makerToken: string,
|
||||||
makerTokenAmounts: BigNumber[],
|
makerTokenAmounts: BigNumber[],
|
||||||
opts: { targetSlippageBps: BigNumber; maxIterations: BigNumber },
|
|
||||||
): ContractFunctionObj<BigNumber[]> {
|
): ContractFunctionObj<BigNumber[]> {
|
||||||
const self = (this as any) as ERC20BridgeSamplerContract;
|
const self = (this as any) as ERC20BridgeSamplerContract;
|
||||||
assert.isString('takerToken', takerToken);
|
assert.isString('takerToken', takerToken);
|
||||||
assert.isString('makerToken', makerToken);
|
assert.isString('makerToken', makerToken);
|
||||||
assert.isArray('makerTokenAmounts', makerTokenAmounts);
|
assert.isArray('makerTokenAmounts', makerTokenAmounts);
|
||||||
|
const functionSignature = 'sampleBuysFromKyberNetwork(address,address,uint256[])';
|
||||||
const functionSignature = 'sampleBuysFromKyberNetwork(address,address,uint256[],(uint256,uint256))';
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
||||||
@ -1174,7 +1171,6 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
takerToken.toLowerCase(),
|
takerToken.toLowerCase(),
|
||||||
makerToken.toLowerCase(),
|
makerToken.toLowerCase(),
|
||||||
makerTokenAmounts,
|
makerTokenAmounts,
|
||||||
opts,
|
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -1185,7 +1181,6 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
* @param takerToken Address of the taker token (what to sell).
|
* @param takerToken Address of the taker token (what to sell).
|
||||||
* @param makerToken Address of the maker token (what to buy).
|
* @param makerToken Address of the maker token (what to buy).
|
||||||
* @param makerTokenAmounts Maker token buy amount for each sample.
|
* @param makerTokenAmounts Maker token buy amount for each sample.
|
||||||
* @param opts `FakeBuyOptions` specifying target slippage and max iterations.
|
|
||||||
* @returns takerTokenAmounts Taker amounts sold at each maker token amount.
|
* @returns takerTokenAmounts Taker amounts sold at each maker token amount.
|
||||||
*/
|
*/
|
||||||
public sampleBuysFromLiquidityProviderRegistry(
|
public sampleBuysFromLiquidityProviderRegistry(
|
||||||
@ -1193,16 +1188,13 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
takerToken: string,
|
takerToken: string,
|
||||||
makerToken: string,
|
makerToken: string,
|
||||||
makerTokenAmounts: BigNumber[],
|
makerTokenAmounts: BigNumber[],
|
||||||
opts: { targetSlippageBps: BigNumber; maxIterations: BigNumber },
|
|
||||||
): ContractFunctionObj<BigNumber[]> {
|
): ContractFunctionObj<BigNumber[]> {
|
||||||
const self = (this as any) as ERC20BridgeSamplerContract;
|
const self = (this as any) as ERC20BridgeSamplerContract;
|
||||||
assert.isString('registryAddress', registryAddress);
|
assert.isString('registryAddress', registryAddress);
|
||||||
assert.isString('takerToken', takerToken);
|
assert.isString('takerToken', takerToken);
|
||||||
assert.isString('makerToken', makerToken);
|
assert.isString('makerToken', makerToken);
|
||||||
assert.isArray('makerTokenAmounts', makerTokenAmounts);
|
assert.isArray('makerTokenAmounts', makerTokenAmounts);
|
||||||
|
const functionSignature = 'sampleBuysFromLiquidityProviderRegistry(address,address,address,uint256[])';
|
||||||
const functionSignature =
|
|
||||||
'sampleBuysFromLiquidityProviderRegistry(address,address,address,uint256[],(uint256,uint256))';
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
||||||
@ -1221,7 +1213,6 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
takerToken.toLowerCase(),
|
takerToken.toLowerCase(),
|
||||||
makerToken.toLowerCase(),
|
makerToken.toLowerCase(),
|
||||||
makerTokenAmounts,
|
makerTokenAmounts,
|
||||||
opts,
|
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -1294,24 +1285,24 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sample sell quotes from Curve.
|
* Sample sell quotes from Curve.
|
||||||
* @param curveAddress Address of the Curve contract.
|
* @param curveInfo Curve information specific to this token pair.
|
||||||
* @param fromTokenIdx Index of the taker token (what to sell).
|
* @param fromTokenIdx Index of the taker token (what to sell).
|
||||||
* @param toTokenIdx Index of the maker token (what to buy).
|
* @param toTokenIdx Index of the maker token (what to buy).
|
||||||
* @param takerTokenAmounts Taker token sell amount for each sample.
|
* @param takerTokenAmounts Taker token sell amount for each sample.
|
||||||
* @returns makerTokenAmounts Maker amounts bought at each taker token amount.
|
* @returns makerTokenAmounts Maker amounts bought at each taker token amount.
|
||||||
*/
|
*/
|
||||||
public sampleSellsFromCurve(
|
public sampleSellsFromCurve(
|
||||||
curveAddress: string,
|
curveInfo: { poolAddress: string; sellQuoteFunctionSelector: string; buyQuoteFunctionSelector: string },
|
||||||
fromTokenIdx: BigNumber,
|
fromTokenIdx: BigNumber,
|
||||||
toTokenIdx: BigNumber,
|
toTokenIdx: BigNumber,
|
||||||
takerTokenAmounts: BigNumber[],
|
takerTokenAmounts: BigNumber[],
|
||||||
): ContractFunctionObj<BigNumber[]> {
|
): ContractFunctionObj<BigNumber[]> {
|
||||||
const self = (this as any) as ERC20BridgeSamplerContract;
|
const self = (this as any) as ERC20BridgeSamplerContract;
|
||||||
assert.isString('curveAddress', curveAddress);
|
|
||||||
assert.isBigNumber('fromTokenIdx', fromTokenIdx);
|
assert.isBigNumber('fromTokenIdx', fromTokenIdx);
|
||||||
assert.isBigNumber('toTokenIdx', toTokenIdx);
|
assert.isBigNumber('toTokenIdx', toTokenIdx);
|
||||||
assert.isArray('takerTokenAmounts', takerTokenAmounts);
|
assert.isArray('takerTokenAmounts', takerTokenAmounts);
|
||||||
const functionSignature = 'sampleSellsFromCurve(address,int128,int128,uint256[])';
|
const functionSignature = 'sampleSellsFromCurve((address,bytes4,bytes4),int128,int128,uint256[])';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber[]> {
|
||||||
@ -1326,7 +1317,7 @@ export class ERC20BridgeSamplerContract extends BaseContract {
|
|||||||
},
|
},
|
||||||
getABIEncodedTransactionData(): string {
|
getABIEncodedTransactionData(): string {
|
||||||
return self._strictEncodeArguments(functionSignature, [
|
return self._strictEncodeArguments(functionSignature, [
|
||||||
curveAddress.toLowerCase(),
|
curveInfo,
|
||||||
fromTokenIdx,
|
fromTokenIdx,
|
||||||
toTokenIdx,
|
toTokenIdx,
|
||||||
takerTokenAmounts,
|
takerTokenAmounts,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user