Skip to content

Instantly share code, notes, and snippets.

@Elyx0
Elyx0 / generateCalldata.js
Created October 9, 2021 08:31 — forked from ezynda3/generateCalldata.js
generateCalldata.js
const ethers = require("ethers");
async function main() {
if (!process.argv[2] || !process.argv[3]) {
console.log("\nUsage: node generateCalldata.js <function signature> <args>");
console.log('e.g node generateCalldata.js "myFunction((uint8,bool)[],uint256)" "[[1,true],[2,false]],12345678"');
console.log("\n")
throw Error
}
// This is universal, works with Infura -- set provider accordingly
const ethers = require('ethers')
//const provider = ethers.getDefaultProvider('rinkeby')
const provider = new ethers.providers.JsonRpcProvider(process.env.WEB3_URL)
function hex_to_ascii(str1) {
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {
@Elyx0
Elyx0 / nginx.conf
Last active August 29, 2015 14:25 — forked from Stanback/nginx.conf
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender). Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;