yuichiroaoki / poly-flash

Flashloan on Polygon
https://yuichiroaoki.medium.com/no-flashloan-fee-with-dodo-cc78215d7f93
MIT License
291 stars 169 forks source link

Error when testing #26

Closed h4ckm1n-dev closed 2 years ago

h4ckm1n-dev commented 2 years ago

Hello . i can't find solution to my problem.

i run yarn install & compile without error but i try "yarn test test/flashloan.test.ts" i get a error

c:\FlashLoan\poly-flash-main>yarn test test/flashloan.test.ts No need to generate any newer typings.

Flashloan 1) "before all" hook in "Flashloan"

0 passing (316ms) 1 failing

1) Flashloan "before all" hook in "Flashloan": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules\node-fetch\lib\index.js:1305:9) at c:\FlashLoan\poly-flash-main\node_modules\node-fetch\lib\index.js:1410:19 at new Promise () at fetch (node_modules\node-fetch\lib\index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules\hardhat\src\internal\core\providers\http.ts:140:30) at async HttpProvider.request (node_modules\hardhat\src\internal\core\providers\http.ts:55:29) at async getNetworkId (node_modules\hardhat\src\internal\hardhat-network\provider\utils\makeForkClient.ts:109:28) at async makeForkClient (node_modules\hardhat\src\internal\hardhat-network\provider\utils\makeForkClient.ts:40:21) at async Function.create (node_modules\hardhat\src\internal\hardhat-network\provider\node.ts:157:9) at async HardhatNetworkProvider._init (node_modules\hardhat\src\internal\hardhat-network\provider\provider.ts:250:28)

An unexpected error occurred:

TypeError: Only absolute URLs are supported at getNodeRequestOptions (c:\FlashLoan\poly-flash-main\node_modules\node-fetch\lib\index.js:1305:9) at c:\FlashLoan\poly-flash-main\node_modules\node-fetch\lib\index.js:1410:19 at new Promise () at fetch (c:\FlashLoan\poly-flash-main\node_modules\node-fetch\lib\index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (c:\FlashLoan\poly-flash-main\node_modules\hardhat\src\internal\core\providers\http.ts:140:30) at async HttpProvider.request (c:\FlashLoan\poly-flash-main\node_modules\hardhat\src\internal\core\providers\http.ts:55:29) at async getNetworkId (c:\FlashLoan\poly-flash-main\node_modules\hardhat\src\internal\hardhat-network\provider\utils\makeForkClient.ts:109:28) at async makeForkClient (c:\FlashLoan\poly-flash-main\node_modules\hardhat\src\internal\hardhat-network\provider\utils\makeForkClient.ts:40:21) at async Function.create (c:\FlashLoan\poly-flash-main\node_modules\hardhat\src\internal\hardhat-network\provider\node.ts:157:9) at async HardhatNetworkProvider._init (c:\FlashLoan\poly-flash-main\node_modules\hardhat\src\internal\hardhat-network\provider\provider.ts:250:28)

c:\FlashLoan\poly-flash-main>

Appreciate the work ;)

h4ckm1n-dev commented 2 years ago

i've tried to start again from scrath on a new system, i used ubuntu, Node.js version is 16.13.2 and yarn version is 1.22.17

When i run "yarn run test" i still get this error :(

No need to generate any newer typings.

DODO pool check Check if dodo pools have enough tokens 1) "before each" hook for "USDC_DAI"

Flashloan 2) "before all" hook in "Flashloan"

dodo flashloan DODO flashloan 3) "before each" hook for "should execute flashloan"

Flashloan Error Message 4) "before all" hook for "should revert flashloan when it cannot pay back the loan."

Flashloan 5) "before all" hook in "Flashloan"

Router 6) "before each" hook for "should get a router address."

Swap on uniswap fork on polygon 7) "before all" hook in "Swap on uniswap fork on polygon"

Swap on uniswap fork on polygon 8) "before all" hook in "Swap on uniswap fork on polygon"

0 passing (1s) 8 failing

1) DODO pool check "before each" hook for "USDC_DAI": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

2) Flashloan "before all" hook in "Flashloan": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

3) dodo flashloan "before each" hook for "should execute flashloan": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

4) Flashloan Error Message "before all" hook for "should revert flashloan when it cannot pay back the loan.": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

5) Flashloan "before all" hook in "Flashloan": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

6) Router "before each" hook for "should get a router address.": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

7) Swap on uniswap fork on polygon "before all" hook in "Swap on uniswap fork on polygon": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

8) Swap on uniswap fork on polygon "before all" hook in "Swap on uniswap fork on polygon": TypeError: Only absolute URLs are supported at getNodeRequestOptions (node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

An unexpected error occurred:

TypeError: Only absolute URLs are supported at getNodeRequestOptions (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1305:9) at /home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1410:19 at new Promise () at fetch (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/node-fetch/lib/index.js:1407:9) at HttpProvider._fetchJsonRpcResponse (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/hardhat/src/internal/core/providers/http.ts:140:30) at async HttpProvider.request (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/hardhat/src/internal/core/providers/http.ts:55:29) at async getNetworkId (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:109:28) at async makeForkClient (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkClient.ts:40:21) at async Function.create (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:9) at async HardhatNetworkProvider._init (/home/h4ckm1n/Documents/FlashLaon/poly-flash-multiple_routes/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:250:28)

I'vetried evrything i could but cannot how to solve this error ... sorry i not a dev pro

yuichiroaoki commented 2 years ago

Sounds like a problem with ALCHEMY_POLYGON_RPC_URL.

Did you create a .env file with that? And is that absolute url?

https://github.com/yuichiroaoki/poly-flash#1-setup-environment-variables

h4ckm1n-dev commented 2 years ago

Thanks, you very much for pointing that out ! that was the <> i didn't delete in the alchemy url !

now the deploy is finishing with : Solidity compilation finished successfully Debugger listening on ws://127.0.0.1:42043/c21fcfcd-231f-4dbd-842d-506c6f72f1e6 For help, see: https://nodejs.org/en/docs/inspector Debugger attached. contract deployed to: 0xd544d7A5EF50c510f3E90863828EAba7E392907A

But i didn't pay any matic for the creation, and it is shown as an address and not a contract ? is that ok ?

seem that i still have the privatekey entern incorectly beacause when i launch "balance" i got this output

Error HH306: The '--account' parameter expects a value, but none was passed.

h4ckm1n-dev commented 2 years ago

solve this issue using npx hardhat run scripts/deploy.ts --network polygon. you can close this issue

Thank you very much