<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Solidity on HecMisio's Blog</title><link>https://blog.hecmisio.com/tags/solidity/</link><description>Recent content in Solidity on HecMisio's Blog</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Thu, 27 Mar 2025 16:28:27 +0800</lastBuildDate><atom:link href="https://blog.hecmisio.com/tags/solidity/index.xml" rel="self" type="application/rss+xml"/><item><title>Exploring Foundry Cheatcodes</title><link>https://blog.hecmisio.com/posts/blockchain/ethereum/solidity/chapter_3/</link><pubDate>Thu, 27 Mar 2025 16:28:27 +0800</pubDate><guid>https://blog.hecmisio.com/posts/blockchain/ethereum/solidity/chapter_3/</guid><description>&lt;p&gt;Foundry is a powerful tool for Ethereum smart contract developers, and its Cheatcodes feature provides great convenience for development and testing. Whether it&amp;rsquo;s simulating the blockchain environment, manipulating contract states, or quickly debugging complex logic, Cheatcodes can help developers achieve twice the result with half the effort. In this article, we will explore the various Cheatcodes provided by Foundry, explaining their uses and usage methods one by one, to help you write and debug Solidity smart contracts more efficiently.&lt;/p&gt;</description></item><item><title>Exploring Chainlink</title><link>https://blog.hecmisio.com/posts/blockchain/ethereum/solidity/chapter_2/</link><pubDate>Wed, 26 Mar 2025 10:24:07 +0800</pubDate><guid>https://blog.hecmisio.com/posts/blockchain/ethereum/solidity/chapter_2/</guid><description>&lt;p&gt;In the world of blockchain, smart contracts are a powerful tool that can be automatically executed when certain conditions are met. However, blockchain itself is a closed system and cannot directly access off-chain data, such as prices in financial markets, weather information, or random numbers. This limitation restricts the application scope of smart contracts.&lt;/p&gt;&#10;&lt;h2 id="what-is-an-oracle"&gt;What is an Oracle?&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Oracles&lt;/strong&gt; are the key to solving this problem. Oracles act as a bridge between the blockchain and the outside world, capable of introducing off-chain data onto the blockchain or transmitting on-chain events to off-chain systems. However, building an oracle system is no easy task, as it must ensure that it does not undermine the decentralization and data security of the chain. How can the source of data be guaranteed to be decentralized? How can the authenticity and reliability of the data be ensured? How can the high availability of the service be guaranteed?&lt;/p&gt;</description></item><item><title>Solidity Basics</title><link>https://blog.hecmisio.com/posts/blockchain/ethereum/solidity/chapter_1/</link><pubDate>Fri, 21 Mar 2025 13:15:41 +0800</pubDate><guid>https://blog.hecmisio.com/posts/blockchain/ethereum/solidity/chapter_1/</guid><description>&lt;h2 id="data-types"&gt;Data Types&lt;/h2&gt;&#10;&lt;p&gt;Solidity offers a variety of data types to meet the different needs of smart contract development. The following are some common data types:&lt;/p&gt;&#10;&lt;table&gt;&#10;&lt;tr&gt;&#10; &lt;th&gt;Category&lt;/th&gt;&#10; &lt;th&gt;Data Type&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10; &lt;td&gt;Value Type&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;, &lt;code&gt;int[8-256]&lt;/code&gt;, &lt;code&gt;uint[8-256]&lt;/code&gt;, &lt;code&gt;address&lt;/code&gt;, &lt;code&gt;bytes[1-32]&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10; &lt;td&gt;Reference Type&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;string&lt;/code&gt;, &lt;code&gt;bytes&lt;/code&gt;, &lt;code&gt;array&lt;/code&gt;, &lt;code&gt;mapping&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10; &lt;td&gt;Special Type&lt;/td&gt;&#10; &lt;td&gt;&lt;code&gt;enum&lt;/code&gt;, &lt;code&gt;struct&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;&lt;strong&gt;bytes[1-32], bytes and string&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;bytes[1-32]&lt;/code&gt; is a fixed-length byte array with a length range of 1 to 32 bytes. &lt;code&gt;bytes&lt;/code&gt; is a dynamic byte array, while &lt;code&gt;string&lt;/code&gt;, although essentially also a dynamic byte array, stores UTF-8 encoded character sequences and involves implicit UTF-8 encoding conversion operations. Therefore, if you need to store fixed-length byte data, such as hash values or identifiers, you can use &lt;code&gt;bytes[1-32]&lt;/code&gt;. For dynamic-sized byte data, such as file content or binary data, use &lt;code&gt;bytes&lt;/code&gt;. If it is text content, such as names or descriptions, use &lt;code&gt;string&lt;/code&gt;. Additionally, only &lt;code&gt;bytes&lt;/code&gt; has a &lt;code&gt;length&lt;/code&gt; attribute; to obtain the length of a &lt;code&gt;string&lt;/code&gt;, it needs to be converted to &lt;code&gt;bytes&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>