/** * This file was generated by TONDev. * TONDev is a part of TON OS (see http://ton.dev). */ pragma ton-solidity >= 0.35.0; pragma AbiHeader expire; // This is class that describes you smart contract. contract HelloWallet { // Contract can have an instance variables. // In this example instance variable `timestamp` is used to store the time of `constructor` or `touch` // function call uint32 public timestamp; // Contract can have a `constructor` – function that will be called when contract will be deployed to the blockchain. // In this example constructor adds current time to the instance variable. // All contracts need call tvm.accept(); for succeeded deploy constructor() public { // Check that contract's public key is set require(tvm.pubkey() != 0, 101); // Check that message has signature (msg.pubkey() is not zero) and // message is signed with the owner's private key require(msg.pubkey() == tvm.pubkey(), 102); // The current smart contract agrees to buy some gas to finish the // current transaction. This actions required to process external // messages, which bring no value (henceno gas) with themselves. tvm.accept(); timestamp = now; } function renderHelloWorld () public pure returns (string) { return 'helloWorld'; } // Updates variable `timestamp` with current blockchain time. function touch() external { // Skip signature check // require(msg.pubkey() == tvm.pubkey(), 102); // Tells to the TVM that we accept this message. tvm.accept(); // Update timestamp timestamp = now; } // Function returns value of state variable `timestamp` function getTimestamp() public view returns (uint) { return timestamp; } // Send specified amount of tokens to the specified address function sendValue(address dest, uint128 amount, bool bounce) public view { require(msg.pubkey() == tvm.pubkey(), 102); tvm.accept(); // It allows to make a transfer with arbitrary settings dest.transfer(amount, bounce, 0); } }