<?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>NO ONE</title>
        <link>https://paragraph.com/@no-one</link>
        <description>Web3.0 preacher</description>
        <lastBuildDate>Fri, 22 May 2026 18:19:39 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>NO ONE</title>
            <url>https://storage.googleapis.com/papyrus_images/8e9e37ea217190e2d9d2007e8d90053799028625a190cb42f7b6df49dd124b79.jpg</url>
            <link>https://paragraph.com/@no-one</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[合约四种 call 区别]]></title>
            <link>https://paragraph.com/@no-one/call</link>
            <guid>UBBubnzVvzpEDUWO8UXn</guid>
            <pubDate>Thu, 29 Sep 2022 11:07:53 GMT</pubDate>
            <description><![CDATA[CALL|CALLCODE|DELEGATECALL|STATICCALL 四种调用的区别CALL & STATICCALLCALL 调用的上下文环境是被调用合约的环境，修改的是被调用合约的 state，调用者函数不能为 view。CALL ContractBSTATICCALL 只能调用不修改 state 的函数（pure view 修饰的函数），调用者函数可以为 view。STATICCALL ContractB// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; // 调用者 contract ContractA { uint256 x; function add(uint256 _num) public { x = x + _num; } function getX() external view returns(uint256) { return x; } } // 被调用者 contract ContractB { function call(address _addr, uint256 _num) e...]]></description>
            <content:encoded><![CDATA[<p><code>CALL|CALLCODE|DELEGATECALL|STATICCALL</code></p><p>四种调用的区别</p><h2 id="h-call-and-staticcall" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">CALL &amp; STATICCALL</h2><p>CALL 调用的上下文环境是被调用合约的环境，修改的是被调用合约的 state，调用者函数不能为 view。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/5b64bbfe8f579f38efffb5201ee6c5293609c22f5aa7621c351cf215840bf269.png" alt="CALL ContractB" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">CALL ContractB</figcaption></figure><p>STATICCALL 只能调用不修改 state 的函数（pure view 修饰的函数），调用者函数可以为 view。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b8ae06593cc5664c15dae332fc7adab13be9ce1f5ce3ca9d0347034b8eeffee3.png" alt="STATICCALL ContractB" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">STATICCALL ContractB</figcaption></figure><pre data-type="codeBlock" text="// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

// 调用者
contract ContractA {

    uint256 x;

    function add(uint256 _num) public {
        x = x + _num;
    }

    function getX() external view returns(uint256) {
        return x;
    }

}

// 被调用者
contract ContractB {

    function call(address _addr, uint256 _num) external {
        bytes memory data = abi.encodeWithSignature(&quot;add(uint256)&quot;, _num);
        (bool result, ) = _addr.call(data);
        require(result, &quot;transaction failed&quot;);
    }

    function staticcall(address _addr) external view returns(uint256) {
        bytes memory data = abi.encodeWithSignature(&quot;getX()&quot;);
        (bool result, bytes memory returnNum) = _addr.staticcall(data);
        require(result, &quot;transaction failed&quot;);
        return abi.decode(returnNum, (uint256));
    }

}
"><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.0;</span>

<span class="hljs-comment">// 调用者</span>
<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">ContractA</span> </span>{

    <span class="hljs-keyword">uint256</span> x;

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params"><span class="hljs-keyword">uint256</span> _num</span>) <span class="hljs-title"><span class="hljs-keyword">public</span></span> </span>{
        x <span class="hljs-operator">=</span> x <span class="hljs-operator">+</span> _num;
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getX</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">uint256</span></span>) </span>{
        <span class="hljs-keyword">return</span> x;
    }

}

<span class="hljs-comment">// 被调用者</span>
<span class="hljs-class"><span class="hljs-keyword">contract</span> <span class="hljs-title">ContractB</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">call</span>(<span class="hljs-params"><span class="hljs-keyword">address</span> _addr, <span class="hljs-keyword">uint256</span> _num</span>) <span class="hljs-title"><span class="hljs-keyword">external</span></span> </span>{
        <span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> data <span class="hljs-operator">=</span> <span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"add(uint256)"</span>, _num);
        (<span class="hljs-keyword">bool</span> result, ) <span class="hljs-operator">=</span> _addr.<span class="hljs-built_in">call</span>(data);
        <span class="hljs-built_in">require</span>(result, <span class="hljs-string">"transaction failed"</span>);
    }

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">staticcall</span>(<span class="hljs-params"><span class="hljs-keyword">address</span> _addr</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">uint256</span></span>) </span>{
        <span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> data <span class="hljs-operator">=</span> <span class="hljs-built_in">abi</span>.<span class="hljs-built_in">encodeWithSignature</span>(<span class="hljs-string">"getX()"</span>);
        (<span class="hljs-keyword">bool</span> result, <span class="hljs-keyword">bytes</span> <span class="hljs-keyword">memory</span> returnNum) <span class="hljs-operator">=</span> _addr.<span class="hljs-built_in">staticcall</span>(data);
        <span class="hljs-built_in">require</span>(result, <span class="hljs-string">"transaction failed"</span>);
        <span class="hljs-keyword">return</span> <span class="hljs-built_in">abi</span>.<span class="hljs-built_in">decode</span>(returnNum, (<span class="hljs-keyword">uint256</span>));
    }

}
</code></pre><h2 id="h-callcode-and-delegatecall" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">CALLCODE &amp; DELEGATECALL</h2><p><code>CALLCODE</code>已被<code>DELEGATECALL</code>取代，区别就是 <code>msg.sender</code>不同。<code>DELEGATECALL</code>会一直使用原始调用者的地址，而<code>CALLCODE</code>不会。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b8bea25db4e151a259c6b20d9bda974c4e091e113432f2af85ec42ad2ae50ee2.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>委托调用的上下文环境是调用者合约的环境，也就是说<code>msg.sender</code>是用户。通常用在可升级的代理合约中。</p>]]></content:encoded>
            <author>no-one@newsletter.paragraph.com (NO ONE)</author>
        </item>
        <item>
            <title><![CDATA[Smart contract storage]]></title>
            <link>https://paragraph.com/@no-one/smart-contract-storage</link>
            <guid>tfKT725eSNMud7a6rW2j</guid>
            <pubDate>Wed, 28 Sep 2022 06:32:45 GMT</pubDate>
            <description><![CDATA[Smart contract storage https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/]]></description>
            <content:encoded><![CDATA[<p>Smart contract storage</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/">https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/</a></p>]]></content:encoded>
            <author>no-one@newsletter.paragraph.com (NO ONE)</author>
        </item>
        <item>
            <title><![CDATA[到底Polkadot是不是Scam]]></title>
            <link>https://paragraph.com/@no-one/polkadot-scam</link>
            <guid>mGEzsDg8DRE0r8i4Hrvv</guid>
            <pubDate>Mon, 07 Feb 2022 06:57:54 GMT</pubDate>
            <description><![CDATA[近期$DOT直接到去年11月份的腰斩以下，国内大V也在私募拿到非常多的$DOT，有时候搞的像个国人盘，本文从实际用途分析波卡的愿景到底能否解决问题]]></description>
            <content:encoded><![CDATA[<blockquote><p>近期$DOT直接到去年11月份的腰斩以下，国内大V也在私募拿到非常多的$DOT，有时候搞的像个国人盘，本文从实际用途分析波卡的愿景到底能否解决问题</p></blockquote>]]></content:encoded>
            <author>no-one@newsletter.paragraph.com (NO ONE)</author>
        </item>
    </channel>
</rss>