@0xsequence/erc20-meta-token 中文文档教程

发布于 3年前 浏览 21 项目主页 更新于 3年前

@0xsequence/erc20-meta-token

通用 ERC20 到 ERC1155 令牌包装合同。

允许将任何 ERC-20 代币包装在 ERC-1155 合约中,从而允许 作为 ERC-1155 合约的 ERC-20 代币。

有关详细信息,请参阅 github.com/0xsequence/erc20-meta-token

Getting started

Install

yarn add @0xsequence/ erc20-meta-tokennpm install @0xsequence/erc20-meta-token

Contract Verification

yarn verify --network {NETWORK_NAME} "{CONTRACT_NAME}={CONTRACT_ADDRESS}"

Usage from Solidity

pragma solidity ^0.7.4;

import '@0xsequence/erc20-meta-token/contracts/interfaces/IMetaERC20Wrapper.sol';

contract ContractA {
  //...
  function f(address wrapperAddress, address ERC20tokenAddress, uint256 amount) public {
    IMetaERC20Wrapper(wrapperAddress).deposit(ERC20tokenAddress, amount);
  }
}

NOTES

@0xsequence/erc20-meta-token 在其分发包中包含以下文件:

  • artifacts -- hardhat output of contract compilation
  • typings -- ethers v5 typings for easier interfacing with the contract abis

LICENSE

版权所有 (c) 2017 年至今 Horizo​​n Blockchain Games Inc

根据 Apache-2.0 获得许可

@0xsequence/erc20-meta-token

General ERC20 to ERC1155 Token Wrapper Contract.

Allows any ERC-20 token to be wrapped inside of an ERC-1155 contract, and thereby allows an ERC-20 token to function as an ERC-1155 contract.

For more information see, github.com/0xsequence/erc20-meta-token

Getting started

Install

yarn add @0xsequence/erc20-meta-token or npm install @0xsequence/erc20-meta-token

Contract Verification

yarn verify --network {NETWORK_NAME} "{CONTRACT_NAME}={CONTRACT_ADDRESS}"

Usage from Solidity

pragma solidity ^0.7.4;

import '@0xsequence/erc20-meta-token/contracts/interfaces/IMetaERC20Wrapper.sol';

contract ContractA {
  //...
  function f(address wrapperAddress, address ERC20tokenAddress, uint256 amount) public {
    IMetaERC20Wrapper(wrapperAddress).deposit(ERC20tokenAddress, amount);
  }
}

NOTES

@0xsequence/erc20-meta-token includes the following files in its package distribution:

  • artifacts -- hardhat output of contract compilation
  • typings -- ethers v5 typings for easier interfacing with the contract abis

LICENSE

Copyright (c) 2017-present Horizon Blockchain Games Inc.

Licensed under Apache-2.0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文