Good day everyone.
I deployed my contract to rinkeby, and I am trying to interact with it to do a uniswap ETH - Dai swap.
Am I doing anything wrong here?

Apr 24, 2022, 6:28 AM
I have seached and seen this syntax as the correct one to convert eth to wei and send while calling a function in my truffle console:
await engine.convertETHToDAI({value: web3.utils.toWei("0.1", "ether")})

When I use it, this is the error I get
I've included the code of function I'm calling for clarity. Can anyone look through it and tell me what I am doing wrong? Been clueless since yesterday
?? Anyone?
Apr 25, 2022, 8:19 AM
share the hash here
Apr 25, 2022, 8:44 AM
tx: 0x6b1bb2ec033bfd4ea1abfdb81b54e7581861310fc5db323251fa26ee2556ceb2
Apr 25, 2022, 8:49 AM
https://jeiwan.net/
Apr 25, 2022, 8:58 AM
Which line from the convertETHToDAI function is it failing on?
Apr 25, 2022, 9:57 AM
How do I know that? I run the command, it fails with the error I showed here
Apr 25, 2022, 9:58 AM
add revert('pof'); after a line. run. if it reverts with message "pof" then you haven't found your point of failure yet, i.e., all code up to that point is working. When it fails and it doesn't say "pof", then you know the code is not reaching your revert and you can assume the line before that is your point of failure.
But I suggest we take it private so we do not distract those specifically seeking help with solidity.
Apr 25, 2022, 10:16 AM
Added the revert statement on the very first line of the convertETHToDAI function and the exact same error as before came up. No "pof"
Apr 25, 2022, 10:50 AM
Hmm... that's odd. But it's helpful information, let me go back and look...
Wait, are you sure you re-compiled and re-deployed?
Apr 25, 2022, 10:58 AM
Yes, i did two steps: truffle compile and truffle deploy to network rinkeby
Can anyone help?
@help240 Alex Donald is another scammer inboxing people and pretending to be some sort of admin pls report him guys and get him off the group
I've pasted tx hash, deployed to GitHub, provided ether scan link. Is it that from what you can see, my code and set up is correct and everything should be ok?
Apr 25, 2022, 2:53 PM
Also so that I know exactly what the code is and I'm not just taking your word for it.
We all make mistakes. I've been 100% sure that the code was X, would stake my life on it, and then realize, "oh wait, I forgot, ..."
When you publish the code, there is no confusion, no doubt, no wasted time.
Apr 25, 2022, 2:56 PM
Thank you for your help and time, it's just getting frustrating.
How exactly do I publish or what should I Google search to find out?
Apr 25, 2022, 2:59 PM
I think truffle has a plugin that makes it easy
https://www.npmjs.com/package/truffle-plugin-verify
Apr 25, 2022, 3:04 PM
getAmountsOut returns in wei already no?
getAmountOut instead returns 1 value
Apr 25, 2022, 3:25 PM
Yes but i don't know what i have to pass into reserves parameters
Apr 25, 2022, 3:26 PM
all uniswap parameters and return values are in wei which is why you end up having to use parse/format so much on the front end
Apr 25, 2022, 3:26 PM
yes but he wants in wei no?
check getReserves
Apr 25, 2022, 3:26 PM
Ok thanks guys, i will try
Apr 25, 2022, 3:27 PM
Well, he was passing "1" into the function, so I told him he needed to convert to wei, I just assumed he'd want to convert the result back into tokenized units.
Apr 25, 2022, 3:28 PM
Yes, beacuse i want to show fixed value, some like 0.000.....
Apr 25, 2022, 3:29 PM
https://twitter.com/transmissions11/status/1518507047943245824?t=Aj0fLQdfKsLLuRtcXl2paQ&s=19
Apr 25, 2022, 3:30 PM
so always, utils.parseUnits(tokenizedValue, tokenDecimals) -> send off your data -> get back result -> utils.formatUnits(resultInWei, tokenDecimals) and display that
Apr 25, 2022, 3:32 PM
Ok thanks, i will try this one
Apr 25, 2022, 3:33 PM
BLACK MAGIC! lol...
Apr 25, 2022, 3:35 PM
I've installed and set it up. I don't know about "publishing" but from the npm documentation I saw it's used to verify contracts so I gave that a try and after setting it up and running the verify command this is my error.
I don't have a constructor argument in my contract so I don't know how to troubleshoot. Could you please check my contact on GitHub and see where I need to fix?
Here it is again
https://github.com/avwunufe/Uniswap-test
Apr 25, 2022, 3:50 PM
Well I think what this is telling you is that whatever contract is deployed at the address that truffle is telling it was deployed with constructor arguments. Try truffle migrate --reset --network rinkeby and then your verify command
you might throw in --compile-all too
Apr 25, 2022, 4:13 PM
I ran this and the verify command worked. But my function to convert eth failed with the Same error.
The new etherscan link:
https://rinkeby.etherscan.io/address/0x3e25f2763395e8b9A194bF37953E66EdE7679A7f
Apr 25, 2022, 5:47 PM
It reverted with 'POF'
Apr 25, 2022, 7:03 PM
Oh.. I thought I was supposed to see it in the console, not just in etherscan
Does this mean I have to move the revert statement down one line at a time then run truffle migrate --reset each time?
Apr 25, 2022, 7:20 PM
Wth is POF?
Apr 25, 2022, 7:41 PM
Lol how are you gonna debug this? First line itself is revert
Pro tip : kovan != rinkeby
Apr 25, 2022, 8:36 PM
??
Apr 25, 2022, 8:52 PM
Check the hardcoded addresses
Apr 25, 2022, 8:55 PM
did you see how it works?
after some blocks
Apr 25, 2022, 10:12 PM
Ok but what about a scenario where the random number is used to choose from a list which can be altered in the same block as the callback function.
Apr 25, 2022, 10:16 PM
I didn't understand
when you request the random value
is 1 tx
then the callback is another tx
Apr 25, 2022, 10:19 PM
Yes and if someone frontruns this transaction they can determine which entry in the list will be picked.
Apr 25, 2022, 10:21 PM
you mean the callback?
Apr 25, 2022, 10:21 PM
Yes
Apr 25, 2022, 10:22 PM
ah yes then yes
Apr 25, 2022, 10:22 PM
So in order to prevent this I should take a snapshot of the list when requesting randomness and use that snapshot in the callback
Apr 25, 2022, 10:23 PM
well I dom't know how you plan to use it
but usually if someone is frontrunning you
you can't do a lot from a contract
Apr 25, 2022, 10:25 PM
Yes, that's what I would do until you find the actual point of failure.
It's the revert message, I just called it POF, short for point of failure, because we're trying to figure out which line of code is actually causing the failure (since the actual failure is not giving us any message or clue).
I'm about to revolutionize block chain technology. DM me if you want to discuss how. And if you need any help with solidity, post your questions here.
Apr 26, 2022, 5:54 AM
Lol can you summarise here?
Apr 26, 2022, 6:02 AM
Sure, here's some bait... The problem we have right now with having multiple dapps on one chain (Smart Contract based chains) is - not all services are created equal. Some services need certain capabilities, some don’t need those capabilities and it’s just overhead for them. Some services are worth $1 a month; some are worth $50; some are worth $500 or more. If you put them all on the same chain, it’s like making people buy rocket fuel just to mow their lawn.
Apr 26, 2022, 6:07 AM
So you mean infra?
Apr 26, 2022, 6:08 AM
What I'm alluding to is what I believe to be the solution to this problem. We need an SDK which makes it super easy to develop what I'm calling SDCs (Single Dapp Chains).
Apr 26, 2022, 6:10 AM
Okay, I kinda follow you lol
Remix is good to get something started quickly, cos it has auto compile
But that's about it
Apr 26, 2022, 6:20 AM
I always suggest people learn to compile their contracts manually with solc and write scripts to manually deploy with ethersjs or web3. But if you really want a framework, I second hardhat.
Apr 26, 2022, 6:23 AM
'npx hardhat compile' lol
Debug - hardhat console.sol helps a lot
It's best to use 0.8.4 for security reasons
Apr 26, 2022, 7:17 AM
Ok but my sc use uniswapv2 so 0.6.6 and another protocol 0.8.8 i feel stuck
Apr 26, 2022, 7:18 AM
https://github.com/crytic/solc-select
Apr 26, 2022, 7:20 AM
Thx I check that
Apr 26, 2022, 7:20 AM
Screenshot?
You need to check for return value
https://ethereum.stackexchange.com/questions/9213/return-value-of-low-level-calls-not-used
https://hardhat.org/guides/compile-contracts.html
Apr 26, 2022, 7:55 AM
You don't need to use their contract, just copy their interface code and put it in your own file with whatever version.
Apr 26, 2022, 7:57 AM

© 2024 Draquery.com All rights reserved.