Skip to content

Instantly share code, notes, and snippets.

View helderjnpinto's full-sized avatar
☢️

ħþ helderjnpinto

☢️
View GitHub Profile
{
"data": {
"extrinsics": {
"nodes": [
{
"extrinsicIdx": 1,
"address": "5ELHJteKdhRgkj7QhtbUrdT971sug6tFUP8BEXxcvGVLHnRb",
"nonce": 77,
"moduleId": "asset",
"callId": "issue",
import { ArgumentsCamelCase, Argv } from "yargs";
import { logger } from "../../logger";
import { BigNumber } from "@polymeshassociation/polymesh-sdk";
import { polymesh } from "../../helpers/polymesh";
import { green, red } from 'picocolors';
import { sleep } from "../../helpers/utils";
interface IssueTokensArgv {
name: string;
ticker: string;
docker logs polymesh-private-subquery-node-1 -f
+ trap _term SIGTERM
+ [[ -n http://polymesh-private:9933 ]]
+ [[ -z '' ]]
++ curl --silent -H 'Content-Type: application/json' -d '{"id":"1", "jsonrpc":"2.0", "method": "chain_getBlockHash", "params":[0]}' http://polymesh-private:9933
++ grep -o '"result":"[^"]*'
++ grep -o '[^"]*$'
+ export NETWORK_CHAIN_ID=0x7f724d9f95057868fda305a792202a9bfdac7e967c993fa194f2220dc3b2b001
+ NETWORK_CHAIN_ID=0x7f724d9f95057868fda305a792202a9bfdac7e967c993fa194f2220dc3b2b001
+ echo 'NETWORK_CHAIN_ID was set to 0x7f724d9f95057868fda305a792202a9bfdac7e967c993fa194f2220dc3b2b001 based on calling: http://polymesh-private:9933. Production chains should explictly set NETWORK_CHAIN_ID instead'
@helderjnpinto
helderjnpinto / Polymesh events.ts
Created October 4, 2024 17:00
Monitor for polymesh polkadot assets
import { ArgumentsCamelCase, Argv } from "yargs";
import { logger } from "../../logger";
import { red, green, blue, yellow } from "picocolors";
import { Polymesh } from "@polymeshassociation/polymesh-sdk";
import { UnsubCallback } from "@polymeshassociation/polymesh-sdk/types";
import {
balanceToBigNumber,
tickerToString,
instructionMemoToString,
bytesToString,
@helderjnpinto
helderjnpinto / StackTooDeepError.md
Last active January 26, 2024 18:10
Solidity stack too deep errors and solutions.

Solving “Stack too deep” Errors in Solidity EVM

This error typically occurs when a function has too many local variables, and the Ethereum Virtual Machine (EVM) imposes a limit on the number of variables that can be pushed onto the stack.

Here the follows investigation that I made today.

References of some examples are given here:

@helderjnpinto
helderjnpinto / Error.sol
Last active October 11, 2023 16:33
test of solidity costs when reverts and deployed transaction gas for require, revert custom errors
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// tx costs when reverts + deployed tx cost
// deployed gas cost 202596
contract Error {
uint num = 0;
// transaction cost 21910 gas
#pragma version 8
if Txn.ApplicationID == 0:
# Handle Create App
exit(1)
end
switch Txn.OnCompletion:
NoOp: main
OptIn: opt_in
@helderjnpinto
helderjnpinto / main.rs
Created May 3, 2023 21:39
MQTT rust wip
use std::collections::HashMap;
use std::io::{ self, Read, Write };
use std::net::{ TcpListener, TcpStream };
use std::sync::{ Arc, Mutex };
use std::thread;
#[derive(Clone)]
struct Broker {
subscribers: HashMap<String, Vec<Arc<Mutex<TcpStream>>>>,
}
@helderjnpinto
helderjnpinto / Auction.sol
Created January 27, 2023 11:13
Simple auction solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
contract SimpleAuction {
address payable public beneficiary;
uint public auctionEndTime;
address public highestBidder;
uint public highestBid;
@helderjnpinto
helderjnpinto / PSQL stats blockscout.txt
Last active January 23, 2023 21:35
PSQL stats blockscout tst
pid,query
218,"SELECT a0.""id"", a0.""name"", a0.""primary"", a0.""metadata"", a0.""address_hash"", a0.""inserted_at"", a0.""updated_at"", a0.""address_hash"" FROM ""address_names"" AS a0 WHERE (a0.""address_hash"" = $1) ORDER BY a0.""address_hash"""
210,"SELECT t0.""hash"", t0.""block_number"", t0.""cumulative_gas_used"", t0.""earliest_processing_start"", t0.""error"", t0.""gas"", t0.""gas_price"", t0.""gas_used"", t0.""index"", t0.""created_contract_code_indexed_at"", t0.""input"", t0.""nonce"", t0.""r"", t0.""s"", t0.""status"", t0.""v"", t0.""value"", t0.""revert_reason"", t0.""max_priority_fee_per_gas"", t0.""max_fee_per_gas"", t0.""type"", t0.""has_error_in_internal_txs"", t0.""old_block_hash"", t0.""inserted_at"", t0.""updated_at"", t0.""block_hash"", t0.""from_address_hash"", t0.""to_address_hash"", t0.""created_contract_address_hash"", t0.""block_hash"" FROM ""transactions"" AS t0 WHERE (t0.""block_hash"" = $1) ORDER BY t0.""block_hash"""
225,"SELECT a0.""hash"", a0.""fetched_coin_balance"", a0.""fet