基于区块链的毕业设计Dbilia Token – Dbilia Token – Nun-Fungible Token mintable with ETH and USD – Dbilia Token-Dbilia Token-可使用ETH和美元铸造的Nun可替代代币

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Dbilia Token – Dbilia Token – Nun-Fungible Token mintable with ETH and USD – Dbilia Token-Dbilia Token-可使用ETH和美元铸造的Nun可替代代币 是一篇很好的国外资料

Dbilia Token – Dbilia Token – Nun-Fungible Token mintable with ETH and USD

Summary

In this project you will be using either truffle or hardhat to build a small minting smart contract. We recommend you to use the solidity version ^0.8.0;

Dbilia app accepts payment both in USD and ETH for minting; and smart contract needs to track this information.

  • When a user wants to pay in USD, user pays gas fee to Dbilia in advance; and Dbilia’s ethereum account will mint the token on the user’s behalf and will keep the token.
  • When a user wants to pay in ETH, user himself (msg.sender) will mint and keep the token.

Create two minting functions in DbiliaToken.sol and make sure to emit an event.

  • mintWithUSD() i. when we confirm the user has paid gas fee to Dbilia, we will trigger this function ii. Only Dbilia can trigger using a modifier iii. take four parameters (userId, cardId, edition, tokenURI) iv. add any require statements as much as possible v. create a mapping to track the owner of token using userId (because dbilia is minting on their behalf) vi. cardId and edition should be mapped to a mapping vii. mint viii. set token uri

  • mintWithETH() i. take three parameters (cardId, edition, tokenURI) ii. add any require statements as much as possible iii. cardId and edition should be mapped to a mapping iv. mint v. set token uri

Make sure you create a test script and test all this process thoroughly.

Configuration

Install Truffle cli

npm install

npx hardhat node

Test!💥

Run Tests

npx hardhat test


Dbilia Token-Dbilia Token-可使用ETH和美元铸造的非可替代代币

摘要

在这个项目中,你将使用块菌或安全帽建立一个小型铸造智能合约。我们建议您使用solidity版本^0.8.0

Dbilia app接受美元和以太币支付铸币费用;智能合约需要跟踪这些信息

  • 当用户想用美元支付时,用户需提前向Dbilia支付燃气费;而Dbilia的以太坊eth账户将代表用户铸造代币,并将保留代币
  • 当用户想用ETH支付时,用户自己(msg.sender)会造币并保留代币

在DbiliaToken.sol中创建两个minting函数,并确保发出一个事件

  • 货币兑换美元()i。当我们确认用户已向Dbilia支付燃气费时,我们将触发此功能ii。只有Dbilia可以使用修饰符iii触发。获取四个参数(userId、cardId、edition、tokenURI)iv。尽可能多地添加require语句。创建一个映射,使用userId跟踪令牌的所有者(因为dbilia代表他们铸造)vi.carid和edition应该映射到映射vii。薄荷八世。设置令牌uri
  • mintWithETH()i。取三个参数(cardId,edition,tokenURI)ii。尽可能地添加任何require语句iii.cardd和edition应映射到映射iv.mint v。设置令牌uri

确保您创建了一个测试脚本并彻底测试了这个过程

配置

安装Truffle cli

npm安装

npx hardhat节点

测试!💥

运行测试

npx hardhat测试

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

www.interchains.cc

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

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Dbilia Token – Dbilia Token – Nun-Fungible Token mintable with ETH and USD – Dbilia Token-Dbilia Token-可使用ETH和美元铸造的Nun可替代代币

提供最优质的资源集合

立即查看 了解详情