Skip to content

Instantly share code, notes, and snippets.

View Luiserebii's full-sized avatar
💤
Birbs do their best now and are preparing Please watch warmly until it is ready.

~Luiserebii~ Luiserebii

💤
Birbs do their best now and are preparing Please watch warmly until it is ready.
View GitHub Profile
.\" Hey, EMACS: -*- nroff -*-
.\" (C) Copyright 2020 Luiserebii <luis@serebii.io>,
.\"
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH GITID 1 "May 12 2020" "gitid 0.3.1" "User Commands"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@Luiserebii
Luiserebii / Contract Enum Test
Created August 24, 2019 04:32
a thing that should run
pragma solidity ^0.5.0;
contract A {
enum Actions { WALK, RUN }
Actions private currentContractAction;
constructor() public {
currentContractAction = Actions.WALK;
}
did:muport:QmdpD6xuyfu9LBc2v87Fr9NHJoXrfaAb98ipshi9Z29U2N
@Luiserebii
Luiserebii / meme.js
Created May 9, 2019 01:17
Node Module Design...?
class MemeGenerator {
constructor(options){
this.options = options;
}
print() {
console.log(this.options);
}
testDeploy(); //calling the "main function"; idea is that more than 1 testDeploy() can be called in a synchronous order, so we can wait for a contract to be deployed before moving onto the next one
async function testDeploy(){
const accounts = await web3.eth.getAccounts();
const CalculatorContractInput = DeployUtil.extractContract(compiled, "Calculator");
//Here, we finally call our actual deployment function; ideally, we will wait until it is finished deploying. As a result, console.log("end of deploy") is used as a marker to show that we are running in the correct order, and waiting for 2 confirmations to have passed before moving on.
let CalculatorContract = await deployContract(CalculatorContractInput, [], { from: accounts[0] });
console.log("end of deploy");
console.log(pp.miniheadline("Deploying " + contract.name));
let contractWeb3 = await new web3.eth.Contract(contract.abi);
//contractWeb3.on('error', (err) => { console.log(err); });
let deployRes = await contractWeb3.deploy({ "data": contract.bytecode.indexOf('0x') === 0 ? contract.bytecode : '0x' + contract.bytecode, "args": args });
await (deployRes.send(sendOptions).on('receipt', (receipt) => {
console.log(pp.arrow("status: " + receipt.status ? "Success!" : "Failed :("));
console.log(pp.arrow("transaction hash: " + receipt.transactionHash));
console.log(pp.arrow("contract address: " + receipt.contractAddress));
console.log(pp.arrow("from: " + receipt.from));
console.log(pp.arrow("block number: " + receipt.blockNumber));
console.log(pp.miniheadline("Deploying " + contract.name));
let contractWeb3 = await new web3.eth.Contract(contract.abi);
//contractWeb3.on('error', (err) => { console.log(err); });
let deployRes = await contractWeb3.deploy({ "data": contract.bytecode.indexOf('0x') === 0 ? contract.bytecode : '0x' + contract.bytecode, "args": args });
let sendRes = await (deployRes.send(sendOptions).on('receipt', (receipt) => {
console.log(pp.arrow("status: " + receipt.status ? "Success!" : "Failed :("));
console.log(pp.arrow("transaction hash: " + receipt.transactionHash));
console.log(pp.arrow("contract address: " + receipt.contractAddress));
console.log(pp.arrow("from: " + receipt.from));
console.log(pp.arrow("block number: " + receipt.blockNumber));
@Luiserebii
Luiserebii / gist:372d5b8cacb360cb7638ad0a69eddcea
Created April 25, 2019 02:00
deployContract() Code Snippet
console.log(pp.miniheadline("Deploying " + contract.name));
let contractWeb3 = await new web3.eth.Contract(contract.abi);
//contractWeb3.on('error', (err) => { console.log(err); });
let deployRes = await contractWeb3.deploy({ "data": contract.bytecode.indexOf('0x') === 0 ? contract.bytecode : '0x' + contract.bytecode, "args": args });
let sendRes = await deployRes.send(sendOptions);
console.log(util.inspect(sendRes));
let receiptRes = await sendRes.on('receipt', (receipt) => {
console.log(pp.arrow("status: " + receipt.status ? "Success!" : "Failed :("));
console.log(pp.arrow("transaction hash: " + receipt.transactionHash));
console.log(pp.arrow("contract address: " + receipt.contractAddress));
@Luiserebii
Luiserebii / ItemFeature.sol
Created April 12, 2019 05:43
ItemFeature truffle-flattener code for Etherscan verification
// File: contracts/ein/util/EINOwnable.sol
pragma solidity ^0.5.0;
/**
* @title EINOwnable
* @dev The EINOwnable contract has an owner EIN, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
@Luiserebii
Luiserebii / SnowflakeBountyProcessTransactionSelectorCalculation.sol
Last active April 2, 2019 02:53
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.7+commit.6da8b019.js&optimize=false&gist=
// File: contracts/zeppelin/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/