Skip to content

Instantly share code, notes, and snippets.

View CHAOWEICHIU's full-sized avatar
🎯
Focusing

Wayne Chiu CHAOWEICHIU

🎯
Focusing
View GitHub Profile
@CHAOWEICHIU
CHAOWEICHIU / derivation_path.js
Last active January 27, 2019 01:11
BIP39 - mnemonic - demo how derivation path works
const HDWalletProvider = require("truffle-hdwallet-provider")
const mnemonic = 'pretty runway design riot organ cloud skate able tide frozen lunar awesome'
const provider237 = new HDWalletProvider(
mnemonic,
"http://testnet.dexon.org:8545",
0,
1,
true,
"m/44'/237'/0'/0/", /* For DEXON Network */
@CHAOWEICHIU
CHAOWEICHIU / 03_Useless_Ownership.sol
Last active January 23, 2019 00:58
Solidity Smart Contract Vulnerability
pragma solidity ^0.5.0;
contract Owned {
address payable public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner{ if (msg.sender != owner) revert(); _; }
}
@CHAOWEICHIU
CHAOWEICHIU / ERC20.sol
Last active January 11, 2019 23:22
ERC20 simple code
pragma solidity ^0.5.0;
contract Token {
string public name = "陳之汗😓";
string public symbol = "SWEAT";
uint256 public totalSupply;
uint8 public decimals = 0;
event Transfer(
address indexed _from,
@CHAOWEICHIU
CHAOWEICHIU / DXNDonation.sol
Last active January 13, 2019 02:43
DXNDonationContract
pragma solidity ^0.5.0;
contract DXNDonationContract {
address payable[] public donationList = [
0x8A1DfD12b5B0D28296a14076D5Da56a97216B929
];
function multiTransfer() public payable {
uint256 amount = msg.value / donationList.length;