Skip to content

Instantly share code, notes, and snippets.

pragma solidity >=0.7.0 <0.9.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Maybe some stuff here -->
</head>
<body>
<div id="root"></div>
<script
src="/static/bundle.js"
></script>
#!/usr/bin/env bash
DATADIR_1=$HOME/.pls.staking/datadir.1 # NODE#1
PWD=$DATADIR_1/pwd.pass
GENESIS_1=$DATADIR_1/test-genesis.json
MANAGERS_JSON=$HOME/.pls.staking/managers.json # Manager Contracts
CONFIG=$DATADIR_1/test-config.json
DATADIR_MANAGERS=$HOME/.pls.staking/datadir.0 # to deploy manager contracts
MANAGERS_JSON=$HOME/.pls.staking/managers.json # Manager Contracts
JSONRPC=ws://13.231.233.189:8546
API_SERVER=https://dashboard-api.tokamak.network/rinkeby
PASSWORD=$DATADIR_MANAGERS/pwd.pass
echo "Cleanup files"
rm -rf $DATADIR_MANAGERS $MANAGERS_JSON
mkdir -p $DATADIR_MANAGERS
@shingonu
shingonu / spec.k
Last active October 24, 2019 13:19
behaviour transfer of Token
interface transfer(address To, uint256 Value)
types
FromBal : uint256
ToBal : uint256
storage
@shingonu
shingonu / mocha-guide-to-testing.js
Created June 12, 2019 09:54 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()

I decided to write this guide because I have been pretty happy recently. I would go as far as to say that I am the happiest I’ve ever been (in a sustained way) in my adult life, and completely independent of my external circumstances. This is how I’ve done it.

Background In our society today it is easy to get caught on the hedonic treadmill: the belief that happiness is just around the corner if one can only achieve the next milestone, or experience the next life experience. This is a trap. As someone who has achieved more and more success over time, and experienced more and more fun, positive, exciting things, no achievement or experience has ever resulted in a sustained increase to baseline happiness for me.

Expectations for how you will feel once you achieve your goal lead to an endless cycle of suffering. Either you get what you want and then set new, higher, loftier goals, or you don’t get what you want and end up feeling miserable. In The Score Takes Care of Itself, Bill Walsh tells of winning three S

@shingonu
shingonu / 12 tips for writing clean and scalable JavaScript.md
Created May 7, 2019 13:58
12 tips for writing clean and scalable JavaScript

1. Isolate your code

topic과 분리해서 명백한 로직의 덩어리가 필요하다. 만약 함수를 작성하면 반드시 하나의 목적을 가지는 것으로 작성해야 한다. 하나의 함수에서 여러 목적의 기능이 들어가면 안된다.

또한 에러를 줄이기 위해서는 함수 내부에서만 상태 변경을 일으켜야 한다. 만약 함수 외부에서 상태를 변경시키고자 할 땐 함수에서 데이터를 리턴받아서 사용한다.

2. Modularization

만약 여러 개의 함수가 같은 방식으로 비슷한 것을 처리할 땐 하나의 모듈로 처리할 수 있다.

@shingonu
shingonu / gist:84bc5e829059238b99f12b641e9568aa
Created May 7, 2019 13:58
12 tips for writing clean and scalable JavaScript.md
### 1. Isolate your code
topic과 분리해서 명백한 로직의 덩어리가 필요하다. 만약 함수를 작성하면 반드시 **하나의 목적**을 가지는 것으로 작성해야 한다. 하나의 함수에서 여러 목적의 기능이 들어가면 안된다.
또한 에러를 줄이기 위해서는 함수 내부에서만 상태 변경을 일으켜야 한다. 만약 함수 외부에서 상태를 변경시키고자 할 땐 함수에서 데이터를 리턴받아서 사용한다.
### 2. Modularization
만약 여러 개의 함수가 같은 방식으로 비슷한 것을 처리할 땐 하나의 모듈로 처리할 수 있다.
pragma solidity ^0.5.0;
import "./PaymentSharer.sol";
contract Attacker {
address private victim;
address payable owner;
constructor() public {
owner = msg.sender;