<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Fatih Furkan</title>
        <link>https://paragraph.com/@fatih-furkan</link>
        <description>just a blockchain developer</description>
        <lastBuildDate>Tue, 04 Aug 2026 05:31:48 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>Fatih Furkan</title>
            <url>https://storage.googleapis.com/papyrus_images/ff46b69b0a3f5d76775d3ae37ccd6f5b5258cd8b2667f16baa08f2dc59b10b0a.jpg</url>
            <link>https://paragraph.com/@fatih-furkan</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Solidity - Constant vs. Immutable vs. Mutable State Variables]]></title>
            <link>https://paragraph.com/@fatih-furkan/solidity-constant-vs-immutable-vs-mutable-state-variables</link>
            <guid>Vwyz55OfxT1EMRa2n9K3</guid>
            <pubDate>Sat, 25 Jun 2022 09:38:20 GMT</pubDate>
            <description><![CDATA[As you know we can define a state variable using these 2 keywords: constant , immutable, or we don’t write anything about mutability.address public ownerOne; address public immutable ownerTwo; address public constant ownerThree; Let’s look at their differences:constant: If you use this keyword, you can’t change the state variable in the contract. You have to define the variable hard-coded.immutable: If you use this keyword, you have to define the variable in the constructor. After than, you c...]]></description>
            <content:encoded><![CDATA[<p>As you know we can define a state variable using these 2 keywords: <code>constant</code> , <code>immutable</code>, or we don’t write anything about mutability.</p><pre data-type="codeBlock" text="address public ownerOne;
address public immutable ownerTwo;
address public constant ownerThree;
"><code><span class="hljs-keyword">address</span> <span class="hljs-keyword">public</span> ownerOne;
<span class="hljs-keyword">address</span> <span class="hljs-keyword">public</span> <span class="hljs-keyword">immutable</span> ownerTwo;
<span class="hljs-keyword">address</span> <span class="hljs-keyword">public</span> <span class="hljs-keyword">constant</span> ownerThree;
</code></pre><p>Let’s look at their differences:</p><ul><li><p><code>constant</code>: If you use this keyword, you can’t change the state variable in the contract. You have to define the variable hard-coded.</p></li><li><p><code>immutable</code>: If you use this keyword, you have to define the variable in the constructor. After than, you can’t change its value. As you can see it’s very similar to constant.</p></li><li><p>If you don’t specify anything, the mutability of the variable will be <code>mutable</code>. You can change its value wherever you want.</p></li></ul><p>You can say “Why would I use constant or immutable”. Freedom has a price.</p><p>If you say “I don’t want to use them, I want to be free while I write the contract”, you’ll both fuck your user’s wallet and your wallet.</p><p>Here are the test results:</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/396bf24e1b7798155c050ff58eacc55609f4c474a4aefe142e336ebb4ad0c06e.png" alt="Use constants or immutable if you can" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Use constants or immutable if you can</figcaption></figure><p>As you can see, there is a big difference in the deployment phase. You can save 51.517 gas by using constants than using mutable variables. You can check the contracts and the test file that I used <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://gist.github.com/0fatih/f72696c5f1a69755d666499b0d45cb34">here</a>.</p><p>Give attention to contract call costs. Constant and immutable used the same amount of gas. So, using <code>constant</code> instead of <code>immutable</code>, saves money on your pocket, not from users’.</p><p>If you don’t use <code>constant</code> or <code>immutable</code> while you can, your users will pay nearly 5% more for every call!</p><p>Don’t screw your users.</p>]]></content:encoded>
            <author>fatih-furkan@newsletter.paragraph.com (Fatih Furkan)</author>
        </item>
        <item>
            <title><![CDATA[Solidity - Low-level Call to a Non-existent Contract]]></title>
            <link>https://paragraph.com/@fatih-furkan/solidity-low-level-call-to-a-non-existent-contract</link>
            <guid>XqV6EJhxpGr3sg3U33zc</guid>
            <pubDate>Fri, 17 Jun 2022 10:13:03 GMT</pubDate>
            <description><![CDATA[We’ll investigate what happens when we call a contract using call , delegatecall, staticcall. You can think “of course it should revert, there is no contract”. But this would be wrong. Those functions return a boolean. If you said, “Oh, okay! So, we’ll get a false”, you’ll be wrong. Because when you call a non-existent contract with those functions, you’ll get a true. This is how EVM works. Let’s try it with hands-on experience. Here is a contract to try them:// SPDX-License-Identifier: GPL-3...]]></description>
            <content:encoded><![CDATA[<p>We’ll investigate what happens when we call a contract using <code>call</code> , <code>delegatecall</code>, <code>staticcall</code>.</p><p>You can think “of course it should revert, there is no contract”. But this would be wrong. Those functions return a boolean. If you said, “Oh, okay! So, we’ll get a <code>false</code>”, you’ll be wrong. Because when you call a non-existent contract with those functions, you’ll get a <code>true</code>. This is how EVM works.</p><p>Let’s try it with hands-on experience. Here is a contract to try them:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.15;

contract DarkForest {
    function callWithCall() external returns (bool res) {
        (res, ) = address(1).call(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }

    function callWithDelegatecall() external returns(bool res) {
        (res, ) = address(1).delegatecall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }

    function callWithStaticcall() external view returns(bool res) {
        (res, ) = address(1).staticcall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>
<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> 0.8.15;</span>

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DarkForest</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithCall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">call</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithDelegatecall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">delegatecall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithStaticcall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">staticcall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }
}
</code></pre><p>You can use this contract in remix and you’ll see the results. It doesn’t matter which network you’ve tried (at least most of them). Because probably there is no contract with the <code>0x0000000000000000000000000000000000000001</code> address if they don’t have a pre-compiled contract with that address. So basically you can use this contract in your localhost.</p><p>You’ll see you are getting a <code>true</code> when you call those functions. But there is no contract with <code>0x0000000000000000000000000000000000000001</code> this address.</p><p>External calls are so important in Solidity. You have to use them very carefully. This is just an example of bad cases when you are using an external call.</p><h2 id="h-prevention-technique" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Prevention Technique</h2><p>If you have to call an external contract that you don’t trust then you have to check if there is a contract with the given address.</p><p>In Solidity, we can check an address’ code length. If the code length is greater than 0, it means that address is a contract. So, let’s add our new security method to our contract:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.15;

contract DarkForest {
    function callWithCall() external returns (bool res) {
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).call(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }

    function callWithDelegatecall() external returns(bool res) {
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).delegatecall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }

    function callWithStaticcall() external view returns(bool res) {
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).staticcall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>
<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> 0.8.15;</span>

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DarkForest</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithCall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">call</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithDelegatecall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">delegatecall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithStaticcall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">staticcall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }
}
</code></pre><p>With the <code>require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);</code> line, we can determine if the address is a contract. Now you can try to call those functions. You’ll get an error. But are we totally safe right now?</p><p>In the constructor, contracts don’t have any code yet. So, a hacker can call our function in a constructor to get what he wants. We don’t want this to happen. We’ll add another layer for security:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.15;

contract DarkForest {
    function callWithCall() external returns (bool res) {
        require(msg.sender == tx.origin, &quot;only eoas&quot;);
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).call(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }

    function callWithDelegatecall() external returns(bool res) {
        require(msg.sender == tx.origin, &quot;only eoas&quot;);
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).delegatecall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }

    function callWithStaticcall() external view returns(bool res) {
        require(msg.sender == tx.origin, &quot;only eoas&quot;);
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).staticcall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>
<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> 0.8.15;</span>

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DarkForest</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithCall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-built_in">tx</span>.<span class="hljs-built_in">origin</span>, <span class="hljs-string">"only eoas"</span>);
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">call</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithDelegatecall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-built_in">tx</span>.<span class="hljs-built_in">origin</span>, <span class="hljs-string">"only eoas"</span>);
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">delegatecall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithStaticcall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-built_in">tx</span>.<span class="hljs-built_in">origin</span>, <span class="hljs-string">"only eoas"</span>);
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">staticcall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
    }
}
</code></pre><p>The <code>require(msg.sender == tx.origin, &quot;only eoas&quot;);</code> line be sure the caller is an EOA.</p><p>One last thing: Now we can safely make an external call safely. But, we don’t check the result. So, if there is an error in the external call our transaction doesn’t bubble up the error. Usually, we don’t want this to happen. We can protect ourselves by adding this line to the end of our functions: <code>require(res, &quot;failed external call&quot;);</code> .</p><p>Now we are safe. Here is the latest code:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.15;

