Skip to content

Instantly share code, notes, and snippets.

@fetsorn
fetsorn / search_github.sh
Last active May 4, 2023 12:46
Search fresh repos in two languages
curl --request GET \
--url "https://api.github.com/search/repositories?q=language:solidity,language:typescript+pushed:>2023-01-01+stars:>=20&per_page=100&page=1" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer YOUR_TOKEN_HERE" | \
jq ".items[] | {owner: .owner.login, name, language}"
@fetsorn
fetsorn / ged2dot.js
Created January 24, 2022 23:54
Translation of ged2dot.py to JavaScript
// Original code in Python Copyright Miklos Vajna (ged2dot@vmiklos.hu) 2022.
// Translated to JavaScript by Anton Davydov (git@fetsorn.website).
// This file is licensed under the Mozilla Public License, v. 2.0.
// License text available at https://mozilla.org/MPL/2.0/
class Config {
constructor() {
this.input = ""
this.rootfamily = "F4"
this.familydepth = 4
@fetsorn
fetsorn / puma.sh
Last active May 14, 2022 22:35
A tree cat that executes.
#!/bin/bash
# "a tree cat that executes"
# suggested by @that-other-guy
# at https://stackoverflow.com/questions/70841809/what-should-this-bash-script-be-called
unset concatenate
OPTIND=1
while getopts 'c' opt; do
@fetsorn
fetsorn / relay_event_encoding.txt
Created August 13, 2021 09:53
Relay event encoding
AttachValue
https://ftmscan.com/tx/0x729fe13521391a8d9b9ae854bf9e97b82fcd71449ae6e21ddc4c60300becbe88#eventlog
000000000000000000000000a7a1869df83968986c383bfe54432475014aaeea - nebula
74070806d706495c85498029b3408c6500000000000000000000000000000000 - bytes16 uuid
0000000000000000000000000000000000000000000000000000000000000120 - encoding
0000000000000000000000000000000000000000000000000000000000000160 - encoding
a4f88aed847e87bafdc18210d88464dc24f71fa4bf1b4672710c9bc876bb0044 - bytes32 topic0
00000000000000000000000000000000000000000000000000000000000001a0 - encoding
00000000000000000000000000000000000000000000000000000000000001e0 - encoding
0000000000000000000000000000000000000000000000000000000000000220 - encoding
@fetsorn
fetsorn / .deps...github...OpenZeppelin...openzeppelin-contracts...contracts...GSN...Context.sol
Created April 25, 2021 16:30
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.1+commit.df193b15.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
@fetsorn
fetsorn / reclaim.sol
Created April 20, 2021 15:55
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=
pragma solidity >=0.6.0 <0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
@fetsorn
fetsorn / artifacts...Context.json
Created April 20, 2021 15:55
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=
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
@fetsorn
fetsorn / reclaim.sol
Created April 20, 2021 14:29
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=
pragma solidity >=0.6.0 <0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
@fetsorn
fetsorn / ibport-bare.sol
Created April 18, 2021 15:09
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=
pragma solidity <=0.7;
abstract contract Ownable {
address private _owner;
address private _admin;
constructor () internal {
_owner = msg.sender;
_admin = msg.sender;
}
@fetsorn
fetsorn / README.txt
Created April 18, 2021 15:09
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 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