the Online Camp focusing on Web3.0 dApp Development.

Subscribe to Web3dAppDevCamp
Share Dialog
Share Dialog

Build SVG NFT dApp by Scaffold-Eth | Web3.0 dApp Dev 0x07
国内用户如需交流,可加微信:197626581.Authors: qiwihui, msfewHistory Articles List:Quickstart | Web3.0 dApp Dev 0x01Web3.0 dApp Developer Growth Path | Web3.0 dApp Dev 0x02Scaffold-Eth Quickstart | Web3.0 dApp Dev 0x03Get & Set Value 1.0 | Web3.0 dApp Dev 0x04Get & Set Value 2.0 | Web3.0 dApp Dev 0x05Get & Set Value 3.0 | Web3.0 dApp Dev 0x06loogies-svg-nft is a simple NFT minting and displaying project provided by scaffold-eth. In this tutorial, we will walk you through a step-by-step analysis and impleme...

RSS in Crypto@NonceGeekLab
Supported by NonceGeekLab <> PlayerLinkAttention: All articles by NonceGeekLab do not constitute any investment advice.PlayerLink: A Trustless Decentralized Web3-Oriented Service Aggregation Protocol. Through reliable, secure, and scalable technology, PlayerLink empowers billions to create and get a new service experience.NonceGeekLab: Focus on Crypto, the most interesting track in the world! https://github.com/WeLightProject/NonceGeekLabAuthors: msfew、leeduckgo、Erqi0x00 Key questionsGood que...

Get & Set Value 3.0 | Web3.0 dApp Dev 0x06
In PurposeHandler version 2.0, we learned to add permission control to functions via the require statement. Now we can add a real economy mechanism to it, so that the value of purpose is controlled by a real bidding auction mechanism!0x01 Add OwnerTo get the owner of a contract owner is a must-learn operation for newbies. The easiest way is to set a public owner variable and pass the _owner parameter in the constructor.pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT contra...

Build SVG NFT dApp by Scaffold-Eth | Web3.0 dApp Dev 0x07
国内用户如需交流,可加微信:197626581.Authors: qiwihui, msfewHistory Articles List:Quickstart | Web3.0 dApp Dev 0x01Web3.0 dApp Developer Growth Path | Web3.0 dApp Dev 0x02Scaffold-Eth Quickstart | Web3.0 dApp Dev 0x03Get & Set Value 1.0 | Web3.0 dApp Dev 0x04Get & Set Value 2.0 | Web3.0 dApp Dev 0x05Get & Set Value 3.0 | Web3.0 dApp Dev 0x06loogies-svg-nft is a simple NFT minting and displaying project provided by scaffold-eth. In this tutorial, we will walk you through a step-by-step analysis and impleme...

RSS in Crypto@NonceGeekLab
Supported by NonceGeekLab <> PlayerLinkAttention: All articles by NonceGeekLab do not constitute any investment advice.PlayerLink: A Trustless Decentralized Web3-Oriented Service Aggregation Protocol. Through reliable, secure, and scalable technology, PlayerLink empowers billions to create and get a new service experience.NonceGeekLab: Focus on Crypto, the most interesting track in the world! https://github.com/WeLightProject/NonceGeekLabAuthors: msfew、leeduckgo、Erqi0x00 Key questionsGood que...

Get & Set Value 3.0 | Web3.0 dApp Dev 0x06
In PurposeHandler version 2.0, we learned to add permission control to functions via the require statement. Now we can add a real economy mechanism to it, so that the value of purpose is controlled by a real bidding auction mechanism!0x01 Add OwnerTo get the owner of a contract owner is a must-learn operation for newbies. The easiest way is to set a public owner variable and pass the _owner parameter in the constructor.pragma solidity >=0.8.0 <0.9.0; //SPDX-License-Identifier: MIT contra...


