@bancor/contracts-solidity
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -0,1 +1,9 @@ | ||
### 0.6.5 (2020-06-29) | ||
General | ||
* Renamed `rate` related functions to `targetAmount` for clarity | ||
LiquidityPoolV1Converter | ||
* Fixed an issue when adding liquidity that only added a fraction of the requested amount | ||
### 0.6.4 (2020-06-18) | ||
@@ -2,0 +10,0 @@ TokenHandler |
{ | ||
"name": "@bancor/contracts-solidity", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "The solidity version of the Bancor smart contracts is composed of many different components that work together to create the Bancor Network deployment.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -15,2 +15,3 @@ ## BancorFormula Contract Verification | ||
* `python RandomTestSale.py` | ||
* `python RandomTestTradeCC.py` | ||
* `python RandomTestTradeCPS.py` | ||
@@ -17,0 +18,0 @@ * `python RandomTestTradeFSC.py` |
@@ -474,18 +474,18 @@ /* global artifacts, contract, before, it, assert */ | ||
it('should throw when attempting to get the rate with an invalid source token adress', async () => { | ||
it('should throw when attempting to get the target amount with an invalid source token adress', async () => { | ||
let converter = await initConverter(type, accounts, true, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(utils.zeroAddress, getReserve1Address(isETHReserve), 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(utils.zeroAddress, getReserve1Address(isETHReserve), 500)); | ||
}); | ||
it('should throw when attempting to get the rate with an invalid target token address', async () => { | ||
it('should throw when attempting to get the target amount with an invalid target token address', async () => { | ||
let converter = await initConverter(type, accounts, true, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(getReserve1Address(isETHReserve), utils.zeroAddress, 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), utils.zeroAddress, 500)); | ||
}); | ||
it('should throw when attempting to get the rate with identical source/target addresses', async () => { | ||
it('should throw when attempting to get the target amount with identical source/target addresses', async () => { | ||
let converter = await initConverter(type, accounts, true, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(getReserve1Address(isETHReserve), getReserve1Address(isETHReserve), 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), getReserve1Address(isETHReserve), 500)); | ||
}); | ||
@@ -492,0 +492,0 @@ |
@@ -175,3 +175,3 @@ const utils = require('./helpers/Utils'); | ||
const diff = allowances[i].div(reserveAmounts[i]); | ||
assert(inRange(diff, '0', '0.004'), `allowance #${i + 1}: diff = ${diff.toFixed()}`); | ||
assert(inRange(diff, '0', '0.0000005'), `allowance #${i + 1}: diff = ${diff.toFixed()}`); | ||
} | ||
@@ -194,3 +194,3 @@ | ||
const diff = state[n - 1].balances[i].div(balances[i]); | ||
assert(inRange(diff, '0.99999999', '1'), `balance #${i + 1}: diff = ${diff.toFixed()}`); | ||
assert(inRange(diff, '0.999999996', '1'), `balance #${i + 1}: diff = ${diff.toFixed()}`); | ||
} | ||
@@ -197,0 +197,0 @@ } |
@@ -166,5 +166,5 @@ /* global artifacts, contract, before, it, assert */ | ||
it('verifies that rateAndFee returns a valid amount', async () => { | ||
it('verifies that targetAmountAndFee returns a valid amount', async () => { | ||
let converter = await initConverter(accounts, true, isETHReserve); | ||
let returnAmount = (await converter.rateAndFee.call(getReserve1Address(isETHReserve), reserveToken2.address, 500))[0]; | ||
let returnAmount = (await converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), reserveToken2.address, 500))[0]; | ||
assert.isNumber(returnAmount.toNumber()); | ||
@@ -174,12 +174,12 @@ assert.notEqual(returnAmount.toNumber(), 0); | ||
it('should throw when attempting to get the rate between the pool token and a reserve', async () => { | ||
it('should throw when attempting to get the target amount between the pool token and a reserve', async () => { | ||
let converter = await initConverter(accounts, true, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(tokenAddress, getReserve1Address(isETHReserve), 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(tokenAddress, getReserve1Address(isETHReserve), 500)); | ||
}); | ||
it('should throw when attempting to get the rate while the converter is not active', async () => { | ||
it('should throw when attempting to get the target amount while the converter is not active', async () => { | ||
let converter = await initConverter(accounts, false, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(getReserve1Address(isETHReserve), reserveToken2.address, 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), reserveToken2.address, 500)); | ||
}); | ||
@@ -247,6 +247,6 @@ | ||
it('verifies that rateAndFee returns the same amount as converting', async () => { | ||
it('verifies that targetAmountAndFee returns the same amount as converting', async () => { | ||
let converter = await initConverter(accounts, true, isETHReserve); | ||
let watcher = converter.Conversion(); | ||
let returnAmount = (await converter.rateAndFee.call(getReserve1Address(isETHReserve), reserveToken2.address, 500))[0]; | ||
let returnAmount = (await converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), reserveToken2.address, 500))[0]; | ||
@@ -253,0 +253,0 @@ let value = 0; |
@@ -151,5 +151,5 @@ /* global artifacts, contract, before, it, assert */ | ||
it('verifies that rateAndFee returns a valid amount', async () => { | ||
it('verifies that targetAmountAndFee returns a valid amount', async () => { | ||
let converter = await initConverter(accounts, true, isETHReserve); | ||
let returnAmount = (await converter.rateAndFee.call(getReserve1Address(isETHReserve), tokenAddress, 500))[0]; | ||
let returnAmount = (await converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), tokenAddress, 500))[0]; | ||
assert.isNumber(returnAmount.toNumber()); | ||
@@ -186,12 +186,12 @@ assert.notEqual(returnAmount.toNumber(), 0); | ||
it('should throw when attempting to get the purchase rate while the converter is not active', async () => { | ||
it('should throw when attempting to get the purchase target amount while the converter is not active', async () => { | ||
let converter = await initConverter(accounts, false, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(getReserve1Address(isETHReserve), tokenAddress, 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(getReserve1Address(isETHReserve), tokenAddress, 500)); | ||
}); | ||
it('should throw when attempting to get the sale rate while the converter is not active', async () => { | ||
it('should throw when attempting to get the sale target amount while the converter is not active', async () => { | ||
let converter = await initConverter(accounts, false, isETHReserve); | ||
await utils.catchRevert(converter.rateAndFee.call(tokenAddress, getReserve1Address(isETHReserve), 500)); | ||
await utils.catchRevert(converter.targetAmountAndFee.call(tokenAddress, getReserve1Address(isETHReserve), 500)); | ||
}); | ||
@@ -198,0 +198,0 @@ |
const utils = require('./helpers/Utils'); | ||
const TokenHandler = artifacts.require('TokenHandler'); | ||
const TokenHandler = artifacts.require('TestTokenHandler'); | ||
const TestStandardToken = artifacts.require('TestStandardToken'); | ||
@@ -25,9 +25,9 @@ const TestNonStandardToken = artifacts.require('TestNonStandardToken'); | ||
it(`approve with ok = ${ok} and ret = ${ret} should ${ok && ret ? 'not ' : ''}revert`, async () => { | ||
await test(ok && ret, tokenHandler.safeApprove(standardToken.address, accounts[0], 0)); | ||
await test(ok && ret, tokenHandler.testSafeApprove(standardToken.address, accounts[0], 0)); | ||
}); | ||
it(`transfer with ok = ${ok} and ret = ${ret} should ${ok && ret ? 'not ' : ''}revert`, async () => { | ||
await test(ok && ret, tokenHandler.safeTransfer(standardToken.address, accounts[0], 0)); | ||
await test(ok && ret, tokenHandler.testSafeTransfer(standardToken.address, accounts[0], 0)); | ||
}); | ||
it(`transferFrom with ok = ${ok} and ret = ${ret} should ${ok && ret ? 'not ' : ''}revert`, async () => { | ||
await test(ok && ret, tokenHandler.safeTransferFrom(standardToken.address, accounts[0], accounts[0], 0)); | ||
await test(ok && ret, tokenHandler.testSafeTransferFrom(standardToken.address, accounts[0], accounts[0], 0)); | ||
}); | ||
@@ -44,9 +44,9 @@ }); | ||
it(`approve with ok = ${ok} should ${ok ? 'not ' : ''}revert`, async () => { | ||
await test(ok, tokenHandler.safeApprove(nonStandardToken.address, accounts[0], 0)); | ||
await test(ok, tokenHandler.testSafeApprove(nonStandardToken.address, accounts[0], 0)); | ||
}); | ||
it(`transfer with ok = ${ok} should ${ok ? 'not ' : ''}revert`, async () => { | ||
await test(ok, tokenHandler.safeTransfer(nonStandardToken.address, accounts[0], 0)); | ||
await test(ok, tokenHandler.testSafeTransfer(nonStandardToken.address, accounts[0], 0)); | ||
}); | ||
it(`transferFrom with ok = ${ok} should ${ok ? 'not ' : ''}revert`, async () => { | ||
await test(ok, tokenHandler.safeTransferFrom(nonStandardToken.address, accounts[0], accounts[0], 0)); | ||
await test(ok, tokenHandler.testSafeTransferFrom(nonStandardToken.address, accounts[0], accounts[0], 0)); | ||
}); | ||
@@ -53,0 +53,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1555948
284
60