yo guys, what is way for transfer our token to user by ca with amount? in personal contract
Feb 18, 2023, 9:07 AM
you have tokens inside a contract and you want to withdraw them?
you can call transfer() method from inside the contract
function withdrawTokens(address tokenAddr) .... {
ierc20(tokenAddr).transfer(....)
}
ierc20(tokenAddr).transfer(....)
}
Feb 18, 2023, 9:11 AM
yeah i can mean its withdraw, send tokens from pool to user, and this contract function is intermediary
transfer is public function i think, i wana customize it like before send , change some data
Feb 18, 2023, 9:14 AM
like what?
I can't understand what you need
Feb 18, 2023, 9:15 AM
look, im user and i send bnb to pool, and now, pool should give me token.
may token change for every user, like shiba for ali, doge for james
how can i transfer token from pool to user for any token
may token change for every user, like shiba for ali, doge for james
how can i transfer token from pool to user for any token
we have _from, _to, _amount, _token
Feb 18, 2023, 9:20 AM
ok so who choose the token to send?
Feb 18, 2023, 9:20 AM
user
Feb 18, 2023, 9:21 AM
ok so you will need to cal lthe transfer method on that token.
You can use an interface like IERC20 to do it
You can use an interface like IERC20 to do it
Feb 18, 2023, 9:22 AM
Yeah agree!
i think this is my answer, is there full code of this function?
Feb 18, 2023, 9:23 AM
just to show you how to use it
do you already have the payable function to receive the bnb?
or you need it?
Feb 18, 2023, 9:24 AM
yes i fixed it, no need
Feb 18, 2023, 9:24 AM
ok so you just need to implement the token transfer
Feb 18, 2023, 9:25 AM
yes
@FreezyDev @shubhangdev02 heart 🤍 with love for you guys haha 😁
also is this code standard?
https://stackoverflow.com/questions/71941928/how-to-transfer-erc20-tokens-to-another-address-using-solidity
https://stackoverflow.com/questions/71941928/how-to-transfer-erc20-tokens-to-another-address-using-solidity
Feb 18, 2023, 9:26 AM
which part
Feb 18, 2023, 9:26 AM
answer part
Feb 18, 2023, 9:27 AM
which
the standard is everythign related to eip20
Feb 18, 2023, 9:27 AM
all this code
Feb 18, 2023, 9:27 AM
so allowance, transfer, balanceOf, transferFrom
are all method of erc20 standard
then the name of the functions you create to use them is your choice
Feb 18, 2023, 9:28 AM
and depositTokens?
cool guy
Feb 18, 2023, 9:28 AM
custom function
Feb 18, 2023, 9:28 AM
oh cool, Thankyou Freezy, i'll test it
Feb 18, 2023, 9:29 AM
not the easiest task
from the opcodes, the first thing you can know is if it is payable or no
then you have to check if that function edit the state
Feb 18, 2023, 10:08 AM
Only thing is i can make abi file.
But abi does not show visibility
But abi does not show visibility
Feb 18, 2023, 10:12 AM
wait you mean public/private etc?
in the abi you should see only accessible functions
Feb 18, 2023, 10:14 AM
So every function in abi is public?
Feb 18, 2023, 10:15 AM
no results
Feb 18, 2023, 10:16 AM
Great
Feb 18, 2023, 10:16 AM
same
Feb 18, 2023, 10:16 AM