contract DarkForest {
    function callWithCall() external returns (bool res) {
        require(msg.sender == tx.origin, &quot;only eoas&quot;);
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).call(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
        require(res, &quot;failed external call&quot;);
    }

    function callWithDelegatecall() external returns(bool res) {
        require(msg.sender == tx.origin, &quot;only eoas&quot;);
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).delegatecall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
        require(res, &quot;failed external call&quot;);
    }

    function callWithStaticcall() external view returns(bool res) {
        require(msg.sender == tx.origin, &quot;only eoas&quot;);
        require(address(1).code.length &gt; 0, &quot;non-existent contract&quot;);

        (res, ) = address(1).staticcall(abi.encodeWithSignature(&quot;transfer(address,uint256)&quot;, msg.sender, 5 ether));
        require(res, &quot;failed external call&quot;);
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: GPL-3.0</span>
<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> 0.8.15;</span>

<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">DarkForest</span> </span>{
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithCall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-built_in">tx</span>.<span class="hljs-built_in">origin</span>, <span class="hljs-string">"only eoas"</span>);
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">call</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
        <span class="hljs-built_in">require</span>(res, <span class="hljs-string">"failed external call"</span>);
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithDelegatecall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-built_in">tx</span>.<span class="hljs-built_in">origin</span>, <span class="hljs-string">"only eoas"</span>);
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">delegatecall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
        <span class="hljs-built_in">require</span>(res, <span class="hljs-string">"failed external call"</span>);
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callWithStaticcall</span>(<span class="hljs-params"></span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> <span class="hljs-title"><span class="hljs-keyword">view</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span>(<span class="hljs-params"><span class="hljs-keyword">bool</span> res</span>) </span>{
        <span class="hljs-built_in">require</span>(<span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span> <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-built_in">tx</span>.<span class="hljs-built_in">origin</span>, <span class="hljs-string">"only eoas"</span>);
        <span class="hljs-built_in">require</span>(<span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">code</span>.<span class="hljs-built_in">length</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span>, <span class="hljs-string">"non-existent contract"</span>);

        (res, ) <span class="hljs-operator">=</span> <span class="hljs-keyword">address</span>(<span class="hljs-number">1</span>).<span class="hljs-built_in">staticcall</span>(<span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"transfer(address,uint256)"</span>, <span class="hljs-built_in">msg</span>.<span class="hljs-built_in">sender</span>, <span class="hljs-number">5</span> <span class="hljs-literal">ether</span>));
        <span class="hljs-built_in">require</span>(res, <span class="hljs-string">"failed external call"</span>);
    }
}
</code></pre>]]></content:encoded>
            <author>fatih-furkan@newsletter.paragraph.com (Fatih Furkan)</author>
        </item>
        <item>
            <title><![CDATA[Solidity - The Strings Library]]></title>
            <link>https://paragraph.com/@fatih-furkan/solidity-the-strings-library</link>
            <guid>ZJiNYVRXFXYdaaF8y3IS</guid>
            <pubDate>Tue, 07 Jun 2022 07:17:26 GMT</pubDate>
            <description><![CDATA[In this article, we are going to inspect OpenZeppelin&apos;s String library. Most of the articles are about core things like oracles, launchpads, tokens, etc. I wanted to write an article about this kind of useful but not too much-used thing. Let’s start!State VariablesAt the beginning of our contract, we have two state variables:bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; We will use these variables in our toHexString functions.toS...]]></description>
            <content:encoded><![CDATA[<p>In this article, we are going to inspect <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol">OpenZeppelin&apos;s String library</a>. Most of the articles are about core things like oracles, launchpads, tokens, etc. I wanted to write an article about this kind of useful but not too much-used thing. Let’s start!</p><h2 id="h-state-variables" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">State Variables</h2><p>At the beginning of our contract, we have two state variables:</p><pre data-type="codeBlock" text="bytes16 private constant _HEX_SYMBOLS = &quot;0123456789abcdef&quot;;
uint8 private constant _ADDRESS_LENGTH = 20;
"><code><span class="hljs-keyword">bytes16</span> <span class="hljs-keyword">private</span> <span class="hljs-keyword">constant</span> _HEX_SYMBOLS <span class="hljs-operator">=</span> <span class="hljs-string">"0123456789abcdef"</span>;
<span class="hljs-keyword">uint8</span> <span class="hljs-keyword">private</span> <span class="hljs-keyword">constant</span> _ADDRESS_LENGTH <span class="hljs-operator">=</span> <span class="hljs-number">20</span>;
</code></pre><p>We will use these variables in our <code>toHexString</code> functions.</p><h2 id="h-tostring-function" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">toString() function</h2><p>This function <code>Converts a uint256 to its ASCII string decimal representation.</code></p><p>First of all, let’s look at the function signature:</p><pre data-type="codeBlock" text="function toString(uint256 value) internal pure returns (string memory)
"><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toString</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> value</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>)
</span></code></pre><ul><li><p>It takes an uint256 parameter.</p></li><li><p>It’s an internal function. So, it can only be accessible in the String contract itself, or a contract inherited from the String contract.</p></li><li><p>It’s a pure function. That means it doesn’t read or write from the state.</p></li><li><p>And lastly, it returns a string.</p></li></ul><p>The method we used in this function does not work with the number 0. So, if the input number is zero, return ”0”:</p><pre data-type="codeBlock" text="if (value == 0) {
  return &quot;0&quot;;
}
"><code><span class="hljs-keyword">if</span> (value <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
  <span class="hljs-keyword">return</span> <span class="hljs-string">"0"</span>;
}
</code></pre><p>Next, we are saving our input variable to another variable. We’ll divide it by 10 continuously. Because we want to get how many digits is the input variable and we don’t want to lose the value.</p><pre data-type="codeBlock" text="uint256 temp = value;
uint256 digits;

