Skip to content

Instantly share code, notes, and snippets.

View shd101wyy's full-sized avatar
🏠
Working from home

Yiyi Wang shd101wyy

🏠
Working from home
  • Mars, Solar system, Universe
View GitHub Profile
@shd101wyy
shd101wyy / decent.sol
Last active April 16, 2018 22:52
My solidity smart contract.
pragma solidity ^0.4.0;
// pragma experimental ABIEncoderV2;
// https://medium.com/daox/three-methods-to-transfer-funds-in-ethereum-by-means-of-solidity-5719944ed6e9
contract Decent {
mapping (bytes32 => mapping(bytes1 => uint256)) state;
mapping (address => bytes32) previousArticleTransactionHashMap;
mapping (bytes32 => bytes32) previousCommentTransactionHashMap;
mapping (bytes32 => bytes32) previousTagTransactionHashMap;
address owner;
pragma solidity ^0.4.0;
// pragma experimental ABIEncoderV2;
// https://medium.com/daox/three-methods-to-transfer-funds-in-ethereum-by-means-of-solidity-5719944ed6e9
contract Gua {
address owner;
address public previousContractAddress;
/**
* 0x0 => earnings
* 0x1 => likes
@shd101wyy
shd101wyy / hex.js
Last active June 7, 2023 01:38
string to hex, hex to string
// https://stackoverflow.com/questions/21647928/javascript-unicode-string-to-hex?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
String.prototype.hexDecode = function(){
var j;
var hexes = this.match(/.{1,4}/g) || [];
var back = "";
for(j = 0; j<hexes.length; j++) {
back += String.fromCharCode(parseInt(hexes[j], 16));
}
@shd101wyy
shd101wyy / call_another_contract.sol
Created April 25, 2018 15:35
Ribbit project experiments ground
// this file is an example of calling other contracts
pragma solidity ^0.4.0;
contract Test {
mapping (string => uint) data;
address public previousContractAddress;
Test previousContract;
constructor(address previousContractAddress_) public {
@shd101wyy
shd101wyy / README.md
Last active May 23, 2018 21:35
ribbit

ribbit

I hope we didn't unleash a beast.

A decentralized social media web application based on Ethereum platform.
基于以太坊的去中心化社交程序。

@shd101wyy
shd101wyy / test.md
Last active June 15, 2018 21:19
IELE communication
  • iele_sendTransaction and iele_call:
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"personal_unlockAccount", "params": ["654510a4a13393d9aed326c86bc84df2d5fcfbbf", "4rfv5tgB"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":true,"id":4}%                                                                                                                                                                     

➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"iele_sendTransaction", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "gasPrice":5000000000, "gasLimit": 1000000, "contractCode": "0x0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000", "arguments": []}], "id": 3}' localhost:8546
{"jsonrpc":"2.0","result":"0xb696754c82cc75b2d361b5180fc7f86846c1d54d48c907
@shd101wyy
shd101wyy / resolve.js
Last active July 27, 2018 15:37
testnet
const url = require("url");
const BASE = "https://staging.iele.dev-mantis.iohkdev.io";
function resolveApiUrl(relativeUrl) {
if (location.hostname.match(/localhost|127\.0\.0\.1/)) {
return url.resolve(BASE, relativeUrl);
} else {
return relativeUrl;
}
}

clang with -fsanitize=thread flag.

➜  bind9 git:(test-tsan) ✗ make unit
sh /home/yiyiwang/GitHub/bind9/unit/unittest.sh
S:unit:Thu Sep 20 11:21:54 CDT 2018
T:unit:1:A
I: unit tests (using atf-run)
Tests root: /home/yiyiwang/GitHub/bind9