nilAddress to ZeroEx.NULL_ADDRESS

This commit is contained in:
Greg Hysen 2018-04-11 10:18:02 -07:00 committed by Amir Bandeali
parent 564ddff4c7
commit cc77f8489e
5 changed files with 22 additions and 27 deletions

View File

@ -42,7 +42,6 @@ describe('AssetProxyDispatcher', () => {
let erc20TransferProxyV1: ERC20Proxy_v1Contract;
let erc20TransferProxy: ERC20ProxyContract;
let erc721TransferProxy: ERC721ProxyContract;
const nilAddress = '0x0000000000000000000000000000000000000000';
const INITIAL_BALANCE = new BigNumber(10000);
before(async () => {
@ -129,7 +128,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
@ -140,7 +139,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
@ -149,7 +148,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC721,
erc721TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721);
@ -160,7 +159,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
@ -190,18 +189,18 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20TransferProxy.address);
// The following transaction will throw because the currentAddress is no longer nilAddress
// The following transaction will throw because the currentAddress is no longer ZeroEx.NULL_ADDRESS
return expect(
assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
),
).to.be.rejectedWith(constants.REVERT);
@ -211,7 +210,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
@ -220,12 +219,12 @@ describe('AssetProxyDispatcher', () => {
// The following transaction will reset the proxy address
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
nilAddress,
ZeroEx.NULL_ADDRESS,
erc20TransferProxy.address,
{ from: owner },
);
const newProxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(newProxyAddress).to.be.equal(nilAddress);
expect(newProxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS);
});
it('should throw if requesting address is not authorized', async () => {
@ -233,7 +232,7 @@ describe('AssetProxyDispatcher', () => {
assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: notOwner },
),
).to.be.rejectedWith(constants.REVERT);
@ -245,7 +244,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
@ -254,7 +253,7 @@ describe('AssetProxyDispatcher', () => {
it('should return NULL address if requesting non-existent proxy', async () => {
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(nilAddress);
expect(proxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS);
});
});
@ -264,7 +263,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);
@ -315,7 +314,7 @@ describe('AssetProxyDispatcher', () => {
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: owner },
);

View File

@ -43,7 +43,6 @@ describe('Asset Transfer Proxies', () => {
let erc20TransferProxyV1: ERC20Proxy_v1Contract;
let erc20TransferProxy: ERC20ProxyContract;
let erc721TransferProxy: ERC721ProxyContract;
const nilAddress = '0x0000000000000000000000000000000000000000';
const makerTokenId = new BigNumber('0x1010101010101010101010101010101010101010101010101010101010101010');
const INITIAL_BALANCE = new BigNumber(10000);

View File

@ -149,23 +149,22 @@ describe('Exchange', () => {
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, {
from: accounts[0],
});
const nilAddress = '0x0000000000000000000000000000000000000000';
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20_V1,
erc20TransferProxyV1.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC721,
erc721TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
zeroEx = new ZeroEx(provider, {

View File

@ -64,17 +64,16 @@ describe('Exchange', () => {
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, {
from: accounts[0],
});
const nilAddress = '0x0000000000000000000000000000000000000000';
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20_V1,
erc20TransferProxyV1.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });

View File

@ -114,17 +114,16 @@ describe('Exchange', () => {
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(erc20TransferProxyV1.address, {
from: accounts[0],
});
const nilAddress = '0x0000000000000000000000000000000000000000';
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20_V1,
erc20TransferProxyV1.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
await assetProxyDispatcher.addAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20TransferProxy.address,
nilAddress,
ZeroEx.NULL_ADDRESS,
{ from: accounts[0] },
);
const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });