aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2017-12-12 14:47:47 +0800
committerAmir Bandeali <abandeali1@gmail.com>2017-12-13 07:05:30 +0800
commitb97f140b78a0420943291af57d122bc90a488112 (patch)
tree29a3dfac4f8fecddba716171432270bbc53cfff4 /packages/contracts/test
parent1dda4d5f78705d96934a08f00000e9a98a3bbc3d (diff)
downloaddexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.tar
dexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.tar.gz
dexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.tar.bz2
dexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.tar.lz
dexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.tar.xz
dexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.tar.zst
dexon-sol-tools-b97f140b78a0420943291af57d122bc90a488112.zip
Add gas limits to failing tests
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/ts/ether_token.ts3
-rw-r--r--packages/contracts/test/ts/ether_token_v2.ts6
-rw-r--r--packages/contracts/test/ts/unlimited_allowance_token.ts9
-rw-r--r--packages/contracts/test/ts/unlimited_allowance_token_v2.ts9
-rw-r--r--packages/contracts/test/ts/zrx_token.ts15
5 files changed, 28 insertions, 14 deletions
diff --git a/packages/contracts/test/ts/ether_token.ts b/packages/contracts/test/ts/ether_token.ts
index 79c618ec2..db281e511 100644
--- a/packages/contracts/test/ts/ether_token.ts
+++ b/packages/contracts/test/ts/ether_token.ts
@@ -81,7 +81,8 @@ contract('EtherToken', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethTokensToWithdraw = initEthTokenBalance;
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account);
+ const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account,
+ {gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS});
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
diff --git a/packages/contracts/test/ts/ether_token_v2.ts b/packages/contracts/test/ts/ether_token_v2.ts
index 4931eb798..174403445 100644
--- a/packages/contracts/test/ts/ether_token_v2.ts
+++ b/packages/contracts/test/ts/ether_token_v2.ts
@@ -104,7 +104,8 @@ contract('EtherTokenV2', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethTokensToWithdraw = initEthTokenBalance;
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account);
+ const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account,
+ {gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS});
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
@@ -121,7 +122,8 @@ contract('EtherTokenV2', (accounts: string[]) => {
const initEthBalance = await getEthBalanceAsync(account);
const ethTokensToWithdraw = initEthTokenBalance;
expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account);
+ const txHash = await zeroEx.etherToken.withdrawAsync(ethTokensToWithdraw, account,
+ {gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS});
const receipt = await zeroEx.awaitTransactionMinedAsync(txHash);
const logs = receipt.logs;
diff --git a/packages/contracts/test/ts/unlimited_allowance_token.ts b/packages/contracts/test/ts/unlimited_allowance_token.ts
index 3b4d2db77..a328563cd 100644
--- a/packages/contracts/test/ts/unlimited_allowance_token.ts
+++ b/packages/contracts/test/ts/unlimited_allowance_token.ts
@@ -85,7 +85,8 @@ contract('UnlimitedAllowanceToken', (accounts: string[]) => {
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer);
+ await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
@@ -96,7 +97,8 @@ contract('UnlimitedAllowanceToken', (accounts: string[]) => {
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer);
+ await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
const newOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
const newSpenderBalance = await zeroEx.token.getBalanceAsync(tokenAddress, spender);
@@ -110,7 +112,8 @@ contract('UnlimitedAllowanceToken', (accounts: string[]) => {
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer);
+ await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);
diff --git a/packages/contracts/test/ts/unlimited_allowance_token_v2.ts b/packages/contracts/test/ts/unlimited_allowance_token_v2.ts
index 73e12f00c..137fcd8a5 100644
--- a/packages/contracts/test/ts/unlimited_allowance_token_v2.ts
+++ b/packages/contracts/test/ts/unlimited_allowance_token_v2.ts
@@ -92,7 +92,8 @@ contract('UnlimitedAllowanceTokenV2', (accounts: string[]) => {
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer);
+ await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
@@ -103,7 +104,8 @@ contract('UnlimitedAllowanceTokenV2', (accounts: string[]) => {
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer);
+ await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
const newOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
const newSpenderBalance = await zeroEx.token.getBalanceAsync(tokenAddress, spender);
@@ -117,7 +119,8 @@ contract('UnlimitedAllowanceTokenV2', (accounts: string[]) => {
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer);
+ await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);
diff --git a/packages/contracts/test/ts/zrx_token.ts b/packages/contracts/test/ts/zrx_token.ts
index 1c9655402..6312056b2 100644
--- a/packages/contracts/test/ts/zrx_token.ts
+++ b/packages/contracts/test/ts/zrx_token.ts
@@ -94,12 +94,14 @@ contract('ZRXToken', (accounts: string[]) => {
it('should return false if owner has insufficient balance', async () => {
const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
const amountToTransfer = ownerBalance.plus(1);
- let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
+ let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_APPROVE_GAS});
await zeroEx.awaitTransactionMinedAsync(txHash);
const didReturnTrue = await zrx.transferFrom.call(owner, spender, amountToTransfer, {from: spender});
expect(didReturnTrue).to.be.false();
// Reset allowance
- txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, new BigNumber(0));
+ txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, new BigNumber(0),
+ {gasLimit: constants.MAX_TOKEN_APPROVE_GAS});
await zeroEx.awaitTransactionMinedAsync(txHash);
});
@@ -127,7 +129,8 @@ contract('ZRXToken', (accounts: string[]) => {
const initSpenderAllowance = MAX_UINT;
let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
await zeroEx.awaitTransactionMinedAsync(txHash);
- txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer);
+ txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
await zeroEx.awaitTransactionMinedAsync(txHash);
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
@@ -144,7 +147,8 @@ contract('ZRXToken', (accounts: string[]) => {
const initSpenderAllowance = initOwnerBalance;
let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
await zeroEx.awaitTransactionMinedAsync(txHash);
- txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer);
+ txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
await zeroEx.awaitTransactionMinedAsync(txHash);
const newOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
@@ -160,7 +164,8 @@ contract('ZRXToken', (accounts: string[]) => {
const initSpenderAllowance = initOwnerBalance;
let txHash = await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
await zeroEx.awaitTransactionMinedAsync(txHash);
- txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer);
+ txHash = await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer,
+ {gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS});
await zeroEx.awaitTransactionMinedAsync(txHash);
const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);