Skip to content

Instantly share code, notes, and snippets.

@nenadjaja
nenadjaja / gist:94389ea38964106d851507798b7f0eec
Last active January 26, 2022 22:41
Approval in components
Components
-----------
1. Check for allowance (ethereum address, contract)
3. Compare with amount in input field
2. Approval buttons - render correct states
3. Approval logic (contract address, amount)
4. Step 2 button as well
type Props = {
@nenadjaja
nenadjaja / List of subgraphs IDs
Last active November 17, 2021 19:26
Multisig subgraphs
["0x9efbea665b79f366fcbb390a55c617257e0c678c-0", "0x26cf67040678eb0f5654c9cbaad78dc1694cbafa-0", "0x0a0319671f2d3c18fb55ab555b48bc01f27747a4-0", "0xfc3ac80003d8a5181e554d03983284e4341a7610-0", "0xd6ce4c87ec3fb6e80d87ff5fa7c5ec8fdefadf5c-0", "0x0503024fcc5e1bd834530e69d592dbb6e8c03968-0", "0x819fd65026848d710fe40d8c0439f1220e069398-0", "0xcb30a985b5a998e96b09f1cd5d7b61d405a5a032-0", "0xb31aa1f312595af94f184c5791dc03d6af12fbff-0", "0x9923c163412e70abf1861562e226ccddc69f9429-0"]
<!doctype html>
<html class="docs-version-current" lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-beta.8">
<title data-react-helmet="true">Migrating an Existing Subgraph to The Graph Network | Graph Docs</title><meta data-react-helmet="true" name="twitter:card" content="summary_large_image"><meta data-react-helmet="true" property="og:url" content="https://thegraph.com/docs/hostedservice/migrating-subgraph"><meta data-react-helmet="true" name="docusaurus_locale" content="en"><meta data-react-helmet="true" name="docusaurus_version" content="current"><meta data-react-helmet="true" name="docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="Migrating an Existing Subgraph to The Graph Network | Graph Docs"><meta data-react-helmet="true" name="description" content="Introduction"><meta data-react-helmet="true" property="og:description" content
@nenadjaja
nenadjaja / ipfs.js
Created August 9, 2021 15:43
IPFS helpers
import base from 'base-x'
const ipfsClient = require('ipfs-http-client')
const ENDPOINT = new URL('api/v0', 'http://ipfs.network.thegraph.com/').href
const ipfs = new ipfsClient(ENDPOINT)
// convert ipfsHash to Hex string
export const ipfsHexHash = (ipfsHash: string) => {
const base58 = base('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz')
// Ethereum account of the subgraph owner
const ethereumAccount = 0xbeb123....
// Network subgraph number - you get it from the id
// if subgraphId is this: 0x87d11bd744b882b7bc5a6b5450cba8c35d90eb10-1
// the networkSubgraphNumber will be the number after the dash, so here number 1
const networkSubgraphNumber = subgraph.id.split('-')[1],
// you need to upload the version metadata object to IPFS
const versionData = {
// Ethereum account of the subgraph owner
const ethereumAccount = 0xbeb123....
// you need to upload the version metadata object to IPFS
const versionData = {
label: "v0.0.1",
description: "can be empty"
}
// IPFS Qm hash of the file with version metadata
@nenadjaja
nenadjaja / GNS ABI
Created July 15, 2021 18:45
gns abi file
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "graphAccount",
"type": "address"
},
import { Contract, BigNumber } from 'ethers'
import { tokensToNSignal, tokensToSignal } from '@graphprotocol/common-ts'
import { bigNumberify } from '../services/ethers'
import { Subgraph, SubgraphDeployment, Network } from '../utils/types'
const E18_100K = bigNumberify('100000000000000000000000')
export const checkAllowance = async (
contractGraphToken: Contract,
contractToCheckAddress: string,
@nenadjaja
nenadjaja / Broken images and displayNames
Last active April 30, 2021 18:37
Indexer allocations that are linking to empty images and displayNames on the Subgraph entity
[
{
displayName: "Opyn Gamma Mainnet",
image: "https://ipfs.network.thegraph.com/api/v0/cat?arg=QmQB3FSVSiYx9XoUjSeprzi35tYhPvMG6zS4NnFRfLcyM6
},
{
displayName: "mStable Protocol",
image: "https://ipfs.network.thegraph.com/api/v0/cat?arg=Qmd3ewU7FgzxfxKpE3Fp1BDkPgw4WeqnjQSrvzw66Fca7L"
},
{
export default [
{
name: 'ariel',
fullName: 'Ariel Barmat',
role: 'Smart Contracts Lead',
},
{
name: 'brandon',
fullName: 'Brandon Ramirez',
role: 'Research & Product Lead',