while (temp != 0) {
  digits++;
  temp /= 10;
}
"><code><span class="hljs-keyword">uint256</span> temp <span class="hljs-operator">=</span> value;
<span class="hljs-keyword">uint256</span> digits;

<span class="hljs-keyword">while</span> (temp <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
  digits<span class="hljs-operator">+</span><span class="hljs-operator">+</span>;
  temp <span class="hljs-operator">/</span><span class="hljs-operator">=</span> <span class="hljs-number">10</span>;
}
</code></pre><p>Let’s assume that we sent <code>100,042</code> to this function. Now, <code>temp</code> is equal to <code>0</code> , and <code>digits</code> is equal to <code>6</code>.</p><p>Now, we are going to create a <code>bytes</code> variable and insert the bytes one by one to it:</p><pre data-type="codeBlock" text="bytes memory buffer = new bytes(digits);
while (value != 0) {
  digits -= 1;
  buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
  value /= 10;
}
return string(buffer);
"><code><span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> buffer <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-keyword">bytes</span>(digits);
<span class="hljs-keyword">while</span> (value <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
  digits <span class="hljs-operator">-</span><span class="hljs-operator">=</span> <span class="hljs-number">1</span>;
  buffer[digits] <span class="hljs-operator">=</span> <span class="hljs-keyword">bytes1</span>(<span class="hljs-keyword">uint8</span>(<span class="hljs-number">48</span> <span class="hljs-operator">+</span> <span class="hljs-keyword">uint256</span>(value <span class="hljs-operator">%</span> <span class="hljs-number">10</span>)));
  value <span class="hljs-operator">/</span><span class="hljs-operator">=</span> <span class="hljs-number">10</span>;
}
<span class="hljs-keyword">return</span> <span class="hljs-keyword">string</span>(buffer);
</code></pre><p>At the beginning <code>buffer</code> is equal to <code>0x000000000000</code>. And in every loop it changes these:</p><ul><li><p>0x000000000032</p></li><li><p>0x000000003432</p></li><li><p>0x000000303432</p></li><li><p>0x000030303432</p></li><li><p>0x003030303432</p></li><li><p>0x313030303432</p></li></ul><p>If you convert every byte to ASCII, you can get <code>0</code> for <code>0x30</code>, <code>1</code> for <code>31</code>, <code>2</code> for <code>32</code>, etc. 30 to 40 are the numbers 0 to 9.</p><p>Let’s break down the confusing line:</p><ul><li><p><code>value % 10</code> is for getting the least important number.</p></li><li><p><code>uint8(48 + uint256(value % 10))</code> nothing much different. Just type conversion to be able to use <code>bytes1</code> without losing data.</p></li><li><p><code>bytes1(uint8(48 + uint256(value % 10)))</code> now we can add the resulting number to our <code>buffer</code> .</p></li></ul><p>Let’s run the first loop to understand what is going on in this line:</p><ul><li><p><code>value % 10</code> gives us <code>2</code>. I am not going to explain to you “what is mod” here. If you don’t know how we are getting <code>2</code> from <code>100,042 % 10</code> , then just google “what is mod in programming”.</p></li><li><p><code>uint8(48 + uint256(value % 10))</code> gives us <code>50</code>. You can think: “what the hell is this number?”. And you’ll be right. They used this, because, we are going to use hexadecimal numbers. If you convert <code>50</code> to hexadecimal, you’ll get <code>32</code>. And <code>32</code> is equal to <code>2</code> in the ASCII table. Wow! What a conversion, hah?</p></li><li><p><code>bytes1(uint8(48 + uint256(value % 10)))</code> conversion is required for our <code>buffer</code> , which is a bytes variable.</p></li></ul><p>Lastly, we are converting our bytes to string. I love this part. Because if you want to get to result in <code>uint</code>, the result is will be a totally different thing. But, we are telling “convert it to string, I want to see its corresponding value in the ASCII table”.</p><h2 id="h-tohexstring-function" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">toHexString() function</h2><p>Before we go deep dive into this function, you have to know that: there are 3 different <code>toHexString</code> functions in this library. If you don’t know <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.soliditylang.org/en/latest/contracts.html#function-overloading">function overloading</a>, you might be thinking “how can they use 3 functions with the same name?”. So, it’ll be better for you to check out function overloading before continuing this article.</p><p>Let’s look at our three functions:</p><pre data-type="codeBlock" text="function toHexString(uint256 value, uint256 length) internal pure returns (string memory)
"><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toHexString</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> value, <span class="hljs-keyword">uint256</span> length</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>)
</span></code></pre><pre data-type="codeBlock" text="function toHexString(uint256 value) internal pure returns (string memory)
"><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toHexString</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> value</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>)
</span></code></pre><pre data-type="codeBlock" text="function toHexString(address addr) internal pure returns (string memory)
"><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toHexString</span>(<span class="hljs-params"><span class="hljs-keyword">address</span> addr</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>)
</span></code></pre><p>As you can see, they have the same name, but, they all have a different kinds of parameters. Because of that, their <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.soliditylang.org/en/v0.8.12/abi-spec.html#function-selector">function selectors</a> are different. So, EVM is good with that.</p><p>Please think the functions in order. For example, the number 1, the first function, is the function that takes two <code>uint256</code> parameters.</p><p>But, you should know that: the second and third functions are calling the first function. It means if you call the second or the third function, your input values are going to the first function at the end of the day.</p><p>Enough for talking. Let’s look at the third function’s code:</p><pre data-type="codeBlock" text="return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
"><code><span class="hljs-keyword">return</span> toHexString(<span class="hljs-keyword">uint256</span>(<span class="hljs-keyword">uint160</span>(addr)), _ADDRESS_LENGTH);
</code></pre><p>It has only one line of code. And it is converting our <code>address</code> input variable to <code>uint256</code>. And, send the result with <code>_ADDRESS_LENGTH</code>, which is <code>20</code>, to our first function.</p><p>Let’s convert my address,<code>0x000000000042bAA586DD7161dC0EB8f0CB4a9fBE</code> , to <code>uint256</code>: <code>346477235235092042596196240046333886</code> we’ll get this huge number.</p><p>We’ll look at the other steps in a minute when we are talking about the first function.</p><p>Okay, now time for our second function. If the input value is <code>0</code>, then we are returning <code>”0x00”</code>.</p><pre data-type="codeBlock" text="if (value == 0) {
  return &quot;0x00&quot;;
}
"><code><span class="hljs-keyword">if</span> (value <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
  <span class="hljs-keyword">return</span> <span class="hljs-string">"0x00"</span>;
}
</code></pre><p>If it is not zero, then we are going to calculate it’s length:</p><pre data-type="codeBlock" text="uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
  length++;
  temp &gt;&gt;= 8;
}
"><code><span class="hljs-keyword">uint256</span> temp <span class="hljs-operator">=</span> value;
<span class="hljs-keyword">uint256</span> length <span class="hljs-operator">=</span> <span class="hljs-number">0</span>;
<span class="hljs-keyword">while</span> (temp <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
  length<span class="hljs-operator">+</span><span class="hljs-operator">+</span>;
  temp <span class="hljs-operator">></span><span class="hljs-operator">></span><span class="hljs-operator">=</span> <span class="hljs-number">8</span>;
}
</code></pre><p>I think only the <code>temp &gt;&gt;= 8;</code> line is confusing. Let’s again send to this function our <code>100,042</code> number and see what happens in our loop:</p><ul><li><p>In our first loop <code>length</code> will be 1 and the temp is <code>390</code>. What? Ok. Now we have to go to the dark side of coding: the binary world. <code>100,042</code> in binary is equal to <code>11000011011001010</code> and 390 is equal to <code>110000110</code> . Did you notice the similarity between to binaries? Their first (start from left) 8 digits are equal. <code>&gt;&gt;</code> means shift bits to right. If you used <code>&lt;&lt;</code> this one, the result will be: <code>25610752</code> and its binary is <code>1100001101100101000000000</code> . Okay, I believe now things are more clear. <code>&gt;&gt;</code> deletes bits, <code>&lt;&lt;</code> adds zero to binary. I think we can think like that. So, our loop basically calculates the length of our value in bytes (8 bits are equal to 1 byte). We will use the length of this byte in our first function. Let’s go on to other steps.</p></li><li><p><code>temp’s</code> value was <code>110000110</code> . So, we can delete the least significant 8 bits by our hand (last 8 bits). If we delete them here we have binary <code>1</code>, it is equal to decimal <code>1</code>. And <code>length</code> is equal to <code>2</code> now.</p></li><li><p>This is the last step for our value. Because in this step our value is going to equal to <code>0</code>. And while loop not going to run anymore. In this step <code>temp</code> is equal <code>0</code> and <code>length</code> is equal to <code>3</code>. Now, we are sending <code>100,042</code> and <code>length</code> to the first function.</p></li></ul><p>So far so good! Only one function is left, the first function. It starts with defining a bytes variable named <code>buffer</code> and its length is equal to <code>2 * length + 2</code>. Why is that? It is because every 2 hexadecimal characters are equal to 1 byte. For example, if you want to convert byte <code>0</code> to hexadecimal, you&apos;ll have <code>0x00</code>. Since we are returning a string, we don’t actually have <code>0x</code> at the beginning. So, we have to add it manually. I think you got why we are adding <code>2</code> to our length, it is because of <code>0x</code>.</p><pre data-type="codeBlock" text="bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = &quot;0&quot;;
buffer[1] = &quot;x&quot;;
"><code><span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> buffer <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-keyword">bytes</span>(<span class="hljs-number">2</span> <span class="hljs-operator">*</span> length <span class="hljs-operator">+</span> <span class="hljs-number">2</span>);
buffer[<span class="hljs-number">0</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"0"</span>;
buffer[<span class="hljs-number">1</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"x"</span>;
</code></pre><p>After than, we are going to determine all of our hexadecimal values one by one.</p><pre data-type="codeBlock" text="for (uint256 i = 2 * length + 1; i &gt; 1; --i) {
  buffer[i] = _HEX_SYMBOLS[value &amp; 0xf];
  value &gt;&gt;= 4;
}
"><code><span class="hljs-keyword">for</span> (<span class="hljs-keyword">uint256</span> i <span class="hljs-operator">=</span> <span class="hljs-number">2</span> <span class="hljs-operator">*</span> length <span class="hljs-operator">+</span> <span class="hljs-number">1</span>; i <span class="hljs-operator">></span> <span class="hljs-number">1</span>; <span class="hljs-operator">-</span><span class="hljs-operator">-</span>i) {
  buffer[i] <span class="hljs-operator">=</span> _HEX_SYMBOLS[value <span class="hljs-operator">&#x26;</span> <span class="hljs-number">0xf</span>];
  value <span class="hljs-operator">></span><span class="hljs-operator">></span><span class="hljs-operator">=</span> <span class="hljs-number">4</span>;
}
</code></pre><p>We have sent to this function to value, do you remember? One is <code>(100042, 3)</code> and the other one is <code>(0x000000000042bAA586DD7161dC0EB8f0CB4a9fBE, 20)</code> . Let’s run them step-by-step. First <code>(100042, 3)</code> :</p><ul><li><p>In this step, we are going to determine <code>value &amp; 0xf</code> first. It is a bitwise AND operation. We want to get the last 4 bits We sent <code>100042</code> , in binary <code>11000011011001010</code>. So, <code>value &amp; 0xf</code> gives us <code>1010</code>, which is equal to decimal <code>10</code>. 10th item in the <code>_HEX_SYMBOLS</code> list is equal to <code>a</code>. After then we are deleting the least significant 4 bits from <code>value</code>. And now we have <code>1100001101100</code> , which is equal to decimal <code>6252</code>. <code>buffer</code> is equal to <code>0x3078000000000061</code>. The first 2 bytes <code>3078</code> are coming from <code>0x</code> that we add before the loop. Do you remember <code>30</code> is equal to <code>0</code> in the ASCII table, right? The same goes with the <code>x</code> and <code>a</code>. <code>78</code> is equal to <code>x</code> in the ASCII table. If you convert the <code>buffer</code> to string, you’ll get <code>0xa</code>.</p></li><li><p>Now we are operating <code>1100001101100 &amp; 0xf</code> which gives us decimal <code>12</code> and hexadecimal <code>c</code>. Buffer is equal to <code>0x3078000000006361</code>, in string <code>0xca</code>.</p></li><li><p>Our number is <code>110000110</code> . Again, delete the least significant 4 bits and run the operation bitwise AND. It gives us <code>0110</code>. Buffer is equal to <code>0x3078000000366361</code> , in string <code>0x6ca</code>.</p></li><li><p>Our number is <code>11000</code> . In this step, we are getting <code>8</code> . Now <code>temp</code> is equal to <code>1</code>. Buffer is <code>0x3078000038366361</code>, in string <code>0x86ca</code> .</p></li><li><p>We get <code>1</code> in binary in this step. And it gives us hexadecimal <code>1</code>. <code>temp</code> is <code>0</code>. Buffer is <code>0x3078003138366361</code>, in string <code>0x186ca</code> .</p></li><li><p><code>temp</code> was equal to. Because of that, we are getting a <code>0</code> in hexadecimal. Buffer is equal to <code>0x3078303138366361</code> , in string <code>0x0186ca</code> . And this was the last step.</p></li></ul><p>We gave <code>(100042, 3)</code> to this function and it returned <code>0x0186ca</code>. You can convert these numbers using an online converter and you’ll see the result is true.</p><h2 id="h-conclusion" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Conclusion</h2><p>I said I also inspect the <code>346477235235092042596196240046333886</code> and <code>20</code> . But I am not a computer, I am bored doing the same thing over and over. So, you can do it by yourself. Here is the full code of the library that I inspect. I am sharing it because, in the future, it can be changed:</p><pre data-type="codeBlock" text="// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = &quot;0123456789abcdef&quot;;
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI&apos;s implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return &quot;0&quot;;
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return &quot;0x00&quot;;
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp &gt;&gt;= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = &quot;0&quot;;
        buffer[1] = &quot;x&quot;;
        for (uint256 i = 2 * length + 1; i &gt; 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value &amp; 0xf];
            value &gt;&gt;= 4;
        }
        require(value == 0, &quot;Strings: hex length insufficient&quot;);
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
"><code><span class="hljs-comment">// SPDX-License-Identifier: MIT</span>
<span class="hljs-comment">// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)</span>

