The following assumes the use of node@>=10
.
yarn
yarn compile
yarn test
License: GNU General Public License v3.0
hey,
when use address
to convert uint
, it prompts that "Cannot convert uint256 into address".
uint means uint256, address means bytes20, so this conversion in the pancakeSwap source codes should
not work , but as I know , this code works for PancakeSwap .
what happened ? its for solidity compiler version?
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66' // init code hash
))));
}
There should be some official documentation when new contract are deployed with factory and router addresses!
The dependency at line 3 of file PancakeRouter is @uniswap/v2-core/contracts/interfaces/IPancakeFactory.sol
, but there are no IPancakeFactory.sol
file.
How can I fix this problem so that I can compile contract without error.
I forked, and pulled the pancake. Then I manually set the links to the Pancake-swap core contracts. As it was reported in issue #10
Now compilation works. However tests are failing.
$ yarn compile
$ yarn clean
$ rimraf ./build/
$ waffle .waffle.json
$ yarn copy-v1-artifacts
$ ncp ./buildV1 ./build
$ mocha
ExampleFlashSwap
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
1) uniswapV2Call:0
WARNING: unsupported ABI type - receive
2) uniswapV2Call:1
ExampleOracleSimple
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
3) "before each" hook for "update"
ExampleSlidingWindowOracle
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
✓ requires granularity to be greater than 0 (40ms)
✓ requires windowSize to be evenly divisible by granularity (42ms)
✓ computes the periodSize correctly (127ms)
#observationIndexOf
✓ works for examples (193ms)
✓ overflow safe (115ms)
✓ matches offline computation (150ms)
#update
4) succeeds
5) sets the appropriate epoch slot
6) gas for first update (allocates empty array)
7) gas for second update in the same period (skips)
8) gas for second update different period (no allocate, no skip)
9) second update in one timeslot does not overwrite
✓ fails for invalid pair (53ms)
#consult
10) fails if previous bucket not set
✓ fails for invalid pair
happy path
11) "before each" hook: add some prices for "has cumulative price in previous bucket"
price changes over period
12) "before each" hook: add some prices for "provides the correct ratio in consult token0"
ExampleSwapToPrice
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
✓ correct router address
#swapToPrice
✓ requires non-zero true price inputs (45ms)
✓ requires non-zero max spend
13) moves the price to 1:90
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
14) moves the price to 1:110
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
15) reverse token order
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
16) swap gas cost
UniswapV2Migrator
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
17) migrate
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
UniswapV2Router{01,02}
UniswapV2Router01
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
✓ factory, WETH
18) addLiquidity
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
19) addLiquidityETH
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
20) removeLiquidity
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
21) removeLiquidityETH
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
22) removeLiquidityWithPermit
23) removeLiquidityETHWithPermit
swapExactTokensForTokens
24) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
25) amounts
26) gas
swapTokensForExactTokens
27) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
28) amounts
swapExactETHForTokens
29) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
30) amounts
31) gas
swapTokensForExactETH
32) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
33) amounts
swapExactTokensForETH
34) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
35) amounts
swapETHForExactTokens
36) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
37) amounts
UniswapV2Router02
✓ factory, WETH
38) addLiquidity
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
39) addLiquidityETH
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
40) removeLiquidity
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
41) removeLiquidityETH
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
42) removeLiquidityWithPermit
43) removeLiquidityETHWithPermit
swapExactTokensForTokens
44) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
45) amounts
46) gas
swapTokensForExactTokens
47) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
48) amounts
swapExactETHForTokens
49) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
50) amounts
51) gas
swapTokensForExactETH
52) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
53) amounts
swapExactTokensForETH
54) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
55) amounts
swapETHForExactTokens
56) happy path
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
RuntimeError: VM Exception while processing transaction: revert
57) amounts
UniswapV2Router02
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
WARNING: unsupported ABI type - receive
0xA193E42526F1FEA8C99AF609dcEabf30C1c29fAA 0xFDFEF9D10d929cB3905C71400ce6be1990EA0F34 BigNumber { _hex: '0x2710' } BigNumber { _hex: '0x2710' } 0 0 0x17ec8597ff92C3F44523bDc65BF0f1bE632917ff BigNumber {
_hex: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
} { gasLimit: 9999999 }
58) getAmountsOut
13 passing (55s)
58 failing
1) ExampleFlashSwap
uniswapV2Call:0:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
2) ExampleFlashSwap
uniswapV2Call:1:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
3) ExampleOracleSimple
"before each" hook for "update":
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
4) ExampleSlidingWindowOracle
#update
succeeds:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
5) ExampleSlidingWindowOracle
#update
sets the appropriate epoch slot:
AssertionError: expected 1577836801 to equal 1577836800
+ expected - actual
-1577836801
+1577836800
at /home/alp/pancake-swap-periphery/test/ExampleSlidingWindowOracle.spec.ts:314:58
at step (test/ExampleSlidingWindowOracle.spec.ts:33:23)
at Object.next (test/ExampleSlidingWindowOracle.spec.ts:14:53)
at fulfilled (test/ExampleSlidingWindowOracle.spec.ts:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
6) ExampleSlidingWindowOracle
#update
gas for first update (allocates empty array):
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
7) ExampleSlidingWindowOracle
#update
gas for second update in the same period (skips):
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
8) ExampleSlidingWindowOracle
#update
gas for second update different period (no allocate, no skip):
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
9) ExampleSlidingWindowOracle
#update
second update in one timeslot does not overwrite:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
10) ExampleSlidingWindowOracle
#consult
fails if previous bucket not set:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
11) ExampleSlidingWindowOracle
#consult
happy path
"before each" hook: add some prices for "has cumulative price in previous bucket":
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
12) ExampleSlidingWindowOracle
#consult
price changes over period
"before each" hook: add some prices for "provides the correct ratio in consult token0":
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
13) ExampleSwapToPrice
#swapToPrice
moves the price to 1:90:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
14) ExampleSwapToPrice
#swapToPrice
moves the price to 1:110:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
15) ExampleSwapToPrice
#swapToPrice
reverse token order:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
16) ExampleSwapToPrice
#swapToPrice
swap gas cost:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
17) UniswapV2Migrator
migrate:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
18) UniswapV2Router{01,02}
UniswapV2Router01
addLiquidity:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
19) UniswapV2Router{01,02}
UniswapV2Router01
addLiquidityETH:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
20) UniswapV2Router{01,02}
UniswapV2Router01
removeLiquidity:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
21) UniswapV2Router{01,02}
UniswapV2Router01
removeLiquidityETH:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
22) UniswapV2Router{01,02}
UniswapV2Router01
removeLiquidityWithPermit:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
23) UniswapV2Router{01,02}
UniswapV2Router01
removeLiquidityETHWithPermit:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
24) UniswapV2Router{01,02}
UniswapV2Router01
swapExactTokensForTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
25) UniswapV2Router{01,02}
UniswapV2Router01
swapExactTokensForTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
26) UniswapV2Router{01,02}
UniswapV2Router01
swapExactTokensForTokens
gas:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
27) UniswapV2Router{01,02}
UniswapV2Router01
swapTokensForExactTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
28) UniswapV2Router{01,02}
UniswapV2Router01
swapTokensForExactTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
29) UniswapV2Router{01,02}
UniswapV2Router01
swapExactETHForTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
30) UniswapV2Router{01,02}
UniswapV2Router01
swapExactETHForTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
31) UniswapV2Router{01,02}
UniswapV2Router01
swapExactETHForTokens
gas:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
32) UniswapV2Router{01,02}
UniswapV2Router01
swapTokensForExactETH
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
33) UniswapV2Router{01,02}
UniswapV2Router01
swapTokensForExactETH
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
34) UniswapV2Router{01,02}
UniswapV2Router01
swapExactTokensForETH
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
35) UniswapV2Router{01,02}
UniswapV2Router01
swapExactTokensForETH
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
36) UniswapV2Router{01,02}
UniswapV2Router01
swapETHForExactTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
37) UniswapV2Router{01,02}
UniswapV2Router01
swapETHForExactTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
38) UniswapV2Router{01,02}
UniswapV2Router02
addLiquidity:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
39) UniswapV2Router{01,02}
UniswapV2Router02
addLiquidityETH:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
40) UniswapV2Router{01,02}
UniswapV2Router02
removeLiquidity:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
41) UniswapV2Router{01,02}
UniswapV2Router02
removeLiquidityETH:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
42) UniswapV2Router{01,02}
UniswapV2Router02
removeLiquidityWithPermit:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
43) UniswapV2Router{01,02}
UniswapV2Router02
removeLiquidityETHWithPermit:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
44) UniswapV2Router{01,02}
UniswapV2Router02
swapExactTokensForTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
45) UniswapV2Router{01,02}
UniswapV2Router02
swapExactTokensForTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
46) UniswapV2Router{01,02}
UniswapV2Router02
swapExactTokensForTokens
gas:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
47) UniswapV2Router{01,02}
UniswapV2Router02
swapTokensForExactTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
48) UniswapV2Router{01,02}
UniswapV2Router02
swapTokensForExactTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
49) UniswapV2Router{01,02}
UniswapV2Router02
swapExactETHForTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
50) UniswapV2Router{01,02}
UniswapV2Router02
swapExactETHForTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
51) UniswapV2Router{01,02}
UniswapV2Router02
swapExactETHForTokens
gas:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
52) UniswapV2Router{01,02}
UniswapV2Router02
swapTokensForExactETH
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
53) UniswapV2Router{01,02}
UniswapV2Router02
swapTokensForExactETH
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
54) UniswapV2Router{01,02}
UniswapV2Router02
swapExactTokensForETH
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
55) UniswapV2Router{01,02}
UniswapV2Router02
swapExactTokensForETH
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
56) UniswapV2Router{01,02}
UniswapV2Router02
swapETHForExactTokens
happy path:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
57) UniswapV2Router{01,02}
UniswapV2Router02
swapETHForExactTokens
amounts:
RuntimeError: VM Exception while processing transaction: invalid opcode
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
58) UniswapV2Router02
getAmountsOut:
RuntimeError: VM Exception while processing transaction: revert
at Function.RuntimeError.fromResults (node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)
at BlockchainDouble.processBlock (node_modules/ganache-core/lib/blockchain_double.js:632:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
error Command failed with exit code 58.
My swap of 3.275 FIL for 1.21 BNB succeeded at withdrawing input FIL coin but failed to output any BNB from the router back to my wallet. The money never showed up, and the FIL coin is gone from the wallet. Take a look at the transaction here:
https://bscscan.com/tx/0x9622b50f8e702cfca538cfd3e2612132491453d8656ac002bad652ce6576fddc
Any ideas how this could happen and why the router didn't output any BNB? Kinda bummed about losing $500 bucks after doing so many swaps flawlessly - I just didn't think to test every pair I swapped with a micro transaction :/
test/shared/fixtures.ts:16:29 - error TS2307: Cannot find module '../../build/PancakeRouter02.json'. 16 import PancakeRouter02 from '../../build/PancakeRouter02.json' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ at createTSError (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:421:12) at reportTSError (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:425:19) at getOutput (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:530:36) at Object.compile (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:735:32) at Module.m._compile (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:814:43) at Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Object.require.extensions.<computed> [as .ts] (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:817:12) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/utsavsingla/pancake_trial/pancake-swap-periphery/test/ExampleFlashSwap.spec.ts:65:18) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module.m._compile (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:814:23) at Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Object.require.extensions.<computed> [as .ts] (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/ts-node/src/index.ts:817:12) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at /home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/mocha.js:334:36 at Array.forEach (<anonymous>) at Mocha.loadFiles (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/mocha.js:331:14) at Mocha.run (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/mocha.js:809:10) at Object.exports.singleRun (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/cli/run-helpers.js:108:16) at exports.runMocha (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/cli/run-helpers.js:142:13) at Object.exports.handler (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/cli/run.js:292:3) at Object.runCommand (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/yargs/lib/command.js:242:26) at Object.parseArgs [as _parseArgs] (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/yargs/yargs.js:1087:28) at Object.parse (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/yargs/yargs.js:566:25) at Object.exports.main (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/lib/cli/cli.js:68:6) at Object.<anonymous> (/home/utsavsingla/pancake_trial/pancake-swap-periphery/node_modules/mocha/bin/mocha:164:29) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Facing same issue
Originally posted by @Ranofty in pancakeswap/pancake-frontend#4167 (comment)
Hi there, as I was trying to call the pairFor()
method from the PancakeLibrary
to compute the CREATE2 address of a token pair, I noticed that the address did not match the ones returned from the router.
After a closer look, I realized the hardcoded value, see line 24 of Pancake Library does not match the INIT_CODE_PAIR_HASH
that was computed by the Factory. You can find the actual value here.
Using the value obtained from BSCscan, it resolves the issue that I had and I was able to get the correct pair address. I thought I would raise this issue for anyone who's also having a hard time with this.
pragma solidity >=0.5.0;
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.