I've found a few old posts that ask a similar question to this (see e.g. Requiring a specific type of token in smart contract) however i'm a bit confused how this relates to some other posts i've seen about how best to transfer tokens.
What i want to do is have a function in a smart contract that expects to recieve some amount of a specific token and will change some state or perform some other action if it is present, i.e. something like :
function do_a_thing(int amount_of_token) public {
//check if token is the right type
state = new_state;
// do something else
}
When reading online i have seen posts about how one should use the 'call' function to transfer, rather than transfer/receive, i've also seen things about 're-entry attacks'.. sufficed to say I am somewhat confused about the right way to go about this!
Any help would be appreciated, as would any suggestions for up to date guides on how to do interesting things with smart contracts.
Many Thanks