<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Solidity - Tag - HEJTAO</title>
        <link>https://hejtao.netlify.app/tags/solidity/</link>
        <description>Solidity - Tag - HEJTAO</description>
        <generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 26 Mar 2025 00:00:00 &#43;0000</lastBuildDate><atom:link href="https://hejtao.netlify.app/tags/solidity/" rel="self" type="application/rss+xml" /><item>
    <title>Merkle Airdrop</title>
    <link>https://hejtao.netlify.app/posts/cs-merkle-airdrop/</link>
    <pubDate>Wed, 26 Mar 2025 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-merkle-airdrop/</guid>
    <description><![CDATA[How to play? Airdrop a bunch of ERC20 tokens to users Deploy a smart contract Send an email with wallet address, token amount and proof to each user The user claims their tokens from the smart contract Build a merkle tree import { MerkleTree } from &#39;merkletreejs&#39;; import keccak256 from &#39;keccak256&#39;; import { solidityPacked } from &#39;ethers&#39;; function main() { const whitelist = [ { address: &#39;0x2173dEd80D3c17D2f349234a31ab8789D28Dd333&#39;, amount: 100 }, { address: &#39;0x2AFAF65965e08DBd0e0aD7a5594E6b5BE398CBd6&#39;, amount: 200 }, { address: &#39;0xfbc89Db3927bCCda61F550d3d9f3998750b7b93f&#39;, amount: 300 }, ]; const leaves = whitelist.]]></description>
</item>
<item>
    <title>How to Create an NFT Contract with Oppenzeppelin</title>
    <link>https://hejtao.netlify.app/posts/cs-721-practice/</link>
    <pubDate>Thu, 27 Feb 2025 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-721-practice/</guid>
    <description><![CDATA[ERC721 // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import { ERC721} from &#34;@openzeppelin/contracts/token/ERC721/ERC721.sol&#34;; contract Wave is ERC721 { constructor() ERC721(&#34;Wave&#34;, &#34;WV&#34;) {} function mint(address to, uint256 tokenId) public { _safeMint(to, tokenId); } } Access Owner // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import { ERC721} from &#34;@openzeppelin/contracts/token/ERC721/ERC721.sol&#34;; import {Ownable} from &#34;@openzeppelin/contracts/access/Ownable.sol&#34;; contract Wave is ERC721, Ownable { constructor() ERC721(&#34;Wave&#34;, &#34;WV&#34;) Ownable(msg.sender) {} function mint(address to, uint256 tokenId) public onlyOwner { _safeMint(to, tokenId); } } Minter Add /interfaces/IMinterManager.]]></description>
</item>
<item>
    <title>How to Build a NFT Market with Locksrare Protocol</title>
    <link>https://hejtao.netlify.app/posts/cs-market/</link>
    <pubDate>Fri, 10 Jan 2025 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-market/</guid>
    <description><![CDATA[Terminology Maker: a passive order that exists off-chain Taker: an order that is executed on-chain Ask: the ask user sells NFT assets for fungible tokens Bid: the bid user buys NFT assets by spending fungible tokens Create Maker Create MakerAsk get global nonce from LooksRareProtocol
check that collection has approved the TransferManager
allow TransferManager to transfer NFT assets check that TransferManager has approved LooksRareProtocol
import { utils, providers, Wallet } from &#39;ethers&#39;; import { LooksRare, CollectionType, StrategyType } from &#39;@looksrare/sdk-v2&#39;; async function main() { const chainId: number = 2021; const provider = new providers.]]></description>
</item>
<item>
    <title>Deploy Smart Contract to Ronin Network with Hardhat</title>
    <link>https://hejtao.netlify.app/posts/cs-hardhat/</link>
    <pubDate>Sun, 15 Sep 2024 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-hardhat/</guid>
    <description><![CDATA[Initiate project mkdir play-hardhat &amp;&amp; cd play-hardhat mkdir contracts mkdir scripts npm init -y yarn add -D hardhat @openzeppelin/hardhat-upgrades @nomicfoundation/hardhat-verify @nomicfoundation/hardhat-ethers yarn hardhat init Configuration // hardhat.config.ts import type { HardhatUserConfig } from &#39;hardhat/config&#39;; import { MNEMONIC, PRIVATE_KEY } from &#39;./secrets.json&#39;; import &#39;@openzeppelin/hardhat-upgrades&#39;; import &#39;@nomicfoundation/hardhat-verify&#39;; import &#39;@nomicfoundation/hardhat-ethers&#39;; const config: HardhatUserConfig = { solidity: { version: &#39;0.8.27&#39;, settings: { optimizer: { enabled: true, runs: 200, }, }, }, networks: { ronin: { chainId: 2020, url: &#39;https://api.]]></description>
</item>
<item>
    <title>Smart Contract Security</title>
    <link>https://hejtao.netlify.app/posts/cs-smartcontract-security/</link>
    <pubDate>Fri, 12 Jul 2024 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-smartcontract-security/</guid>
    <description><![CDATA[Reentrancy Single-Function Reentrancy // SPDX-License-Identifier: MIT pragma solidity ^0.8.27; contract Vulnerable { mapping (address =&gt; uint256) private balances; function withdraw() public { uint256 amount = balances[msg.sender]; (bool success, ) = msg.sender.call{value: amount}(&#34;&#34;); require(success); balances[msg.sender] = 0; } } When msg.sender is a smart contract, the withdraw() process may include:
update the Ethereum State Trie (i.g. the balances of from and to) excute receive() or fallback() of the smart contract withdraw() is called again during the second step Cross-Function Reentrancy // SPDX-License-Identifier: MIT pragma solidity ^0.]]></description>
</item>
<item>
    <title>How to Use Randomness in Smart Contracts -- Chainlink VRF</title>
    <link>https://hejtao.netlify.app/posts/cs-chainlink-vrf/</link>
    <pubDate>Sun, 02 Jul 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-chainlink-vrf/</guid>
    <description><![CDATA[Refer to Chainlink VRF for more details.
Check the coordinator contract on the sepolia testnet.
Create and fund subscription Subscription is needed to implement payment mechanism
You have to send native currency to coordinator contract before receiving randomness from it
// Create subscription function of coordinator contract function createSubscription() external override nonReentrant returns (uint256 subId) { // Generate a subscription id that is globally unique. uint64 currentSubNonce = s_currentSubNonce; subId = uint256( keccak256(abi.]]></description>
</item>
<item>
    <title>Blockchain Glassory</title>
    <link>https://hejtao.netlify.app/posts/cs-blockchain/</link>
    <pubDate>Thu, 05 Jan 2023 00:00:00 &#43;0000</pubDate>
    <author>HEJTAO.COM</author>
    <guid>https://hejtao.netlify.app/posts/cs-blockchain/</guid>
    <description><![CDATA[Abstract Contract An abstract contract is only used as a base/parent contract and cannot be instantiated. It typically contains at least one abstract function (i.e., a function marked as virtual). Address On Ethereum, an address is made of 20 bytes (160 bits or 40 hex characters) and is a more convenient and shorter version of an account's public key. An example of an address is: 0x71C7656EC7ab88b098defB751B7401B5f6d8976F Algorithmic Stablecoin An algorithmic stablecoin mantains it's price stability by manipulating the supply of coins to adjust it's price.]]></description>
</item>
</channel>
</rss>
