Skip to content

Instantly share code, notes, and snippets.

@svanas
Last active March 4, 2025 18:59
Show Gist options
  • Save svanas/35dceb33f64d6d2c12675e20b5631bcc to your computer and use it in GitHub Desktop.
Save svanas/35dceb33f64d6d2c12675e20b5631bcc to your computer and use it in GitHub Desktop.
Transferring ERC-20 tokens with Delphi
const ERC20: IERC20 = TERC20.Create(TWeb3.Create(
Sepolia.SetRPC('https://sepolia.infura.io/v3/your-project-id')), // Sepolia testnet
'0xe28a3A4BFbf285676405cF55354f8b504D844f3c'); // TST smart contract address
ERC20.Transfer(
TPrivateKey('24622d680bb9d6d80c4d3fb4b4818e738de64b521948b1b1c85616eeeda54ee1'), // from private key
'0xaDDcedc01C1070bCE0aF7eb853845e7811EB649C', // to public key
1000000000000000, // 0.001 TST
procedure(hash: TTxHash; err: IError)
begin
TThread.Synchronize(nil, procedure
begin
if Assigned(err) then
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0)
else
MessageDlg(string(hash), TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK], 0);
end);
end);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment