bentobox's Issues
Publish compiled ABI's to NPM
It would be great to include in the release pipeline publishing of ABI's to NPM to avoid the need for copying ABI's manually. I believe this already happens for https://github.com/sushiswap/sushiswap.
support 1-tx deposit into LP
currently this is the only way to get into the Pair:
approve()
to Box, thenaddAsset()
/addCollateral()
to LP
which requires 2 transactions on the UI.
addAssetWithPermit()
and addCollateralWithPermit()
could forward receipts to Box. only useful for some tokens obviously.
don't store price in oracle
use blocks instead of timestamp
Slither does not run
Error HH12: Trying to use a non-local installation of Hardhat, which is not supported.
Please install Hardhat locally using npm or Yarn, and try again.
For more info go to https://hardhat.org/HH12 or run Hardhat with --show-stack-traces
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/slither/__main__.py", line 712, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/usr/lib/python3.9/site-packages/slither/__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 81, in compile
(compiler, version_from_config, optimized) = _get_version_from_config(config_file)
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 193, in _get_version_from_config
raise InvalidCompilation(f"{config} not found")
crytic_compile.platform.exceptions.InvalidCompilation: cache/solidity-files-cache.json not found
ERROR:root:None
ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/slither/__main__.py", line 712, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/usr/lib/python3.9/site-packages/slither/__main__.py", line 71, in process_all
compilations = compile_all(target, **vars(args))
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 1076, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 137, in __init__
self._compile(**kwargs)
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 987, in _compile
self._platform.compile(self, **kwargs)
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 81, in compile
(compiler, version_from_config, optimized) = _get_version_from_config(config_file)
File "/home/keno/.local/lib/python3.9/site-packages/crytic_compile/platform/hardhat.py", line 193, in _get_version_from_config
raise InvalidCompilation(f"{config} not found")
crytic_compile.platform.exceptions.InvalidCompilation: cache/solidity-files-cache.json not found
Inclusion of a GPL3 library requires all code to become GPL3
GPL3 is infectious; any code that uses a GPL library automatically becomes GPL as well.
SushiSwap Swapper Test has unhandled rejections
SushiSwapSwapper
Swap
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "0" to be equal 20000000000000000000
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
✓ should swap (158ms)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2822)
(node:3572) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "0" to be equal 20000000000000000000
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
✓ should swap with minimum set (159ms)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2841)
✓ should not swap with minimum not met (128ms)
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "2000000000" to be equal 0
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2875)
✓ should swap in opposite direction (151ms)
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "2000000000" to be equal 0
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2894)
✓ should swap in opposite direction with minimum set (152ms)
✓ should not swap in opposite direction with minimum not met (114ms)
Swap Exact
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "0" to be equal 20068207824754776535
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2930)
✓ should swap exact (173ms)
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "0" to be equal 20068207824754776535
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2950)
✓ should swap exact with exact amountIn (159ms)
✓ should not swap exact with not enough amountIn (95ms)
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "2006820783" to be equal 0
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2982)
✓ should swap exact in opposite direction (169ms)
(node:3572) UnhandledPromiseRejectionWarning: AssertionError: Expected "2006820783" to be equal 0
at assertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:48:52)
at tryAssertArgsArraysEqual (/home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:54:20)
at /home/runner/work/bentobox/bentobox/node_modules/@ethereum-waffle/chai/dist/cjs/matchers/emit.js:66:13
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runNextTicks (internal/process/task_queues.js:62:3)
at listOnTimeout (internal/timers.js:523:9)
at processTimers (internal/timers.js:497:7)
(node:3572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3002)
✓ should swap exact in opposite direction with exact AmountIn (151ms)
✓ should not swap exact in opposite direction with not enough amountIn (92ms)
```
possible size reduction?
Are these checks necessary?
require(amount >= 0, 'LendingPair: amount should be >= 0');
require(balanceOf[to] + amount >= balanceOf[to], 'LendingPair: overflow detected');
Interface IOracle misses getInitData
The Oracle Interface does not implement getInitData.
bentobox/contracts/oracles/TestOracle.sol
Lines 22 to 25 in 6a722c6
SLP oracle should respect token decimals
i've tested the SLPTWAP oracle with different decimals. here is what i get:
collateral 1e21, asset 1e9 => oracle price 1e6
collateral 1e18, asset 1e9 => oracle price 1e9
collateral 1e18, asset 1e18 => oracle price 1e18
collateral 1e9, asset 1e18 => oracle price 1e27
it always giving the price for 1e18 of the ask currency, no matter what the decimals.
i expect the following values:
collateral 1e21, asset 1e9 => oracle price 1e9
collateral 1e18, asset 1e9 => oracle price 1e9
collateral 1e18, asset 1e18 => oracle price 1e18
collateral 1e9, asset 1e18 => oracle price 1e18
so giving the price for 1 full unit of the ask currency, considering the decimals. would make the implementation of isSolvent()
and liquiditations more simple, imo.
move init-data into helper library
additional functions increase gas cost for all contract calls.
LendingPair does not implement IPair
asset / tokenAsset mismatch found
Remove Kashi related files
Interface IPair defined twice
The interface IPair is defined once in interfaces/IPair.sol (
bentobox/contracts/interfaces/IPair.sol
Lines 6 to 58 in bb436ba
Lines 10 to 12 in bb436ba
Wrong owner for swiping collateral/asset in LendingPair
This line
bentobox/contracts/LendingPair.sol
Line 590 in 12a66dd
should be:
bentoBox.transfer(token, masterContract.owner(), excessAmount);
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.