Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_.set(this.balances.erc1155, [fromAddress, tokenAddress], fromBalances);
_.set(this.balances.erc1155, [toAddress, tokenAddress], toBalances);
break;
}
case AssetProxyId.MultiAsset: {
// tslint:disable-next-line:no-unused-variable
const [_proxyId, amounts, nestedAssetData] = await this._devUtils
.decodeMultiAssetData(assetData)
.callAsync();
for (const [i, amt] of amounts.entries()) {
const nestedAmount = amount.times(amt);
await this.transferAssetAsync(fromAddress, toAddress, nestedAmount, nestedAssetData[i]);
}
break;
}
case AssetProxyId.StaticCall:
// Do nothing
break;
default:
throw new Error(`Unhandled asset proxy ID: ${assetProxyId}`);
}
}
}
const registeredERC721ProxyInMAP = await multiAssetProxy.getAssetProxy(AssetProxyId.ERC721).callAsync();
warnIfMismatch(
registeredERC721ProxyInMAP,
erc721Proxy.address,
'Unexpected ERC721Proxy registered in MultiAssetProxy',
);
const registeredERC1155ProxyInMAP = await multiAssetProxy.getAssetProxy(AssetProxyId.ERC1155).callAsync();
warnIfMismatch(
registeredERC1155ProxyInMAP,
erc1155Proxy.address,
'Unexpected ERC1155Proxy registered in MultiAssetProxy',
);
const registeredStaticCallProxyInMAP = await multiAssetProxy.getAssetProxy(AssetProxyId.StaticCall).callAsync();
warnIfMismatch(
registeredStaticCallProxyInMAP,
addresses.staticCallProxy,
'Unexpected StaticCallProxy registered in MultiAssetProxy',
);
const registeredERC20BridgeProxyInMAP = await multiAssetProxy
.getAssetProxy(AssetProxyId.ERC20Bridge)
.callAsync();
warnIfMismatch(
registeredERC20BridgeProxyInMAP,
addresses.erc20BridgeProxy,
'Unexpected ERC20BridgeProxy registered in MultiAssetProxy',
);
}
const registeredERC1155Proxy = await exchangeV2.getAssetProxy(AssetProxyId.ERC1155).callAsync();
warnIfMismatch(
registeredERC1155Proxy,
erc1155Proxy.address,
'Unexpected ERC1155Proxy registered in ExchangeV2',
);
const registeredMultiAssetProxy = await exchangeV2.getAssetProxy(AssetProxyId.MultiAsset).callAsync();
warnIfMismatch(
registeredMultiAssetProxy,
multiAssetProxy.address,
'Unexpected MultiAssetProxy registered in ExchangeV2',
);
const registeredStaticCallProxy = await exchangeV2.getAssetProxy(AssetProxyId.StaticCall).callAsync();
warnIfMismatch(
registeredStaticCallProxy,
addresses.staticCallProxy,
'Unexpected StaticCallProxy registered in ExchangeV2',
);
}
callbackData,
};
}
case AssetProxyId.MultiAsset: {
const [amounts, nestedAssetData] = assetDataEncoder.getABIDecodedTransactionData<
[BigNumber[], string[]]
>('MultiAsset', assetData);
const multiAssetData: MultiAssetData = {
assetProxyId,
amounts,
nestedAssetData,
};
return multiAssetData;
}
case AssetProxyId.StaticCall:
const [callTarget, staticCallData, callResultHash] = assetDataEncoder.getABIDecodedTransactionData<
[string, string, string]
>('StaticCall', assetData);
return {
assetProxyId,
callTarget,
staticCallData,
callResultHash,
};
default:
throw new Error(`Unhandled asset proxy ID: ${assetProxyId}`);
}
},
/**