<span class="hljs-meta"><span class="hljs-keyword">pragma</span> <span class="hljs-keyword">solidity</span> ^0.8.0;</span>

<span class="hljs-comment">/**
 * @dev String operations.
 */</span>
<span class="hljs-class"><span class="hljs-keyword">library</span> <span class="hljs-title">Strings</span> </span>{
    <span class="hljs-keyword">bytes16</span> <span class="hljs-keyword">private</span> <span class="hljs-keyword">constant</span> _HEX_SYMBOLS <span class="hljs-operator">=</span> <span class="hljs-string">"0123456789abcdef"</span>;
    <span class="hljs-keyword">uint8</span> <span class="hljs-keyword">private</span> <span class="hljs-keyword">constant</span> _ADDRESS_LENGTH <span class="hljs-operator">=</span> <span class="hljs-number">20</span>;

    <span class="hljs-comment">/**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toString</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> value</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>) </span>{
        <span class="hljs-comment">// Inspired by OraclizeAPI's implementation - MIT licence</span>
        <span class="hljs-comment">// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol</span>

        <span class="hljs-keyword">if</span> (value <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
            <span class="hljs-keyword">return</span> <span class="hljs-string">"0"</span>;
        }
        <span class="hljs-keyword">uint256</span> temp <span class="hljs-operator">=</span> value;
        <span class="hljs-keyword">uint256</span> digits;
        <span class="hljs-keyword">while</span> (temp <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
            digits<span class="hljs-operator">+</span><span class="hljs-operator">+</span>;
            temp <span class="hljs-operator">/</span><span class="hljs-operator">=</span> <span class="hljs-number">10</span>;
        }
        <span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> buffer <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-keyword">bytes</span>(digits);
        <span class="hljs-keyword">while</span> (value <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
            digits <span class="hljs-operator">-</span><span class="hljs-operator">=</span> <span class="hljs-number">1</span>;
            buffer[digits] <span class="hljs-operator">=</span> <span class="hljs-keyword">bytes1</span>(<span class="hljs-keyword">uint8</span>(<span class="hljs-number">48</span> <span class="hljs-operator">+</span> <span class="hljs-keyword">uint256</span>(value <span class="hljs-operator">%</span> <span class="hljs-number">10</span>)));
            value <span class="hljs-operator">/</span><span class="hljs-operator">=</span> <span class="hljs-number">10</span>;
        }
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">string</span>(buffer);
    }

    <span class="hljs-comment">/**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toHexString</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> value</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>) </span>{
        <span class="hljs-keyword">if</span> (value <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
            <span class="hljs-keyword">return</span> <span class="hljs-string">"0x00"</span>;
        }
        <span class="hljs-keyword">uint256</span> temp <span class="hljs-operator">=</span> value;
        <span class="hljs-keyword">uint256</span> length <span class="hljs-operator">=</span> <span class="hljs-number">0</span>;
        <span class="hljs-keyword">while</span> (temp <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>) {
            length<span class="hljs-operator">+</span><span class="hljs-operator">+</span>;
            temp <span class="hljs-operator">></span><span class="hljs-operator">></span><span class="hljs-operator">=</span> <span class="hljs-number">8</span>;
        }
        <span class="hljs-keyword">return</span> toHexString(value, length);
    }

    <span class="hljs-comment">/**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toHexString</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> value, <span class="hljs-keyword">uint256</span> length</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>) </span>{
        <span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> buffer <span class="hljs-operator">=</span> <span class="hljs-keyword">new</span> <span class="hljs-keyword">bytes</span>(<span class="hljs-number">2</span> <span class="hljs-operator">*</span> length <span class="hljs-operator">+</span> <span class="hljs-number">2</span>);
        buffer[<span class="hljs-number">0</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"0"</span>;
        buffer[<span class="hljs-number">1</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"x"</span>;
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">uint256</span> i <span class="hljs-operator">=</span> <span class="hljs-number">2</span> <span class="hljs-operator">*</span> length <span class="hljs-operator">+</span> <span class="hljs-number">1</span>; i <span class="hljs-operator">></span> <span class="hljs-number">1</span>; <span class="hljs-operator">-</span><span class="hljs-operator">-</span>i) {
            buffer[i] <span class="hljs-operator">=</span> _HEX_SYMBOLS[value <span class="hljs-operator">&#x26;</span> <span class="hljs-number">0xf</span>];
            value <span class="hljs-operator">></span><span class="hljs-operator">></span><span class="hljs-operator">=</span> <span class="hljs-number">4</span>;
        }
        <span class="hljs-built_in">require</span>(value <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-number">0</span>, <span class="hljs-string">"Strings: hex length insufficient"</span>);
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">string</span>(buffer);
    }

    <span class="hljs-comment">/**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toHexString</span>(<span class="hljs-params"><span class="hljs-keyword">address</span> addr</span>) <span class="hljs-title"><span class="hljs-keyword">internal</span></span> <span class="hljs-title"><span class="hljs-keyword">pure</span></span> <span class="hljs-title"><span class="hljs-keyword">returns</span></span> (<span class="hljs-params"><span class="hljs-keyword">string</span> <span class="hljs-keyword">memory</span></span>) </span>{
        <span class="hljs-keyword">return</span> toHexString(<span class="hljs-keyword">uint256</span>(<span class="hljs-keyword">uint160</span>(addr)), _ADDRESS_LENGTH);
    }
}
</code></pre>]]></content:encoded>
            <author>fatih-furkan@newsletter.paragraph.com (Fatih Furkan)</author>
        </item>
        <item>
            <title><![CDATA[How Does Compound Finance Work]]></title>
            <link>https://paragraph.com/@fatih-furkan/how-does-compound-finance-work</link>
            <guid>uMmaK6JobwcAW4ePDn67</guid>
            <pubDate>Wed, 18 May 2022 18:00:52 GMT</pubDate>
            <description><![CDATA[We’ve talked about “What is Compound” and now, we’ll investigate “How Does Compound Work”. Unlike banks where interest rates are fixed, Compound interest works in a dynamic fashion. The Compound interest keeps changing depending on the balance of a particular liquidity pool. When the total amount of crypto in a liquidity pool is abundantly available, the annual interest is low for lending. However, for a smaller pool with a lesser balance, the Compound Annual Growth Rate is high. Similarly, t...]]></description>
            <content:encoded><![CDATA[<p>We’ve talked about “What is Compound” and now, we’ll investigate “How Does Compound Work”.</p><p>Unlike banks where interest rates are fixed, Compound interest works in a dynamic fashion. The Compound interest keeps changing depending on the balance of a particular liquidity pool. When the total amount of crypto in a liquidity pool is abundantly available, the annual interest is low for lending. However, for a smaller pool with a lesser balance, the Compound Annual Growth Rate is high.</p><p>Similarly, the interest rate for borrowing from a larger pool is less since there is sufficient money to borrow. On the contrary, the interest rate is higher when someone borrows from a small liquidity pool.</p><p>The principal amount is compounded daily so that your money witnesses exponential growth at an incredibly faster rate. In banks, your savings are locked in for long periods that can be as long as nine years. With the DeFi protocol’s daily compounding interest, you don’t need to wait so long.</p><p>In fact, the compounding period is as small as a few seconds. Although the interest rate is displayed for annual terms, Compounding periods are as low as one Ethereum block mine time.</p><p>The obvious advantage of such short Compounding periods is that you will be earning interest on a daily compounding basis. This means you don’t need to wait for monthly interests. With a floating interest rate, the returns on your initial investment will also be significantly higher. Overall, compounding interest on your starting amount will give you larger returns on your money.</p><p>There are two main contracts in Compound: cToken and Comptroller. Let’s start by exploring them.</p><h2 id="h-the-comptroller" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Comptroller</h2><p>The Comptroller is the risk management layer of the Compound protocol; it determines how much collateral a user is required to maintain, and whether (and by how much) a user can be liquidated. Each time a user interacts with a cToken, the Comptroller is asked to approve or deny the transaction.</p><p>As you can understand from its name, The Comptroller is the controller of The Compound. It adds, removes, starts, pauses, etc. cTokens. It is the guardian, accounter, and manager of The Compound. It’s kinda Uniswap v2’s router + factory + some extra shit.</p><p>Also, it is upgradable. With the governance token, the community can upgrade the comptroller.</p><p>Some of the functions that the Comptroller has:</p><ul><li><p><code>enterMarkets</code>: In order to supply collateral or borrow in a market, it must be entered first. So with this function, you can enter any market you want. It takes an address list. This list contains the markets (cTokens) that you want to enter.</p></li><li><p><code>exitMarket</code>: Exited markets will not count towards account liquidity calculations. It takes one address as a parameter.</p></li></ul><h2 id="h-ctoken" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">cToken</h2><p>In Compound if you have some cTokens (cAAVE, cDAI, etc.), that means you have some rights over Compound. Some of the underlying assets of cToken belong to you. You can get it whenever you want.</p><p>cTokens are represents the underlying assets. For example, cAAVE represents the AAVE. But they are not 1-1. All cTokens has <code>exchange rate</code>. It is equal to <code>0.02</code> at the beginning but it will increase buy time.</p><p>Let’s say you supply 1,000 DAI to the Compound protocol, when the exchange rate is 0.020070; you would receive 49,825.61 cDAI (1,000/0.020070).</p><p>A few months later, you decide it’s time to withdraw your DAI from the protocol; the exchange rate is now 0.021591:</p><ul><li><p>Your 49,825.61 cDAI is now equal to 1,075.78 DAI (49,825.61 * 0.021591)</p></li><li><p>You could withdraw 1,075.78 DAI, which would redeem all 49,825.61 cDAI</p></li><li><p>Or, you could withdraw a portion, such as your original 1,000 DAI, which would redeem 46,315.59 cDAI (keeping 3,510.01 cDAI in your wallet)</p></li></ul><p>Some of the functions that cTokens have:</p><ul><li><p><code>mint</code>: The mint function transfers an asset into the protocol, which begins accumulating interest based on the current supply rate for the asset. The user receives a quantity of cTokens equal to the underlying tokens supplied, divided by the current exchange rate.</p></li><li><p><code>redeem</code>: The redeem function converts a specified quantity of cTokens into the underlying asset, and returns them to the user. The amount of underlying tokens received is equal to the quantity of cTokens redeemed, multiplied by the current exchange rate. The amount redeemed must be less than the user&apos;s account liquidity and the market&apos;s available liquidity.</p></li><li><p><code>borrow</code>: The borrow function transfers an asset from the protocol to the user, and creates a borrow balance which begins accumulating interest based on the borrow rate for the asset. The amount borrowed must be less than the user&apos;s account liquidity and the market&apos;s available liquidity.</p></li><li><p><code>repay borrow</code>: The repay function transfers an asset into the protocol, reducing the user&apos;s borrow balance.</p></li><li><p><code>liquidate borrow</code>: A user who has negative account liquidity is subject to liquidation by other users of the protocol to return his/her account liquidity back to positive (i.e. above the collateral requirement). When a liquidation occurs, a liquidator may repay some or all of an outstanding borrow on behalf of a borrower and in return receive a discounted amount of collateral held by the borrower; this discount is defined as the liquidation incentive.</p></li></ul><h2 id="h-references" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">References</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://compound.finance/docs">https://compound.finance/docs</a></p>]]></content:encoded>
            <author>fatih-furkan@newsletter.paragraph.com (Fatih Furkan)</author>
        </item>
        <item>
            <title><![CDATA[What is Compound Finance]]></title>
            <link>https://paragraph.com/@fatih-furkan/what-is-compound-finance</link>
            <guid>mnKrOtf20ijnefAXZLK4</guid>
            <pubDate>Wed, 18 May 2022 06:52:24 GMT</pubDate>
            <description><![CDATA[Compound is a DeFi borrowing and lending protocol built on Ethereum that functions as the blockchain version of a money market. At the most basic level, Compound is an autonomous protocol that calculates interest rates using algorithms. It is permissionless, meaning anyone can access the tools provided at any time. There is no verification process and no user identification mechanism. For individuals, Compound is primarily used as a cryptocurrency borrowing and lending protocol. Users can dep...]]></description>
            <content:encoded><![CDATA[<p>Compound is a DeFi borrowing and lending protocol built on Ethereum that functions as the blockchain version of a money market.</p><p>At the most basic level, Compound is an autonomous protocol that calculates interest rates using algorithms. It is permissionless, meaning anyone can access the tools provided at any time. There is no verification process and no user identification mechanism.</p><p>For individuals, Compound is primarily used as a cryptocurrency borrowing and lending protocol. Users can deposit one of the supported tokens into a shared pool at any time and receive interest. Or, after depositing their tokens, they can borrow a <strong>smaller</strong> amount of tokens and pay interest. The amount of interest is determined by the supply and demand of tokens deposited.</p><p>There are two main actors in Compound: lenders and borrowers.</p><h2 id="h-lenders" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Lenders</h2><p>Lenders deposit or lock their crypto into Compound to earn money at a dynamic annual interest rate. You receive income interest in tokens you lend. Thus, if you lend ETH to Compound, your interest compounds in ETH. Similarly, if you deposit USDT, you will get your compound in USDT.</p><p>To lend with this protocol, all you need to do is supply the cryptocurrency that you want to provide liquidity for. Lenders deposit tokens into a liquid fund. Once you do that, you will immediately start earning interest, which is controlled by the supply and demand of the currency.</p><p>When lenders put their cryptocurrency in the market, they receive an amount of cToken corresponding to the lend. For example, if you lock USDT in the protocol, you will get cUSDT tokens. These cUSDT tokens can then be used in apps on Ethereum. That way, your locked-up capital isn’t truly locked up like it would be if you were to lend to a borrower in a traditional system.</p><p>When a market is launched, the cToken exchange rate (how much ETH one cETH is worth) begins at 0.020000 — and increases at a rate equal to the compounding market interest rate. For example, after one year, the exchange rate might equal 0.021591. Each user has the same cToken exchange rate; there’s nothing unique to your wallet that you have to worry about.</p><p>When you need to make use of your cryptocurrency, all you need to do is pay back your cTokens, and you will receive your original tokens in return.</p><h2 id="h-borrowers" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Borrowers</h2><p>Borrowers can take a loan against their crypto balance in the Compound protocol. When you borrow money from a bank, they usually do a personal finance background check to determine credit ratings. However, Compound is keeping up with DeFi’s promise of anonymity and never inquires about personal finance. Thus, in order to avoid debt and bankruptcy, Compound only offers over-collateralized loans. This means that users who want to borrow have to have collateral that is more than what they want to borrow, that way the lender and the system are exposed to zero risk. The protocol sets a borrowing limit/collateral factor to determine how much a user can borrow. Their deposited amount is also called “borrowing power”. After acquiring that power, they will be able to borrow tokens equivalent to the amount of borrowing power that they have.</p><p>Since borrowers take money from the protocol, they need to pay Compound interest on it.</p><p>Borrowers should also note that the value of their collateral must remain above a certain value to be viable. If it doesn’t remain above that value, the collateral will be liquidated to pay back the loan. When a user’s collateral enters the liquidation event, other users will have the opportunity to pay the outstanding amount borrowed for a percentage of the collateral of the borrower. To incentivize this purchase, users can buy the collateral for a better price than the market price.</p><p>A note on liquidation: many who are wary of this term believe they will lose all of their funds upon liquidation. However, these concerned individuals should realize that they would still have their borrowed funds. For example, if I were to collateralize 100 and borrow 80, if my 100 was liquidated, I would still have 80 (excluding market movements), for a loss of 20, not 100.</p><h2 id="h-the-comp-token" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The COMP Token</h2><p>The COMP token is the governance token of Compound. COMP is also the rewards token for Compound’s liquidity mining. Whenever a lender adds cryptocurrencies to Compound’s liquidity pools or borrows from these pools, they get COMP tokens.</p><h2 id="h-what-makes-compound-finance-stand-out" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">What Makes Compound Finance Stand Out</h2><h3 id="h-no-need-for-negotiations" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">No Need For Negotiations</h3><p>The great thing about Compound is that it eliminates the need for negotiations. Lenders to the market don’t have to negotiate terms as they would in a regular bank, or even in other DeFi apps.</p><p>Lenders and Borrowers only need to interact with the protocol to deposit or borrow cryptocurrency. The entire operation is governed by algorithms. Individuals do not hold the funds. The funds are held in smart contracts. There is no threat of unfair or preferential treatment and no threat of counterparty risk.</p><h3 id="h-it-makes-investing-easier" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">It Makes Investing Easier</h3><p>Lenders aren’t the only ones who benefit from this arrangement. Borrowers who would like to go long on a particular asset can use Compound to do so.</p><p>For example, if a trader assumes that the price of ETH can increase exponentially in the long to medium term, he can use his existing ETH as collateral to borrow USDT, which can then be used to buy even more ETH.</p><p>If the trader is right, and the increase in their ETH is more than the interest on the USDT they borrowed, they can turn a healthy profit. However, if it doesn’t work out they will still have to repay the loan or be liquidated.</p><h2 id="h-references" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">References</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.ulam.io/blog/how-compound-protocol-works/">https://www.ulam.io/blog/how-compound-protocol-works/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://thedefiant.io/what-is-compound-crypto/">https://thedefiant.io/what-is-compound-crypto/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://101blockchains.com/compound-protocol/">https://101blockchains.com/compound-protocol/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.kraken.com/tr-tr/learn/what-is-compound-comp">https://www.kraken.com/tr-tr/learn/what-is-compound-comp</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://decrypt.co/resources/compound-defi-ethereum-explained-guide-how-to">https://decrypt.co/resources/compound-defi-ethereum-explained-guide-how-to</a></p>]]></content:encoded>
            <author>fatih-furkan@newsletter.paragraph.com (Fatih Furkan)</author>
        </item>
        <item>
            <title><![CDATA[My WHE Method]]></title>
            <link>https://paragraph.com/@fatih-furkan/my-whe-method</link>
            <guid>msHR7rMWdwB7Rc6M5QFR</guid>
            <pubDate>Tue, 17 May 2022 21:16:35 GMT</pubDate>
            <description><![CDATA[I want to learn and read about different blockchain projects. So, I decided to create a method for good learning and teaching. My method’s name is WHE, an acronym for What How Example. What is X: In those articles, I’ll write what the X project is about and what they want to do in general. Those articles will not be a technical guide. They will appeal to a general audience. How does the X project works: In those articles, I’ll write more about the X project. Those articles will be a little bi...]]></description>
            <content:encoded><![CDATA[<p>I want to learn and read about different blockchain projects. So, I decided to create a method for good learning and teaching. My method’s name is <strong>WHE</strong>, an acronym for What How Example.</p><p><strong>What is X:</strong> In those articles, I’ll write what the X project is about and what they want to do in general. Those articles will not be a technical guide. They will appeal to a general audience.</p><p><strong>How does the X project works:</strong> In those articles, I’ll write more about the X project. Those articles will be a little bit more technical.</p><p><strong>Example usage of the X project:</strong> After writing general and technical articles, I’ll write some codes about the X project. Because I’m not a writer, I’m a developer. But, I’ll not explain every row. I just write a little paragraph about the code. If you want to learn more about the code, you should look at the code in depth.</p><p>Here is my plan. So, let’s BUIDL!</p>]]></content:encoded>
            <author>fatih-furkan@newsletter.paragraph.com (Fatih Furkan)</author>
        </item>
    </channel>
</rss>