Hello, everyone🖖🏼 I am trying to sell a custom ERC20 token for USDT. I have a separate smart contract for that. How can I check how many USDT tokens are sent to my smart contract?
Mar 29, 2022, 6:49 AM
depends liquidity x Price of token = USDT total
Mar 29, 2022, 6:51 AM
it’s supposed to be sold for a fixed price
i have that: uint256 public tokensForUSDT = 2;
Mar 29, 2022, 6:52 AM
what token btw ?
Mar 29, 2022, 6:52 AM
I am working on an nft marketplace and there should custom token
so I am just testing rn
I wanna check how many usdt were sent to calculate how many tokens the user can get for that amount of USDT
kinda like that: uint256 amountToBuy = /USDT_Sent/ * tokensForUSDT;
meaning that for 1 usdt user can get 2 tokens
Mar 29, 2022, 6:56 AM
you can check balanceOf before and after and work with the difference
Mar 29, 2022, 7:20 AM
i have stuck BNB on my smart contract 😂
Mar 29, 2022, 8:04 AM