基于区块链的毕业设计Etherplex – 以太丛

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Etherplex – 以太丛 是一篇很好的国外资料

Etherplex

Ethers.js + Multicall

Batch multiple Ethereum JSON RPC calls into a single RPC call.

Features:

  • Uses the Multicall contract when available
  • Falls back to individual RPC requests when not available

Setup

$ yarn add @pooltogether/etherplex

Usage

  1. First create a contract wrapper using the contract function
  2. Chain calls on the contract and pass the results into the batch function
import { ethers } from 'ethers' import { batch, contract } from '@pooltogether/etherplex'  // Assuming ERC20Abi is an ABI // Assume the DAI_ADDRESS and USDC_ADDRESS constants are Ethereum addresses  let daiContract = contract('Dai', ERC20Abi, DAI_ADDRESS)  // Alternatively, you can just pass in an ethers.Contract instance let ethersContract = new ethers.Contract(USDC_ADDRESS, ERC20Abi, provider) let usdcContract = contract('Usdc', ethersContract)  let results = await batch(   ethers.getDefaultProvider(),   daiContract     .balanceOf(address)     .totalSupply(),   usdcContract     .balanceOf(address)     .totalSupply() ) /* Will yield:  {   Dai: {     'balanceOf(address)': [BigNumber],     balanceOf: [BigNumber],   },   Usdc: {     'balanceOf(address)': [BigNumber],     balanceOf: [BigNumber],   } }  */

* add mumbai multicall address to etherplex


Etherplex

Ethers.js + Multicall

Batch multiple Ethereum JSON RPC calls into a single RPC call.

Features:

  • Uses the Multicall contract when available
  • Falls back to individual RPC requests when not available

Setup

$ yarn add @pooltogether/etherplex

Usage

  1. First create a contract wrapper using the contract function
  2. Chain calls on the contract and pass the results into the batch function
import { ethers } from 'ethers' import { batch, contract } from '@pooltogether/etherplex'  // Assuming ERC20Abi is an ABI // Assume the DAI_ADDRESS and USDC_ADDRESS constants are Ethereum addresses  let daiContract = contract('Dai', ERC20Abi, DAI_ADDRESS)  // Alternatively, you can just pass in an ethers.Contract instance let ethersContract = new ethers.Contract(USDC_ADDRESS, ERC20Abi, provider) let usdcContract = contract('Usdc', ethersContract)  let results = await batch(   ethers.getDefaultProvider(),   daiContract     .balanceOf(address)     .totalSupply(),   usdcContract     .balanceOf(address)     .totalSupply() ) /* Will yield:  {   Dai: {     'balanceOf(address)': [BigNumber],     balanceOf: [BigNumber],   },   Usdc: {     'balanceOf(address)': [BigNumber],     balanceOf: [BigNumber],   } }  */

* add mumbai multicall address to etherplex

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/21121.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Etherplex – 以太丛

提供最优质的资源集合

立即查看 了解详情