Skip to content

Instantly share code, notes, and snippets.

const axios = require('axios')
const fetchToken = async (tokenUrl) => {
try {
const tokenUrlSplitted = tokenUrl.split('/').slice(3).join('/')
if (tokenUrlSplitted) {
const resp = await axios.get(
`https://api-v2-mainnet.paras.id/${tokenUrlSplitted}`
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
*Submitted for verification at Etherscan.io on 2020-08-26
*/
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
{
"author": "binancestaking.poolv1.near",
"header": {
"chunk_hash": "G2Ey62vdpSKtMg9VR6GquXWzCnnPcutEaojjViaZCJZ9",
"prev_block_hash": "5ef19wsGqP3XfFxRX7yrzhfyBRcz6hgD5bmWHAkjdykd",
"outcome_root": "11111111111111111111111111111111",
"prev_state_root": "EX37s76fftw3Mp7jETmCiPPNKBsLnBi2HYxpRDNrEjmJ",
"encoded_merkle_root": "3s5S9ERdEpRCszAUdUftZQPTiAy9sPhiC2AczaWamsHB",
"encoded_length": 387,
"height_created": 32839512,
@hdriqi
hdriqi / check-nft-snippet.js
Created March 5, 2021 00:32
Check NFT Balance on Paras
const { keyStores, connect } = require('near-api-js')
const getConfig = (env, contractName) => {
if (!contractName) {
throw '[env] contractName not found'
}
switch (env) {
case 'mainnet':
return {
const DEBUG = false; // set to `true` to surface debug log msgs throughout
/**
* EIP 20: ERC-20 Token Standard
*
* ERC-20 is a standard interface for tokens which allows for the implementation
* of a standard API for tokens within smart contracts. This standard provides
* basic functionality to transfer tokens, as well as allow tokens to be approved
* so they can be spent by another on-chain third party.
*
@hdriqi
hdriqi / gist:aa6a04891f417ff4db5869ecc4e8651d
Created September 19, 2019 03:26
blockstack verification
Verifying my Blockstack ID is secured with the address 1AJm23HyYYdWjX1kh1rhkecvPxpJPhz6bP https://explorer.blockstack.org/address/1AJm23HyYYdWjX1kh1rhkecvPxpJPhz6bP
* {
font-family: 'Roboto', sans-serif;
}
body {
font-size: 16px;
line-height: 1.5;
color: #6C6C6C;
}
@hdriqi
hdriqi / app.js
Created October 3, 2018 13:16
file with different hash
This file has been truncated, but you can view the full file.
// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
// eslint-disable-next-line no-global-assign
parcelRequire = (function (modules, cache, entry) {
@hdriqi
hdriqi / Compare and Conquer
Last active June 8, 2018 11:50
Modified binary search to find the nearest value of an array based on the user input.
var kVAStandard = [
900, 1300, 2200, 3500, 4400, 5500, 6600, 7700, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000, 30000, 50000, 75000, 100000
]
const conquer = (left, right, val)=>{
console.log('conquer', left, right, val)
if(left.length === 1 && right.length === 1){
if(Math.abs(left[0] - val) > Math.abs(right[0] - val)){
console.log('conquer return right', right[0])
return [right[0]]