bancorprotocol / contracts-solidity Goto Github PK
View Code? Open in Web Editor NEWBancor Protocol Contracts
License: Other
Bancor Protocol Contracts
License: Other
...
✓ should throw when attempts to call multiple convertFor with wrong path index (82ms)
✓ should throw when attempts to call multiple convertFor with zero amount in the amounts array
1) verifies prioritized quick buy with trusted signature
> No events were emitted
✓ should throw when attempts to call quick convert prioritized with untrusted signature (200ms)
...
2865 passing (5m)
1 failing
1) Contract: BancorNetwork
verifies prioritized quick buy with trusted signature:
Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
at endReadableNT (_stream_readable.js:1085:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
I used the following procedure to perform the unit tests
https://github.com/CyberMiles/tim-research/blob/master/bancor/unit_testing/bancor_unit_testing.asciidoc
Kind regards
Tim
In the BancorConverter
contract, functions fund
and liquidate
are supported only when the sum of the weights is 100%.
In order to extend them for any weight-combination, I believe that we can simply change this:
connectorAmount = _amount.mul(connectorBalance).div(supply);
To this:
connectorAmount = _amount.mul(connectorBalance).div(supply).mul(MAX_WEIGHT / 2).div(connector.weight).sub(connectorBalance);
Or for slightly better accuracy, to this:
connectorAmount = _amount.mul(connectorBalance).mul(MAX_WEIGHT / 2).div(supply.mul(connector.weight)).sub(connectorBalance);
The line Connector storage connector = connectors[connectorToken];
will need to move above it.
Is there any way to discover all Token Relays and Smart Tokens to compose path
?
Faster, queueless Bancor would be great. And I want to initiate how Bancor will use Plasma.
It is not a simple way because it would require to update account based contract to UTXO based contract, and that disruptive change would be slightly bothersome for each Smart Tokens.
For now let's assume that all Smart Tokens apply that Plasma update, then all Smart Tokens may be on Plasma chain only for Bancor. And current planned EOS integration, wallet integration, bancor network and so on need to know how the Plasma for Bancor would be. That might make migration easier.
This topic must be more discussed for prosperity of both Bancor and Plasma.
I guess the forum is wrong in whitepaper P11 as cited aboved.
The forum should be
connected tokens paid out = Balance ×(1 - (1 - Token_Paid / Supply)^ (1 / CW))
I can verify this with a sample.
When the buyer sold 19.803902718556966005644821804556 smart token, how many connected token will he received?
with your forum :
connected tokens paid out = balance × ( (1 + tokens destroyed / supply ) ^ (1/CW)− 1)
= (250+10) × ( (1+19.803902718556966005644821804556/(1000 + 19.803902718556966005644821804556)) ^ (1/0.5) - 1)
= 260 * ((1+19.803902718556966005644821804556/1019.8039027185569660056448218046)^2 -1 )
= 260 × (1.01941932430907984037918767134177 ^ 2 - 1)
= 260 × 0.0392157587747808999782891469054
= 10.196097281443033994355178195405
with my forum:
connected tokens paid out = Balance ×(1 - (1 - tokens destroyed / Supply)^ (1 / CW))
= (250+10) × (1 - (1 - 19.803902718556966005644821804556 /(1000 +19.803902718556966005644821804556)^ (1 / 0.5) ))
= 260 × (1 - 0.98058067569092015962081232865823 ^ 2)
= 260 × (1 - 0.96153846153846153846153846153846)
= 260 × 0.03846153846153846153846153846154
= 9.9999999999999999999999999999994
my forum is more closer.
If you try to convert 750 units of the connected token into Smart Tokens, and then convert back, you'll
find the big difference.
In the beginning, the reserved Ethers is 300000*0.2=60000, BNT supply is 30000000BNT
the current price is 0.01ETH/BNT, BNT cap is 30000000BNT*0.01ETH/BNT=300000ETH
If some guy has 1000000BNT and 0ETH, just sales 1000000BNT and get 10000ETH
the price down to (60000-10000)/((30000000-1000000)*0.2)=0.00862ETH/BNT, now the reserved Ethers is 300000*0.2-10000=50000, BNT supply is 29000000BNT, BNT cap is 29000000BNT*0.00862ETH/BNT=249979ETH
and as soon as possible, the same guy buy 1100000BNT @ 0.00862ETH/BNT
the price up to (50000+1100000*0.00862)/((29000000+1100000)*0.2)=0.0098ETH/BNT,
now this guy has 1100000BNT (~10868ETH) and 518ETH, earned 868+518=1386ETH for a round, and he can keep manipulating the BNT contract.
After round 1, BNT supply is 30100000BNT, the BNT cap is 30100000BNT*0.0098ETH/BNT=294980ETH, which is less than original even there are more BNT issued.
All in all, this guy drains up the value from BNT network round by round by diluting the BNT!!!
Hello,
I think you must not be aware but your website is delivering Mixed Content and giving somethings HTTP and HTTPs, therefore very easy to hack your website.
Example files that you are delivering via HTTP:
http://www.bancor.network/static/fonts/333d8c_1_unhinted_0.woff
See picture how many things are not secure: (All Links in Red)
Using "power" function when numerator/denominator is > 0 and < 1 doesn't return the correct value. example: power(10, 20, 2, 4) or power(10, 20, 4, 2).
The tests in https://github.com/bancorprotocol/contracts/blob/master/solidity/test/BancorFormula.js do not check if the result is correct either.
In the white-paper, section 3.3 (Handling Price Slippage), the Sell formula is denoted by:
It should be noted that the values of connected tokens paid out
and tokens destroyed
are considered negative in this formula.
There have been several cases where users raised concerns about the formula (such as this one), due to this fact missing in the description.
If one wishes to input these variables as positive values, then the formula to use is denoted by:
This is also how the formula is implemented in the contract.
I'm working on integrating the BancorFormula for some emergent organization scheme and it happens that the formula's computation functions reverts in some situations. For instance if it try to call calculateSellReturn
with the following values formula.calculateSaleReturn(1000, 100, 100000, 999)
it throws a revert
error.
Unless this is a mistake from my side I feel like this is pretty tricky cause it means the market maker is not totally liquid ...
Starting in a clean environment, when calling truffle test
after npm install
, I get:
Error: Cannot find module '@babel/runtime/helpers/typeof'
A quick investigation shows that this error stems from require('web3-utils')
in several different tests.
It can be resolved by changing the version of web3-utils
in package.json
:
^1.0.0-beta.39
1.0.0-beta.37
or lowerTitle:
Build a dApp for Deploying Stable Liquidity Pools
Prize:
15 ETH
Challenge Description:
Bancor challenges developers to hack on one of the most exciting DeFi primitives - the decentralized liquidity pool. Liquidity pools are designed to perform non-custodial token-to-token conversions that also accrue value for liquidity providers who effectively act as passive market makers.
Up until now, liquidity pools have mostly been deployed with two volatile assets in their reserves. This has required liquidity providers to speculate on two volatile assets when contributing liquidity.
Bancor recently announced the release of USDB - a stable version of Bancor’s Network Token, BNT. USDB-based relays allow liquidity providers to plug into Bancor and generate fees from conversions without exposure to two volatile assets - which could dramatically reduce the risk of impermanent loss.
Now, we’re looking for a pioneering developer to create a DAPP that allows liquidity providers to transfer their liquidity from an existing Bancor liquidity pool (using BNT) to a Bancor liquidity pool that utilizes USDB.
Submission Requirements
For a certain token X, the dApp should enable the following process:
Important notes:
Judging Criteria:
Submission Deadline
October 4, 2019.
Winner Announcement Date
October 10, 2019.
Helpful tools:
Bancor Github: https://github.com/bancorprotocol/contracts
USDB Github: https://github.com/zachdoty/peg-usdb
Open-source liquidity portal built atop Bancor: bancor.cotrader.com & GitHub: https://github.com/CoTraderCore/Bancor-CoTrader-UI
Bancor Developer’s Telegram Channel: https://t.me/BancorDevelopers
Video explainer on Bancor community staking:
https://www.youtube.com/watch?v=oXTvHwRO61M&feature=youtu.be
Video explainer on Bancor liquidity pools (i.e., “Bancor Relays”):
https://blog.bancor.network/how-bancor-relays-work-c712a374374f
More resources at blog.bancor.network
https://github.com/bancorprotocol/contracts/blob/master/solidity/contracts/SmartToken.sol#L81
The destroy function is modified by ownerOnly, which is unnecessary.
Is master up to date with this?
https://etherscan.io/address/0x3839416bd0095d97bE9b354cBfB0F6807d4d609E#code
I have gone over the code in the BancorFormula.sol contract (https://github.com/bancorprotocol/contracts/blob/master/solidity/contracts/converter/BancorFormula.sol) and although there is some high-level documentation that helped me understand most of the hard-wired constants, there is half a function I need help with.
In the function optimalLog, lines 444-457 (as of commit 63480ca) compute the most significant 8 bits of the logarithm. But how are the following bits computed? The rest of the code seems to implement a series. If I'm not mistaken, term n is
[ 2n/(2n-1) - (x-1) ] / 2n * (x-1)^(2n - 1).
I can't match this to a Taylor / McLaurin series, as you have done elsewhere. Can anyone give a reference to what series is being used here?
Thanks.
We are now develop a great project, the first banking system on blockchain, the Decentralized Autonomous Bank, and we want to connect our token to the Bancor network. If there are any support from the community?
I have deep insight of the codebase of Bancor Protocol. We just need to redeploy another Changer and use the BNT as reserve token. That is quite simple for us.
The only problem is: how to start up a such kind Changer? A new ICO or other solutions?
I have been trying to use Bancor's API to convert ETH to tokens and vice versa. I can successfully convert ETH to DAI and pinging the server to get other conversion rates works as explained in the API documentation (1 JSON package returned from Bancor, sign it, send it - and it works). However, when converting DAI to ETH Bancor gives back 2 JSON packages. I've extensively tried sending all sorts of combinations (eg just the first, just the second, both, both with a time delay between them, etc) and it always fails. [Note: when the transaction fails I must then make a manual transaction to "clear" the account before sending another request. If not another API conversion will result in a "Blockchain Error" from Bancor]
I've manually converted DAI to ETH on the Bancor site and notice that using the developer tools in Firefox it seems to send 3 JSON packages. This is also confirmed when the transactions show up on etherscan.io.
I'm guessing I should be receiving a third JSON package to send to my ETH node or there is some other detail not covered in the documentation as to why I can only successfully convert in one direction right now.
Code:
publicKey = '0x1234567890'
privateKey = '1234567890'
body = {"blockchainType":"ethereum",
"fromCurrencyId":"{}".format('5a604b62c5e04600015b72d5'), # DAI
"toCurrencyId":"{}".format('5937d635231e97001f744267'), # ETH
"amount":"1000000000000000000", # in Wei
"minimumReturn":"980000000000000000", # amount in Wei * 0.98 per Bancor's suggestion
"ownerAddress":"{}".format(publicKey)}
w3 = Web3(HTTPProvider('https://mainnet.infura.io/v3/your_node'))
convertData = requests.post('https://api.bancor.network/0.1/currencies/convert', data=body)
account = Account()
acct = account.privateKeyToAccount(privateKey)
necessary = w3.eth.accounts
txn = convertData['data'][0] # copy paste this part again with index 1 to send the second package
txn['gas'] = convertData['data'][0]['gasLimit']
txn['to'] = Web3.toChecksumAddress(txn['to'])
del txn['gasLimit']
txn['from'] = Web3.toChecksumAddress(txn['from'])
sig = w3.eth.account.signTransaction(txn, privateKey)
confirm = w3.eth.sendRawTransaction(sig['rawTransaction'])
print(confirm.hex())
The two JSON packages return from Bancor are shown below:
{'from': '0xba2d8d08d71686b0502dcb8b221e1a535df3112c', 'to': '0xa485bd50228440797abb4d4595161d7546811160', 'data': '0x095ea7b3000000000000000000000000dda1bfaf552b0f303d27853a4a13dd440c7e849f000000000000000000000000000000000000000000000000009b69dba47c9567', 'gasPrice': '0x12a05f200', 'nonce': '0x24', 'gasLimit': '0x24a6b'}
{'from': '0xBA2d8d08d71686b0502DcB8b221E1A535DF3112C', 'to': '0xdda1bfaf552b0f303d27853a4a13dd440c7e849f', 'data': '0x2274256400000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000009b69dba47c9567000000000000000000000000000000000000000000000000009b69db888f5200000000000000000000000000000000000000000000000000000000000068bc05000000000000000000000000000000000000000000000000000000000000001c9783230cea1daacbd17fa1f22111ec1c1b9acf387a6dee53e00eb85ebdaf17635922883904c80b52f9dfce3637eee88e7eba640301764a2a3293a2bd2f3b36370000000000000000000000000000000000000000000000000000000000000005000000000000000000000000a485bd50228440797abb4d4595161d7546811160000000000000000000000000607108c46bce4cf6f86698e9b46e3270a734fefe0000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c000000000000000000000000c0829421c1d260bd3cb3e0f06cfe2d52db2ce315', 'gasLimit': '0xcf850', 'gasPrice': '0x12a05f200', 'nonce': '0x25'}]}
Challenge 2 — Blockchain Conversion Widget
Up to $5,000 in USD
Bancor is a decentralized liquidity protocol that provides tokens with constant liquidity. The protocol is made up of a series of smart contracts which are designed to pool liquidity and instantly fulfill non-custodial token-to-token conversions in a single transaction. More than 150 tokens are integrated with the Bancor Protocol across 11,000+ trading pairs including ETH, EOS, DAI, BAT & OMG.
Bancor’s core development team previously deployed an embeddable token conversion widget utilizing Bancor’s APIs. The Bancor Protocol Foundation challenges developers to build a better UI — one that interacts directly with the blockchain and can be easily integrated and customized by third-party developers to embed automated token conversions (and/or token creation) into their applications.
Eligible projects must utilize Bancor’s Ethereum smart contracts, as well as Bancor’s Network Token, BNT, or some derivative of it.
Bancor Ethereum Smart Contract Documentation: https://docs.bancorfoundation.org/
Projects should not utilize the Bancor API; rather, the widget should interact directly with the Ethereum blockchain.
11:59pm EST Friday the 13th.
Winners will be announced on September 15th.
Hi,
I was wondering if there is a way to 'partially' convert tokens and get the maximum amount that I would get in return for converting token A to token B given a price limit.
Let's say I want to spend up to 1ETH and I want to buy some OMG tokens, but don't want to pay an unfair price for them. For this example let's assume that we have a conversion rate of 1 OMG = 0.01 ETH when converting small amounts of eth. When converting bigger amounts (eg 1ETH) the slippage is greater and the price could potentially be 0.02 ETH per OMG token.
In this case I would like to be able to make a conversion, but without spending all the amount (1ETH) if the slippage is to high. I would like to call convert with a maximum amount spendable and a price limit (eg 0.015 eth per OMG token) and get converted only the part of the max amount that would result in a conversion with a price below the imposed price limit.
I'm thinking at something like this for convert
:
/**
@dev converts up to _maxAmount of _fromToken to _toToken with a _priceLimit
@param _fromToken ERC20 token to convert from
@param _toToken ERC20 token to convert to
@param _maxAmount max amount to convert, in fromToken
@param _priceLimit max conversion price
@param _minReturn if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero
@return conversion return amount of _toToken converted
@return rest return amount of _fromToken not used for conversion, because price would have been > _priceLimit
*/
function limitConvert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _priceLimit, uint256 _minReturn) public returns (uint256, uint256) {
so a call to limitConvert
in the example above could result in something like [80 OMG, 0.1 ETH] (in wei) and 80 OMG is all the liquidity I got in return for 0.9 ETH with the constrain that all OMG tokens have been paid less than 0.015.
This should be similar to partially filled limit orders on traditional exchanges.
Is it already feasible?
Running the test script, i.e. using Ganache under the hood works well.
However, even after looking at #268 and changing the web3-utils version to either 1.0.0-beta37
or 1.0.0-beta41
, I still cannot get this test suite to pass when not using the script, but rather running truffle develop
and then truffle test
from within the solidity
directory. When I do, I always get:
TypeError: web3.toBigNumber is not a function
at contract (~/test/contracts/solidity/test/BancorFormula.js:14:28)
Why does truffle develop
differ from ganache
? I ask because I am trying to solve this issue currently: status-im/discover-dapps#14
Hello!
I was interested in bancor, but the implementation is in ERC20, and is not ideal for the future of ethereum.
I think it would help the community if the default contract was changed to an erc223 standard to prevent token lock-ups and to reduce transaction fees. In order to scale, we need to change to ERC223.
What do you think?
Kyler
Hi
Is it possible, to set up an exchange, that only accepts another token instead of Eth. ?
So, you can only buy "Token X" if you have enough amount of "Token Y".
You can not buy Token X using Eth.
Would that be possible/difficult to implement?
Thanks
Hi, can you please create a tutorial to explain how to use the bancor protocol with erc20 token? The documentation is very poor.
ethereum/EIPs#621 is unlikely to get consensus soon but your inputs to that discussion might be helpful.
ethereum/EIPs#223 may also be worth considering; the burn functionality in
https://github.com/bancorprotocol/contracts/blob/master/solidity/contracts/SmartToken.sol
might be implemented in a tokenFallback
.
These are just suggestions since these EIPs are works in progress.
I am a php developer . but i read all document. also not find about contract used method
do u know. what's question?
as JSON-RPC not support eth_contract api.
i don't know what i do.
who know the question solution.
For example, can't find token BNB in any page of this API: https://api.bancor.network/0.1/currencies/
I am getting the following error when calling the acceptOwnership function of SmartToken.sol
> deployedContract.acceptOwnership();
Error: invalid address
at web3-cmt.js:12250:13
at web3-cmt.js:12080:18
at web3-cmt.js:13332:28
at map (<native code>)
at web3-cmt.js:13331:12
at web3-cmt.js:13357:18
at web3-cmt.js:13382:23
at web3-cmt.js:12448:16
at apply (<native code>)
at web3-cmt.js:12534:16
The error seems to be asking for an argument of address type.
If I provide one (the address that deployed the contract i.e. the value returned from deployedContract.owner()) I get the following error (which makes sense given that the abi and Solidity code are argument-less)
Error: Invalid number of arguments to Solidity function
What is the purpose of the acceptOwnership function and how should/could it be used?
Many thanks
Tim
Truffle v4.0.1
solcjs 0.4.18+commit.9cf6e910.Emscripten.clang
EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)
npm test result:
2002 passing (2m)
78 failing
Contract: BancorConverter should throw when attempting to construct a converter with no token:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:95:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to construct a converter with no converter extensions:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:105:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to construct a converter with invalid max fee:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:115:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to construct a converter with a connector with invalid weight:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:133:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to update the fee to an invalid value:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:234:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should not fire an event when attempting to update the fee to an invalid value:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:289:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add a connector with invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:353:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add a connector with weight = 0:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:365:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add a connector with weight greater than 100%:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:377:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add the token as a connector:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:389:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add the converter as a connector:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:401:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add a connector that already exists:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:414:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to add multiple connectors with total weight greater than 100%:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:427:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to update a connector that does not exist:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:463:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to update a connector with weight = 0:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:476:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to update a connector with weight greater than 100%:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:489:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to update a connector that will result in total weight greater than 100%:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:503:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to disable connector purchases for a connector that does not exist:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:571:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to retrieve the balance for a connector that does not exist:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:602:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to withdraw from a connector to an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:646:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to withdraw from a connector to the converter address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:661:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to get the return with an invalid from token adress:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:710:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to get the return with an invalid to token address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:722:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to get the return with identical from/to addresses:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:734:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to get the purchase return with a non connector address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:758:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to get the purchase return while purchasing with the connector is disabled:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:771:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to get the sale return with a non connector address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:795:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to convert with an invalid from token adress:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:890:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to convert with an invalid to token address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:903:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to convert with identical from/to addresses:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:916:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to buy with a non connector address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:985:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to buy with 0 minimum requested amount:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:1038:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to buy while the connector purchases are disabled:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:1065:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to buy without first approving the converter to transfer from the buyer account in the connector contract:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:1077:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to sell with a non connector address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:1117:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to sell with 0 minimum requested amount:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:1154:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to sell with amount greater then the seller balance:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverter.js:1178:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when attempting to construct the converter extensions with no formula:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:46:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when attempting to construct the converter extensions with no gas price limit:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:56:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when attempting to construct the converter extensions with no quick converter:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:66:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when the owner attempts update the formula contract address with an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:97:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when the owner attempts update the formula contract address with the converter extensions address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:109:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when the owner attempts update the gas price limit contract address with an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:140:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when the owner attempts update the gas price limit contract address with the converter extensions address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:152:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when the owner attempts update the quick converter contract address with an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:183:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverterExtensions should throw when the owner attempts update the quick converter contract address with the converter extensions address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/BancorConverterExtensions.js:195:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when attempting to construct a controller with no token:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:77:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when attempting to construct a controller without beneficiary address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:97:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when attempting to construct a controller without bitcoin suisse address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:107:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when attempting to construct a controller without ether cap hash:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:117:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when the owner attempts to enable the real ether cap with an invalid cap:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:172:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when the owner attempts to enable the real ether cap with the wrong real cap:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:184:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: CrowdsaleController should throw when the owner attempts to enable the real ether cap with the wrong cap key:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/CrowdsaleController.js:196:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: ERC20Token should throw when attempting to transfer to an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/ERC20Token.js:58:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: ERC20Token should throw when attempting to define allowance for an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/ERC20Token.js:83:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: ERC20Token should throw when attempting to transfer from an invalid account:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/ERC20Token.js:137:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: ERC20Token should throw when attempting to transfer from to an invalid account:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/ERC20Token.js:150:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: EtherToken should throw when attempting to transfer to the token address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/EtherToken.js:92:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: EtherToken should throw when attempting to transferFrom to the token address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/EtherToken.js:106:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when the owner attempts to set an invalid short quick buy path:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/QuickConvert.js:174:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when the owner attempts to set an invalid long quick buy path:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/QuickConvert.js:188:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when the owner attempts to set a quick buy path with an invalid length:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/QuickConvert.js:198:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to quick buy and the return amount is lower than the given minimum:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/QuickConvert.js:273:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to quick buy and passing an amount higher than the ETH amount sent with the request:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/QuickConvert.js:285:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: BancorConverter should throw when attempting to sell directly for ether and the return amount is lower than the given minimum:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/QuickConvert.js:327:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartToken should throw when attempting to construct a token with no name:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartToken.js:24:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartToken should throw when attempting to construct a token with no symbol:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartToken.js:34:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartToken should throw when the owner attempts to issue tokens to an invalid address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartToken.js:91:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartToken should throw when the owner attempts to issue tokens to the token address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartToken.js:103:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartToken should throw when a non owner attempts to destroy tokens:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartToken.js:162:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartTokenController should throw when attempting to construct a controller with no token:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartTokenController.js:43:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartTokenController should throw when the owner attempts to transfer token ownership while the controller is not active:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartTokenController.js:96:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartTokenController should throw when the owner attempts to disable token transfers while the controller is not active:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartTokenController.js:137:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: SmartTokenController should throw when the owner attempts to withdraw other tokens from the token while the controller is not active:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/SmartTokenController.js:173:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: TokenHolder should throw when attempting to withdraw tokens from an invalid ERC20 token address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/TokenHolder.js:51:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: TokenHolder should throw when attempting to withdraw tokens to an invalid account address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/TokenHolder.js:63:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: TokenHolder should throw when attempting to withdraw tokens to the holder address:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/TokenHolder.js:75:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Contract: TokenHolder should throw when attempting to withdraw an amount greater than the holder balance:
AssertionError: Error: VM Exception while processing transaction: revert
at Object.ensureException (test/helpers/Utils.js:9:5)
at Context.it (test/TokenHolder.js:87:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! Test failed. See above for more details.
i wonder that where i can see various of constant reserve
(like ETH or ERC20 Tokens).
what is the difference of coin price between CoinMarketCap and Bancor Network???
Hello,
I got a few warnings and SyntaxError when I try to run 'npm test'.
Node v6.9.4
TestRPC v6.0.3 (ganache-core: 2.0.2)
Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)
Here are the logs:
Compilation warnings encountered:
/home/david/eth_project/bancor/solidity/contracts/Owned.sol:16:5: Warning: No visibility specified. Defaulting to "public".
function Owned() {
^
Spanning multiple lines.
/home/david/eth_project/bancor/solidity/contracts/BancorFormula.sol:297:5: Warning: Function state mutability can be restricted to pure
function floorLog2(uint256 _n) internal constant returns (uint8) {
^
Spanning multiple lines.
/home/david/eth_project/bancor/solidity/migrations/2_deploy_contracts.js:19
module.exports = async (deployer) => {
^
SyntaxError: Unexpected token (
at Object.exports.createScript (vm.js:47:10)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:202038:23
at tryToString (fs.js:455:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12)
npm ERR! Test failed. See above for more details.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
I'm a beginner and need some help to fix these problems. Thx!
Let's optimize a number of transfers avoiding transfer tokens to BancorNetwork contract. This will optimize gas at least twice.
Hi,
I'm doing some api calls for getting all relays via /currencies
endpoint, but I found that 3 relays are missing in the response "DGDBNT", "FLIXXBNT" and "DTRCBNT" . All of them are tradable using the Bancor website.
The response for the respective tokens "DGD", "FLIXX" and "DTRC" under the details.changer
attribute do not shows any of the changer data besides activatedAt
.
Hi,
I'm trying to convert some ETH to XBP using the convert call function of the BancorNetwork contract at "0xF20b9e713A33F61fA38792d2aFaF1cD30339126A" but It always returns me an amount equal to 0.
I'm using web3 0.20.6 and trying to do the following (amount 0.003281014854 ETH):
bancor = Bancor.at("0xf20b9e713a33f61fa38792d2afaf1cd30339126a")
bancor.convert.call(["0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315", "0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c", "0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c", "0xb79c3a1a2d50cc99459f3a21d709bcec86656e97", "0x5102791ca02fc3595398400bfe0e33d7b6c82267"], 3281014854000000, 1).then(res => console.log(res.toNumber()))
Am I missing something?
the estimateGas call is always failing too with
Error: gas required exceeds allowance or always failing transaction
Should I add a value to the call given that I'm converting from ETH? If yes how?
Hi,
I wanna to debug your code.
so I downloaded your code, compiled the smart contracts and trying to run the tests.
for some reason, it failed to deploy the specific contract (bancor converter factory).
after some digging, there is a problem in bancorConverter contract constructor, maybe?
Bancor Version : Master.
Node Version : 8.11.4
Npm Version : 5.6.0
Web3 Version : [email protected]
Genache Version : 6.2.0
Challenge 1 — Towards Decentralized Liquidity
Up to $5,000 in USD
The decentralized liquidity pool is among the most exciting innovations to emerge in the DeFi ecosystem. Everyday users are now incentivized to store their idle assets in smart contracts designed to algorithmically pool liquidity and perform non-custodial token conversions that generate fees for liquidity providers.
Liquidity pools fundamentally alter how liquidity is networked and incentivized — but they are still in their early stages of development.
The Bancor Protocol Foundation challenges developers to build tools that advance and optimize pool-driven liquidity and lower the technical barriers to creating, contributing liquidity to and transacting with Bancor liquidity pools, known as Bancor Relays.
In particular, the Bancor Protocol Foundation is interested in seeing developers build:
Tools for users to track the ROI of every Bancor Relay over time
Tools for users to create new Bancor Relays and contribute liquidity to existing Bancor Relays
Solutions that minimize the gas costs of Bancor Relays
Solutions that mitigate front-running of transactions processed by on-chain liquidity pools
Tools that optimize the profitability of Bancor Relays
Eligible projects must utilize Bancor’s Ethereum smart contracts, as well as Bancor’s Network Token, BNT, or some derivative of it.
Bancor Ethereum Smart Contract Documentation: https://docs.bancorfoundation.org/
Github: https://github.com/bancorprotocol/contracts
11:59pm EST Friday the 13th.
Winners will be announced on September 15th.
Hi,
I have trouble understanding how should I interact with your contract(s).
I have a currency_id (from /currencies
endpoint) and I need to buy/sell that currency with ETH, how should procede?
I mean I thought I could use some function like
convert(from_id, to_id, amount, min_return)
or
convert(from_token_address, to_token_address, amount, min_return)
instead the main entry point seems to be
function convert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256)
is there a way to get the correct path for buying or selling a token with ETH?
Thank you
Is there any documentation how my smart contract can discover token prices?
For example STOX converter has no method connectors(address)
: https://etherscan.io/address/0x8606704880234178125b2d44cbbe190ccdbde015#code
Here you can see how connectors(address)
call is handled in fallback to quickConvert
and failed in getReturnByPath
call:
Decoded call tree:
* [1] 0x0c8496cc(0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000005000000000000000000000000c0829421c1d260bd3cb3e0f06cfe2d52db2ce3150000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c000000000000000000000000006bea43baa3f7a6f765f14f10a1a1b08334ef45000000000000000000000000006bea43baa3f7a6f765f14f10a1a1b08334ef45) { to: 0x24618ec3a496e576a65503a16afd3ccfcf613f96 }
[2] registry():0x52ae12abe5d8bd778bd5397f99ca900624cfadd4 { to: 0x6690819cb98c1211a8e38790d6cd48316ed518db }
[3] getAddress((bytes32)(0x42616e636f72466f726d756c6100000000000000000000000000000000000000)):0xffd2de852b694f88656e91d9defa6b425c454742 { to: 0x52ae12abe5d8bd778bd5397f99ca900624cfadd4 }
[4] owner():0xcbc6a023eb975a1e2630223a7959988948e664f3 { to: 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c }
[5] totalSupply():0x3b264e5e1bf8dbb0598adb { to: 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c }
[6] connectors((address)(0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315)):0x4553e09afc773b36d7700000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001 { to: 0xcbc6a023eb975a1e2630223a7959988948e664f3 }
[7] getConnectorBalance((address)(0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315)):0x4553e09afc773b36d77 { to: 0xcbc6a023eb975a1e2630223a7959988948e664f3 }
[8] connectors((address)(0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315)):0x4553e09afc773b36d7700000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001 { to: 0xcbc6a023eb975a1e2630223a7959988948e664f3 }
[9] calculatePurchaseReturn((uint256)(0x3b264e5e1bf8dbb0598adb),(uint256)(0x4553e09afc773b36d77),(uint32)(0x186a0),(uint256)(0xde0b6b3a7640000)):0x12f1b71ca6c0200498 { to: 0xffd2de852b694f88656e91d9defa6b425c454742 }
[10] conversionFee():0x0 { to: 0xcbc6a023eb975a1e2630223a7959988948e664f3 }
[11] totalSupply():0x3b264e5e1bf8dbb0598adb { to: 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c }
[12] owner():0x8606704880234178125b2d44cbbe190ccdbde015 { to: 0x006bea43baa3f7a6f765f14f10a1a1b08334ef45 }
[13] totalSupply():0x2ecd7ad47ba1b593ae4222 { to: 0x006bea43baa3f7a6f765f14f10a1a1b08334ef45 }
* [14] connectors((address)(0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c)) { to: 0x8606704880234178125b2d44cbbe190ccdbde015 }
[15] quickConverter():0x6690819cb98c1211a8e38790d6cd48316ed518db { to: 0xf46002c37af6fb078ae1833fd447698a0c9012f7 }
[16] transferFrom((address)(0x24618ec3a496e576a65503a16afd3ccfcf613f96),(address)(0x6690819cb98c1211a8e38790d6cd48316ed518db),(uint256)(0x0)):0x1 { to: 0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315 }
* [17] convertFor((address[])(c0829421c1d260bd3cb3e0f06cfe2d52db2ce315,1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,1f573d6fb3f13d689ff844b4ce37794d79a7ff1c,006bea43baa3f7a6f765f14f10a1a1b08334ef45,006bea43baa3f7a6f765f14f10a1a1b08334ef45),(uint256)(0x0),(uint256)(0x1),(address)(0x24618ec3a496e576a65503a16afd3ccfcf613f96)) { to: 0x6690819cb98c1211a8e38790d6cd48316ed518db }
[18] addressOf((bytes32)(0x42616e636f7247617350726963654c696d697400000000000000000000000000)):0x607a5c47978e2eb6d59c6c6f51bc0bf411f4b85a { to: 0x52ae12abe5d8bd778bd5397f99ca900624cfadd4 }
[19] validateGasPrice((uint256)(0x2540be400)):0x0 { to: 0x607a5c47978e2eb6d59c6c6f51bc0bf411f4b85a }
[20] addressOf((bytes32)(0x436f6e7472616374466561747572657300000000000000000000000000000000)):0x563172281800b139f69fb038cc2c08cad56ce699 { to: 0x52ae12abe5d8bd778bd5397f99ca900624cfadd4 }
[21] owner():0xcbc6a023eb975a1e2630223a7959988948e664f3 { to: 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c }
[22] isSupported((address)(0xcbc6a023eb975a1e2630223a7959988948e664f3),(uint256)(0x1)):0x1 { to: 0x563172281800b139f69fb038cc2c08cad56ce699 }
[23] conversionWhitelist():0x0 { to: 0xcbc6a023eb975a1e2630223a7959988948e664f3 }
[24] allowance((address)(0x6690819cb98c1211a8e38790d6cd48316ed518db),(address)(0xcbc6a023eb975a1e2630223a7959988948e664f3)):0x0 { to: 0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315 }
* [25] change((address)(0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315),(address)(0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c),(uint256)(0x0),(uint256)(0x1)) { to: 0xcbc6a023eb975a1e2630223a7959988948e664f3 }
[26] addressOf((bytes32)(0x42616e636f724e6574776f726b00000000000000000000000000000000000000)):0x6690819cb98c1211a8e38790d6cd48316ed518db { to: 0x52ae12abe5d8bd778bd5397f99ca900624cfadd4 }
[27] owner():0xcbc6a023eb975a1e2630223a7959988948e664f3 { to: 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c }
[28] totalSupply():0x3b264e5e1bf8dbb0598adb { to: 0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c }
[29] addressOf((bytes32)(0x42616e636f72466f726d756c6100000000000000000000000000000000000000)):0xffd2de852b694f88656e91d9defa6b425c454742 { to: 0x52ae12abe5d8bd778bd5397f99ca900624cfadd4 }
[30] calculatePurchaseReturn((uint256)(0x3b264e5e1bf8dbb0598adb),(uint256)(0x4553e09afc773b36d77),(uint32)(0x186a0),(uint256)(0x0)):0x0 { to: 0xffd2de852b694f88656e91d9defa6b425c454742 }
New version of metamask 4.1.2 are resulting in multiple fails between aprove and convert.
I'm not sure if is a bancor website problem, or is just metamask.
Made a few exchanges, all approves successed but all exchanges failed. Maybe for some reason exchanges transcations happend before appoves?
-
0x98eef9aa09368672cb5ed488a34adfd093e8cc9466f56ed1c3745121f49a7d49
+
0xd51f531d6e8f7caaaea1116538ff841dad195c724dfce9f47497f5fb14355811
-
0x30a405090cfef7dd7b577ff6da63d117576bb99d047158208be357e47a9a2041
+
0xda6199adf1555a4c5ac652969341637ec0f209483c5183c1787bd60ec3948bc5
-
0xcaf0ee101b5d8aff5b4c314e7df0123ecffb180ebe729bcdb83b5ee138ce3734
+
0xd5702a4169d2556bd933c88b1af0bd9547b1e04cf8e86c1b47078e8fdd896b96
-
0xf7908e7264dc3a474f9b16122e562e3db24380bbcd698fda682e1462c3597c7a
+
0x2f5fffb37688ad39d4f9d68835b6741ab85be4813280b31fceecec227fc4baf9
-
0xc16e5c38c0e3c6cbbe741ba0fa21dd1b6745b4787493981564217e2a001aa6f4
+
0xf85e43c536aa9e6c6719c198a69a9f22e22c926b3ac841e46917fca850d3e5a5
-
0x20ce307ff058a7ab106babe61c59caec648e6c56aedda3d67cd51bd4eb908663
Hi,
I'm looking into writing a DApp that buys and sells BNT, for example a simple "options contract", or something along these lines.
Just playing around with it now.
I got the Buy BNT part working, by following the example in BancorBuyer.sol - simply calling the change() on the changer contract.
However, I cannot seem to do the reverse (selling).
Is there an example anywhere for how to do it?
I've tried something like this:
ISmartToken smartToken = tokenChanger.token();
uint256 returnAmount = tokenChanger.change(smartToken, etherToken, getBNTBalance(msg.sender), 1);
However, the function throws with "bad instruction" when i try it.
https://etherscan.io/tx/0x5c6fda07aacfd5f39b6e55418c8244bb29f9cb74454ae0fe1fc5307e21889f8c
The getBNTBalance
function gets the balance from the BNT Token contract in wei. For me, it returns 877843110001289470
Am I missing something?
Someone run a bot that is also a ethereum full-node, to get access to tx as soon as possible.
It reads all unconfirmed tx
that address to a bancor
contract.
When someone make a tx
on bancor
it read and explore the interest price slippage
percentage.
And put a tx with higher miner fee, forcing it to go first and profit on the difference price.
And sell it right after the target tx
got confirmed on bancor, realizing the profit.
To fix this the price slippage default should be 1% or even less.
!! Current default is 5% !!
Also the user default should be cached.
Here is one address abusing
https://etherscan.io/address/0x1d8a5212ae7c196cafbf58ad5f75b7ac9bdeb0b9#tokentxns
As you can see, multiple people per day are falling on this.
Only today this address did that ~25 times and counting
The User Tx
https://etherscan.io/tx/0x40017c6dab40e1ba9cb41a9391da3d36c28b14bd63206b3f7e2e782f534dd921
The scam Buy right before the User Tx
https://etherscan.io/tx/0xaa094f3e481d37150afd29642856e063f592654583933428f5dd203680a0a6c0
The scam Sell after
https://etherscan.io/tx/0x256adb60e45b4022338efb3378d9ac9f2f475f6ae8baba83e0b1d13b5261a8ea
I saw multiple people falling on this. With obscene profit going to the bug-exploit.
I tagged that as a critical because, new users have a high chance in fall on this, and give up on bancor.
Please feel free to delete this issue if you find it compromising.
After deploying the SmartToken contract on an Ethereum test network I am unable to call the issue function. I get the following error.
Error: invalid address
at web3-cmt.js:12250:13
at web3-cmt.js:12080:18
at web3-cmt.js:13332:28
at map ()
at web3-cmt.js:13331:12
at web3-cmt.js:13357:18
at web3-cmt.js:13382:23
at web3-cmt.js:12448:16
at apply ()
at web3-cmt.js:12534:16
I have tried all of these addresses, they should be valid, not sure what is going on.
"0xfc4067602f68b3b729000ef92cff05f2b94aa5fb", "0xdc13d113fca85a2873d9ffd254bc556d80e52483", "0xab52776885fb487ab60fd10f77604cb5dda4f6f5"
I can call other functions
contractInstance.totalSupply()
0
Guys, technical suggestion please. Which contact/function can I use for retrieving current price of my Bancor Protocol supported token?
The background of my question is the relation of Bancor Protocol supported token with exchanges. Usually token price might be defined by demand-supply of majority-volume exchange, but in terms of Bancor world, token has it's price on blockchain as state. And this value must be the master indicator of exchange price. If my assumption could be correct, Bancor Protocol must have "get current price" kinda contact on solidity code. And as far as I know, price is retuned only on buy/sell time calculation contact. Could you kindly give me ideas?
Hello,
I'm trying to understand how to call the bancor smart contract and how to read the gas price.
Already took a look on https://support.bancor.network/hc/en-us/articles/360003057852-How-Bancor-prioritizes-transactions-on-the-Network. So as I understand there are different gas prices according to that docu. Where to find this values?
Tried to read the smart contract and find out the gasprice:
Calling your API with the method "https://api.bancor.network/0.1/currencies/convert"
--> GasPriceWebApi 5320000000
That is a bit confusing. Why is the GasPriceWebApi 5320000000 higher than the GasPrice from the gasPriceLimit 5000000000?
Thanks a lot for any hint!
PS: I don't think that is a bug.
Hey,
I'm getting some random errors when I do calls like this one
https://api.bancor.network/0.1/currencies/5a957c0cd10aa7000167e4c7/ticker?fromCurrencyId=5937d635231e97001f744267
(most of the time it works, sometimes it doesn't)
The lib I'm using complaints about json not properly formatted
FetchError: invalid json response body at https://api.bancor.network/0.1/currencies/5a957c0cd10aa7000167e4c7/ticker?fromCurrencyId=5937d635231e
97001f744267 reason: Unexpected token I in JSON at position 0
Any idea why?
Adding an MAX_GAS_PRICE will likely cause miners to modify software to accept bribes using smart contracts like this: https://gist.github.com/naterush/ab172a26946ada6712db2e76c64b11a8
This is such a simple change/workaround (for such a high reward; see gas profits off recent ICOs) all rational miners will likely accept this very soon if there are contracts that enforce a MAX_GAS_PRICE.
Encouraging miners to accept bribes is bad for a couple reasons.
Both of these things would lead to worse average user experience - and would likely favor whales more than it hurts them.
If this is the case, Bancor has the duty to not impose a MAX_GAS_LIMIT, as it will likely lead to bribing channels in the very near future. This is a short-term "fix" for a single ICO that is meant to stop whales, but actually, may lead to negative outcomes for most users and be positive for whales.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.