Skip to content

Instantly share code, notes, and snippets.

View Martoon-00's full-sized avatar
🤔
Focusing

Konstantin Ivanov Martoon-00

🤔
Focusing
View GitHub Profile
@Martoon-00
Martoon-00 / Try.hs
Created March 8, 2022 19:52
Spawn thread dies too early
import Control.Concurrent
import qualified Data.Text as T
import GHC.IO.Handle
import System.Process
getFileContent :: IO T.Text
getFileContent = withCreateProcess (proc "cat" ["very-big-file.txt"]){ std_out = CreatePipe }
\_mStdin mStdout _mStderr phandler ->
case mStdout of
Nothing -> error "No handler"
@Martoon-00
Martoon-00 / CounterSdu.md
Last active May 13, 2020 17:23
UStore documented

Upgradeable counter (SDU)

Sample of storage-driven upgradeable contract.

Version: 1

@Martoon-00
Martoon-00 / ManagedLedger.md
Last active February 24, 2020 13:46
Example of entrypoints in documentation

Managed Ledger

Code revision: a53685a (Mon Feb 24 02:53:34 2020 +0300)

This documentation describes a smart contract which implements FA1.2 interface. This contract also maintains an entity called administrator which has an exclusive right to perform management operations like Mint and Pause.

Entrypoints

@Martoon-00
Martoon-00 / CounterSdu.md
Last active February 24, 2020 14:07
Example of documented entrypoints

Upgradeable counter (SDU)

Sample of storage-driven upgradeable contract.

Version: 1

Contract upgradeability

This contract uses upgradeability approach described here. This mechanism provides adminstrator-forced address-preserving upgradeability

@Martoon-00
Martoon-00 / Doc.md
Created October 29, 2019 21:09
Counter SDU

Upgradeable counter (SDU)

Sample of storage-driven upgradeable contract.

Entry points


epInc

@Martoon-00
Martoon-00 / ManagedLedgerAthens.md
Last active September 26, 2019 22:26
Automatically generated documentation for Tezos contract (ManagedLedgerAthens)

Managed Ledger (Athens)

This documentation describes a smart contract which implements FA1.2 interface. This contract also maintains an entity called administrator which has an exclusive right to perform management operations like Mint and Pause.

This version targets Athens release of Tezos and implements the approach proposed in the relevant section of FA1.2.1.

Entry points

@Martoon-00
Martoon-00 / hello_world.py
Created September 26, 2019 15:31
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@Martoon-00
Martoon-00 / ManagedLedger (Athens).md
Created September 24, 2019 20:11
Example of automatically generated contract documentation, with errors

Managed Ledger (Athens)

This contract implements a smart contract which implements FA1.2 interface. This contract also maintains an entity called administrator which has an exclusive right to perform management operations like Mint and Pause.

This version targets Athens release of Tezos and implements the approach proposed in the relevant section of FA1.2.1.

Entry points

parameter (or (pair %transfer address (pair address (nat :val))) (or (pair %approve address nat) (or (pair %getBalance address (contract (pair address (option nat)))) (or (pair %getAllowance (pair address address) (contract (pair (pair address address) (option nat)))) (or (pair %getTotalSupply unit (contract (pair unit (option nat)))) (or (bool %setPause) (or (address %setManager)

@Martoon-00
Martoon-00 / swagger.json
Created March 9, 2019 10:16
Educator API with auto filters
{"swagger":"2.0","info":{"contact":{"email":"hi@serokell.io","url":"https://serokell.io","name":"Serokell OÜ"},"termsOfService":"https://disciplina.io/tnc.pdf","version":"1.0.0","title":"Disciplina Educator API","license":{"url":"http://www.apache.org/licenses/LICENSE-2.0.html","name":"Apache 2.0"}},"host":"127.0.0.1:8090","basePath":"/api/educator/v1","schemes":["http","https"],"paths":{"/status":{"get":{"tags":["General"],"produces":["application/json;charset=utf-8"],"responses":{"200":{"schema":{"$ref":"#/definitions/EducatorInfo"},"description":"Successfull operation"},"401":{"$ref":"#/responses/Unauthorized"}}}},"/students":{"get":{"tags":["Students"],"summary":"Get a list of all registered students' addresses","produces":["application/json;charset=utf-8"],"parameters":[{"default":false,"in":"query","name":"onlyCount","allowEmptyValue":true,"type":"boolean","description":"If this parameter is present, return only the total count of items."},{"format":"int32","required":false,"in":"query","name":"offset",