added multicall
This commit is contained in:
+31
-4
@@ -4,17 +4,18 @@ import { storeToRefs } from "pinia";
|
|||||||
|
|
||||||
import Web3 from "web3";
|
import Web3 from "web3";
|
||||||
import Navbar from "./components/Navbar.vue";
|
import Navbar from "./components/Navbar.vue";
|
||||||
|
|
||||||
import { useWalletStore } from "@/stores/wallet";
|
import { useWalletStore } from "@/stores/wallet";
|
||||||
const walletStore = useWalletStore();
|
const walletStore = useWalletStore();
|
||||||
import { useTokenStore } from "@/stores/tokens";
|
import { useTokenStore } from "@/stores/tokens";
|
||||||
import { useContractStore } from "@/stores/contracts";
|
import { useContractStore } from "@/stores/contracts";
|
||||||
import { useMemeburnerStore } from "@/stores/memeburner";
|
import { useMemeburnerStore } from "@/stores/memeburner";
|
||||||
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
||||||
|
import { useMultiCallStore } from "@/stores/multicall";
|
||||||
const tokenStore = useTokenStore();
|
const tokenStore = useTokenStore();
|
||||||
const contractStore = useContractStore();
|
const contractStore = useContractStore();
|
||||||
const memeBurnerStore = useMemeburnerStore();
|
const memeBurnerStore = useMemeburnerStore();
|
||||||
const rewardLockerStore = useRewardLockerStore();
|
const rewardLockerStore = useRewardLockerStore();
|
||||||
|
const multiCallStore = useMultiCallStore();
|
||||||
const { memeBurner } = storeToRefs(tokenStore);
|
const { memeBurner } = storeToRefs(tokenStore);
|
||||||
const { list } = storeToRefs(contractStore);
|
const { list } = storeToRefs(contractStore);
|
||||||
const isMobile = ref(false);
|
const isMobile = ref(false);
|
||||||
@@ -48,6 +49,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
let web3 = new Web3("https://eth-goerli.g.alchemy.com/v2/0-W9tOm6v_QP1PfRV8RuBCpWr-qoEbkN");
|
let web3 = new Web3("https://eth-goerli.g.alchemy.com/v2/0-W9tOm6v_QP1PfRV8RuBCpWr-qoEbkN");
|
||||||
|
|
||||||
|
walletStore.web3 = web3;
|
||||||
const contract = new web3.eth.Contract(memeBurner.value.config.abi, memeBurner.value.config.contractAddress);
|
const contract = new web3.eth.Contract(memeBurner.value.config.abi, memeBurner.value.config.contractAddress);
|
||||||
list.value.memeBurnerPublic = new web3.eth.Contract(
|
list.value.memeBurnerPublic = new web3.eth.Contract(
|
||||||
memeBurner.value.config.abi,
|
memeBurner.value.config.abi,
|
||||||
@@ -60,9 +62,34 @@ onMounted(async () => {
|
|||||||
memeBurnerStore.config.contractAddress
|
memeBurnerStore.config.contractAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
var getGoal = await memeBurnerStore.getGoal(2);
|
var getGoal = await memeBurnerStore.getGoal(1);
|
||||||
var getSacrificedMeme = await memeBurnerStore.getSacrificedMeme(1, "0x60dd9D0e015115b9aEf61bEDCcBE1390CEEfC247");
|
var getSacrificedMeme1 = await memeBurnerStore.getSacrificedMeme(1, "0x4435ABC578136e2Eca50b5EFf950F17CAF42485b");
|
||||||
console.log("getSacrificedMeme", getSacrificedMeme);
|
var getSacrificedMeme2 = await memeBurnerStore.getSacrificedMeme(1, "0xa0B7b2a78dF87eDc70736f7ED9D40d86c37B533F");
|
||||||
|
var blub1 = (getSacrificedMeme1.amountAchieved / getGoal) * 100;
|
||||||
|
var blub2 = (getSacrificedMeme2.amountAchieved / getGoal) * 100;
|
||||||
|
|
||||||
|
memeBurnerStore.contract = new web3.eth.Contract(
|
||||||
|
memeBurnerStore.config.abi,
|
||||||
|
memeBurnerStore.config.contractAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
var testabc = await memeBurnerStore.contract.methods
|
||||||
|
.getSacrificedMeme(1, "0x4435ABC578136e2Eca50b5EFf950F17CAF42485b")
|
||||||
|
.call();
|
||||||
|
console.log("testabc", testabc);
|
||||||
|
|
||||||
|
multiCallStore.contract = new web3.eth.Contract(multiCallStore.config.abi, multiCallStore.config.contractAddress);
|
||||||
|
|
||||||
|
var data = await memeBurnerStore.getSacrificedRound(1);
|
||||||
|
console.log("data", data);
|
||||||
|
memeBurnerStore.contract = new web3.eth.Contract(
|
||||||
|
memeBurnerStore.config.abi,
|
||||||
|
memeBurnerStore.config.contractAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("blub1", blub1);
|
||||||
|
console.log("blub2", blub2);
|
||||||
|
console.log("getSacrificedMeme", getSacrificedMeme1.amountAchieved);
|
||||||
console.log("getGoal", getGoal);
|
console.log("getGoal", getGoal);
|
||||||
console.log("memeBurnerStore.contract", memeBurnerStore.contract);
|
console.log("memeBurnerStore.contract", memeBurnerStore.contract);
|
||||||
console.log("list", list.value);
|
console.log("list", list.value);
|
||||||
|
|||||||
@@ -0,0 +1,444 @@
|
|||||||
|
{
|
||||||
|
"contractName": "Multicall3",
|
||||||
|
"contractAddress": "0xcA11bde05977b3631167028862bE2a173976CA11",
|
||||||
|
"abi": [
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "target",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "callData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Call[]",
|
||||||
|
"name": "calls",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "aggregate",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "blockNumber",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes[]",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "bytes[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "payable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "target",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "allowFailure",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "callData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Call3[]",
|
||||||
|
"name": "calls",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "aggregate3",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "success",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Result[]",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "payable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "target",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "allowFailure",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "value",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "callData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Call3Value[]",
|
||||||
|
"name": "calls",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "aggregate3Value",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "success",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Result[]",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "payable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "target",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "callData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Call[]",
|
||||||
|
"name": "calls",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "blockAndAggregate",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "blockNumber",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes32",
|
||||||
|
"name": "blockHash",
|
||||||
|
"type": "bytes32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "success",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Result[]",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "payable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getBasefee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "basefee",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "blockNumber",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "getBlockHash",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bytes32",
|
||||||
|
"name": "blockHash",
|
||||||
|
"type": "bytes32"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getBlockNumber",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "blockNumber",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getChainId",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "chainid",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getCurrentBlockCoinbase",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "coinbase",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getCurrentBlockDifficulty",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "difficulty",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getCurrentBlockGasLimit",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "gaslimit",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getCurrentBlockTimestamp",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "timestamp",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "addr",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "getEthBalance",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "balance",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getLastBlockHash",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bytes32",
|
||||||
|
"name": "blockHash",
|
||||||
|
"type": "bytes32"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "requireSuccess",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "target",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "callData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Call[]",
|
||||||
|
"name": "calls",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "tryAggregate",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "success",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Result[]",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "payable",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "requireSuccess",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "target",
|
||||||
|
"type": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "callData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Call[]",
|
||||||
|
"name": "calls",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "tryBlockAndAggregate",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "blockNumber",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes32",
|
||||||
|
"name": "blockHash",
|
||||||
|
"type": "bytes32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"internalType": "bool",
|
||||||
|
"name": "success",
|
||||||
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "bytes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"internalType": "struct Multicall3.Result[]",
|
||||||
|
"name": "returnData",
|
||||||
|
"type": "tuple[]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "payable",
|
||||||
|
"type": "function"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import MemeBurnerJson from "@/assets/contracts/MemeBurner.json";
|
import MemeBurnerJson from "@/assets/contracts/MemeBurner.json";
|
||||||
|
import { useTokenStore } from "./tokens";
|
||||||
|
import { useMultiCallStore } from "./multicall";
|
||||||
|
|
||||||
export const useMemeburnerStore = defineStore("memeburner", {
|
export const useMemeburnerStore = defineStore("memeburner", {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@@ -15,8 +17,19 @@ export const useMemeburnerStore = defineStore("memeburner", {
|
|||||||
return await this.contract.methods.rounds(roundnumber).call();
|
return await this.contract.methods.rounds(roundnumber).call();
|
||||||
},
|
},
|
||||||
//returns participated, amount achieved
|
//returns participated, amount achieved
|
||||||
async getSacrificedMeme(roundnumber, address) {
|
async getSacrificedMeme(roundnumber, tokenAddress) {
|
||||||
return await this.contract.methods.getSacrificedMeme(roundnumber, address).call();
|
return await this.contract.methods.getSacrificedMeme(roundnumber, tokenAddress).call();
|
||||||
|
},
|
||||||
|
async getSacrificedRound(roundnumber) {
|
||||||
|
const tokenStore = useTokenStore();
|
||||||
|
const calls = [];
|
||||||
|
for (let index = 0; index < tokenStore.token.length; index++) {
|
||||||
|
const token = tokenStore.token[index];
|
||||||
|
calls.push(this.contract.methods.getSacrificedMeme(roundnumber, token.contractAddress));
|
||||||
|
}
|
||||||
|
const multicallStore = useMultiCallStore();
|
||||||
|
return await multicallStore.aggregate(calls);
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
import MulticallJson from "@/assets/contracts/Multicall.json";
|
||||||
|
import { useWalletStore } from "./wallet";
|
||||||
|
|
||||||
|
|
||||||
|
export const useMultiCallStore = defineStore("multicall", {
|
||||||
|
state: () => ({
|
||||||
|
config: MulticallJson,
|
||||||
|
contract: null,
|
||||||
|
}),
|
||||||
|
getters: {},
|
||||||
|
actions: {
|
||||||
|
async aggregate(calls, parameters = {}) {
|
||||||
|
const callRequests = calls.map((call) => {
|
||||||
|
const callData = call.encodeABI();
|
||||||
|
return {
|
||||||
|
target: call._parent._address,
|
||||||
|
callData,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const { returnData } = await this.contract.methods.aggregate(callRequests).call(parameters);
|
||||||
|
|
||||||
|
return returnData.map((hex, index) => {
|
||||||
|
const types = calls[index]._method.outputs.map((o) =>
|
||||||
|
o.internalType !== o.type && o.internalType !== undefined ? o : o.type
|
||||||
|
);
|
||||||
|
const walletStore = useWalletStore();
|
||||||
|
|
||||||
|
let result = walletStore.web3.eth.abi.decodeParameters(types, hex);
|
||||||
|
|
||||||
|
delete result.__length__;
|
||||||
|
|
||||||
|
result = Object.values(result);
|
||||||
|
return result.length === 1 ? result[0] : result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
+11
-398
@@ -9,393 +9,6 @@ import MemeBurnerJson from "@/assets/contracts/MemeBurner.json";
|
|||||||
export const useTokenStore = defineStore("token", {
|
export const useTokenStore = defineStore("token", {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
token: [
|
token: [
|
||||||
// {
|
|
||||||
// name: "PEPE",
|
|
||||||
// contractAddress: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
|
|
||||||
// abi: [
|
|
||||||
// {
|
|
||||||
// inputs: [{ internalType: "uint256", name: "_totalSupply", type: "uint256" }],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "constructor",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// anonymous: false,
|
|
||||||
// inputs: [
|
|
||||||
// { indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
||||||
// { indexed: true, internalType: "address", name: "spender", type: "address" },
|
|
||||||
// { indexed: false, internalType: "uint256", name: "value", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "Approval",
|
|
||||||
// type: "event",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// anonymous: false,
|
|
||||||
// inputs: [
|
|
||||||
// { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
|
|
||||||
// { indexed: true, internalType: "address", name: "newOwner", type: "address" },
|
|
||||||
// ],
|
|
||||||
// name: "OwnershipTransferred",
|
|
||||||
// type: "event",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// anonymous: false,
|
|
||||||
// inputs: [
|
|
||||||
// { indexed: true, internalType: "address", name: "from", type: "address" },
|
|
||||||
// { indexed: true, internalType: "address", name: "to", type: "address" },
|
|
||||||
// { indexed: false, internalType: "uint256", name: "value", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "Transfer",
|
|
||||||
// type: "event",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "owner", type: "address" },
|
|
||||||
// { internalType: "address", name: "spender", type: "address" },
|
|
||||||
// ],
|
|
||||||
// name: "allowance",
|
|
||||||
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "spender", type: "address" },
|
|
||||||
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "approve",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
||||||
// name: "balanceOf",
|
|
||||||
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "_address", type: "address" },
|
|
||||||
// { internalType: "bool", name: "_isBlacklisting", type: "bool" },
|
|
||||||
// ],
|
|
||||||
// name: "blacklist",
|
|
||||||
// outputs: [],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
||||||
// name: "blacklists",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [{ internalType: "uint256", name: "value", type: "uint256" }],
|
|
||||||
// name: "burn",
|
|
||||||
// outputs: [],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "decimals",
|
|
||||||
// outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "spender", type: "address" },
|
|
||||||
// { internalType: "uint256", name: "subtractedValue", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "decreaseAllowance",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "spender", type: "address" },
|
|
||||||
// { internalType: "uint256", name: "addedValue", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "increaseAllowance",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "limited",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "maxHoldingAmount",
|
|
||||||
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "minHoldingAmount",
|
|
||||||
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "name",
|
|
||||||
// outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "owner",
|
|
||||||
// outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "renounceOwnership",
|
|
||||||
// outputs: [],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "bool", name: "_limited", type: "bool" },
|
|
||||||
// { internalType: "address", name: "_uniswapV2Pair", type: "address" },
|
|
||||||
// { internalType: "uint256", name: "_maxHoldingAmount", type: "uint256" },
|
|
||||||
// { internalType: "uint256", name: "_minHoldingAmount", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "setRule",
|
|
||||||
// outputs: [],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "symbol",
|
|
||||||
// outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "totalSupply",
|
|
||||||
// outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "recipient", type: "address" },
|
|
||||||
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "transfer",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { internalType: "address", name: "sender", type: "address" },
|
|
||||||
// { internalType: "address", name: "recipient", type: "address" },
|
|
||||||
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "transferFrom",
|
|
||||||
// outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
||||||
// name: "transferOwnership",
|
|
||||||
// outputs: [],
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [],
|
|
||||||
// name: "uniswapV2Pair",
|
|
||||||
// outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: "SHIBA INU",
|
|
||||||
// contractAddress: "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
|
|
||||||
// abi: [
|
|
||||||
// {
|
|
||||||
// constant: true,
|
|
||||||
// inputs: [],
|
|
||||||
// name: "name",
|
|
||||||
// outputs: [{ name: "", type: "string" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: false,
|
|
||||||
// inputs: [
|
|
||||||
// { name: "spender", type: "address" },
|
|
||||||
// { name: "value", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "approve",
|
|
||||||
// outputs: [{ name: "", type: "bool" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: true,
|
|
||||||
// inputs: [],
|
|
||||||
// name: "totalSupply",
|
|
||||||
// outputs: [{ name: "", type: "uint256" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: false,
|
|
||||||
// inputs: [
|
|
||||||
// { name: "sender", type: "address" },
|
|
||||||
// { name: "recipient", type: "address" },
|
|
||||||
// { name: "amount", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "transferFrom",
|
|
||||||
// outputs: [{ name: "", type: "bool" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: true,
|
|
||||||
// inputs: [],
|
|
||||||
// name: "decimals",
|
|
||||||
// outputs: [{ name: "", type: "uint8" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: false,
|
|
||||||
// inputs: [
|
|
||||||
// { name: "spender", type: "address" },
|
|
||||||
// { name: "addedValue", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "increaseAllowance",
|
|
||||||
// outputs: [{ name: "", type: "bool" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: false,
|
|
||||||
// inputs: [{ name: "value", type: "uint256" }],
|
|
||||||
// name: "burn",
|
|
||||||
// outputs: [],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: true,
|
|
||||||
// inputs: [{ name: "account", type: "address" }],
|
|
||||||
// name: "balanceOf",
|
|
||||||
// outputs: [{ name: "", type: "uint256" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: true,
|
|
||||||
// inputs: [],
|
|
||||||
// name: "symbol",
|
|
||||||
// outputs: [{ name: "", type: "string" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: false,
|
|
||||||
// inputs: [
|
|
||||||
// { name: "spender", type: "address" },
|
|
||||||
// { name: "subtractedValue", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "decreaseAllowance",
|
|
||||||
// outputs: [{ name: "", type: "bool" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: false,
|
|
||||||
// inputs: [
|
|
||||||
// { name: "recipient", type: "address" },
|
|
||||||
// { name: "amount", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "transfer",
|
|
||||||
// outputs: [{ name: "", type: "bool" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "nonpayable",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// constant: true,
|
|
||||||
// inputs: [
|
|
||||||
// { name: "owner", type: "address" },
|
|
||||||
// { name: "spender", type: "address" },
|
|
||||||
// ],
|
|
||||||
// name: "allowance",
|
|
||||||
// outputs: [{ name: "", type: "uint256" }],
|
|
||||||
// payable: false,
|
|
||||||
// stateMutability: "view",
|
|
||||||
// type: "function",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// inputs: [
|
|
||||||
// { name: "name", type: "string" },
|
|
||||||
// { name: "symbol", type: "string" },
|
|
||||||
// { name: "decimals", type: "uint8" },
|
|
||||||
// { name: "totalSupply", type: "uint256" },
|
|
||||||
// { name: "feeReceiver", type: "address" },
|
|
||||||
// { name: "tokenOwnerAddress", type: "address" },
|
|
||||||
// ],
|
|
||||||
// payable: true,
|
|
||||||
// stateMutability: "payable",
|
|
||||||
// type: "constructor",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// anonymous: false,
|
|
||||||
// inputs: [
|
|
||||||
// { indexed: true, name: "from", type: "address" },
|
|
||||||
// { indexed: true, name: "to", type: "address" },
|
|
||||||
// { indexed: false, name: "value", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "Transfer",
|
|
||||||
// type: "event",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// anonymous: false,
|
|
||||||
// inputs: [
|
|
||||||
// { indexed: true, name: "owner", type: "address" },
|
|
||||||
// { indexed: true, name: "spender", type: "address" },
|
|
||||||
// { indexed: false, name: "value", type: "uint256" },
|
|
||||||
// ],
|
|
||||||
// name: "Approval",
|
|
||||||
// type: "event",
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
name: "$PEPE",
|
name: "$PEPE",
|
||||||
logo: "/src/assets/img/token/pepe.png",
|
logo: "/src/assets/img/token/pepe.png",
|
||||||
@@ -419,17 +32,17 @@ export const useTokenStore = defineStore("token", {
|
|||||||
abi: Meme2Json.abi,
|
abi: Meme2Json.abi,
|
||||||
contractAddress: Meme2Json.contractAddress,
|
contractAddress: Meme2Json.contractAddress,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: "$ELON",
|
// name: "$ELON",
|
||||||
logo: "/src/assets/img/token/elon.png",
|
// logo: "/src/assets/img/token/elon.png",
|
||||||
logoMobile: "/src/assets/img/token/elonMobile.png",
|
// logoMobile: "/src/assets/img/token/elonMobile.png",
|
||||||
vamp: {
|
// vamp: {
|
||||||
logo: "/src/assets/img/token/shibvamp.png",
|
// logo: "/src/assets/img/token/shibvamp.png",
|
||||||
name: "$ELON Vamp Token",
|
// name: "$ELON Vamp Token",
|
||||||
},
|
// },
|
||||||
abi: null,
|
// abi: null,
|
||||||
contractAddress: null,
|
// contractAddress: null,
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
activeToken: {
|
activeToken: {
|
||||||
address: null,
|
address: null,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export const useWalletStore = defineStore("wallet", {
|
|||||||
alchemy: null,
|
alchemy: null,
|
||||||
connected: false,
|
connected: false,
|
||||||
address: null,
|
address: null,
|
||||||
|
web3: null
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user