当前位置:网站首页>How to start an NFT collection
How to start an NFT collection
2022-08-03 16:02:00 【Han Ru_】
入门
Just contact block chain world,Hope that through creating your first NFT Collections enter the field?在本文中,We will create our first step by step is intelligent contract,Use it to cast new NFT 集合,最后,put it on the shelf NFT 市场,We can benefit from our digital collections!
写在开头
Before the actual writing any code,We should get to know a few concepts.I will be very brief introduction to each of them,但是,If you want further familiar with these,I will also attach some external resources,Suggest you to explore.
基本要素
为了简洁起见,I assume that if you are reading this article,You already have some knowledge of block chain,并且对 Python Such as programming languages have some basic understanding of(这就是我们今天将使用的!).如果没有,I suggest you before you continue to view the following resources,Because it will greatly reduce our continues confusion today:
The etheric fang and intelligent contract
The etheric fang is a intelligent support contract execution block chain;These procedures in the etheric fang block chain only address.The type of these contracts is actually the etheric fang account,They can be like any other account to send and receive money,但是,They deploy them to block the chain when a specified program logic control.
请注意,The etheric fang block chain native tokens, known as the etheric coin(表示为 ETH),And need to have the etheric currency can promote trade.
有关更多信息,请查看以下内容:
ERC-721:非同质化代币标准
由 ERC-721 标准定义的 NFT Is hosted in the chain of blocks on the only tokens,And that is associated with the standard contract specific intelligence.Each belongs to intelligent contract NFT In the contract has a unique tokens ID,So that it can and set apart from the rest of the tokens in the.每个 NFT Can contract with addresses and tokens ID Other than the data associated with it.而我们的目的,These data will be reference for some digital art works(我们稍后会谈到这一点),当然,It may be many other data.
如果您想了解更多信息,Please review these resources:
ERC-721 Non-fungible token standard | ethereum.org
使用 MetaMask Create our first encrypted wallet
Encrypt in order to participate in the world and interact with the blocks chain,We need some interface.Many people choose to use one of these interfaces is encrypted wallet,例如 MetaMask.
想要使用,请按照此处的说明进行操作:
Please be sure to follow their instructions carefully,Memorize your mnemonic.这非常非常重要,Because you have lost access may be unable to access the purse,Or let others control your money.To test the deployment to create a separate wallet,Rather than where you save real tokens!
Get some test currency
使用真正的 ETH 可能非常昂贵,当我们学习时,In the etheric lane experiment on the main network may have a lot of.即使在像 Polygon So try to suppress the etheric fang expensive transaction cost 2 层网络上,Every time we want to change the status of block chain when it takes real tokens.幸运的是,The etheric fang some test network only need to test their tokens.
首先,让我们确保我们的 MetaMask Allow us to interact with these test network.在 MetaMask 中,Click on your account icon,然后单击settings → Advanced → Toggle “Show test networks”切换为开启.我们现在可以在 MetaMask See the test on the network.从现在开始,我们将继续使用 Rinkeby 测试网络.
Now let's get some test in our account currency.导航到https://faucets.chain.link/rinkeby.您可能需要将您的 MetaMask Connect to this site;Simply follow the steps to provide.Then make sure that the network is set to theEthereum Rinkeby,选择 10 test LINK,0.1 test ETH,And make sure you actually not a robot.最后,发送请求,You should soon see the money in your account.We can now use the test money to change the status of block chain!
使用 Python Brownie SDK 和 Infura 设置我们的项目
In order to start block chain development,我们将使用 Brownie,这是一个很好的框架.Brownie 将通过使用 Python Script to deploy and interact with the intelligence of our contract,Help us the flexibility to start and run our NFT 项目.除了 Brownie,我们还将使用 Infura,This is a kind of infrastructure as a service product,Allows us to easily interact with block chain.
安装 Brownie
Go ahead and in accordance with the instructions listed here:
请注意,Brownie The creator of the recommended pipx,但是也可以使用 pip.
创建一个 Brownie 项目
现在我们已经安装了 Brownie,Let's start our first project.
首先,Open a command line and navigate to the position you want to create a new project directory.Create a project directory from here.我们将其称为“NFT-demo”.
mkdir NFT-demo
cd NFT-demo
Now we can use the following command to initialize our new project:
brownie init
现在,在我们的 NFT-demo 目录中,We should see the following directory:
contracts/
: contract sourceinterfaces/
: 接口来源scripts/
: For deployment and interactive scripttests/
: Used for testing the script for the projectbuild/
:项目数据,For example, compiler artifacts and unit test resultsreports/
: 在 Brownie GUI 中使用的 JSON 报告文件
配置项目
In addition to the above subdirectory,我们还需要 NFT-demo In the project root directory two attached file:An environment variable file,Used to hide our sensitive variable,以及一个 brownie-config 文件,用于告诉 Brownie Where can I find these variables,Any dependencies and configuration.
.env
Starting from the environment variable file,在 NFT-demo 目录中创建一个新文件 .env
.首先,包括以下代码:
PRIVATE_KEY=''
WEB3_INFURA_PROJECT_ID=''
PINATA_API_KEY=''
PINATA_API_SECRET=''
ETHERSCAN_TOKEN=''
现在,除了我们的 PRIVATE_KEY
变量之外,We will put all the content is blank.现在,Please go to yours MetaMask 账户 → Menu → Account details → Export private key.Enter your from here MetaMask Password and replace the first line,Make it now show up asPRIVATE_KEY=<YOUR_PRIVATE_KEY>
.其余部分,We fill in slowly.
有关环境变量的更多信息,请查看以下资源:
Environment variables regarding their use
brownie-config.yaml
Now let's create our Brownie 配置文件.在一个名为brownie-config.yaml
(同样,在 NFT-demo 目录中)的文件中,输入以下代码:
dotenv: .env
dependencies:
- smartcontractkit/chainlink-brownie-[email protected]0.4.0
- OpenZeppelin/openzeppelin-[email protected]4.5.0
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/[email protected]'
- '@openzeppelin=OpenZeppelin/[email protected]'
wallets:
from_key: ${
PRIVATE_KEY}
几个重要的点:
dotenv
,告诉 Brownie Where can I find our environment variable- 在高层次上,
dependencies
和compiler
Mapping allows us to easily interact with external libraries(有关更多信息,Please refer to the following resources) wallets
,Provides us with a simple method to programmatically access the private key,So that we can interact with block chain like yourself
使用 Infura 连接到区块链
Before writing can be deployed to block chain contract,We need a way to easily interact with them,而无需运行我们自己的节点.要开始使用 Infura,Please follow the steps provided here operation:
一旦有了 Infura 项目设置后,获取项目 ID 并将其添加到我们的.env
文件中,The second line is now readWEB3_INFURA_PROJECT_ID=<YOUR_PROJECT_ID>
. Brownie In the background to use it to connect us to block chain network,So we don't have to worry about that.
We are now ready to start writing our first NFT 智能合约!
Write our first intelligent contract
让我们通过在 contracts 子目录中创建一个名为WaterCollection.sol
的文件,This will be our new one NFT Collection of contracts.
Now our project directory structure should look like this:
- NFT-demo
| - build
| - contracts
| - WaterCollection.sol
| - interfaces
| - reports
| - scripts
| - tests
请注意,Solidity Is a popular intelligent contract development programming language.如需更深入地了解,请查看他们的文档:
首先,让我们添加以下几行:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
在这里,首先,We define a license.Temporary don't worry too much about this,只要知道 MIT License essentially means that we are open our contract.
其次,We are defining oursolidity 版本.同样,不要太担心,But if you are curious about these versions,Please see the above documentation.
最后,我们从 OpenZeppelin 导入合约,It can be thought of as a set of credible intelligence contract.We will provide our own contract inherits some of the properties of these contracts.
继承 OpenZeppelin 实现
为了利用 OpenZeppelin Provided existing implementation,We will create our contract,使其具有 OpenZeppelin 合约的功能.具体来说,我们将使用他们的 ERC721URIStorage 模块,This module is similar to their base ERC721 模块,Increased by called tokens URI A reference to the data attached to NFT 的能力.这将使我们能够将 NFT That is associated with our art.Please read more information about the module here:
更新我们的WaterCollection.sol
文件:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract WaterCollection is ERC721URIStorage {
uint256 public tokenCounter;
}
我们现在有了 WaterCollection
Outline of the contract,它继承 OpenZeppelin 合约.
请注意,We also added a contract variable tokenCounter
,Enable us to record our contracts create NFT 数量.
Define contract constructor
Constructor allows us to define the behavior of the contract when deployment.
让我们再次更新我们的WaterCollection.sol
文件:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract WaterCollection is ERC721URIStorage {
uint256 public tokenCounter;
constructor() public
ERC721("Water Collection", "DRIP")
{
tokenCounter = 0;
}
}
在这里,我们调用 OpenZeppelin ERC721 构造函数,Define its name as “Water Collection”,其标记符号为“DRIP”.此外,We will contract the tokens, the counter is set to 0,因为在部署时,我们还没有创建 NFT.
创建 NFT 的方法
Now, let's define a method,Allow us to use our contract real to create NFT.
We will update the contract again:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract WaterCollection is ERC721URIStorage {
uint256 public tokenCounter;
constructor() public
ERC721("Water Collection", "DRIP")
{
tokenCounter = 0;
}
function createToken(string memory tokenURI)
public returns (bytes32){
require(tokenCounter < 100, "Max number of tokens reached");
uint256 tokenId = tokenCounter;
_safeMint(msg.sender, tokenId);
_setTokenURI(tokenId, tokenURI);
tokenCounter++;
}
}
We will write a scrip URI The string as a parameter method.让我们回顾一下逻辑.
首先,We require the most contracts can create 100 个 NFT.这是一种设计选择,Don't need to do this,但是,在我们的例子中,If someone is trying to create the first 101 个 NFT,They will receive an error message and does not create.
接下来,我们将 token ID 设置为当前 tokenCounter
,以便我们可以调用 ERC721的 _safeMint
方法和 ERC721URIStorage 的 _setTokenURI
方法.
_safeMint
Methods for our contract to create or build“mints”一个新 token,And set the owner to call createToken
方法的人,其token ID 为tokenCounter
.
然后,_setTokenURI
方法将该 token 的代币 URI Is set to the string passed to the function we.We will be discussed later in this should be what.
最后,我们增加 token The number of tokens in counter to update the collection.
Our contract is now complete and ready for deployment!
让我们运行brownie compile
确保一切正常.We should see a message,Assert that our project has been compiled.
Will be deployed to contract testing script
Now our contract has been completed,我们可以自己编写一个 Python 脚本,Deploy it to our chosen block chain.In our project directoryscripts
中新建一个新文件,叫deploy_water.py
,Then write the following code calls:
from brownie import WaterCollection, accounts, config
def main():
dev = accounts.add(config['wallets']['from_key'])
WaterCollection.deploy(
{
'from': dev}
)
在这里,We will through our in brownie-config.yaml
File reference of a private key account information stored in the dev
变量中.
With this account information,我们让 Brownie Our contract will be deployed to block chain,And use our information and{'from': dev}
Code snippet to sign deals,In order to block chain can we identify the sender for this status change.
Our project directory now should look like this:
- NFT-demo
| - build
| - contracts
| - WaterCollection.sol
| - interfaces
| - reports
| - scripts
| - deploy_water.py
| - tests
让我们使用 Brownie 运行此脚本,将其部署到 Ethereum Rinkeby 测试网络.切换到 NFT-demo 目录运行:
brownie run scripts/deploy_water.py --network rinkeby
We should now see is similar to the following:
Running 'scripts/WaterCollection/deploy_water.py::main'...
Transaction sent: 0xade52b4a0bbabdb02aeda6ef4151184116a4c6429462c28d4ccedf90eae0d36d
Gas price: 1.033999909 gwei Gas limit: 1544657 Nonce: 236
WaterCollection.constructor confirmed Block: 10423624 Gas used: 1404234 (90.91%)
WaterCollection deployed at: 0xE013b913Ca4dAD36584D3cBFCaB6ae687c5B26c5
In order to ensure all according to expected,我们可以访问 https://rinkeby.etherscan.io/.This is a allows us to explore block chain service.复制部署 WaterCollection 的地址,并将其粘贴到 Etherscan Rinkeby 搜索栏中.Keep this address for future use!
We should see a under the contract on our behalf to create contract deal.
非常不错!We have deployed to Rinkeby ,Next to understand decentralized storage.
Blockchain storage and IPFS
正如我们之前提到的,We need a way to our work of art with our NFT 关联起来.Because our goal is to make sure our tokens, and its future owner have tokens related art access and ownership of the same,As long as they have stated tokens,我们希望我们的 NFT Binary data directly contains its art. 但是,我们必须认识到,On the block chain store large amounts of data can be very expensive,And high resolution image or a set of frames may need a lot of storage.We consider by the aforementioned tokens URI Indirectly linked data.此 URI Is to store our data links to external resources.
Why decentralized storage?
Because we will use the external links,Our intuition may be used simply to some cloud storage providers(例如 Google Drive 或 AWS S3)link to the address,但是,仔细思考,We found that this is problematic in concept.
由于 NFT 的一大优点是,They are decentralized management,So we don't have to rely on any single organization to ensure that they continue to exist.因此,If we put our artwork stored in one of these cloud provider,We will rely on a central agency to save our art work,这就破坏了 NFT one of the core purposes.诚然,谷歌或 AWS Is unlikely to suddenly disappear,但是,为了保留 NFT 的去中心化特性,We will seek a decentralized storage method.
IPFS
幸运的是,我们拥有InterPlanetary File System (IPFS),It is a peer-to-peer distributed file system,We can use it to store our data.有关 IPFS 的更多信息,Please see their website:
IPFS Powers the Distributed Web
使用 Pinata 将数据绑定到 IPFS
与 IPFS Interaction and the data persisted to IPFS A good way is through called Pinata 的服务.创建一个免费的 Pinata 帐户.The following guide will lead you to get API keys and secrets(We need these two key and password),And explain more about using the Pinata Fixed data information:
一旦你有了 API keys and secrets,让我们回到我们的.env
documents and fill them out.It should now be similar to:
PRIVATE_KEY=<YOUR_PRIVATE_KEY>
WEB3_INFURA_PROJECT_ID=<YOUR_PROJECT_ID>
PINATA_API_KEY=<YOUR_PINATA_KEY>
PINATA_API_SECRET=<YOUR_PINATA_SECRET>
ETHERSCAN_TOKEN=''
为 IPFS Ready for our work
Now we are almost ready to upload our work to IPFS,We should consider what we want to include.在本文中,我选择使用 100 Such water pictures:
You can choose any you like works of art!
Now for the sake of simplicity,I named my image1.jpg
, 2.jpg
, …, 100.jpg
,But if you want to be more creative,也可以更改名字;You only need to make sure that in a way that they are mapped to the name of the digital,So that we will write the script can be found each of them.
让我们创建一个新的images
Directory and upload our work.Project directory now should look like this:
- NFT-demo
| - build
| - contracts
| - WaterCollection.sol
| - images
| - 1.jpg
| - ...
| - 100.jpg
| - interfaces
| - reports
| - scripts
| - deploy_water.py
| - tests
现在,There is a place we can make our script(我们将要编写的)Find our artwork.
To save art and metadata to IPFS 的脚本
我们已经设置好了 Pinata,Our work is ready.Let's write a script to interact with the data.在 scripts
子目录中创建一个名为create_metadata.py
的文件.
在我们开始编写代码之前,We should have a quick review we are trying to do.由于 ERC721 (NFT) 标准的规范,我们的数据(We pass tokens URI 引用的数据)Will not the art itself,But refer to the actual art metadata file.它看起来像这样:
因此,我们必须为每个 NFT 上传 2 个文件到 IPFS:1 For art itself,1 For reference metadata file of artwork.
Now that we have covered this point,Let's write our scriptscreate_metadata.py
:
import requests
import os
import json
metadata_template = {
"name": "",
"description": "",
"image": ""
}
def main():
write_metadata(100)
def write_metadata(num_tokens):
# We'll use this array to store the hashes of the metadata
meta_data_hashes = []
for token_id in range(num_tokens):
collectible_metadata = metadata_template.copy()
# The filename where we're going to locally store the metadata
meta_data_filename = f"metadata/{
token_id + 1}.json"
# Name of the collectible set to its token id
collectible_metadata["name"] = str(token_id)
# Description of the collectible set to be "Wata"
collectible_metadata["description"] = "Wata"
# Path of the artwork to be uploaded to IPFS
https://img.chengxuka.com_path = f"images/{
token_id + 1}.jpg"
with open(https://img.chengxuka.com_path, "rb") as f:
https://img.chengxuka.com_binary = f.read()
# Upload the image to IPFS and get the storage address
image = upload_to_ipfs(https://img.chengxuka.com_binary)
# Add the image URI to the metadata
image_path = f"<https://ipfs.io/ipfs/{
image}>"
collectible_metadata["image"] = image_path
with open(meta_data_filename, "w") as f:
# Write the metadata locally
json.dump(collectible_metadata, f)
# Upload our metadata to IPFS
meta_data_hash = upload_to_ipfs(collectible_metadata)
meta_data_path = f"<https://ipfs.io/ipfs/{
meta_data_hash}>"
# Add the metadata URI to the array
meta_data_hashes.append(meta_data_path)
with open('metadata/data.json', 'w') as f:
# Finally, we'll write the array of metadata URIs to a file
json.dump(meta_data_hashes, f)
return meta_data_hashes
def upload_to_ipfs(data):
# Get our Pinata credentials from our .env file
pinata_api_key = os.environ["PINATA_API_KEY"]
pinata_api_secret = os.environ["PINATA_API_SECRET"]
endpoint = "<https://api.pinata.cloud/pinning/pinFileToIPFS>"
headers = {
'pinata_api_key': pinata_api_key,
'pinata_secret_api_key': pinata_api_secret
}
body = {
'file': data
}
# Make the pin request to Pinata
response = requests.post(endpoint, headers=headers, files=body)
# Return the IPFS hash where the data is stored
return response.json()["IpfsHash"]
简而言之,It will save all of our works of art to IPFS,Create the following metadata file format:
{
"name": "<TOKEN_ID>",
"description": "Wata",
"image": "<https://ipfs.io/ipfs/><ARTWORK_IPFS_HASH>"
}
The file on the local metadata
子目录下(We will immediately create)写入名为<TOKEN_ID>.json
的文件和 IPFS.最后,In the same subdirectory,它将 IPFS Save metadata hash list to data.json
in the called file.
在 NFT-demo Directory, run the following commands in the command line:
mkdir metadata
brownie run scripts/create_metadata.py --network rinkeby
如果一切按预期进行,We will now have the following project structure:
- NFT-demo
| - build
| - contracts
| - WaterCollection.sol
| - images
| - 1.jpg
| - ...
| - 100.jpg
| - interfaces
| - metadata
| - data.json
| - 1.json
| - ...
| - 100.json
| - reports
| - scripts
| - deploy_water.py
| - create_metadata.py
| - tests
We are now ready to cast our collection!
Mint our collection
现在,Our contract is deployed to the Rinkeby 网络,And we will all works of art and the metadata in the IPFS.Now it is time to cast our collection.
By calling the contracts to casting collection script
让我们在 scripts
Subdirectory to write a script file:create_collection.py
import json
from pathlib import Path
from brownie import (
accounts,
config,
WaterCollection,
)
from scripts.WaterCollection.create_metadata import write_metadata
def main():
# Get our account info
dev = accounts.add(config['wallets']['from_key'])
# Get the most recent deployment of our contract
water_collection = WaterCollection[-1]
# Check the number of currently minted tokens
existing_tokens = water_collection.tokenCounter()
print(existing_tokens)
# Check if we'eve already got our metadata hashes ready
if Path(f"metadata/data.json").exists():
print("Metadata already exists. Skipping...")
meta_data_hashes = json.load(open(f"metadata/data.json"))
else:
meta_data_hashes = write_metadata(100)
for token_id in range(existing_tokens, 100):
# Get the metadata hash for this token's URI
meta_data_hash = meta_data_hashes[token_id]
# Call our createCollectible function to mint a token
transaction = water_collection.createCollectible(
meta_data_hash, {
'from': dev, "gas_limit": 2074044, "allow_revert": True})
# Wait for 3 blocks to be created atop our transactions
transaction.wait(3)
现在,Please your own validation code,This script essentially ensure that we can visit the metadata IPFS 地址,Then use these addresses as our tokens URI One by one, to create our collection.
现在,我们使用以下命令运行脚本:
brownie run scripts/create_collection.py --network rinkeby
让我们前往https://testnets.opensea.io/ ,And we address in the search bar in the contract.Loading may take a few minutes.We should be able to see our collection here!We have now made our collection!The rest is listed our tokens.
On the other network to redeploy
现在我们已经在 Rinkeby The test finished the work on the network,You may want to know how we redo the work on the real network,So that we can benefit from our hard work and artistry.幸运的是,It's like change we provide Brownie The network parameters as simple.
Suppose we want to deploy to Polygon 网络,我们只需要在 Polygon On the network to run our script(我们可以使用相同的 IPFS 地址):
brownie run scripts/deploy_water.py --network polygon-main
brownie run scripts/create_collection.py --network polygon-main
请注意,We will need some MATIC(Polygon 的原生代币)来与 Polygon 网络进行交互.如果我们这样做,我们将能够在 https://opensea.io/ See our collection,Polygon Under the contract address on the network(我们将在 Polygon Network to run on the first deployment scripts to get this).
List ours NFT
最后,Let us in our listed on the market NFT.为此,我们将使用 NFT 市场协议 Zora,But you can explore other options.
Zora Asks 模块
Zora Ask module allows us by providing NFT 合约的地址、To list the tokens of tokens ID、ask 货币、ask 要价(以我们的 ask 货币)、Deposit funds address to list NFT出售的 NFT,Incentives and recommend to us NFT finder fee.You can see their documentation here:
Etherscan API
Before we write a script to list these requests,We need a programmatically access Zora 合约的方法.为此,我们将使用 Etherscan 的 API.Continue by creating a Etherscan Account and in accordance with the instructions for free here API:
获取您的 API Tokens and fill in.env
文件的最后一行,使其显示为ETHERSCAN_TOKEN=<YOUR_ETHERSCAN_API_TOKEN>
.现在,Brownie You will be able to extract contract from the etheric lane network in the background.
请注意,You can get here Polyscan API Tokens come for Polygon The process of web applications are very similar:
and add a new one.env
条目:POLYGONSCAN_TOKEN=<YOUR_POLYSCAN_API_TOKEN>
.
列出 NFT Collection of scripts
This is our final script.再次在scripts
子目录中,让我们创建一个名为的新文件set_asks.py
:
from brownie import WaterCollection, network, accounts, config, Contract
def main():
# Fill your own MetaMask public key here
creator_address = ""
net = network.show_active()
water_collection = WaterCollection[-1]
# Get the asks contract depening on the network
if net == "polygon-main":
asks_address = "0x3634e984Ba0373Cfa178986FD19F03ba4dD8E469"
asksv1 = Contract.from_explorer(asks_address)
module_manager = Contract.from_explorer("0xCCA379FDF4Beda63c4bB0e2A3179Ae62c8716794")
erc721_helper_address = "0xCe6cEf2A9028e1C3B21647ae3B4251038109f42a"
water_address = "0x0d2964fB0bEe1769C1D425aA50A178d29E7815a0"
weth_address = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"
elif net == "rinkeby":
asks_address = "0xA98D3729265C88c5b3f861a0c501622750fF4806"
asksv1 = Contract.from_explorer(asks_address)
module_manager = Contract.from_explorer("0xa248736d3b73A231D95A5F99965857ebbBD42D85")
erc721_helper_address = "0x029AA5a949C9C90916729D50537062cb73b5Ac92"
water_address = "0xFA3D765E90b3FBE91A3AaffF1a611654B911EADb"
weth_address = "0xc778417E063141139Fce010982780140Aa0cD5Ab"
dev = accounts.add(config['wallets']['from_key'])
# Give Zora permission to facilitate transactions with the ASK contract
module_manager.setApprovalForModule(asks_address, True, {
"from": dev})
water_collection.setApprovalForAll(erc721_helper_address, True, {
"from": dev})
for token_id in range(100):
price = (100 - token_id) * 10 ** 16
asksv1.createAsk(water_address, # Address of our contract
token_id, # Token ID of the NFT to be listed
price, # Our asking price
weth_address, # The address of the token required to pay for our NFT
creator_address, # The address where the funds will be sent to
0, # A finder reward
{
'from': dev}) # Sign our transaction with our account
This script will access Zora asks Contract and use sliding scale price list of our NFT.在这里,我们要求用 Wrapped ETH 支付 NFT,但是,如果您愿意,您可以更改此设置.
另外,请注意,This script will be approved Zora Contracts on behalf of our transfer funds and NFT.Before approving the contract logic is always a good idea,但如果你愿意,You can believe me the legitimacy of the.
最后,We will run our script:
brownie run scripts/set_asks.py --network rinkeby
真棒!我们现在已经在 Rinkeby Test is a list of our online collection.Wish you have a nice today!
边栏推荐
猜你喜欢
How to get the 2 d space prior to ViT?UMA & Hong Kong institute of technology & ali SP - ViT, study for visual Transformer 2 d space prior knowledge!.
js数组方法总结
【QT】Qt 给已经开发好的程序快速封装成动态库
2021年数据泄露成本报告解读
新一代网状网协议T-Mesh无线通信技术优势介绍
不可忽略!户外LED显示屏的特点及优势
A new round of competition for speech recognition has started. Will natural dialogue be the next commanding height?
生态剧变,电子签名SaaS模式迎来新突破,网络效应加速到来
FATFS | 中文显示 | 长文件名
【码蹄集新手村600题】将一个函数定义宏
随机推荐
自定SvgIcon公用组件
opencv 读取和写入路径有汉字的处理方法
ECCV 2022 | Relational Query-Based Temporal Action Detection Methods
How to play deep paging with hundreds of millions of data?Compatible with MySQL + ES + MongoDB
【899. Ordered Queue】
Ark server opening tutorial win
Convex Optimization of Optimal Power Flow (OPF) in Microgrids and DC Grids (Matlab Code Implementation)
DC-DC 2C(40W/30W) JD6606SX2退功率应用
1、实例开启无锁表结构变更以后,在任务编排中通过“单实例SQL”节点进行的结构变更,是优先采用无锁表
参与便有奖,《新程序员》杂志福利来袭!
ReentrantReadWriteLock详解
产品以及研发团队有使用专业的办公软件,如禅道、蓝湖等,他们应该如何使用 Tita 系统?
【Unity入门计划】基本概念(8)-瓦片地图 TileMap 02
MATLAB gcf图窗保存图像,黑色背景/透明背景
如何用二分法搜索、查找旋转数组中是否含有某个(目标)值? leetcode 81.搜索旋转排序数组
全新探险者以40万的产品击穿豪华SUV价格壁垒
瞌睡检测系统介绍
托尔斯泰:生活中只有两种不幸
指令重排以及案例
DC-DC 2C (40W/30W) JD6606SX2 power back application