Code Monkey home page Code Monkey logo

ticktimer's Introduction

This repository for freeton contest for running this contract you need: solc, tvm_linker, tonos-cli

Deploy

Compile contract:
solc main.sol
Compile in tvc:
tvm_linker compile --lib stdlib_sol.tvm --abi-json main.abi.json main.code
Generate address
tonos-cli genaddr <main>.tvc main.abi.json --genkey timer.keys.json
Send some crystal there or use giver
Use it!
tonos-cli call <address> createTimer '{"_payload":"<payload in int64>","_time":<time in seconds>}' --abi main.abi.json --sign timer.keys.json

or

tonos-cli call <address> createHandler '{"_payload":"<payload in int64>","_time":<time in seconds>}' --abi main.abi.json --sign timer.keys.json

Are there any differences between createTimer and createHandler?

Yes, createTimer create handler nowtime + your time. Its useful for users. And createHandler set only your time.

How connect this library to my contract?

Its simple. You can watch the test.sol

First you need create contract interface
contract timer {
    function createHandler(uint _payload,uint64 _time) public {}
    function createTimer(uint _payload,uint64 _time) public {}
}
More you need to save address of timer in contract
address timerAddress;
and set this address through the function for example changeAddress
function changeAddress(address _adr) public onlyOwnerAndAccept {
    timerAddress = _adr;
}
Then you need to create handler there will be sending from timer
function _timer_handler(uint payload) public {
    require(timerAddress == msg.sender,100,'Unauthorized');
    <Your code>
}
And start timer
timer(timerAddress).createTimer(100,60);

You can use payload to diffent things, for instance delay send.

By commaster1

ticktimer's People

Contributors

com-master avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.