<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Harpal Jadeja on Medium]]></title>
        <description><![CDATA[Stories by Harpal Jadeja on Medium]]></description>
        <link>https://medium.com/@jadejaharpal?source=rss-fc1a96456089------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kJjQ0El7iy6uIfbEVs_lXg.jpeg</url>
            <title>Stories by Harpal Jadeja on Medium</title>
            <link>https://medium.com/@jadejaharpal?source=rss-fc1a96456089------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:08:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jadejaharpal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to create a Loyalty Program using Meta-transactions]]></title>
            <link>https://medium.com/@jadejaharpal/how-to-create-a-loyalty-program-using-meta-transactions-686ae036b976?source=rss-fc1a96456089------2</link>
            <guid isPermaLink="false">https://medium.com/p/686ae036b976</guid>
            <category><![CDATA[gasless-transactions]]></category>
            <category><![CDATA[relayer]]></category>
            <category><![CDATA[celo-blockchain]]></category>
            <category><![CDATA[meta-transactions]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Harpal Jadeja]]></dc:creator>
            <pubDate>Wed, 27 Jul 2022 07:09:15 GMT</pubDate>
            <atom:updated>2022-08-08T19:32:58.671Z</atom:updated>
            <content:encoded><![CDATA[<h4>What if users could get rewarded for transactions and not pay gas? This tutorial will show you how!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*afvjAg5CAAQVGbicWaZs7g.jpeg" /></figure><p>How cool would it be if the users of your dApp did not need need to pay gas for transactions? What if they received rewards instead?</p><p>MASS-ADOOOOOOOOOPTION!</p><h4>Here’s what we’ll cover</h4><p>In this tutorial, you will learn how to create dApps that support Meta-transactions and how to implement a Loyalty program to reward users. I will cover:</p><ul><li><a href="#e6bc">✅ What are Meta-Transactions?</a></li><li><a href="#56a8">✅ Why do we need ERC20Permit?</a></li><li><a href="#b71a">✅ Setting up the Project</a></li><li><a href="#996a">✅ Implementing the ERC20Permit type Token</a></li><li><a href="#90b8">✅ Implementing the LoyaltyReward Token</a></li><li><a href="#1955">✅ Implementing the LoyaltyProgram Contract</a></li><li><a href="#eb4f">✅ Testing Contracts</a></li></ul><h4>What are Meta-Transactions?</h4><p>When transacting on blockchain networks like Celo, you’ll come across <a href="https://ethereum.org/en/developers/docs/gas/#top">gas fees</a>. Gas fees are used to prevent the network from getting DDosed (<a href="https://www.cloudflare.com/learning/ddos/what-is-a-ddos-attack/">Distributed denial of service</a>). If there were no gas fees, malicious users could spam the network with transactions, resulting in a denial of service for legitimate users.</p><p>So gas fees make sense. But when it is your first time building on a network, you won’t have the tokens available to try dApps and to pay for gas. This is where meta-transactions come in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sv4da_JwW8_jQtH5E2WSXA.png" /></figure><p>A <strong>Meta-transaction</strong> is a process where the <strong>user</strong>, instead of paying a gas fee, forwards their transaction to a third party. That third party, a <strong>relayer</strong>, will pay the gas fee for the transaction. This is all possible using signatures.</p><p>When you use signatures on the blockchain, you sign a message that specifies the contract, the function, and the parameters you want to pass using your private key. Once signed, you receive a signature that can be passed to anyone who is willing to pay for your gas fees. Because gas fees are charged to the broadcaster of the transaction, it doesn’t matter for who the relayer is.</p><blockquote>All of this is subject to the fact that the contract supports calling the specified functions by signatures!</blockquote><p>You should have a fair understanding of what meta-transactions are. Next, we’ll go over the <strong>ERC20Permit</strong>.</p><blockquote><strong>Note: </strong>If you are not familiar with the ERc20 Permit, you can learn more at this <a href="https://eips.ethereum.org/EIPS/eip-20">link</a></blockquote><h4>Why do we need ERC20Permit?</h4><p>When viewing the ERC20 implementation, you will notice that in order for someone to transfer ERC20 on your behalf, the transfer amount needs to be approved first.</p><p>The Loyalty program you will be implementing assumes that the user has no gas tokens to pay for gas fees. This means a third party will be transferring tokens on behalf of the user.</p><p>But for a third party to perform this action, it needs approval first. To start, take a look at the ERC20 implementation for <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol#L136">approve</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1N2m1A182pFDWD0zjE_GQ.png" /><figcaption>ERC20 Approve Implementation</figcaption></figure><p>approve assumes that the caller of this function is the one who wants to approve a spender to spend amount number of tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gsBosQoRDy6oqy9hn3Cnw.png" /><figcaption>First Approve and then the spender can spend.</figcaption></figure><p>As you can see above, approve needs to be called by the user itself and that will require gas.</p><p>But as mentioned in meta-transactions, the sender is a relayer. The user, depicted above, will instead approve the relayer’s tokens. We do not want that.</p><p>To tackle this, <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/draft-ERC20Permit.sol#L49"><strong>ERC20Permit</strong></a> was introduced. ERC20Permit allows <strong>approval via signatures.</strong> Here is how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdLPqq8q1faa5hjqzHnutA.png" /><figcaption>ERC20 Permit implementation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJ8KKnhyVwfIxE8FgAjecA.png" /></figure><p>The payer (user) signs a message and sends the message to the vendor (relayer) via an off-chain mechanism. It can be anything API or even a text message works, there is no need to keep it private.</p><p>From the signature v, r and s can be extracted.</p><p>The permit function takes in the details for the approval and v, r and s, which are parts that allow the public address of the signer be recovered.</p><p>Using this function, we can approve the transfer of tokens on one’s behalf and also perform the transfer in the same transaction!</p><p>At this point, you have all the information you need to implement the Loyalty program contract. Now, let’s set up the project and get to coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vi_ydt1HmW9AO2HfGmWqQA.png" /><figcaption>Architecture of the Loyalty Program</figcaption></figure><h4>Setting up the Project</h4><p>All the code you are about to write is available <a href="https://github.com/therealharpaljadeja/meta-transactions-loyalty-program">here</a> for reference.</p><ul><li>Create a folder for your project and open a terminal on the same path</li><li>Execute the command given below in order to get a project starter template</li></ul><pre>npx hardhat init</pre><p>You should get the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hySUd0utdI1f_O8ClwxwIA.png" /></figure><ul><li>For this tutorial, select <strong>Create a Javascript project</strong></li><li>You might be asked to install additional dependencies if yes then type Y and hit Enter</li><li>Once it completes, you should have a project structure like this (excluding the node_modules folder)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I5LrkiGvozs9IdNOSc5ZSg.png" /></figure><p>You can remove the starter Lock.sol contract from /contracts folder as it is not needed.</p><p>That’s it for setting up the project!</p><h4>Implementing the ERC20Permit type Token</h4><p>You can now implement the ERC20Permit token. In order to make the dApp truly gasless, you’ll need to use the ERC20Permit type token for transactions.</p><p>Luckily, <a href="https://openzeppelin.com/">OpenZeppelin</a> makes it easy. OpenZeppelin has already done the implementation for you and all you need to do is inherit it.</p><p><strong>Here is the code for the ERC20Permit Token:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc2c9927cb4fcd959445087f48b5db77/href">https://medium.com/media/bc2c9927cb4fcd959445087f48b5db77/href</a></iframe><p>You start with a constructor where you provide the name for the ERC20Permit token and the same name must be provided to the ERC20, along with the symbol.</p><p>Inside the constructor, you are minting 500 tokens to the deployer, so someone can have those tokens. These can then be passed on or be used as payment for services.</p><p><strong>Why inherit ERC20 &amp; ERC20Permit?</strong></p><p>Because ERC20Permit is an abstract contract — meaning it does not implement all the functionality of ERC20 — only the permit parts.</p><p>Let&#39;s talk about the differences between ERC20 and ERC20Permit in brief. permit function lets users approve transfers via signatures.</p><p>There are some helper functions that keep track of nonce, in order to avoid invalid signatures from being replayed. For example, this could happen if a vendor tries claiming the same amount twice using the same signature 😅</p><p>In order to protect re-use, a nonce is used.</p><p>There are 2 more important things DOMAIN_TYPEHASH and STRUCT_TYPEHASH</p><p>These are related to <a href="https://eips.ethereum.org/EIPS/eip-712">EIP712</a>, which specifies a standard for how signatures should be generated to provide better UX to wallet users and RPC providers.</p><p>Why all this? Using a standard for signing messages, Wallets and RPC providers can provide a better UX for their users indicating what is being signed by the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*rPo0OOJTUBE20Fxy.png" /></figure><p>The STRUCT_TYPEHASH is used to define the structure in which the data is encoded and helps both the contract and the off-chain signers understand how to encode the parameters to pass to the function.</p><blockquote><strong>Note: </strong>In this context, STRUCT_TYPEHASH is _PERMIT_TYPEHASH. You can check it out <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/draft-ERC20Permit.sol">here</a></blockquote><p>The DOMAIN_TYPEHASH is generated using another OpenZeppelin contract named EIP712.sol</p><p>The role of DOMAIN_TYPEHASH is to support the STRUCT_TYPEHASH by specifying the <strong>contract address that is going to verify the signature</strong>, the name of the contract, the chainid depending on which chain this contract is deployed, and the version of the contract.</p><p><strong>Why?</strong></p><p>Specifying the contract address allows only the specified contract address to verify the signature provided.</p><ul><li>The chainid is extremely important. We don’t want a contract with the same contract address on another chain to be able to verify the signature, thus performing actions on other chains.</li><li>The version is used in case your contract is upgradeable. You can specify which version of your contract the signature is meant to be verifiable.</li></ul><p>All of this is to prevent re-use and replay of the signature provided by the payer to the vendor.</p><p><em>Read more about replay attacks </em><a href="https://www.coindesk.com/markets/2016/07/29/rise-of-replay-attacks-intensifies-ethereum-divide/"><em>here</em></a><em>.</em></p><p>You should have a pretty fair understanding of why the ERC20Permit is being used at this point. Now let’s implement the loyalty reward token!</p><h4>Implementing the LoyaltyReward Token</h4><p>The code for LoyaltyToken is below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a299cc8d8861afe09d40875b083a569/href">https://medium.com/media/0a299cc8d8861afe09d40875b083a569/href</a></iframe><p>LoyaltyToken is a standard ERC20 token with the additional functionality of rewarding users.</p><ul><li>First, you have the constructor, we are calling it the ERC20 constructor, and passing in the name and symbol</li><li>Inside the constructor, you assign the msg.sender as the loyaltyProgram address so we can keep track of it</li><li>Next, you have a modifier onlyProgram that let’s us mark functions that can only be called by our loyaltyProgram address. We don’t want anyone to call rewardUser and reward themselves 😅</li><li>function rewardUser is fairly simple, just mint the provided amount of tokens to the user and emit an event called Rewarded for off-chain services on your frontend. Notice, the reward ratio is 10% of the payment amount.</li><li>The function is marked external making it available to be called by anyone but will only execute when called by loyaltyProgram because we have a modifier onlyProgram applied to it.</li><li>Lastly, we define the Rewarded event on what is to be indexed</li></ul><p>That’s it for the loyalty token.</p><p>You can now implement the most interesting part, the LoyaltyProgram contract!</p><h4>Implementing the LoyaltyProgram Contract</h4><p>Following is the code for the LoyaltyProgram.solcontract,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d96c35d471a272de722ace9c64cbc434/href">https://medium.com/media/d96c35d471a272de722ace9c64cbc434/href</a></iframe><ul><li>First, you have 2 variables loyaltyToken &amp; token keeping track of the token that acts as a reward and the one that acts as a payment token.</li><li>You have a mapping called isVendorRegistered, which keeps track of addresses that are registered vendors who can receive payment via this contract and also relay transactions for their respective payers.</li><li>In the constructor, you are deploying the loyaltyToken making this contract able to call rewardUser on the loyaltyToken. The constructor also takes in token address which acts as the payment token.</li><li>function registerVendor() lets any address register themselves as a vendor on the loyaltyProgram in order to receive payment and able to relay transactions. It checks if the vendor is already registered and if they are not, it reverts.</li><li>function payViaSignature() this is the main function that does most of the work. This function takes in the payer, amount, deadline, v, r &amp; s</li></ul><p>Let’s go one-by-one:</p><ul><li>payer — The address of the user who is going to make a payment</li><li>amount — The amount to be transferred to the vendor in this payment</li><li>deadline — This signature can be configured to expire after a particular deadline and becomes useless</li><li>v — A recovery factor, this is related to elliptic curves where the point can lie either on +ve y-axis or -ve y-axis this v factor helps pick the right one</li><li>r,s — These 2 factors are used to recover the public address who signed the signature</li></ul><blockquote>You can read more about v, r &amp; s <a href="https://medium.com/mycrypto/the-magic-of-digital-signatures-on-ethereum-98fe184dc9c7">here</a></blockquote><p>In the first line of the function, you check whether the sender of the transaction is a registered vendor or not. Remember the vendor is the transaction sender since it is a meta-transaction. If the sender is not registered, it reverts.</p><ul><li>The function then calls permit on the payment token so as to get the approval to transfer token on behalf of payerto the vendor</li><li>The next line transfers the token from payer to vendor</li><li>Once the transfer is complete, we now reward the user by calling rewardUser on loyaltyToken this is being called in the context of loyaltyProgram so it is allowed.</li><li>Lastly, you emit Transaction and Rewarded events to indicate successful transfer and reward delivery for off-chain applications and frontends.</li></ul><p><strong>Why specify </strong><strong>payer, </strong><strong>amount &amp; </strong><strong>deadline?</strong></p><p>Signatures are hashes, which are irreversible, so instead of reversing the hash we re-create it on-chain and compare the output. If the output is the same, then the signature is verified. If not, it is invalid. It is also used to define the events in the contract.</p><p>At this point, you are done implementing the contracts that make up the Loyalty program. Below I have some tests prepared.. This will helps you figure out if we imlemented the contracts as per requirement.</p><p>Let’s have a look at the tests.</p><h4>Testing Contracts</h4><p>This is the code I have made available for testing. Feel free to add more to your own repository.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a69b95fe004dbe2ad8b0ca242f113f8d/href">https://medium.com/media/a69b95fe004dbe2ad8b0ca242f113f8d/href</a></iframe><p><strong>What does this file do?</strong></p><ul><li>To check if the payer is able to pay the vendor by signing a message in EIP712 format and the vendor can submit this to loyaltyProgram contract to perform the payment and reward the payer</li><li>To check if the transaction reverts when vendor tries to request an amount more than they are supposed to receive</li><li>To check if the vendor is not requesting amount from some other payer / user using the same signature</li></ul><p>This file should be inside /test folder.</p><p>To execute this tests use the following command in your terminal</p><pre>npx hardhat test</pre><p>If you get the following output, everything is working fine!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tN_EeN0YjtRu4K6KoKF9tw.png" /></figure><blockquote>Disclaimer: This implementation should not be assumed as secure, since it is being used for the purpose of the tutorial. I do not recommend implementing and getting it audited before going to mainnet.</blockquote><p><strong>Modifying your loyalty program</strong></p><p>That’s everything it takes to implement a basic Loyalty Program! If you’d like to extend your loyalty program, there are many more modifications you can make.</p><p><em>Here are some ideas you can take and perform on the Loyalty program.</em></p><ul><li>Implement it in a way that you are able to modify the reward percentage</li><li>Implement a pausing mechanism where the program organizer can suspend the reward program (for a certain period of time or completely)</li><li>The current implementation supports only one single payment token, try implementing it in a way that it supports more ERC20Permit compliant tokens as payment</li></ul><h4><strong>References</strong></h4><ul><li><a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/draft-EIP712.sol">EIP712 Implementation</a></li><li><a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol">ERC20 Implementation</a></li><li><a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/draft-ERC20Permit.sol">ERC20 Permit</a></li></ul><h4><strong>Contact</strong></h4><p><em>In case you need any help reach out:</em></p><p><a href="https://twitter.com/harpaljadeja11">twitter</a> | harpaljadeja.eth#2927 on discord.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=686ae036b976" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bridging tokens to and from Celo via Wormhole]]></title>
            <link>https://medium.com/@jadejaharpal/bridging-token-to-and-from-celo-via-wormhole-83cae48dfcff?source=rss-fc1a96456089------2</link>
            <guid isPermaLink="false">https://medium.com/p/83cae48dfcff</guid>
            <category><![CDATA[wormhole]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[token-bridge]]></category>
            <category><![CDATA[celos]]></category>
            <category><![CDATA[cross-chain-bridge]]></category>
            <dc:creator><![CDATA[Harpal Jadeja]]></dc:creator>
            <pubDate>Wed, 06 Jul 2022 04:07:42 GMT</pubDate>
            <atom:updated>2022-07-28T15:26:20.901Z</atom:updated>
            <content:encoded><![CDATA[<h4>Wormhole has enabled the Celo chain.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAEK8r6hGbU0nkQwMj2WwA.jpeg" /></figure><p>Meaning now you can bridge tokens in and out of the Celo ecosystem 🥳.</p><h4><strong>In this article, you will learn:</strong></h4><ul><li>✅ How to bridge Wormhole supported tokens to the Celo blockchain.</li><li>✅ How to bridge Wormhole supported tokens out of the Celo blockchain</li><li>✅ How to bridge your own custom tokens. 🥳</li></ul><p>In this article I will be bridging <a href="https://polygonscan.com/address/0x11cd37bb86f65419713f30673a480ea33c826872">WETH</a> (Wormhole supported) from Polygon to Celo and back. By saying Wormhole supported, I mean that these tokens are created by the Wormhole team themselves which the Wormhole Bridge natively recognises.</p><blockquote><strong>Learn more: </strong>You can checkout the other supported tokens and their respective markets <a href="https://docs.wormholenetwork.com/wormhole/overview-liquid-markets">here</a>.</blockquote><p>Before you start it is recommended to have some funds on both chains. Depending on which token you are willing to bridge you might have to redeem it on the destination chain manually.</p><p>Manually redeem means you will have to make a separate transaction by changing your network to the destination chain in order to redeem the tokens. (Wormhole will prompt you for that)</p><blockquote>Beware only use links either in this article or in the docs of Wormhole.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*349XABgvhHdEFdPHPyJRXw.png" /></figure><blockquote>If bridging for the first time, consider performing with a small test amount.</blockquote><p>So, let’s not wait anymore and get to bridging.</p><p>The mainnet version is <a href="https://www.portalbridge.com/#/transfer">here</a> and if you want to test <a href="https://certusone.github.io/wormhole/#/transfer">here</a> is the testnet version.</p><h3>How to bridge Wormhole-supported tokens to the Celo blockchain.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1_ZfN2TbcNI8lZBxd632w.png" /></figure><p>From this interface select the <strong>Tokens </strong>tab if it is not already selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tkTJTeLm0E5PLtNhrrcMkg.png" /></figure><ul><li>Select the chains from which you wish to bridge. For this example, I will bridge from Polygon to Celo.</li><li>Connect your wallet by clicking the <strong>Connect </strong>button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kkBeqM-uzuwzi6ABN5bm6w.png" /></figure><p>I will be using <strong>Metamask</strong> for this tutorial but you can choose from additional wallets using Wallet Connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OuJbBwQnRgndKbWyrKwiKg.png" /><figcaption>Prompt to switch network</figcaption></figure><blockquote>Throughout this tutorial, you might be prompted to add/switch network in your wallet. For instance, if you are on <strong>Ethereum Mainnet</strong> and you select <strong>Polygon</strong> it will prompt for a network switch. This will be done several times in the tutorial so when asked choose <strong>Switch Network</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hI2qxQJfVb_ntR7-TnpAA.png" /></figure><p>Once connected you will be prompted to select the token you want to bridge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eKvDQBieiIuCjNjlNIKzTA.png" /></figure><p>I have selected <a href="http://0x11cd37bb86f65419713f30673a480ea33c826872">WETH</a>, if you are not given the option to select it that could be because you don’t have it. The token you want to have is</p><pre>0x11cd37bb86f65419713f30673a480ea33c826872 (Wrapped ETH Portal).`</pre><p>In this example, I am using <strong>Wrapped ETH Portal</strong> tokens, but you may wish to use another token. Enter the amount to bridge then click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7RfEPbSSvwihS-hGDNIsg.png" /></figure><p>Depending on which token you are bridging you will be prompted for <strong>Automatic Payment</strong> or <strong>Manual Payment.</strong></p><p><strong>Automatic payments</strong> are achieved by using a relayer who takes a portion of the token you are bridging and uses that to pay fees for the transaction on the destination chain.</p><p>A <strong>Manual payment</strong> basically means that you will have to pay for gas for the transaction you make to bridge the tokens on both the chains manually, so you will have to make a separate transaction at the end to redeem the tokens on the destination chain as well.</p><p>You won’t get Automatic payment for every token because not every token has value. If you are prompted with an <strong>Automatic Payment</strong> for gas, then select that otherwise select <strong>Manual Payment</strong>, then click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Q-va0zlemU-YI3PCh8d-g.png" /></figure><p>You will now be prompted to approve the amount of tokens you wish to bridge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_5tQiFq2n1kN5WvdCCNZQg.png" /></figure><p>The prompt for approval looks like the image shown above.</p><ul><li>Review and confirm the requested bridging amount.</li><li>If correct click <strong>Confirm</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VTVHxQvPANGnbQi6bZnYw.png" /></figure><p>Once approval is complete you select <strong>Transfer</strong> on the prompt provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*NMr6XT0DUCr3sSJ-9W8KEw.png" /></figure><p>You will be asked for confirmation with a visual guide on what you are about to do. Click <strong>Confirm </strong>if everything looks right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZVWq6tkGnLVZoXlvi2KkQ.png" /><figcaption>This is what the prompt for Transfer looks like.</figcaption></figure><p>Click <strong>Confirm</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3u1Rqa44CPBfNsw7gbpyzQ.png" /></figure><p>At the time of this writing bridging from Polygon to Celo requires 512 confirmations on your transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HFNOhQ9R0aBrNrRFlEa7w.png" /></figure><p>Once the required number of confirmations has been reached. You will be greeted with a success message. Select <strong>Add to Metamask </strong>button to add the bridged token to your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6pUlO_0i-Yd2yOesUkRYww.png" /></figure><p>Select <strong>Add Token</strong> to add the new token to your wallet.</p><p>That is all there is to bridging your tokens to Celo ecosystem! If you wish to swap it, you can check if the Wormhole team has already created the liquidity pool <a href="https://docs.wormholenetwork.com/wormhole/overview-liquid-markets#target-chain-celo">here</a>.</p><blockquote>Depending on the origin chain and token some steps and estimated time might vary.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CiPo5yEMtAEmPSqq31dolQ.png" /></figure><p>For anyone interested, you can see the fee is taken by the relayer and the amount being sent to the destination address.</p><h3>How to bridge Wormhole-supported tokens from the Celo blockchain</h3><p>Let’s try bridging this WETH back to Polygon!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YuErH6dJnOvhuIV17S1-aw.png" /></figure><p>Connect your wallet, select the desired chains (Celo -&gt; Polygon), the token you want to transfer, and the amount you want to transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6xhBj9umpwYEfnU73MDLQ.png" /></figure><p>You’ll be prompted with <strong>Automatic Payment</strong> option like before. It’s recommended that you select this option. Check out the images below to view the Manual Payment process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uWQAAireeOH9ztoKcO7zRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VTVHxQvPANGnbQi6bZnYw.png" /></figure><p>The <strong>Approve</strong> and <strong>Transfer</strong> steps are the same as before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*cAdEn5X9qcknniUTw71mMg.png" /></figure><p>The confirmation screen is different than before and has Celo as Origin. Once confirmed, you will be asked to wait for confirmation on your transaction on the Celo chain. (This one is pretty fast 😎)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-U5Da_lk_JZcS5AVAcLTDQ.png" /></figure><p>Once done, you will have your tokens on the destination chain!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VuWSJfyHi0M23z11FKCzvg.png" /></figure><p>At this point, you’re able to bridge tokens using Wormhole!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4v0YsIMQpSlp17Zmt-1Yxg.png" /></figure><p>If you’re interested, you can view the fee that is taken by the relayer and the remaining that is sent to the destination address.</p><h3>How to bridge your own custom tokens</h3><p>Next, let’s go over how can you can bridge your own custom tokens!</p><h4><strong>Before getting started…</strong></h4><p>Before jumping into bridging custom tokens it is important to understand how it works. When you create custom tokens no one knows about them and there are no markets for them to trade unless you add liquidity and create pool.</p><p>Nevertheless, bridging custom tokens doesn’t require you have to liquidity. Instead, you will need a wrapped version of your own token on the destination chain.</p><p>For example, I have a TestToken (TT) for this tutorial which will be deployed as TestToken (Wormhole) on the destination chain by Wormhole.</p><p>The assumption that bridged ETH on other chains is the same is wrong. Most are wrapped versions of ETH. You should check and verify addresses to ensure you are receiving the expected token.</p><p>You can check the addresses of the tokens you receive on the target chain when you bridge via Wormhole <a href="https://docs.wormholenetwork.com/wormhole/overview-liquid-markets">here</a>.</p><h4><strong>So how does it work?</strong></h4><p>It&#39;s pretty simple actually! When you create a new token you <strong>Mint </strong>yourself some tokens right? Or some address gets it on deployment or an address can mint as they wish depending on the implementation.</p><p>Similarly, there is <strong>Burn </strong>once you burn a token it ends up in an address to which no one holds the key eg: address(0)</p><p>That’s it when you bridge from X chain to Y chain your tokens are <strong>burned</strong> on X chain and <strong>minted</strong> on Y chain. But for that to happen you need to have a token on the destination chain.</p><p>This is the first step to bridging custom tokens and thankfully you don’t have to do it ourselves Wormhole has a process for that called <strong>Token Registration</strong>. There is no queue for it you can do it as many times as you want and for as many tokens as you want.</p><h4>Time to bridge your custom token!</h4><p>For this tutorial, I have a token named <strong>TestToken </strong>on the Celo blockchain that I want to bridge to Polygon blockchain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1ikfVsCuOzN9vmMm15Y9g.png" /></figure><p>First, you can go to <strong>Token Origin Verifier </strong>which is a tool where you can select the origin and destination chain. Using the address of the token you can check if there is already a wrapped version available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4AJkG6boxwcOYWui7O-iA.png" /></figure><p>The verifier should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8RrxCiJh4OkhE-qXoT6Jg.png" /></figure><p>Next, select the chains and paste the custom token address. If it says <strong>Register Now </strong>you need to register the token with the Wormhole contracts.</p><blockquote>This needs to be done once every pair of chains. For example, you only need to do it once for Celo and Polygon but for Celo and Ethereum you’ll need to do it again.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KtrItOs0ACmR7t_cMeSTsQ.png" /></figure><p>You will be asked to <strong>Attest</strong> your token. You can think of Attest as updating your token metadata. If you make changes to your token in the future, like updating the name in the token’s metadata, you can <strong>Attest</strong> again and update on the respective chains!</p><p>When you Attest you will be asked to perform a transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNyRmO0fDFbAD6McKwpnqQ.png" /></figure><p>Confirm it once the once Attestation is complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia3BD_GQm3IZE8U3moBEiA.png" /></figure><p>You will be then prompted to <strong>Create</strong> a wrapped version of your token on the destination chain.</p><p>Click <strong>Create </strong>and you will be asked to perform another transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNyRmO0fDFbAD6McKwpnqQ.png" /></figure><p>Once transaction completes you will have a wrapped version of your custom token on the destination chain!</p><blockquote><strong>Caution</strong>: The wrapped version of your token <strong>will not be the same</strong> as the unwrapped version. <a href="https://github.com/certusone/wormhole/blob/dev.v2/ethereum/contracts/bridge/token/TokenImplementation.sol">Here</a> is the link to the code that is deployed.</blockquote><blockquote>The <strong>new owner</strong> of the wrapped version will be the <strong>Wormhole Bridge</strong> and only the bridge can <strong>mint</strong> new wrapped tokens. You will need to use the Wormhole interface to <strong>administer or update</strong> your token metadata.</blockquote><p>Now you are set to bridge our custom tokens since it is now available on both the origin and the destination chain</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khHv5DdH1ra5vYy3Hv3vYw.png" /></figure><p>You can head over to the Bridging section, select the chains, the token (in this case TT), enter the amount to bridge and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rx-77owE_AffOpEk99G2iw.png" /></figure><p>As expected, you won’t get the <strong>Automatic Payment</strong> option for paying fees this time the reason being the custom tokens maybe of no value for the relayers.</p><p>In this case, you will need funds to pay for gas on the destination chain when redeeming the tokens manually.</p><p><strong>In case you need funds on Celo side, this can be done in several ways.</strong></p><ul><li>1) Purchase CELO on an exchange (e.g., Binance or Coinbase, depending on the user’s geographic location), and then transfer the CELO to the Celo wallet address.</li><li>2) Use the <a href="https://stakely.io/en/faucet/celo-platform">Celo faucet</a> powered by Stakely. Please note that Stakely is not an official faucet offered by the Celo Foundation.</li></ul><p>Once you are ready, click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKXaJhPI0jcVsyuIi8xN3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beRTErzpxn__UsFckpDCWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*tKwiMOEWfaa8QUPGvL1Law.png" /></figure><p>You will be asked to <strong>Approve</strong> and <strong>Transfer</strong> the custom tokens, please do so.</p><p>The confirmation screen will have the symbol of the custom token you want to bridge. If everything looks as expected click <strong>Confirm </strong>and<strong> Confirm </strong>the wallet prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*48s_91DykrObGPY2za3gWA.png" /></figure><p>Once the transaction goes through you will be prompted to <strong>Switch Network</strong> to your <strong>Destination Chain</strong>,<strong> </strong>and then you can click <strong>Redeem </strong>to manually pay gas fees on the destination chain and redeem your tokens!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tF8eKVSLhE4G5FmjD8xB4Q.png" /></figure><p>On successful redeem, you will get a button <strong>Add to Metamask </strong>click it to add the wrapped version of your token to your wallet and check balance.</p><h3>Congratulations 💪</h3><p>That is it! You now know how to bridge tokens including custom tokens! If you face any problems or have any questions don’t hesitate to reach out <a href="https://twitter.com/harpaljadeja11">me</a> harpaljadeja.eth#2927 on Discord.</p><ul><li><a href="https://discord.gg/6yWMkgM">Celo Discord</a></li><li><a href="https://twitter.com/CeloOrg">Celo Twitter</a></li><li><a href="https://docs.wormholenetwork.com/wormhole/">Wormhole Docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83cae48dfcff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native & Celo: Easily build React Native dApps on Celo.]]></title>
            <link>https://medium.com/@jadejaharpal/celo-composer-react-native-easily-build-react-native-dapps-on-celo-bdc57080772f?source=rss-fc1a96456089------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdc57080772f</guid>
            <category><![CDATA[react-native-development]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[celo-blockchain]]></category>
            <dc:creator><![CDATA[Harpal Jadeja]]></dc:creator>
            <pubDate>Mon, 20 Jun 2022 19:48:07 GMT</pubDate>
            <atom:updated>2022-06-20T21:35:47.691Z</atom:updated>
            <content:encoded><![CDATA[<h4>Quickly develop Android and iOS apps on Celo using the Celo Composer for React Native.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xK8OZNOPJw2BdyXy" /></figure><p><strong>Celo Composer</strong> is a set of templates created by Celo to reduce <em>time-to-first-output</em> for developers building dApps in the Celo Ecosystem. The objective is to improve the <em>developer experience</em>. The template is set up to work right out of the box, but also make customization as easy as possible.</p><p>In this article, you will go through the React Native version of the template. You will learn how to interact with smart contracts deployed on Celo blockchain using a react native dApp. If you plan to build or are already building mobile dApps on Celo 😁 consider reading till the end.</p><p>Here’s a list of things will we cover <strong>🗒</strong></p><ul><li>✅ Prerequisites</li><li>✅ Setting up the project</li><li>✅ Deploying smart contracts</li><li>✅ Downloading Expo Go​</li><li>✅ Downloading testnet Valora</li><li>✅ Funding Valora with testnet coins</li><li>✅ Exploring the Mobile dApp</li><li>✅ Customizing the dApp</li></ul><h4>Prerequisites</h4><p>Before we get started you will need some packages and dependencies to be installed beforehand, here is a list of them.</p><ul><li>Node v12+</li><li>Yarn / NPM</li><li>Python (node-gyp requires this)</li><li>windows-build-tools (only for windows)</li></ul><p>Once you have the dependencies installed, it’s time we start setting up the template.</p><h4>Setting up the project</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b_t-95qp-1ApxPQy" /><figcaption><em>therealharpaljadeja/celo-composer on Github</em></figcaption></figure><ul><li>Access the repo <a href="https://github.com/celo-org/celo-composer">here</a>.</li><li>Click the <strong>Use this template</strong> button to get it into your GitHub profile.</li></ul><p>Once done, clone the repo to work on it on your local machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mdfOH1fyJoMVggE6" /><figcaption>This is what I get when I clicked the “Use this template” button</figcaption></figure><p>Once cloned we need to install expo and expo-cli globally since we are using Expo to build our app. Open up a terminal and use the below command or yarn global expo expo-cli to globally install expo and expo-cli.</p><pre>npm i -g expo expo-cli</pre><p>It’s time we install the package dependencies. In your terminal, navigate to &lt;your_repo_name&gt;/packages/react-native-app and use the below command in your terminal.</p><pre>yarn install --ignore-engines</pre><p>At this point, you are all set to start running the app on your local server use the command below.</p><pre>expo start</pre><p>Once the command is executed, you will see a QR code in the terminal like so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*eD6ieSzPUj6XQKRO" /><figcaption>QR code I got when I executed “expo start” in my terminal</figcaption></figure><p>Thanks to Expo, there are various ways you can access your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/0*lLI1PR9EfrFnR0W2" /><figcaption>Ways you can run the app depending on device.</figcaption></figure><p>If you want to use Android Studio type <strong>A</strong> on the keyboard and it will start the Android Studio.</p><blockquote>Note:- If you want to access using Android Studio make sure you have a Virtual Device with play store support.</blockquote><p>If you press <strong>W</strong> it will open it in your web browser. In this tutorial, you are going to access the app using a mobile device. Because that’s how the user of your app will access it right?</p><p>In order to do so, we need to install the <strong>Expo Go App</strong> on our device of choice. Before we start using the app, we also need to deploy the smart contracts that we plan to interact with, so let’s do that now.</p><h4>Deploying Smart Contracts</h4><p>Smart contracts are like the backend to your dApp. Most of the logic resides in smart contracts. We are going to deploy contracts to the Alfajores testnet since I don’t expect you to use real funds in order to follow this tutorial.</p><p>You can see that in the file hardhat.config.jsonwhich is in the folder /packages/hardhat</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/0*TQGw-lsJz3GpROZB" /><figcaption>hardhat.config.json</figcaption></figure><p>Before we deploy our contracts let us see which account we are going to use to deploy the contracts. You can use the below command in your terminal to do so. Make sure you are in the /packages/hardhat folder.</p><pre>npx hardhat accounts</pre><p>You can add your own account if you want. Let’s deploy the smart contracts using the below command in your terminal.</p><pre>npx hardhat deploy --network alfajores</pre><p>We specify the network we want to deploy to in the command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y1CfL62_SOnZWZVE" /><figcaption>terminal output for smart contract deployment</figcaption></figure><p>You can see the transaction hash of the transaction and the address where the contract lives on the Alfajores chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ilma4dIlZLayMdwJ5PVPPg.png" /></figure><p>When you want to deploy fresh contracts you will need to delete the respective network folder.</p><p>You don’t need to worry about copying the contract addresses into the react-native-app project because we have wired it up in such a way that we pick up the address from the JSON files. 😃</p><p>Just to recap we are done with the following</p><p>🔳 Project Setup</p><p>🔳 App server On</p><p>🔳 Smart Contracts deployed</p><p>🔲 Get a Celo wallet (Valora for this tutorial)</p><p>🔲 Get some testnet funds.</p><p>🔲 Download the Expo Go App on your mobile device of choice</p><p>To interact with smart contracts on the blockchain we need a wallet specifically the Celo wallet in this case. For this tutorial, you will use the Valora wallet which is the preferred Celo wallet however you are free to use other wallets like Metamask but you won’t be able to use stablecoins as gas fees.</p><h4>Downloading Testnet Valora</h4><p>In this post, you’ll use the Alfajores testnet with the <a href="https://valoraapp.com/">Valora app</a>. This allows you to create dApps using test funds which allows you to avoid spending real money during development.</p><ul><li>Download <strong>Celo Alfajores Wallet</strong> from the Play Store or App Store.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqcuWfJDFYXxQhg0CZb2Rg.png" /></figure><p>Once downloaded <strong>Create New Account</strong> (recommended) you can also recover if you have a test account on Testnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTg_xE7smlhWVbTk1IWR-A.png" /></figure><p>Next, set up your account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*wMSTBOL9J2J3OqNi1EdKhw.png" /></figure><p>If you created a new account your balance will be zero and we need to have some funds to start interacting with the contracts deployed on the testnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RbASysoSSN4qmnfFhR_lRA.png" /></figure><p>You can now get some funds from Celo Faucet so that we can interact with the deployed smart contracts. Even though you are using the app eventually you end up interacting with the smart contracts directly, the app is just an interface for user-friendliness.</p><h4>Funding wallet with testnet coins</h4><p>Copy your address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kQXt-21JldvxMVuv06tTRw.png" /></figure><p>In the browser go to — <a href="https://celo.org/developers/faucet">https://celo.org/developers/faucet</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INhh_eKj2cf7B76j90wYVA.png" /></figure><ul><li>Paste your address, complete the captcha, and tap <strong>Get Started</strong>.</li><li>After a few seconds, if you go back to your app, you should see the token received from the faucet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYxQAODusIUnS3VpYJeNBA.png" /></figure><p>Keep in mind these are not real funds 😄 these are required to interact with the testnet. You’re finally ready to play around the starter app. 🥳</p><h4>Exploring the Mobile DApp</h4><p>Scan the QR code shown in the terminal using the Expo App to open up the app on your device. The moment you see the Metro Bundler will start bundling the code and once that is done your device will start downloading it.</p><p>Once done you should have a screen like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyyX2ujvaNtiAXotIAoXLw.png" /></figure><blockquote>Note: At this point, if you get redirected to a browser and WalletConnect website, this means you are using Android 11 and above. There are steps to resolve this in the Github repo readme</blockquote><p>Tap <strong>Connect Wallet</strong> to get a prompt to select the wallet of your choice. (For this tutorial Alfajores Wallet)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bk3vkqXcZLxDqei-Fxtnqw.png" /></figure><p>You will see a screen prompting you to Allow the Starter app to get your account details like account address. Tap <strong>Allow</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oWEHVb4o7d2biV_ILuS97w.png" /></figure><p>If successful you will see a notification like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*azpU8BhnQSSgFFfy2QZhOg.png" /></figure><p>If you switch back to the Expo App you will see now that our account is connected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbvn8ynCqlPJiBjGWRcEwg.png" /></figure><p>You can use the interface to interact with the standard Greeting Contract. The address underlined is the address of the Greeting Contract tapping will take you to the explorer.</p><p>Try tapping the <strong>Read Greeter Contract</strong> button and see if you get a greeting. Your output might be different since I have used it before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUifrmjigwCaxBS1aKbq1Q.png" /></figure><p>You can update the <strong>Greeting</strong> by using the input field. Once you have your greeting entered in the field tap the <strong>Update Greeter Contract</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G7nfk2H3BRZ7hv1hj45Juw.png" /></figure><p>Since you are doing a write operation on the contract we need to sign this transaction and it will cost you funds, don’t worry we are on testnet so we won’t be using real money.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kplbAPRPfBnTbkTGsNtg-A.png" /></figure><p>You should see a screen like this, Alfajores is asking if you want to proceed with the transaction.</p><ul><li>Click <strong>Allow</strong> to proceed this will perform an update on the Greeter Contract.</li><li>Once done if you switch back to the Expo App we can tap the <strong>Read Greeter Contract</strong> to see our update Greeting.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SwdK8DOFrr2ekNLSRORbQ.png" /></figure><p>Similarly, there is a screen for the <strong>Storage</strong> contract and an <strong>Account Info </strong>screen to view your account address and disconnect the wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7siIYKoHyfo_8nu6u9KirQ.png" /></figure><p>For now, these are all the screens we have but we are planning to add more. Expect more updates on this starter template. But wait there is more. 😲</p><h4>Customizing the DApp</h4><p>We have tried to provide a fair amount of customizations that can be done on the starter template and we at Celo working hard to make it easier and easier, to customize and also have plans to have various components that can help with mobile dApp development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMQmTnCqQCDSjWH2Nt8Nxw.png" /><figcaption>folder structure to quickly get to the file you are willing to modify</figcaption></figure><p>For now, here is a list of things you can do:</p><ul><li><strong>Add a splash screen: </strong>Add the splash screen image inside /assets/images</li><li><strong>Change app colors:</strong> Edit Colors.ts in /constants</li><li><strong>Add touchable opacity to buttons: </strong>Inside /componentsyou will see I have added some modified TouchableOpacitycomponent to look like a button with color, feel free to edit it as you like.</li><li><strong>Organize component styles: </strong>There is also a ThemeProvider.ts in /contextwhich uses React Native StyleSheet for organizing styles for components, play with it as you like.</li><li><strong>Organize your styles: </strong>It is not necessary to take the template as-is for design purposes, you can have your own way of code organization for colors and styles.</li><li><strong>Add more screens: </strong>To add more screens to your app, there is /screensfolder to add more screen files this is for code organization purposes.</li><li><strong>Add to the interface:</strong> However, to add it to the interface check out the LinkingConfiguration.ts in /navigation</li><li><strong>Add tabs:</strong> index.tsx inside /navigationhas the code to the BottomTabnavigation where you can add more tabs to various screens.</li><li><strong>Add drawer navigation: </strong>After 3 to 4 screens BottomTabmight not be the right choice to add more tabs so check out the docs to the <a href="https://reactnavigation.org/docs/drawer-navigator">Drawer Navigation</a>.</li><li><strong>Change app names: </strong>Refer<strong> </strong>to edit it inside index.js line number 15.</li><li><strong>Add contracts:</strong> Add solidity files to in /hardhat/contracts</li></ul><p>In the end, it is an Expo-based React Native project, so it can be customized as you want. Feel free to report any issues under the <strong>Issues</strong> tab in the Github repo and if you plan to contribute we will welcome you with open hands. 🤝</p><h4>External References</h4><p>Here are some links that can help if you wish to explore more.</p><ul><li><a href="https://reactnative.dev/docs/getting-started">React Native</a> — Library to build cross-platform apps.</li><li><a href="https://docs.expo.dev/">Expo</a> — React Native Framework.</li><li><a href="https://reactnavigation.org/docs/getting-started">React Navigation</a> — Library to help with navigation of screens.</li><li><a href="https://hardhat.org/getting-started">Hardhat</a> — Library to help with smart contract testing and deployment.</li><li><a href="https://docs.soliditylang.org/en/v0.8.15/">Solidity</a> — Language used to write smart contracts.</li><li><a href="https://docs.walletconnect.com/quick-start/dapps/react-native">WalletConnect</a> — Library to access mobile install wallets in our dApps.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdc57080772f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>