Aharonla / Tea-Presale-Front

0 stars 0 forks source link

21-smart contract integration #24

Closed SorooshDeveloper closed 7 months ago

SorooshDeveloper commented 7 months ago

This PR Brings :

New :

Fixed

This pr will be updated to fully resolve issue 21

Aharonla commented 7 months ago

@SorooshDeveloper At this point, the UI is not functioning. See screenshot צילום מסך 2024-04-02 094458

You get a bunch of Uncaught (in promise) Error: could not decode result data errors. Currently for getRoundEnd, decimals and getPrice.
Check for origin of these errors and fix them.
Also, I don't get my USDC/USDT balance (Should be 299,000,000$ for both, but shows null). Missing fields: Countdown and price.

Aharonla commented 7 months ago

@SorooshDeveloper The above errors seem to be caused from those problems raised by the TS engine: צילום מסך 2024-04-02 110945

apps/ui/src/app/pages/buy.tsx Lines: 50, 100, 109, 143

SorooshDeveloper commented 7 months ago

@Aharonla for some reason in some browsers it , provider connects to the mainnet instead of test net i will find a fix for this.

SorooshDeveloper commented 7 months ago

@Aharonla for fixing this cannot get data issue you need to create a file named : .env.development under /apps/ui directory and add below keys to it : (this file is in .gitignore so that's why it's not working on your side)

VITE_PUBLIC_API_URL=https://teaswap.io
VITE_WALLET_CONNECT_PROJECT_ID=167efa6c024c45590200c9868c0bda3e
VITE_PUBLIC_INFURA_API=039b2dba37b945e4a97d4bef93ceb773
VITE_PUBLIC_SEPOLIA_URL=https://sepolia.infura.io/v3/039b2dba37b945e4a97d4bef93ceb773

these keys are for testing purpose and they are also public keys so no worries.

SorooshDeveloper commented 7 months ago

@Aharonla i will add user mapping on its own branch including issue #30. if eveything is passed it's better to merge this pr. thanks.

Aharonla commented 7 months ago

@SorooshDeveloper

@Aharonla for fixing this cannot get data issue you need to create a file named : .env.development under /apps/ui directory and add below keys to it : (this file is in .gitignore so that's why it's not working on your side)

VITE_PUBLIC_API_URL=https://teaswap.io
VITE_WALLET_CONNECT_PROJECT_ID=167efa6c024c45590200c9868c0bda3e
VITE_PUBLIC_INFURA_API=039b2dba37b945e4a97d4bef93ceb773
VITE_PUBLIC_SEPOLIA_URL=https://sepolia.infura.io/v3/039b2dba37b945e4a97d4bef93ceb773

these keys are for testing purpose and they are also public keys so no worries.

So document this. Me, or anyone else wanting to run this project shouldn't have to scan through the whole codebase to find out that there are environmental variables missing. Better yet, add an .env.development.example file with:

VITE_PUBLIC_API_URL=""
VITE_WALLET_CONNECT_PROJECT_ID=""
VITE_PUBLIC_INFURA_API=""
VITE_PUBLIC_SEPOLIA_URL=""

And then add to the documentation that the user should fill those out before starting the project, with instructions on where to get them, and instruction to change the filename from .env.development.example to .env.development so that the values do not get uploaded to git.

BTW, sending the API keys in this thread defies the purpose of having a .env file that gets ignored by git in the first place, as now you have a record of your API keys documented on github's history. Be careful of this, it is a serious security issue.

SorooshDeveloper commented 7 months ago

@Aharonla these keys are for testing purpose and some keys like wallet connect project id is a public key that anyone can have it with no problem and i will delete other test keys after its over.

and also i updated this in readme branch so anyone who uses this project will get the idea.

Aharonla commented 7 months ago

@SorooshDeveloper the buyToken's amount is wrong.
When I choose an amount in $TEA, this is the amount that's supposed to be sent to the smart contract. Instead, the calculated amount in paymentToken is sent.
For example, if I want to buy 10 $TEA and pay with USDC, at a price of 0.07, I should get 10 $TEA and pay 0.7 $USDC as appears in the UI: צילום מסך 2024-04-03 122759

Instead, I get 0.7 $TEA and pay 0.049 $USDC as in the transaction record on etherScan: צילום מסך 2024-04-03 123951

SorooshDeveloper commented 7 months ago

@Aharonla check the latest commit