This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.0; | |
contract ArithValue { | |
uint number; | |
constructor () { | |
number = 100; | |
} | |
function setNumber(uint value) public { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.0; | |
contract HelloWorld { | |
function myFirstHelloWorld() public pure returns (string memory) { | |
return 'Hello World!'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.call(TWeb3.Create( | |
Sepolia.SetRPC( // Sepolia test net | |
'https://sepolia.infura.io/v3/your-project-id')), // RPC access to Sepolia | |
'0x643C9Db08aBE4D95e4F2Afc733F78b601b84007A', // smart contract address | |
'myFirstHelloWorld()', [], procedure(tup: TTuple; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAddress.Create('0xa0400ba66b4fe0b13bb909abfd377596c02b6733').ToString( | |
TWeb3.Create(Ethereum.SetRPC('https://mainnet.infura.io/v3/your-project-id')), | |
procedure(str: string; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
else | |
ShowMessage(str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TAddress.FromName(TWeb3.Create( | |
Ethereum.SetRPC('https://mainnet.infura.io/v3/your-project-id')), // Ethereum mainnet | |
'thecoinoffering.eth', // Ethereum domain name | |
procedure(addr: TAddress; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ERC20 = TERC20.Create(TWeb3.Create( | |
Goerli.SetRPC('https://goerli.infura.io/v3/your-project-id')), // Goerli testnet | |
'0x45843aF56Aa1057eD1730cA5Ba3F709833900E77'); // TST smart contract address | |
try | |
ERC20.Transfer( | |
TPrivateKey('24622d680bb9d6d80c4d3fb4b4818e738de64b521948b1b1c85616eeeda54ee1'), // from private key | |
'0xaDDcedc01C1070bCE0aF7eb853845e7811EB649C', // to public key | |
1000000000000000, // 0.001 TST | |
procedure(hash: TTxHash; err: IError) | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.tx.sendTransaction( | |
TWeb3.Create(Ganache), // Ganache 2.7.1 | |
TPrivateKey('24622d680bb9d6d80c4d3fb4b4818e738de64b521948b1b1c85616eeeda54ee1'), // from private key | |
'0xaDDcedc01C1070bCE0aF7eb853845e7811EB649C', // to public key | |
web3.eth.utils.toWei('0.01', ether).Value, // 0.01 ether | |
procedure(tx: TTxHash; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TForm1.Button1Click(Sender: TObject); | |
begin | |
ShowMessage( | |
web3.eth.crypto.sign( | |
TPrivateKey('b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7'), | |
'Hello, World!' | |
).ToHex | |
); | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Client: IWeb3 = TWeb3.Create('https://mainnet.infura.io/v3/your-project-id'); | |
web3.eth.call(Client, '0xB8c77482e45F1F44dE1745F52C74426C631bDD52', 'symbol()', [], procedure(tup: TTuple; err: IError) | |
begin | |
if Assigned(err) then | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
end); | |
EXIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web3.eth.getBalance(TWeb3.Create(Ganache), Edit1.Text, procedure(qty: BigInteger; err: IError) | |
begin | |
TThread.Synchronize(nil, procedure | |
begin | |
if Assigned(err) then | |
MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0) | |
else | |
ShowMessage(web3.eth.utils.fromWei(qty, web3.eth.utils.ether) + ' ether'); | |
end); | |
end); |