solang icon indicating copy to clipboard operation
solang copied to clipboard

ERC20 is not available on solana

Open vinodsharmak opened this issue 2 years ago • 4 comments

I am trying to compile my contract but getting

error: 'msg.sender' is not available on Solana. See https://solang.readthedocs.io/en/latest/targets/solana.html#msg-sender-solana ┌─ D:\Github\solana-solidity\ERC20.sol:380:16 │ 380 │ return msg.sender;

Please let me know how I can fix this ? or is there any alternative for "msg.Sender"

vinodsharmak avatar Feb 13 '23 11:02 vinodsharmak

Hi @vinodsharmak

The documentation you linked literally answers your question:

The way to implement this on Solana is to have an authority account for the contract that must be a signer for the transaction (note that on Solana there can be many signers too). This is a common construct on Solana contracts.

xermicus avatar Feb 13 '23 11:02 xermicus

@vinodsharmak can you show us the solidity you are trying to compile, so we can help you re-write it without msg.sender?

seanyoung avatar Feb 13 '23 11:02 seanyoung

Hi @seanyoung Here is the sol ERC20.txt

vinodsharmak avatar Feb 13 '23 13:02 vinodsharmak

@vinodsharmak you are right, we need an ERC20 example that works on Solana. We should add this to our to do list.

seanyoung avatar Feb 15 '23 11:02 seanyoung