BSC 及HT 等链的NFT 创造及绑定图片教程

2023-11-05

我们首先打开REMIX 智能合约编程网站

下面代码是NFT合约

/**
 *Submitted for verification at BscScan.com on 2021-10-07
*/

// File: @openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol

pragma solidity ^0.8.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: @openzeppelin/contracts/utils/Address.sol

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        a
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

BSC 及HT 等链的NFT 创造及绑定图片教程 的相关文章

  • AXI从设备接口

    AXI从设备接口 可以实现EP应用 即作为PCIe总线主设备通过PCIe总线向主机发起PCIe事务 实现RP应用时 AXI从设备接口可以用于发起I O 配置CFG和延迟内存写DMWr请求 实现EP应用时 该接口连接的客户逻辑 外设 必须具有

随机推荐

  • vue的script的三种写法

    以搜索框为例子 vue2的写法 第一种
  • 2021年阿里巴巴83行代码挑战赛来啦!赢MacBook Pro等好礼

    2021年83行代码挑战赛来啦 点击立即前往 CHERRY机械键盘 代码马克杯 Git 鼠标垫 霸王洗发水等2000份将奖品等你来 本次大赛由阿里云云效团队耗时一个月精心筹备 熬夜加班完成 只为真诚地用代码向所有卓越的程序猿致敬 也向卓越的
  • docker logs命令查看日志

    docker logs 打印详细信息 docker logs mysql 容器名字 NAMES docker logs d6c6e958f022 容器ID CONTAINER ID docker logs f 持续输出日志 持续的输出名为m
  • vscode配置码云

    参考 https blog csdn net watfe article details 79761741 1 通过git init命令把这个目录变成Git可以管理的仓库 建立本地仓库 本地仓库和代码开发的不是同一个 git init In
  • 关于elasticsearch连接时断时续以及Kibana出现server is not ready yet的问题,大坑!

    代码小白 记录自学制作谷粒商城遇到的坑 如有错误请轻喷 1 问题的出现 elasticsearch连接时断时续 在加完分词插件之后 出现了elasticsearch连接失败的情况 但是经过多次刷新之后居然是可以成功连接上去的 查看日志也没发
  • react的jsx的基本语法和创建脚手架

    初始react react是一个构建用户界面的javascript库 创建一个简单react 第一步 引入核心库 第二步 在真实dom中提供一个挂载点 div div 第三步 业务代码 创建虚拟dom对象 createElement let
  • Keil如何提升性能和减小代码大小

    在编译程序的过程中 需要考虑两个问题 一个是使用的代码够不够快 另一个是编译的代码够不够小 下面汇集一些解决方法 主要针对Keil ARMCC编译器 1 让代码够小 如图 1 未进行任何优化时 keil编译生成的文件大小为 9668字节 第
  • 基于麻雀算法优化的深度极限学习机DLM的预测算法(Matlab代码实现)

    欢迎来到本博客 博主优势 博客内容尽量做到思维缜密 逻辑清晰 为了方便读者 座右铭 行百里者 半于九十 本文目录如下 目录 1 概述 2 运行结果 3 参考文献 4 Matlab代码及文章讲解 1 概述 根据ELM AE的特征表示能力 将它
  • 循环机换变速箱油教程_「图文并茂」最先进的自动变速箱油更换全过程

    自动变速箱发展至今 内部的电子和液压控制等已经变得异常复杂 因此定期保养自动变速箱就显得尤为重要 一般来说 更换自动变速箱油的期限汽车厂家建议6 8万公里或2 3年左右 4S店会建议缩短更换里程 不及时更换自动变速箱油会直接影响车辆的性能
  • 关于机器学习数据挖掘的算法总结(优缺点)

    目录 一 支持向量机 SVM 二 朴素贝叶斯 三 逻辑回归Logistic Regression 四 线性回归 五 最近领算法 KNN 六 决策树 七 K Means聚类 八 层次聚类 九 DBSCAN的分析 十 回归 Regression
  • RTL8762DK RTC(五)

    概述 本示例 只要介绍 RTC 如何实现 年 月 日 时 分 秒 又离成功进了一步 一 环境 1 硬件 RTL8762DK 128M Bits Falsh 2 软件 keil IDE 二 RTC的使用 1 创建examples ble rt
  • 高泽龙:下一个独角兽来自长租公寓,行业创新极大地释放租赁红利

    超过万亿的巨大市场前景 九部委联合印发住房租赁新政 提出将采取多种措施加快推进租赁住房建设 培育和发展住房租赁市场 长租公寓尤其让众多资本机构觊觎 正在用惊人的扩张速度勾勒出一幅蓝图盛景 对于被称为 下一个风口 的公寓行业 各方有不同的解读
  • ant design vue 年份选择器

    因为ant design vue 里面没有原生的年份选择器 需要使用date picker去改造 html
  • 文件包含漏洞特点和php封装伪协议

    渗透学习 文件包含漏洞 文章目录 渗透学习 前言 本文只做学习用途 严禁利用本文提到的技术进行非法攻击 否则后果自负 本人不承担任何责任 一 文件包含漏洞 二 实验步骤 1 文件包含特点 2 本地包含配合文件上传包含图片马 3 包含Apac
  • udig下载、安装及汉化,生成geoserver图层样式sld文件

    uDig是一款开源免费的桌面地理信息系统框架软件 uDig汉化版主要采用RCP技术构建 内置的多专业的水文工具 拥有复杂专业的分析能力 既可以作为独立程序运行 还可以作为插件使用 uDig是一个 open source EPL and BS
  • 【报错记录】AttributeError: ‘xxx‘ object has no attribute ‘module‘

    文章目录 问题描述 问题分析与解决 总结 参考资料 问题描述 在跑代码时 报出 AttributeError InpaintGenerator object has no attribute module 的错误 如下图所示 经过一通Deb
  • Qt 带参数的信号与槽

    1 在dialog h中定义带参数的信号函数 signals void A double level double pitch double dis double time double min spend double max spend
  • 花5分钟判断,你的Jmeter技能是大佬还是小白!

    jmeter 这个工具既可以做接口的功能测试 也可以做自动化测试 还可以做性能测试 其主要用途就是用于性能测试 但是 有些公司和个人 就想用 jmeter 来做接口自动化测试 你有没有想过呢 下面我就给大家讲讲 用 jmeter 如何做接口
  • Linux文件权限一共10位长度,分成四段

    Linux文件权限一共10位长度 分成四段 Linux文件权限 1 文件aaa的访问权限为rw r r 现要增加所有用户的执行权限和同组用户的写权限 下列哪些命令是正确的 a chmod a x g w aaa b chmod 764 aa
  • BSC 及HT 等链的NFT 创造及绑定图片教程

    我们首先打开REMIX 智能合约编程网站 下面代码是NFT合约 Submitted for verification at BscScan com on 2021 10 07 File openzeppelin contracts util