hyperledger-solang/solang

Conversion of payable

curry68 opened this issue · 1 comments

function flip(address _addr) public payable {
total += 1;
payable(_addr).transfer(1);
}
How to call this in Solana:
await program.methods
.flip(transferToAccount)
.accounts({ dataAccount: dataAccount.publicKey})
.rpc();
Isn’t this right? How can I transfer the sol into the contract?thanks

A transfer needs to transfer tokens from somewhere to somewhere else. You can't magic tokens out of nowhere.

You can use airdrop or other Solana methods of funding accounts.