Hi. I want to design a website that shows a wallet address for each person and each person can use my smart contract by transferring some currency ( trx) to that wallet address. The problem is that I can not read the transaction history through the smart contract or how can I provide a separate wallet address for each person who becomes a member of the smart contract so that I can know the amount of their assets in the smart contract by sending money to that address. please help me

Mar 2, 2022, 2:23 PM
please help me for this question
Mar 2, 2022, 2:32 PM
Simplest way is just have them deposit to the smart contract itself via a function call, and your contract can track their deposited balance
Mar 2, 2022, 2:34 PM
before i test this way. in this way we should run function and connect to wallet. but i want persons just send the trx to contract address. in this way contract can not know which person how much send.
i want to show for each person Different address for sending currency and also save this amount to variable in struct.
Mar 2, 2022, 2:40 PM
Providing an unique address to each person is more of a hot wallet for a website, not a contract. In a contract everyone sends to the same address, and you track the sender's
Mar 2, 2022, 2:46 PM
If you just have people deposit to the contract via plain transfers, the contract can't track anything. You could set up multiple wallets for them, and then do the final deposits for them I guess...but seems unnecessarily complicated
Much simpler to just have a deposit function on the contract
Mar 2, 2022, 2:49 PM
how can track senders? when my customer run function i dont have problem and they information regester in strust but when someone just send currency to contract address ,No traces are recorded.
Mar 2, 2022, 2:52 PM
Right, you can't track sender on-chain via plain transfers. Just have your website call the deposit function, problem solved
Mar 2, 2022, 2:53 PM
Fall back function. You can still access the sender and track. Also remember the contract has access to the full data block of the chain your on, so you do have ways of tracking.
Mar 2, 2022, 2:54 PM
Oh yeah, if sending trx then fallback works. For some reason I thought he was talking about other tokens
Mar 2, 2022, 2:56 PM
Yes only works with native tokens. The issue with using other tokens is nothing is actually sent or changes in a target contract, only change that is made is in host contracts ledger.
Mar 2, 2022, 3:00 PM
Yep
Mar 2, 2022, 3:02 PM
Thank you. Get information about this function (fall back func). If I do not get results, I will ask you for guidance again. Thanks
Mar 2, 2022, 3:03 PM
This issue is an old one, it why we have approve, and trnasferFrom
Mar 2, 2022, 3:03 PM
I am a beginner and have just started coding. If you have any examples with this theme, send it to me links.
Mar 2, 2022, 3:05 PM

© 2024 Draquery.com All rights reserved.