hyperledger-solang / solang

Solidity Compiler for Solana and Polkadot
https://solang.readthedocs.io/
Apache License 2.0
1.28k stars 217 forks source link

Conversion of payable #1614

Closed curry68 closed 11 months ago

curry68 commented 11 months ago

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

seanyoung commented 11 months ago

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.