Skip to content

Instantly share code, notes, and snippets.

View vyorkin's full-sized avatar
❤️‍🔥

Vasiliy Yorkin vyorkin

❤️‍🔥
View GitHub Profile
@vyorkin
vyorkin / contracts...Vault.sol
Created March 7, 2022 20:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.12+commit.f00d7308.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
/*
Note: cannot use web3 on JVM, so use the contract deployed on ropsten
Note: browser Web3 is old so use Web3 from truffle console
Contract deployed on Ropsten
0x3505a02BCDFbb225988161a95528bfDb279faD6b
*/
@vyorkin
vyorkin / README.txt
Created March 7, 2022 17:07
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.12+commit.f00d7308.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@vyorkin
vyorkin / README.txt
Last active March 7, 2022 17:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.12+commit.f00d7308.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@vyorkin
vyorkin / README.txt
Created March 7, 2022 16:50
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.12+commit.f00d7308.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@vyorkin
vyorkin / README.txt
Created March 7, 2022 16:41
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@vyorkin
vyorkin / README.txt
Created March 7, 2022 15:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.10+commit.fc410830.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@vyorkin
vyorkin / zathurarc
Created March 6, 2022 09:32
zathurarc
set selection-clipboard clipboard
set statusbar-h-padding 0
set statusbar-v-padding 0
set smooth-scroll true
set statusbar-home-tilde true
set page-padding 1
map u scroll half-up
map d scroll half-down
map D toggle_page_mode
@vyorkin
vyorkin / crates.md
Created July 12, 2021 10:32
Substrate & Cumulus crates cheat sheet
  • sp - Substrate Primitives

  • sc - Substrate Client

  • sp-api - Substrate runtime API

  • sp-consensus - Common utilities for building and using consensus engines in Substrate

  • sp-consensus-aura - Primitives for Aura PoA consensus engine

  • sc-consensus-aura - Client primitives for Aura PoA consensus engine

  • sp-core - Shareable Substrate types

  • sp-finality-grandpa - Primitives for GRANDPA integration, suitable for WASM compilation

  • sp-runtime - Runtime Modules shared primitive types

{-# LANGUAGE ScopedTypeVariables #-}
import Foreign.Marshal.Array (newArray)
import Control.Exception (bracket)
import Data.Int (Int8)
import System.IO (IOMode(..), openBinaryFile, hClose, hPutBuf, hFlush)
main :: IO ()
main = bracket (openBinaryFile "rom.bin" WriteMode) hClose $ \handle -> do
let bytes = replicate 32768 (0xea :: Int8)
@vyorkin
vyorkin / shell.nix
Created June 15, 2019 11:07
parallel & concurrent haskell book shell.nix
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc7102" }:
let
inherit (nixpkgs) pkgs;
metapkgs = import (builtins.fetchTarball "https://github.com/matthewbauer/metapkgs/archive/master.tar.gz");
ghc = metapkgs.${compiler};
in pkgs.stdenv.mkDerivation {
name = "my-haskell-env-0";
buildInputs = [ ghc nixpkgs.zlib ];
shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)";