Skip to content

Instantly share code, notes, and snippets.

🏠
Working at home

Sungwoo Yang yangga

🏠
Working at home
Block or report user

Report or block yangga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View migrations\2_deploy_tototoken.js
const ToToToken = artifacts.require("ToToToken");
module.exports = function(deployer, network, accounts) {
deployer.deploy(ToToToken)
};
View contacts\ToToToken.sol
pragma solidity 0.5.2;
import "./CustomToken.sol";
contract ToToToken is CustomToken {
uint8 private DECIMALS = 5; //자리수
uint256 private MAX_TOKEN_COUNT = 20000000000; // 총 토큰 개수
uint256 private MAX_SUPPLY = MAX_TOKEN_COUNT * (10 ** uint256(DECIMALS)); //총 발행량
uint256 private INITIAL_SUPPLY = MAX_SUPPLY * 1 / 10; //초기 공급량
View create-erc20-001-install_libraries.sh
$ npm init -y
$ npm install --save-exact openzeppelin-solidity@2.2.0
$ npm install --save-exact truffle-hdwallet-provider@1.0.6
View create-erc20-005-truffle-console-balanceOf.txt
truffle(develop)> let instance = await ToToToken.deployed()
truffle(develop)> instance.totalSupply()
<BN: 71afd498cfff6>
truffle(develop)> let accounts = await web3.eth.getAccounts()
truffle(develop)> instance.balanceOf(accounts[0])
<BN: 71afd498cfff6>
View create-erc20-004-dev-truffle-config.js
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
}
}
View create-erc20-001-init_project.sh
$ npm install -g truffle
$ npm install -g ganache-cli
$ mkdir myproject && cd myproject
$ truffle init
View create-erc20-003-truffle-config.js
const HDWalletProvider = require('truffle-hdwallet-provider');
const infuraKey = [PROJECT ID];
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();
View sample-hello-socket:haproxy.cfg
global
maxconn 4096
defaults
mode http
balance roundrobin
option redispatch
option forwardfor
timeout connect 5s
View sample-hello-socket:index.js
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello Socket!');
});
var server = require('http').createServer(app).listen(3000, function() {
console.log(`Listening on port 3000 with http`);
});
@yangga
yangga / gist:2883c6483511838b1b2172495571eb1e
Created Feb 18, 2019
clone sample-hello-node project
View gist:2883c6483511838b1b2172495571eb1e
git clone https://github.com/yangga/sample-hello-node
You can’t perform that action at this time.