<100 subscribers
<100 subscribers
In our 1.0 version, we created a simple Get & Set value dApp and its contract and deploy that onto Github-Pages.
Now, we can upgrade the 1.0 version. It will become much cooler with economic model!
In the repo, we can see that the contracts folder actually stores another repo. Here we used the submodule feature of git.
For smart contract, the benefit of doing this is that for the same dApp, we may have different contract versions. For NFT project, we may have the regular version, whitelist version, upgradeable version and etc. If we set contracts as submodule, we will be able to switch contracts inside the folder directly.
Here are some git commands for submodule:
# add submodule for this folder
git submodule add submodule-repository-URL
# example:
# git submodule add https://github.com/leeduckgo/set-purpose-contracts.git
# clone the submodule when cloning repo
git clone --recurse-submodules repository-URL
# manually clone specified submodules
git submodule update --init folder-path
# example:
# git submodule update packages/hardhat/contracts --init
On basis of PurposeHandler, we can use require statements to add access control to setPurpose . When the caller of the contract is not the assigned owner in the constructor function, an error will occur and the following code will not be executed.
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
contract PurposeHandler {
//event SetPurpose(address sender, string purpose);
string public purpose = "Building Unstoppable Apps";
address public owner = 0x7EF99B0E5bEb8ae42DbF126B40b87410a440a32a;
// replace with your own address
constructor() {
// owner = msg.sender;
}
function setPurpose(string memory newPurpose) public {
// about msg.sender:
// https://cryptozombies.io/en/lesson/2/chapter/3
// about require:
// https://cryptozombies.io/en/lesson/2/chapter/4
require( msg.sender == owner, "NOT THE OWNER!");
purpose = newPurpose;
console.log(msg.sender,"set purpose to",purpose);
//emit SetPurpose(msg.sender, purpose);
}
}
**TIPS: **
More about msg.sender: https://cryptozombies.io/en/lesson/2/chapter/3
More about require: https://cryptozombies.io/en/lesson/2/chapter/4
Go back to set-purpose root directory. Start local network, deploy the contract, and start the dApp:
export SKIP_PREFLIGHT_CHECK=true # config environment variable
yarn chain # Start local blockchain network
yarn deploy # Deploy contract
yarn start # run dApp
Open up http://localhost:3000 in browser.
When Owner is making transaction:
When address other that Owner is making transaction:
TIPS:
If address have errors related to Nonce, just reset the Nonce:
Metamask > Settings > Advanced > Reset Account
Authors:
In our 1.0 version, we created a simple Get & Set value dApp and its contract and deploy that onto Github-Pages.
Now, we can upgrade the 1.0 version. It will become much cooler with economic model!
In the repo, we can see that the contracts folder actually stores another repo. Here we used the submodule feature of git.
For smart contract, the benefit of doing this is that for the same dApp, we may have different contract versions. For NFT project, we may have the regular version, whitelist version, upgradeable version and etc. If we set contracts as submodule, we will be able to switch contracts inside the folder directly.
Here are some git commands for submodule:
# add submodule for this folder
git submodule add submodule-repository-URL
# example:
# git submodule add https://github.com/leeduckgo/set-purpose-contracts.git
# clone the submodule when cloning repo
git clone --recurse-submodules repository-URL
# manually clone specified submodules
git submodule update --init folder-path
# example:
# git submodule update packages/hardhat/contracts --init
On basis of PurposeHandler, we can use require statements to add access control to setPurpose . When the caller of the contract is not the assigned owner in the constructor function, an error will occur and the following code will not be executed.
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
contract PurposeHandler {
//event SetPurpose(address sender, string purpose);
string public purpose = "Building Unstoppable Apps";
address public owner = 0x7EF99B0E5bEb8ae42DbF126B40b87410a440a32a;
// replace with your own address
constructor() {
// owner = msg.sender;
}
function setPurpose(string memory newPurpose) public {
// about msg.sender:
// https://cryptozombies.io/en/lesson/2/chapter/3
// about require:
// https://cryptozombies.io/en/lesson/2/chapter/4
require( msg.sender == owner, "NOT THE OWNER!");
purpose = newPurpose;
console.log(msg.sender,"set purpose to",purpose);
//emit SetPurpose(msg.sender, purpose);
}
}
**TIPS: **
More about msg.sender: https://cryptozombies.io/en/lesson/2/chapter/3
More about require: https://cryptozombies.io/en/lesson/2/chapter/4
Go back to set-purpose root directory. Start local network, deploy the contract, and start the dApp:
export SKIP_PREFLIGHT_CHECK=true # config environment variable
yarn chain # Start local blockchain network
yarn deploy # Deploy contract
yarn start # run dApp
Open up http://localhost:3000 in browser.
When Owner is making transaction:
When address other that Owner is making transaction:
TIPS:
If address have errors related to Nonce, just reset the Nonce:
Metamask > Settings > Advanced > Reset Account
Authors:
No activity yet