aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/asset_proxy/decoder.ts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-05 13:34:04 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:39:40 +0800
commit774d831fae5809408f9ddfcf9393d579416b1bfb (patch)
tree6ea66da84f218b54263aaec1d5c6f8a5b064abc6 /packages/contracts/test/asset_proxy/decoder.ts
parenta1b49d8389844c9b2d62ded91b76a23deb060ab6 (diff)
downloaddexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.gz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.zst
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.zip
Style updates to ERC721 onReceiver
Diffstat (limited to 'packages/contracts/test/asset_proxy/decoder.ts')
-rw-r--r--packages/contracts/test/asset_proxy/decoder.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/contracts/test/asset_proxy/decoder.ts b/packages/contracts/test/asset_proxy/decoder.ts
index f2668dfe6..6a60c07bb 100644
--- a/packages/contracts/test/asset_proxy/decoder.ts
+++ b/packages/contracts/test/asset_proxy/decoder.ts
@@ -25,6 +25,12 @@ describe('TestAssetDataDecoders', () => {
let testAddress: string;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
// Setup accounts & addresses
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
@@ -78,8 +84,12 @@ describe('TestAssetDataDecoders', () => {
it('should correctly decode ERC721 asset data with receiver data', async () => {
const tokenId = generatePseudoRandomSalt();
- const receiverData =
- ethUtil.bufferToHex(assetProxyUtils.encodeUint256(generatePseudoRandomSalt())) + 'FFFF';
+ const receiverDataFirst32Bytes = ethUtil.bufferToHex(
+ assetProxyUtils.encodeUint256(generatePseudoRandomSalt()),
+ );
+ const receiverDataExtraBytes = 'FFFF';
+ // We add extra bytes to generate a value that doesn't fit perfectly into one word
+ const receiverData = receiverDataFirst32Bytes + receiverDataExtraBytes;
const encodedAssetData = assetProxyUtils.encodeERC721AssetData(testAddress, tokenId, receiverData);
const expectedDecodedAssetData = assetProxyUtils.decodeERC721AssetData(encodedAssetData);
let decodedAssetProxyId: number;