Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
shafu0x committed Oct 15, 2022
1 parent 0513f6b commit 392b38e
Show file tree
Hide file tree
Showing 4 changed files with 7,274 additions and 267 deletions.
251 changes: 251 additions & 0 deletions abi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
export const dNFT_ABI = [
{
name: "Transfer",
inputs: [
{ name: "sender", type: "address", indexed: true },
{ name: "receiver", type: "address", indexed: true },
{ name: "tokenId", type: "uint256", indexed: true },
],
anonymous: false,
type: "event",
},
{
name: "Approval",
inputs: [
{ name: "owner", type: "address", indexed: true },
{ name: "approved", type: "address", indexed: true },
{ name: "tokenId", type: "uint256", indexed: true },
],
anonymous: false,
type: "event",
},
{
name: "ApprovalForAll",
inputs: [
{ name: "owner", type: "address", indexed: true },
{ name: "operator", type: "address", indexed: true },
{ name: "approved", type: "bool", indexed: false },
],
anonymous: false,
type: "event",
},
{
stateMutability: "nonpayable",
type: "constructor",
inputs: [{ name: "dyad", type: "address" }],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "setPool",
inputs: [{ name: "pool", type: "address" }],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "deposit",
inputs: [
{ name: "tokenId", type: "uint256" },
{ name: "amount", type: "uint256" },
],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "withdraw",
inputs: [
{ name: "tokenId", type: "uint256" },
{ name: "amount", type: "uint256" },
],
outputs: [],
},
{
stateMutability: "payable",
type: "function",
name: "mintDyad",
inputs: [{ name: "tokenId", type: "uint256" }],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "syncTokenId",
inputs: [{ name: "tokenId", type: "uint256" }],
outputs: [],
},
{
stateMutability: "pure",
type: "function",
name: "supportsInterface",
inputs: [{ name: "interface_id", type: "bytes4" }],
outputs: [{ name: "", type: "bool" }],
},
{
stateMutability: "view",
type: "function",
name: "balanceOf",
inputs: [{ name: "_owner", type: "address" }],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "ownerOf",
inputs: [{ name: "_tokenId", type: "uint256" }],
outputs: [{ name: "", type: "address" }],
},
{
stateMutability: "view",
type: "function",
name: "getApproved",
inputs: [{ name: "_tokenId", type: "uint256" }],
outputs: [{ name: "", type: "address" }],
},
{
stateMutability: "view",
type: "function",
name: "isApprovedForAll",
inputs: [
{ name: "_owner", type: "address" },
{ name: "_operator", type: "address" },
],
outputs: [{ name: "", type: "bool" }],
},
{
stateMutability: "nonpayable",
type: "function",
name: "transferFrom",
inputs: [
{ name: "_from", type: "address" },
{ name: "_to", type: "address" },
{ name: "_tokenId", type: "uint256" },
],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "safeTransferFrom",
inputs: [
{ name: "_from", type: "address" },
{ name: "_to", type: "address" },
{ name: "_tokenId", type: "uint256" },
],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "safeTransferFrom",
inputs: [
{ name: "_from", type: "address" },
{ name: "_to", type: "address" },
{ name: "_tokenId", type: "uint256" },
{ name: "_data", type: "bytes" },
],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "approve",
inputs: [
{ name: "_approved", type: "address" },
{ name: "_tokenId", type: "uint256" },
],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "setApprovalForAll",
inputs: [
{ name: "_operator", type: "address" },
{ name: "_approved", type: "bool" },
],
outputs: [],
},
{
stateMutability: "nonpayable",
type: "function",
name: "mint",
inputs: [{ name: "_to", type: "address" }],
outputs: [{ name: "", type: "bool" }],
},
{
stateMutability: "nonpayable",
type: "function",
name: "burn",
inputs: [{ name: "_tokenId", type: "uint256" }],
outputs: [],
},
{
stateMutability: "view",
type: "function",
name: "tokenURI",
inputs: [{ name: "tokenId", type: "uint256" }],
outputs: [{ name: "", type: "string" }],
},
{
stateMutability: "view",
type: "function",
name: "tokenByIndex",
inputs: [{ name: "index", type: "uint256" }],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "tokenOfOwnerByIndex",
inputs: [
{ name: "owner", type: "address" },
{ name: "index", type: "uint256" },
],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "ownerToNFTokenCount",
inputs: [{ name: "arg0", type: "address" }],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "totalSupply",
inputs: [],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "virtualDyadBalance",
inputs: [{ name: "arg0", type: "uint256" }],
outputs: [{ name: "", type: "int256" }],
},
{
stateMutability: "view",
type: "function",
name: "xp",
inputs: [{ name: "arg0", type: "uint256" }],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "dyadMinted",
inputs: [{ name: "arg0", type: "uint256" }],
outputs: [{ name: "", type: "uint256" }],
},
{
stateMutability: "view",
type: "function",
name: "lastCheckpointForTokenId",
inputs: [{ name: "arg0", type: "uint256" }],
outputs: [{ name: "", type: "uint256" }],
},
];
15 changes: 13 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { createClient } from "@supabase/supabase-js";
import Web3 from "web3";
import Contract from "web3-eth-contract";
import { dNFT_ABI } from "./abi.js";

const dNFT = "0xEf569857eF000566272cDfc5Bf5E8681f347A871";
const N_NFTS = 100;
const INFURA = "https://goerli.infura.io/v3/786a7764b8234b06b4cd6764a1646a17";

// Create a single supabase client for interacting with your database
const supabase = createClient(
Expand All @@ -18,5 +23,11 @@ async function setUpNftTable() {
console.log(error);
}

console.log(333);
setUpNftTable();
Contract.setProvider(INFURA);

var contract = new Contract(dNFT_ABI, dNFT);

contract.methods.xp(1).call().then(console.log);

// console.log(web3);
// setUpNftTable();
Loading

0 comments on commit 392b38e

Please sign in to comment.