Does someone know how pair and liquidity is added in one transaction if pair for the token is currently not created (showing address 0x0000) via the addLiquidityETH() function from the pankcakeSwap router? When i try to do it via my GUI it return 'execution reverted' error if i do not create the pair first via the createPair() func from factory contract and then call the addLiquidityETH() function from the router.
But when i add liquidity in testnet via PCS GUI, thats done in 1 txn via the addLiquidityETH() function only, how they do this? How can i call 2 functions from 2 separate contracts in 1 txn from ethers.js without any intermediary aggregator contract, is that possible?

Mar 8, 2023, 1:57 PM
Mar 8, 2023, 2:00 PM
if you call addLiquidity and the pool doesn't exists it should be created automatically
Mar 8, 2023, 2:04 PM
ty, the err was in my frontend
shubhangdev helped alot to see the err ty very much
wohooo
Mar 8, 2023, 2:44 PM
nice now change font🤣
looks like the Black Ops 1 font
Mar 8, 2023, 2:46 PM
At least he is using the double check mark like WhatsApp lol
Mar 8, 2023, 3:40 PM
yeah it is, why should i change it its a nice one, dont you like it?
Mar 8, 2023, 3:42 PM
I don't get this
struct UserTransaction {
Transaction[] transactions;
}
why not directly
mapping(address => UserTransaction[])
with
struct UserTransaction {
address user;
address token;
uint256 amount;
bytes32 title;
uint256 status;
}
Mar 8, 2023, 4:51 PM
because in this case, I have to specify the array index to get data
like with mapping
Mar 8, 2023, 4:52 PM
I didn't understand
Mar 8, 2023, 4:53 PM
to get the whole array I use this function

function getData() public view returns (Transaction[] memory) {
return data[msg.sender].transactions;
}
Mar 8, 2023, 4:55 PM
better iterating it offchain
Mar 8, 2023, 4:59 PM
just cheked. Your option also works.
Mar 8, 2023, 5:00 PM
through some indexer, such as The Graph
Mar 8, 2023, 5:01 PM
in this case you only need events
Mar 8, 2023, 5:02 PM
make sense, it is always best option to store large dataset offchain
There are 3party apis for blockchain history, you can get to use them
You can enjoy sql-like querying
Mar 8, 2023, 5:03 PM
the problem with offchain store is that the user will use this data for further interaction and so I have to somehow verify that he use his account address and not somebody else
yes but he also can find what endpoint I use to get offchain data and insert other address and do a call from postman for example
Mar 8, 2023, 5:11 PM
you are missing something
I don't see anything that avoid this in your code
Mar 8, 2023, 5:12 PM
guess you are right, even if he gets someone else data offchain he won't be able to to change them in blockchain because of the wallet signature
Mar 8, 2023, 5:15 PM
this depends on you
we don't have that snippet section
Mar 8, 2023, 5:15 PM
anyway, I see that the best option will be to use mapping with storing data offchain
thanks to everyone
Mar 8, 2023, 5:22 PM
what does it mean
Mar 8, 2023, 6:14 PM

Ā© 2024 Draquery.com All rights reserved.