Skip to content

Instantly share code, notes, and snippets.

View delegatecall.sol
pragma solidity ^0.4.18;
contract D {
uint public realN;
address public realSender;
function delegatecallSetN(address _e, uint _n) public {
_e.delegatecall(bytes4(keccak256("setN(uint256)")), _n); // D's storage is set, E is not modified
}
}
@luckyyang
luckyyang / WETH9.sol
Created July 28, 2021 06:40
Wrapped Ether
View WETH9.sol
/**
*Submitted for verification at Etherscan.io on 2017-12-12
*/
// Copyright (C) 2015, 2016, 2017 Dapphub
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
View Bridge_v1_flattened.sol
// File: contracts/zeppelin/upgradable/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
View provider-apis.md

摘要

本文定义了一组 Provider 方法,这些方法用来定义 DApp (Decentralized Application) 如何与 CKB 区块链的节点之间进行交互。

动机

为防止不同的 Provider 定义不同的方法名称,导致定义和交互方式的碎片化,我们希望通过这个文档定义一组通用的 Provider 方法。

名词解释

@luckyyang
luckyyang / abstractFactory.ts
Last active June 27, 2020 04:19
Design Pattern: Observer. You can play with it at https://www.typescriptlang.org/play/index.html
View abstractFactory.ts
abstract class Dough {
}
class ThinDough extends Dough {
}
class ThickDough extends Dough {
}
View Keypering Protocol.md

Keypering Protocol

Rich node RPC

ckb-rich-node RPC base on ckb-rpc and ckb-indexer-rpc.

Both RPCs are JSON-RPC protocol, more information can refer to ckb-rich-node.

Keypering API

View affirmation-request.log
yarn run v1.17.3
$ ./scripts/start-worker.sh watcher affirmation-request-watcher
[1568900257870] INFO (watcher-native-erc-affirmation-request): Connected to redis
[1568900257888] DEBUG (watcher-native-erc-affirmation-request): Last Processed block obtained
fromRedis: "13596650"
fromConfig: "13588055"
[1568900257909] INFO (watcher-native-erc-affirmation-request): Connected to amqp Broker
[1568900258891] DEBUG (watcher-native-erc-affirmation-request): Getting block number
module: "web3"
[1568900258894] DEBUG (watcher-native-erc-affirmation-request): Getting required block confirmations
View gist:c219ba93d3af10d8eca86841281aa815
Verifying my Blockstack ID is secured with the address 126aVHrFrwL6Y9jFBnTugnYt9Fb82yG5be https://explorer.blockstack.org/address/126aVHrFrwL6Y9jFBnTugnYt9Fb82yG5be
@luckyyang
luckyyang / donation.sol
Last active January 6, 2023 20:40
donation example of solidity
View donation.sol
pragma solidity ^0.4.25;
contract Donation {
uint fundLimit = 1 ether;
address owner;
event fundMoved(address _to, uint _amount);
modifier onlyowner { if (msg.sender == owner) _; }
address[] _giver;
uint[] _values;
@luckyyang
luckyyang / fomo.sol
Created November 6, 2018 09:19 — forked from hayeah/fomo.sol
fomo3d contract
View fomo.sol
pragma solidity ^0.4.24;
/**
* @title -FoMo-3D v0.7.1
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* (, / /) /) /) (, / /) /)
* ┌─┐ / _ (/_ // // / _ // _ __ _(/
* ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_