<?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 Kseniya Lifanova on Medium]]></title>
        <description><![CDATA[Stories by Kseniya Lifanova on Medium]]></description>
        <link>https://medium.com/@kseniya292?source=rss-3c9135e14c7d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ylh5-7zXaq0xkc1UPnpIgA.jpeg</url>
            <title>Stories by Kseniya Lifanova on Medium</title>
            <link>https://medium.com/@kseniya292?source=rss-3c9135e14c7d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 08:30:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kseniya292/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[Meta Gamma Delta DAO: Announcing Rolling Grant Opportunities]]></title>
            <link>https://medium.com/meta-gamma-delta/meta-gamma-delta-dao-announcing-rolling-grant-opportunities-7110777e06bf?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7110777e06bf</guid>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[women-in-crypto]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Thu, 08 Jul 2021 16:07:23 GMT</pubDate>
            <atom:updated>2021-07-08T16:07:23.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9B4VTecRw8oJtlbvyQ9kQQ.png" /></figure><h3><strong>MGD Grants Program — Mission</strong></h3><p>Our vision is a world in which all people have economic freedom and financial independence. No matter the color of their skin, gender, sexual orientation, or the country they live in, everyone should have the right to live a happy and meaningful life. This type of world requires breaking down conventional structures and pushing against the status quo. It is what blockchain technology and decentralization aim to do.</p><p>To get to this vision, we need all types of people working together. We need diversity in the companies we start and the projects we build. We need to get money into the hands of people who represent the world in which we live, rather than a subset of society.</p><p><strong>That is why we created the MGD Grants Program </strong>💫</p><p>Our mission is to fund women-led projects that aim to benefit the development of the decentralized ecosystem.</p><h3><strong>Program Details</strong></h3><ul><li>The MGD Grant Program will open <strong>July 8th, 2021</strong> on a <em>rolling</em> schedule and will run indefinitely.</li><li>The Grant Committee will meet once a month to review applications and reach out to potential candidates.</li><li>In 6 months, we hope to fund three projects for a total of 30K+ DAI.</li></ul><h3><strong>Application Process</strong></h3><p>Apply for a grant <a href="https://forms.gle/kzy5EpguiMWkHbaC7">here</a>!</p><p><strong>Qualifications</strong></p><ul><li>A female Founder or Co-Founder</li><li>Building a decentralized application or working on a project that benefits the development of a decentralized world</li><li>Working on a program that encourages women/minorities to be part of your community</li></ul><p>You can find resources and information about the MGD Grants program <a href="https://www.notion.so/Meta-Gamma-Delta-Grants-c5a5aa538aa440beb60410f7f5925ff7">here</a>.</p><h3>Funding</h3><ul><li>Funding comes from the money raised through the MGD Fundraising Committee</li><li>All funding is distributed in DAI</li><li>Current funding amount is <strong>~37k DAI </strong>with an ongoing goal of raising more funds. If you would like to donate to this initiative please send DAI to <strong>0x7d58c962356ae66ba91b108751d67ae5d3b022fc</strong></li></ul><h3>Ecosystem Support</h3><p>Additionally, we’d like to thank <a href="https://polygon.technology/"><strong>Polygon</strong></a> and <a href="https://kernel.community/en/"><strong>KERNEL</strong></a> for donating to this initiative. All grantees will be streamlined to an interview for an upcoming KERNEL cohort giving them the opportunity to grow and foster their projects. We wouldn’t be able to do it without support from our ecosystem friends! 🙏</p><p><strong><em>We can’t wait to see these applications and meet potential grantees!!</em></strong></p><p><strong><em>Email </em></strong><a href="/service/mailto:mgddao@gmail.com"><strong><em>mgddao@gmail.com</em></strong></a><strong><em> with questions.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7110777e06bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/meta-gamma-delta/meta-gamma-delta-dao-announcing-rolling-grant-opportunities-7110777e06bf">Meta Gamma Delta DAO: Announcing Rolling Grant Opportunities</a> was originally published in <a href="https://medium.com/meta-gamma-delta">Meta Gamma Delta DAO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Our commitment to decentralization: Why we locked up 32 ETH]]></title>
            <link>https://medium.com/upstate-interactive/our-commitment-to-decentralization-why-we-locked-up-32-eth-692d517cd1e8?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/692d517cd1e8</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[staking]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[proof-of-stake]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Tue, 12 Jan 2021 19:14:21 GMT</pubDate>
            <atom:updated>2021-01-12T19:14:21.255Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCofQjFmbMyTVx2gSV9eTw.jpeg" /></figure><p>On December 1, 2020, the long-awaited Beacon Chain was deployed. The Beacon Chain, also known as Phase 0, marks the first phase of Ethereum 2.0. Although the Beacon Chain doesn’t change the Ethereum we use today, it is the first major step to making the transition to proof-of-stake.</p><h4>The Basics</h4><p>Proof-of-stake is a consensus mechanism and is different than the proof-of-work consensus mechanism that Ethereum uses today. The goal is the same — to process a batch of transactions into a block and add it to the Ethereum blockchain. However, the method of getting to the goal is different.</p><p>In proof-of-work, hardware is purchased for “mining.” Mining means verifying transactions to create a new block and earn a reward by solving a complex computational puzzle. Mining Ethereum and Bitcoin only required a basic computer when the blockchains were first deployed, but now the hardware needed is quite expensive as the popularity of mining has grown. If many people are mining, having a powerful machine increases your chances of solving the computational problem first.</p><p>In proof-of-stake, rather than “mining”, participating nodes are “staking.” In Ethereum, staking is the act of depositing 32 ETH to activate validator software. A validator is randomly chosen to propose a block, and if their block is finalized, they win a reward. If the validator proposes a block with fraudulent transactions, they risk losing their entire stake. The rest of the validators are voting on the blocks and earn a reward for this, though much smaller than a proposer validator. In short, the incentive to behave correctly is there.</p><p>There is an ongoing debate about which consensus mechanism is better. Proof-of-work has undoubtedly proven to be a robust and secure consensus mechanism, but there are benefits of proof-of-stake. Most importantly, proof-of-stake allows for sharding which helps to increase the transaction throughput. For Ethereum, deemed the “world computer” whose network has been clogged because of a virtual cat application, an increase in throughput is instrumental to its success. Staking also makes it easier for people to run a node since it doesn’t require a huge investment in hardware.</p><p>To get an in-depth explanation of the Beacon chain and proof-of-stake, we recommend <a href="https://ethos.dev/beacon-chain/#rewards-penalties">this article</a>.</p><h4>Why</h4><p>Now the question is — <a href="https://www.coindesk.com/to-stake-or-not-to-stake-eth-2-question">to stake or no?</a> Staking for ETH2 is not for the faint of heart. The Beacon chain is Phase 0, the first out of a four-phase approach to fully transition to the proof-of-stake Ethereum chain. Staking your ETH means you are locking it up for at <em>least</em> one year. Yes, staking offers yields but keep in mind that this <a href="https://docs.google.com/spreadsheets/d/15tmPOvOgi3wKxJw7KQJKoUe-uonbYR6HF7u83LR5Mj4/edit#gid=842896204">yield decreases</a> as more validators come online. You’ll also need a total of 32 ETH if you want to run your own validator node.</p><p>However, at the heart of it all is the most fundamental question:</p><p><em>Do you want to be part of the community that lays the foundational building blocks of the new Ethereum?</em></p><p>Our answer is yes.</p><p>The yield that we’ll make is a nice bonus, but it’s more about supporting the growing blockchain community, strengthening the Ethereum network, and committing to a decentralized world.</p><p>The remainder of this article will outline our journey. We followed <a href="https://raymonddurk.medium.com/how-to-stake-for-ethereum-2-0-with-dappnode-231fa7689c02">this tutorial</a> and the DAppNode <a href="https://dappnode.github.io/DAppNodeDocs/install/#how-to-install-dappnode-from-an-iso">documentation</a> to get our node set up. We won’t go into the detailed steps since they are outlined in the tutorial, but we’ll get into the decisions we had to make and roadblocks we hit. It may be helpful to you or inspire you to run your own validator node. We highly encourage this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FGcSqyYa2aF8dy%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FGcSqyYa2aF8dy%2Fsource.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FGcSqyYa2aF8dy%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="324" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d115d7845b6597652189d81aa9e0a4a/href">https://medium.com/media/7d115d7845b6597652189d81aa9e0a4a/href</a></iframe><h4>Hardware 🖥</h4><p>The first decision we needed to make was how we were going to run our Ethereum node. Running a virtual node with a cloud service was an easy option that we quickly eliminated. Although we respect anyone’s decision to use this configuration, running a decentralized node with a company like Amazon feels counterintuitive to us. We also considered purchasing a pre-configured validator node from <a href="https://ava.do/">Avado</a> or <a href="https://shop.dappnode.io/">DappNode</a>. Given that we aren’t hardware experts, the idea of pre-configured hardware that requires minimum setup sounding appealing to us.</p><p>After several conversations and some soul-searching, we opted to purchase our own hardware and use DappNodeOS. With all the tutorials and community support, we figured we had enough resources to figure this out on our own. What can we say, we love a good challenge!</p><p>Here’s what we ended up buying:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oFi33VoKQCysthQqziCsDQ.png" /></figure><p><a href="https://www.newegg.com/intel-bxnuc10i7fnk1/p/N82E16856102228?Item=9SIA2F8B014296"><em>Intel NUC 10 i7–10710U</em></a></p><p><a href="https://www.newegg.com/g-skill-32gb-260-pin-ddr4-so-dimm/p/N82E16820232169?Item=N82E16820232169"><em>32GB laptop RAM (16GB x 2)</em></a></p><p><a href="https://www.newegg.com/intel-660p-series-2tb/p/N82E16820167461?Item=N82E16820167461"><em>2TB SSD</em></a><em> (we splurged)</em></p><p><em>Ethernet Cable</em></p><p>You’ll also need the following for temporary use:</p><p><em>8GB USB</em></p><p><em>Computer monitor</em></p><p><em>Keyboard with USB</em></p><p>Setting up the hardware was surprisingly simple. All you do is unscrew the bottom of the NUC, slide in your SSD and RAM chips, and screw it back together. Then you plug in the ethernet cable, monitor, keyboard, and 8GB USB that you downloaded the DappNode OS on. Boot everything up and go through the series of questions.</p><h4><strong>Configuring DappNode 💾</strong></h4><p>The only snag we hit with this step was a question that was not included in the tutorial or the DappNode documentation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zN7Tp-z16QlgEZg2hQsxOQ.png" /></figure><p><em>Force UEFI installation?</em></p><p>The first time around we selected “No” (that sounded like the right answer), but after completing the setup, the DappNode OS wouldn’t boot up. We reinstalled and went through the questions again, answering “Yes” to the UEFI Installation question and it worked! At the end of the process, you will get to a large QR code on the screen. These are your credentials for the VPN to log into the device.</p><h4><strong>VPN 🌎</strong></h4><p>The next thing we needed to do was download and set up a <a href="https://openvpn.net/download-open-vpn/">VPN</a> so we could access our machine without having to use wifi.</p><p>We got stuck at this step for a while…</p><p>We were able to scan the QR code on our phone to download the VPN file, but how do you securely move that file to your laptop? If anyone gets access to this file they can access your node. We ended up transferring the file through iCloud and immediately deleting it off iCloud. Maybe this wasn’t the best way, but we couldn’t think of another. We had trouble with connecting and after some troubleshooting with our ports and settings, we finally got it connected.</p><p>Once connected, you can go to <a href="https://searchassist.verizon.com/main?ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&amp;FailedURI=http%3A%2F%2Fmy.dappnode%2F&amp;FailureMode=1&amp;Implementation=&amp;AddInType=4&amp;Version=pywr1.0&amp;Referer=https%3A%2F%2Fraymonddurk.medium.com%2Fhow-to-stake-for-ethereum-2-0-with-dappnode-231fa7689c02&amp;ClientLocation=us">my.dappnode</a> where you see the dashboard of your device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mfL-evKM3WH_ByAQpcdztw.png" /></figure><p>When you first get to this dashboard, you’ll go to the DAppStore and download everything you need. We downloaded Goerli Geth for the ETH1 testnet, Geth for the ETH1 mainnet, and Prysm Pyrmont for the Beacon Chain client. Goerli Geth took a few hours to sync whereas Geth took about 30 hours.</p><p>We already had our Metamask set up with 32 testnet ETH, and our hardware wallet with 32 real ETH. As suggested by many, we went through the process of setting up our validator and staking ETH on the <a href="https://pyrmont.launchpad.ethereum.org/">testnet Launch Pad</a> first. Once we felt ready, we switched over to mainnet and hooked up our hardware wallet. Then we went to the <a href="https://launchpad.ethereum.org/">Mainnet Launch Pad</a> and went through the process on mainnet. Even after our practice run with testnet, we went through the instructions slowly, reading all of the warnings. We triple-checked the mainnet deposit contract:</p><p><a href="https://blog.ethereum.org/2020/11/04/eth2-quick-update-no-19/"><strong>0x00000000219ab540356cBB839Cbe05303d7705Fa</strong></a></p><p>At last, we clicked the Confirm button on Metamask…</p><p>Transaction failed 🙄</p><p>People<strong>, don’t forget to change the setting on your Ledger wallet to allow Contract Data.</strong> This allows your wallet to interact with a smart contract. Once we fixed this, we were able to confirm the transaction!</p><p>And that’s it, we did it. Overall, it was a fun learning experience and we’re happy to support the security of the system. We are currently in the queue to officially stake on ETH2, which should start on January 25th:</p><pre>This validator has been processed by the beacon chain and is currently waiting to be activated. It will approximately be activated on <strong>Jan 25, 2021, 5:11 AM</strong> during epoch <strong>12358</strong>. Make sure your nodes and your client is up and running <em>before</em> the countdown reaches zero.</pre><p>Here is our ETH2 node baby:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCaE4I6P3yfP4HX7lyzKUw.jpeg" /></figure><p>A big thank you to <a href="https://raymonddurk.medium.com/">Raymond Durk</a> for the <a href="https://raymonddurk.medium.com/how-to-stake-for-ethereum-2-0-with-dappnode-231fa7689c02">tutorial</a> we used. We don’t know you, but we couldn’t have done it without you!</p><p>Also, a shout to my brother Gregory Lifanov (a hardware wizard) for helping us set up the hardware and install the operating system.</p><p>If you have any questions or get stuck when setting up your node, feel free to reach out: <em>team@upstateinteractive.io</em>.</p><p>To stay up-to-date with Upstate Interactive, <a href="https://resources.upstateinteractive.io/newsletter-signup">sign up for our newsletter</a>.</p><p>👾</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=692d517cd1e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/our-commitment-to-decentralization-why-we-locked-up-32-eth-692d517cd1e8">Our commitment to decentralization: Why we locked up 32 ETH</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meta Gamma Delta 2020 Recap]]></title>
            <link>https://medium.com/meta-gamma-delta/meta-gamma-delta-2020-recap-94c422a6148f?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/94c422a6148f</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[dao]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Tue, 12 Jan 2021 01:12:58 GMT</pubDate>
            <atom:updated>2021-01-12T01:12:58.541Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m9BpwXy5JLZMkSuOMq9MUA.png" /></figure><p>Meta Gamma Delta was born out of the desire to create a community of humans who could come together from all around the world and make an impact in the blockchain ecosystem in which we all live and thrive.</p><p>While I’m sure we are collectively grateful that 2020 is over, we’d like to take a moment and highlight all of the wonderful things that we accomplished this year.</p><h3>The Beginning</h3><p>Meta Gamma Delta “MGD” was summoned as a DAO at ETH Denver on February 14th, 2020. What started as a fun virtual sorority has grown into a global movement of women who provide mentorship, resources, and grants for those who want to build great things. And yes, we are still fun!</p><ul><li>From 3 to 51 pledged members by the end of the year</li><li>The launch of our <a href="https://metagammadelta.com/">website</a></li><li>Our <a href="https://metagammadelta.files.wordpress.com/2020/05/mgd-dragonquest.pdf">Women Defi-ying the Defi Space</a> submission to the Dragon Quest Virtual Hackathon</li><li>4 public events including a <a href="https://metagammadelta.com/2020/06/23/personal-privacy-online-security-hangout/">Personal Privacy &amp; Online Security Hangout</a> and a Personal Financial Management discussion.</li><li>Migration from v1 to v2 MolochDAO</li><li>Weekly DAO calls</li><li>Internal presentations by members about projects they are working on or protocols they are using</li><li>~37,000 DAI raised for our first <a href="https://medium.com/meta-gamma-delta/meta-gamma-delta-grant-winners-4acda4bd2411">MGD Grant Round</a></li><li>Started joint calls with MetaCartel DAO</li></ul><h4>MGD Grants Program</h4><p>We are proud to say that within our first year, we launched a grants round program and awarded three women-led projects:</p><ul><li><a href="https://twitter.com/DefiantNews">The Defiant</a>, a Defi-focused media platform</li><li><a href="https://twitter.com/goodghosting">GoodGhosting</a>, a gamified savings app</li><li><a href="https://twitter.com/PowerDada">DADA</a>, a collaborative art platform</li></ul><h3>The Future</h3><p>On our last call of the year, each member brought an image that showed their goals for the future of the DAO. The collage below depicts this collaboration. Some images were funny, others serious, and others sassy…yet all called for the same mission…support more women-powered initiatives in Web3 and work towards this greater good! We hope to see you this year on a call and feel free to <a href="https://twitter.com/metagammadelta">connect</a> with us at any time to learn more about joining and/or supporting our DAO.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ex8tRW539UhI4WP-Icr7_w.png" /></figure><p>Cheers to a happy 2021 🥂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94c422a6148f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/meta-gamma-delta/meta-gamma-delta-2020-recap-94c422a6148f">Meta Gamma Delta 2020 Recap</a> was originally published in <a href="https://medium.com/meta-gamma-delta">Meta Gamma Delta DAO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Meta Gamma Delta Grants Round]]></title>
            <link>https://medium.com/meta-gamma-delta/meta-gamma-delta-grants-round-f12c4b17e035?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f12c4b17e035</guid>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[fundraising]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Wed, 30 Sep 2020 12:03:41 GMT</pubDate>
            <atom:updated>2020-10-01T15:08:07.917Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9B4VTecRw8oJtlbvyQ9kQQ.png" /></figure><h3>What is Meta Gamma Delta DAO?</h3><p>For those of you who don’t know us, we are an inclusive and empowering society supporting women-led projects in the blockchain space.</p><p><a href="https://metagammadelta.com/">Meta Gamma Delta</a>, or “MGD”, was summoned on February 14th, 2020 ❤️ at ETHDenver. Since that time we’ve onboarded over 35 members (mostly women), from all corners of the world. Some work in blockchain already, some are just starting out. All share a common vision in growing a community of women passionate about furthering the decentralized world.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FY5rqLLuVMg4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DY5rqLLuVMg4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FY5rqLLuVMg4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b278a48f0a8ef0d8e6e6684ccc8045b3/href">https://medium.com/media/b278a48f0a8ef0d8e6e6684ccc8045b3/href</a></iframe><h3><strong>MGD Grants Round</strong></h3><p>We are excited to announce our very <strong>first MGD Grants Round</strong>! We are looking for women-led projects that aim to benefit the development of the decentralized ecosystem. We realize there is a lack of diversity in teams building the new web3 world and are passionate about funding and supporting teams that shake up the status quo. We want to see a larger representation of female-led projects in the blockchain space.</p><p>We will open the Grants Round for application submissions on <strong>October 1st</strong>. This will run for <strong>one month</strong>, with October 31st being the last day to apply.</p><p>The round is split into two funds, a<strong> General MGD Fund</strong> and a <strong>MakerDAO Fund</strong>. If you are using the MakerDAO protocol in your project, you may apply under the MakerDAO Fund. All other projects can apply under the General MGD Fund.</p><h3><strong>What kind of projects are we looking for?</strong></h3><p>As a women-powered DAO, our main mission is to provide tools and funding to female-led projects. We are looking for projects that:</p><ul><li>Have a female founder or female co-founder</li><li>Benefit the development of the decentralized ecosystem</li><li>Have a clear roadmap detailing how these funds will be used and sustainable plans for the future</li><li>Bonus: encourages women and/or minorities to join their community</li></ul><h3><strong>What we are offering</strong></h3><h4>Funding</h4><p>Winners of the MGD General Fund will receive anywhere from 5k to 15k in DAI. Winners of the MakerDAO Fund will receive 10k in DAI.</p><h4>Additional Resources</h4><p>On top of receiving funds, winners will also get:</p><ul><li>A security review with a member from the <a href="https://quantstamp.com/">Quantstamp</a> team</li><li>Mentorship and guidance from leading developers in the ecosystem</li><li>Access to legal guidance specific to the blockchain industry</li><li>An interview with <a href="https://twitter.com/girlgone_crypto">Girl Gone Crypto</a> (25k followers on Twitter)</li><li>A free domain from <a href="https://unstoppabledomains.com/">Unstoppable Domains</a> (along with potential to qualify for additional grant money)</li></ul><h3>How to Apply?</h3><p>We will release our <a href="https://docs.google.com/forms/d/e/1FAIpQLSebA4GYi8LyKTG7E3rOQDtc0cDXKOnKPQj-FEcYABi5nKbU0w/viewform?vc=0&amp;c=0&amp;w=1&amp;flr=0&amp;gxids=7628">application</a> on October 1st. After the open application process closes, members of the DAO will carefully review applications and reach out the teams we believe may be a good fit. We look forward to seeing all of your applications!</p><h3>Fundraising</h3><p>To date, we have raised nearly 25,000 DAI, and we are still accepting donations. The majority of these funds will go to our winning teams so know that your contributions will go directly to the women-led teams that win this Grant.</p><p>In addition, thanks to our partnership with <a href="https://www.pooltogether.com/">PoolTogether</a>, for every 50 DAI that you donate, you will receive a PoolTogether ticket which gives you a chance to win the weekly pot! DM us on <a href="https://twitter.com/metagammadelta">Twitter</a> with your etherscan transaction and we’ll make sure you receive your ticket!</p><h4>How to donate?</h4><p>You can donate to our <a href="https://gitcoin.co/grants/615/a-buidl-sorority-that-supports-dope-projects-made">Gitcoin Grant</a> with Panvala League until October 2nd.</p><p>After that, you can send funds directly to our DAO address: <strong>0x7d58c962356ae66ba91b108751d67ae5d3b022fc</strong></p><p>A BIG shout out to our generous supporters…our very own Meta Gamma Delta members, the <a href="https://panvala.com/">Panvala League</a>, <a href="https://makerdao.com/en/">MakerDAO</a>, <a href="https://www.pooltogether.com/">PoolTogether</a>, <a href="https://unstoppabledomains.com/">Unstoppable Domains</a>, and all our friends that donated to this effort! You are the reason we are impacting the ecosystem in this positive way, thank you.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fd68IdpvmAHohx5NMEV%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmoodman-thank-you-thankyou-d68IdpvmAHohx5NMEV&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fd68IdpvmAHohx5NMEV%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="311" frameborder="0" scrolling="no"><a href="https://medium.com/media/985e63d3f17bef5cbb3a2f130cb19f46/href">https://medium.com/media/985e63d3f17bef5cbb3a2f130cb19f46/href</a></iframe><h3>🦄🦄🦄🦄</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f12c4b17e035" width="1" height="1" alt=""><hr><p><a href="https://medium.com/meta-gamma-delta/meta-gamma-delta-grants-round-f12c4b17e035">Meta Gamma Delta Grants Round</a> was originally published in <a href="https://medium.com/meta-gamma-delta">Meta Gamma Delta DAO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solidity override vs. virtual functions]]></title>
            <link>https://medium.com/upstate-interactive/solidity-override-vs-virtual-functions-c0a5dfb83aaf?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0a5dfb83aaf</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[upstate-new-york]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Wed, 15 Jul 2020 12:33:01 GMT</pubDate>
            <atom:updated>2020-07-15T12:33:01.227Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*NsxpNekiq1BhXhrjMljSgQ.png" /></figure><p>In our most recent smart contract project, we used Solidity 0.6 where I learned about override vs virtual. As always, you can read the <a href="https://solidity.readthedocs.io/en/v0.6.0/contracts.html#function-overriding">docs</a>, but I wanted to write this post for those of us who prefer to read quick tutorials on Medium.</p><p>Solidity is an object-oriented programming language that supports multiple inheritances. You can inherit from a base contract and then override a function in that base contract. Before Solidity 0.6, there was no way of knowing what functions should be overridden. Now, you can explicitly label a function as virtual or override.</p><h4>Function Overriding</h4><p>A function that allows an inheriting contract to override its behavior will be marked at virtual. The function that overrides that base function should be marked as override. Let’s take a look at an example from our favorite library, <a href="https://docs.openzeppelin.com/contracts/3.x/">OpenZeppelin</a>.</p><p>If you look at the <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol">ERC20.sol</a> contract in the latest version of the @openzeppelin/contracts library you will see that the transfer function contains both the virtual and override keywords.</p><pre>function transfer(address recipient, uint256 amount) public <strong>virtual</strong> <strong>override</strong> returns (bool) {</pre><pre>      _transfer(_msgSender(), recipient, amount);<br>      return true;</pre><pre>}</pre><p>This means if you inherit the ERC20.sol contract into your project, you can write your own transfer function and mark it as override since it’s overriding the base transfer function. If you forget to add the override the compiler will yell at you:</p><pre>TypeError: Overriding function is missing &quot;override&quot; specifier.</pre><p>The reason the OpenZeppelin transfer function includes theoverride keyword is because it’s inheriting the IERC20 interface which also has a transfer function. <em>All functions in interface contracts are automatically considered </em><em>virtual.</em></p><p>If your contract is inheriting the <em>same</em> function from multiple base contracts (that are unrelated), you must explicitly state which contracts: override(Base1, Base2)</p><pre><strong>pragma solidity</strong> &gt;=0.5.0 &lt;0.7.0;<br><br><strong>contract</strong> Base1<br>{<br>    <strong>function</strong> foo() virtual <strong>public</strong> {}<br>}<br><br><strong>contract</strong> Base2<br>{<br>    <strong>function</strong> foo() virtual <strong>public</strong> {}<br>}<br><br><strong>contract</strong> Inherited <strong>is</strong> Base1, Base2<br>{<br>    <em>// Derives from multiple bases defining foo(), so we must explicitly</em><br>    <em>// override it</em><br>    <strong>function</strong> foo() <strong>public</strong> override(Base1, Base2) {}<br>}</pre><h4>Conclusion</h4><p>That’s it, folks! This update makes it clear what functions are meant to be overridden vs what functions should be left as is. This is useful when working with libraries such as OpenZeppelin. This is also useful if you are building a contract that is meant to be used by other developers. You can be explicit in your intention for a function. If you do not want a function to be overridden, leave off the virtual marker.</p><p><a href="https://upstateinteractive.io/">Upstate Interactive</a> is a software consultancy that builds custom web and mobile applications and decentralized applications. If you need help with your smart contract application, please email us at <em>team@upstateinteractive.io </em>💜</p><p>☞ Follow us on <a href="https://medium.com/upstate-interactive">Medium</a>, <a href="https://twitter.com/upstateagency/">Twitter</a>, and <a href="https://www.linkedin.com/company/upstate-interactive">LinkedIn</a></p><p>☞ Follow me on Twitter <a href="https://twitter.com/devgirlla">@devgirlla</a></p><p>☞ Sign up for our monthly newsletter below</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F682c6d%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F682c6d%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href">https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0a5dfb83aaf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/solidity-override-vs-virtual-functions-c0a5dfb83aaf">Solidity override vs. virtual functions</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[For Those Who Never Chainlink]]></title>
            <link>https://medium.com/upstate-interactive/for-those-who-never-chainlink-966946e14ec8?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/966946e14ec8</guid>
            <category><![CDATA[upstate-new-york]]></category>
            <category><![CDATA[chain-link]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Thu, 21 May 2020 19:17:06 GMT</pubDate>
            <atom:updated>2020-05-21T19:17:06.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCiUW4FR7-fbTT5G6yNubg.jpeg" /></figure><h3>The Oracle Problem?</h3><p>Simply put, an oracle is a <strong>provider of data</strong>.</p><p>In the blockchain realm, an oracle is what feeds information from the outside world to a smart contract. <em>Smart contracts are self-executing applications that live on the blockchain and do something when triggered.</em></p><p>If a smart contract relies on outside data to run some type of function, we must ensure the data provided is secure, accurate, and has not been tampered with.</p><p>Relying on one source of data creates a <strong>single point of failure</strong>. If an oracle provides false data to the smart contract and the smart contract executes based on that data, we have ourselves an “oracle problem.”</p><blockquote>“The security of any system is only as strong as its weakest link, so a highly trustworthy oracle is required to preserve the trustworthiness of a well-engineered blockchain.” — <a href="https://link.smartcontract.com/whitepaper">Chainlink Whitepaper</a></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fjt0J5uARSlNO8%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fjt0J5uARSlNO8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fjt0J5uARSlNO8%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="183" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d567c6d43b8889be12b035436ad7472/href">https://medium.com/media/2d567c6d43b8889be12b035436ad7472/href</a></iframe><h3>What is Chainlink?</h3><p><a href="https://chain.link/">Chainlink</a> is a decentralized oracle network. It exists to help connect smart contracts to real-world data in a highly secure and reliable way. It kills the single point of failure and eliminates the oracle problem.</p><h4>How does it work?</h4><p>Chainlink is run by a network of nodes that provide information to and from the blockchain. You can think of it as <strong>middleware</strong> between the blockchain and an external API.</p><p>If a smart contract needs information from an API, it would make a request to a node or nodes in the Chainlink network. Those nodes would make the API call, evaluate the data, and return it back to the smart contract. The nodes are <strong>incentivized to provide truthful data</strong> through LINK tokens. A purchaser of data (<em>the smart contract</em>) must send LINK tokens when requesting outside data.</p><h4>Architecture</h4><p>The Chainlink network consists of an on-chain and off-chain architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlnVecjSSow4oe7DpzJmYw.jpeg" /><figcaption>Chainlink Architecture Diagram</figcaption></figure><p>On-chain, a requesting smart contract (Requester) interfaces with a Chainlink oracle contract to make a request for data. The Requester Contract sends LINK tokens and data for the request. The on-chain oracle contract receives the LINK tokens and request and emits an event to the off-chain Chainlink network.</p><p>Off-chain, Chainlink nodes are connected to the Ethereum blockchain and monitoring events. A Chainlink node will pick up an event and perform a request to an external API. The API returns data, which the Chainlink node returns back to the on-chain oracle. The oracle aggregates the responses and passes them back as a single response to the requesting contract.</p><h4><strong>External adapter</strong></h4><p>External adapters are not always necessary to use with the Chainlink network, but provide developers with the ability to customize an API response. They are also used with private APIs that require a secret key to be sent along with the request.</p><p>External adapters live between the Chainlink node and an external API and communicate with a simple JSON specification. They can be written in any language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vwb-wAC3KivL5Gs7EJdTvA.jpeg" /><figcaption>Chainlink Architecture with External Adapter</figcaption></figure><h4>Decentralization</h4><p>The Chainlink network allows users to easily customize their integration with the system. To maximize decentralization and help protect an application against faulty nodes, a user can use the following approaches: <strong>distribution of sources</strong> and <strong>distribution of oracles</strong>.</p><p><strong>Distribution of sources</strong></p><p>To protect against a single faulty data source, you can tell your oracle contract to collect data from multiple sources. Rather than using one API, use three APIs and aggregate the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4IxWbJySb5k_LB6oRvSP2Q.jpeg" /><figcaption>Distribution of sources</figcaption></figure><p><strong>Distribution of oracles</strong></p><p>To take it a step further, you can use multiple nodes to collect data from a source or from multiple sources. This provides greater decentralization as you are not relying on any one single node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MoQkHcNEu1uDcKv1al89qg.jpeg" /><figcaption>Distribution of oracles and sources</figcaption></figure><h4><strong>Our use case</strong></h4><p>At Upstate Interactive, we’ve been working on a decentralized application that needs results from an external API. Since the results will trigger a payout to users on the platform, we integrated Chainlink to provide us with an accurate and trustworthy data feed. For maximum decentralization, we chose three external APIs and three nodes for providing the data we needed.</p><p>We wrote a requester contract with a <a href="https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.4/Aggregator.sol">function</a> that would make a request to three separate nodes. The three API providers we selected required an API key so we wrote an external adapter to safely store the key and make the API calls.</p><p>We aggregated the responses within the adapter and if two out of the three responses agreed, we sent the response back to the smart contract. If they did not agree, we sent back an error. If all went well, payouts would be executed based on the results.</p><h3>Our thoughts on Chainlink</h3><p>We believe that Chainlink plays an important role in the blockchain ecosystem.</p><p>Most applications use some kind of external data, and as decentralized applications become more ubiquitous, the need for accessing secure data from the outside world will become increasingly important. This is particularly true in the DeFi (decentralized finance) space, where many of the protocols depend on accurate price feeds.</p><p>Before Chainlink, DeFi projects created their own oracles that were responsible for aggregating off-chain price data and sending it to their smart contracts. As we’ve learned, this presents a risk as the protocol is relying on one centralized source of data.</p><p>Over the past year, we’ve seen several popular DeFi protocols integrate with Chainlink including Synthetix, Aave, and bZx.</p><p><em>To learn more about how Chainlink is helping the DeFi ecosystem, we recommend </em><a href="https://blog.chain.link/analyzing-the-defi-ecosystem-and-the-many-ways-chainlink-can-accelerate-adoption/"><em>this</em></a><em> article.</em></p><p><strong>The future</strong></p><p>Chainlink is vital to the success of decentralized applications and continued iteration and development is a must. The system outlined in their whitepaper is not fully functional on mainnet yet, but work continues to be done.</p><p>For example, service level agreements and pluggable aggregations are still being worked on. Service level agreements will allow users to specify the service criteria they are looking for (external data, timeframe, node requirements) and the agreement will assist with selecting the nodes that fulfill those requirements.</p><p>As of today, you can use the distributed oracle model but with a predetermined list of nodes that you assign on-chain.</p><p><strong>Working with Chainlink</strong></p><p>Overall, we had a good experience working with Chainlink. As with all new technologies, there is a learning curve which can sometimes be frustrating. However, the Chainlink team does a great job of providing educational resources and community support.</p><p>There is extensive documentation, a GitHub repo full of coding examples, and their top developers are available on Gitter and Discord to help you with anything you are stuck on. You can tell this is a team that truly believes in what they do and cares about the community!</p><p>Guess what? We made a video! Check it out on YouTube and click the subscribe button!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqU5vYj8FRNM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqU5vYj8FRNM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FqU5vYj8FRNM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/85643025bbe37711d25513b3d8b67e2c/href">https://medium.com/media/85643025bbe37711d25513b3d8b67e2c/href</a></iframe><h3>Need to integrate with Chainlink?</h3><p><a href="https://upstateinteractive.io/">Upstate Interactive</a> is a software consultancy that builds custom web and mobile applications and decentralized applications. If you are looking to integrate your DApp with Chainlink and need help, reach out to us at <em>team@upstateinteractive.io </em>💜</p><p>☞ Follow us on <a href="https://medium.com/upstate-interactive">Medium</a>, <a href="https://twitter.com/upstateagency/">Twitter</a>, and <a href="https://www.linkedin.com/company/upstate-interactive">LinkedIn</a></p><p>☞ Follow me on Twitter <a href="https://twitter.com/devgirlla">@devgirlla</a></p><p>☞ Sign up for our monthly newsletter below</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F682c6d%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F682c6d%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href">https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href</a></iframe><h3>Sources</h3><ul><li><a href="https://blog.chain.link/analyzing-the-defi-ecosystem-and-the-many-ways-chainlink-can-accelerate-adoption/">https://blog.chain.link/analyzing-the-defi-ecosystem-and-the-many-ways-chainlink-can-accelerate-adoption</a></li><li><a href="https://docs.chain.link/">https://docs.chain.link</a></li><li><a href="https://kaleido.io/how-chainlink-works-under-the-covers/">https://kaleido.io/how-chainlink-works-under-the-covers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=966946e14ec8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/for-those-who-never-chainlink-966946e14ec8">For Those Who Never Chainlink</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a contract with a smart contract]]></title>
            <link>https://medium.com/upstate-interactive/creating-a-contract-with-a-smart-contract-bdb67c5c8595?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdb67c5c8595</guid>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[distributed-ledgers]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 12:20:12 GMT</pubDate>
            <atom:updated>2020-06-17T00:54:50.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZbZGFxaBbwINIzQ1roia6A.jpeg" /></figure><p>There are two ways a contract can be created in Solidity.</p><ol><li>They can be created “from outside” by a creator — a developer who is deploying the contract or a user that is interacting with a dApp which deploys the contract on their behalf.</li><li>They can also be created by another smart contract.</li></ol><p>Today I’m going to focus on #2.</p><p>There are a lot of great articles out there about using a factory to create smart contracts. These articles focus on creating multiple instances of the same contract. In my case, I needed a very simple factory. A parent contract that would deploy one instance of a child contract. Just once. We don’t want twins, triplets, quadruplets… that is more then we can handle.</p><p>Whether you want to create many instances of the same contract or you only want to create one, you can use the new keyword as described briefly here in the <a href="https://solidity.readthedocs.io/en/v0.5.0/control-structures.html#creating-contracts">Solidity docs</a>. In my case, I decided to have my parent contract create the child contract in it’s constructor. That way it would all happen at once on deployment.</p><h4>A family example</h4><p>Let’s take a look at an example.</p><p>In this example, we are going to have our parent contract that we will call MomContract deploy a child contract called DaughterContract.</p><p>:)</p><pre>pragma solidity ^0.5.0;</pre><pre>import &quot;./DaughterContract.sol&quot;;</pre><pre>contract MomContract {</pre><pre> string public name;<br> uint public age;</pre><pre> DaughterContract public daughter;</pre><pre> constructor(<br>  string memory _momsName,<br>  uint _momsAge,<br>  string memory _daughtersName,<br>  uint _daughtersAge<br> )<br>  public<br> {<br>  daughter = new DaughterContract(_daughtersName, _daughtersAge);<br>  name = _momsName;<br>  age = _momsAge;<br> }<br>}</pre><p>We are starting with the MomContract and creating the DaughterContract using the new keyword. We pass the parameters needed to create the DaughterContract to the MomContract so we can pass them on. We have a variable daughterof type DaughterContract, which will allow us to call that contract.</p><p>Now let’s take a look at the DaughterContract.</p><pre>pragma solidity ^0.5.0;</pre><pre>contract DaughterContract {</pre><pre> string public name;<br> uint public age;</pre><pre> constructor(<br>  string memory _daughtersName,<br>  uint _daughtersAge<br> )<br>  public<br> {<br>  name = _daughtersName;<br>  age = _daughtersAge;<br> }<br>}</pre><p>The name and age that is passed from the MomContract is used to create the DaughterContract, and we set those arguments to the name and age variable.</p><p>Now we know how a contract can create another contract. Great.</p><p>Let’s take it a step further.</p><p>Creating a contract from another contract is particularly useful when you want to restrict access of the child contract functions to it’s parent contract. To do this, I recommend using Open Zeppelin’s <a href="https://github.com/OpenZeppelin/openzeppelin-solidity">library</a>. They have several ways you can control access, as written in this <a href="https://openzeppelin.org/api/docs/learn-about-access-control.html">guide</a>. I’m going to use the well known and popular Ownable.sol file, which is perfect when you only need to provide access to one address. To use the Ownable.sol file, you’ll need to import it and inherit it in your child contract.</p><pre>pragma solidity ^0.5.0;</pre><pre>import &quot;openzeppelin-solidity/contracts/ownership/Ownable.sol&quot;;</pre><pre>contract DaughterContract is Ownable {<br> // contract code<br>}</pre><p>Let’s add a function that is restricted to the MomContract.</p><pre>pragma solidity ^0.5.0;</pre><pre>import &quot;openzeppelin-solidity/contracts/ownership/Ownable.sol&quot;;<br>import &quot;./MomContract.sol&quot;;</pre><pre>contract DaughterContract is Ownable {<br> <br> string public name;<br> uint public age;<br> bool public canDate;</pre><pre>constructor(<br>  string memory _daughtersName,<br>  uint _daughtersAge<br> )<br>  public<br> {<br>  name = _daughtersName;<br>  age = _daughtersAge;<br>  canDate = false;<br> }<br>}</pre><pre>function permissionToDate() onlyOwner {<br>  canDate = true;<br>}</pre><p>We added acanDate variable and set it false (we don’t want the daughter to date without her mom’s permission). Next, we added a permissionToDate function and added the onlyOwner modifier available to us from the Ownable contract. Now, the only contract that can call this function is the MomContract. To test this, I added a function in the MomContract that calls the permissionToDate function in the DaughterContract.</p><pre>function allowDaughterToDate() public {<br>  daughter.permissionToDate();<br>}</pre><p>Now, when you call the allowDaughterToDate function in the MomContract, it will call the permissionToDate function and update the canDate variable to true. If you try to call the permissionToDate function from any other contract or address, the function will revert. Yay!</p><p>Now, let’s say we want our MomContract to create another contract and we want that contract to access functions in the MomContract <em>and</em> theDaughterContract. This scenario is possible!</p><p>We will call our second child contract SonContract (of course).</p><p>We will import it into MomContract, pass additional parameters, and use new to create it. Along with the name and age variables, we are going to pass it the instance of the DaughterContract that we created right before creating the SonContract and we are going to pass it address(this). address(this) is the address of the contract itself. Yes, you can access the address of the contract you are creating in it’s constructor. You won’t be able to access its functions because the contract has not finished initializing, but you can at least pass around its address (<a href="https://ethereum.stackexchange.com/questions/29469/is-addressthis-a-valid-address-in-a-contracts-constructor">look here</a>).</p><pre>pragma solidity ^0.5.0;</pre><pre>import &quot;./DaughterContract.sol&quot;;<br>import &quot;./SonContract.sol&quot;;</pre><pre>contract MomContract {</pre><pre> string public name;<br> uint public age;</pre><pre> DaughterContract public daughter;<br> SonContract public son;</pre><pre>constructor(<br>  string memory _momsName,<br>  uint _momsAge,<br>  string memory _daughtersName,<br>  uint _daughtersAge,<br>  string memory _sonsName,<br>  uint _sonsAge<br>  )<br>  public<br> {<br>  daughter = new DaughterContract(_daughtersName, _daughtersAge);<br>  son = new SonContract(_sonsName, _sonsAge, daughter, <br>     address(this));<br>  name = _momsName;<br>  age = _momsAge;<br> }<br>}</pre><p>Now, let’s take a look at the SonContract.</p><pre>pragma solidity ^0.5.0;</pre><pre>import &quot;openzeppelin-solidity/contracts/ownership/Ownable.sol&quot;;<br>import &quot;./MomContract.sol&quot;;<br>import &quot;./DaughterContract.sol&quot;;</pre><pre>contract SonContract is Ownable {<br> <br> string public name;<br> uint public age;<br> DaughterContract public daughter;<br> MomContract public mom;</pre><pre>constructor(<br>  string memory _sonsName,<br>  uint _sonsAge<br>  DaughterContract _daughter,<br>  address _mom<br>  )<br>  public<br> {<br>  name = _sonsName;<br>  age = _sonsAge;<br>  daughter = _daughter;<br>  mom = MomContract(_mom);<br>  }<br>}</pre><p>Because we are passing the instance of DaughterContract, we can simply set our daughter variable to the _daughter that is being passed in the constructor. Because we are passing the address of the MomContract rather than the instance itself, we need to set it using MomContract(_mom).</p><p>Now, the MomContract can access functions in the SonContract and the SonContract can access functions in the MomContract <em>and</em> the DaughterContract. Let’s see an example of this. Add these three functions to the SonContract:</p><pre>function permissionToDate() public onlyOwner {<br>  canDate = true;<br>}</pre><pre>function howMuchIsYourAllowance() public returns (uint) {<br>  return daughter.howMuch();<br>}</pre><pre>function howOldAreYou() public returns (uint) {<br>  return mom.getAge();<br>}</pre><p>We’ll add the permissionToDate function that only the owner (Mom) can call. The son, ever so rudely, wants to know how much his sister’s allowance is and how old his mom is because he forgot. Since we have access to both the MomContract and the DaughterContract, he is able to access functions within those contracts.</p><p>In the MomContract I’ve added:</p><pre>function getAge() public returns (uint) {<br>  return age;<br>}</pre><p>And in the DaughterContract I’ve added a variable called allowance, and set it to equal 100. I’ve also added:</p><pre>function howMuch() public returns (uint) {<br>  return allowance;<br>}</pre><p>The son can call those functions and find out the age of his Mom and the allowance of his Sister.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FeWYGCVTJuOcg0%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FeWYGCVTJuOcg0%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FeWYGCVTJuOcg0%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/54c667e9261bd4aae9cdb7984bc9d464/href">https://medium.com/media/54c667e9261bd4aae9cdb7984bc9d464/href</a></iframe><p>You can see the code for all three contracts and the tests <a href="https://github.com/kseniya292/family">here</a>.</p><h4><strong>Let’s get real</strong></h4><p>Maybe some of you are thinking — why would you ever need to do this? You can simply access the functions of another contract by passing its address in the constructor of your contract. In the example above, we could have deployed the DaughterContract and SonContract first, and passed the addresses to the MomContract so she could call their functions.</p><p>I initially used this method because I wanted to use the onlyOwner modifier. In our real world project, we had a MultiSig contract that would call the functions of ContractA and ContractB once everyone signed off. In ContractA and ContractB, we wanted to check that <strong>only</strong> the MultiSig wallet was calling those functions. So I thought, great, let’s use the Ownable contract provided by OpenZepplin and have the MultiSig contract deploy those children contracts.</p><p>However…</p><p>As we added functions to the MultiSig contract and the child contracts that the MultiSig contract was creating, the gas cost to deploy the MultiSig contract was increasing. I learned that the CREATE opcode is one of the <a href="https://docs.google.com/spreadsheets/d/1n6mRqkBz3iWcOlRem_mO09GtSKEKrAsfO7Frgx18pNU/edit#gid=0">most expensive opcodes</a>, and we were using it twice in our MultiSig constructor. Eventually, we got to a point where the contracts had gotten so large that we could not add any new functions. The gas cost was to high.</p><p>Going back to our Family factory example — when the MomContract uses new to create the DaughterContract and SonContract, she stores all of their bytecode. That means, any function you add to the those child contracts adds to the bytecode size of the MomContract.</p><p>Deploying the DaughterContract and SonContract first, and passing them into the MomContract will save on gas since the MomContract will not store the bytecode of the child contracts. However, the son will not be able to find out how old his mom is because he won’t have her address to call the getAge function (since he is created first).</p><p>This is what happened with our project. We had 6 smart contracts that all needed to call each other’s functions and we wanted modifiers in several of those contracts to restrict access to specific contracts. How can all contracts know about each other at the time of deployment? Sometimes you can’t line them up perfectly.</p><p>Our solution…a registry. Stay tuned for my next post where I will be writing about how we used a registry to keep track of our smart contracts.</p><p>If you want to learn more about using factories to create multiple instances of contracts, I recommend the following articles:</p><p><a href="https://blog.gnosis.pm/solidity-delegateproxy-contracts-e09957d0f201">Solidity DelegateProxy Contracts</a></p><p><a href="https://medium.com/@i6mi6/solidty-smart-contracts-design-patterns-ecfa3b1e9784">Solidity Smart Contracts Design Patterns</a></p><p>I hope you found this article useful. Please don’t hesitate to reach out if you have additional questions or thoughts you’d like to discuss further with our team — <em>team@upstateinteractive.io</em></p><p>☞ To stay up to date with <a href="http://upstate.agency/">our</a> work with smart contract development, <a href="http://blog.upstate.agency/">follow us on Medium</a> and <a href="https://twitter.com/upstateagency/">Twitter</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F682c6d%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F682c6d%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href">https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdb67c5c8595" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/creating-a-contract-with-a-smart-contract-bdb67c5c8595">Creating a contract with a smart contract</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What you missed at Devcon IV]]></title>
            <link>https://medium.com/upstate-interactive/what-you-missed-at-devcon-iv-fc0097f88406?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc0097f88406</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[dapps]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Wed, 05 Dec 2018 13:52:36 GMT</pubDate>
            <atom:updated>2018-12-07T22:35:55.808Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdqgUJZ3DHP8nUWwmE43Xg.jpeg" /></figure><p>A few weeks ago, I was fortunate enough to attend the 4th annual <a href="https://devcon4.ethereum.org/">Devcon</a> conference in Prague. This was a 4 day conference hosted by the Ethereum Foundation that brought together developers, designers, researchers, community organizers, and even artists from all over the world. I met talented people working on really interesting projects in the space. I attended talks and workshops that focused on scalability, security, privacy, and UX &amp; design. I roamed the streets of Prague with new friends. And most importantly, I left the conference feeling inspired and even more excited about this new paradigm shift of the internet.</p><p>Here are a few things you missed:</p><h3>Ethereum 2.0 (aka Serenity)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1rC4sP3jQ1U45m3VU0eN8w.jpeg" /><figcaption>Vitalik Buterin (Latest of Ethereum)</figcaption></figure><p>Vitalik Buterin gave a talk about the past, present and future of Ethereum development. He spoke about Ethereum 2.0, dubbed “Serenity”, which is a combination of different features that the Ethereum team has been working on and researching for the past few years including Proof of Stake (Casper), Scalability (sharding), and improvements to the VM, cross-contract logic, and protocol economics. He spoke about the history of the research &amp; development that went into proof of stake and sharding, and addressed some of the things that we wrong.</p><p>The most exciting part of the talk was about the future of Ethereum. Serenity, which will start as a new blockchain with a link to the existing PoW chain, is the “the world computer” as it’s really meant to be according to Vitalik. It will process transactions at a faster rate then the current blockchain and hopefully allow for 1000x higher scalability.</p><p>Serenity will be introduced in 4 phases:</p><p><strong>Phase 0:</strong> the first phase will introduce the beacon chain, the new proof of stake blockchain that will co-exist alongside Ethereum (dummy chain). This blockchain will be halfway between a testnet and mainnet.</p><p><strong>Phase 1:</strong> The second phase will introduce a simplified version of “shards as data chains”. These shards can store data but won’t be able to transfer smart contracts or money from one shard to another.</p><p><strong>Phase 2: </strong>This phase will enable cross-shard communication, meaning users can send messages and funds to each other across different shards.</p><p><strong>Phase 3:</strong> The last phase will include tweaks and optimizations.</p><p>You can check out the recording of Vitalik’s talk <a href="https://slideslive.com/38911602/latest-of-ethereum">here</a>!</p><h3>Zero-Knowledge Proofs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ELEAk2WYf_nih75pO72jcg.jpeg" /><figcaption>Elena Nadolinski (Demystifying Zero-Knowledge Proofs)</figcaption></figure><p>Zero-Knowledge Proofs were a hot topic at the conference and they definitely caught my attention. Zero-Knowledge proofs are a method in which one party (a prover) can prove to another party (the verifier), that they know the value of an output without revealing the inputs. Zero-Knowledge proofs are not a new concept: they were first introduced in 1985 by MIT Shafi Goldwasser, Silvio Micali and Charles Rackoff in their paper <a href="http://people.csail.mit.edu/silvio/Selected%20Scientific%20Papers/Proof%20Systems/The_Knowledge_Complexity_Of_Interactive_Proof_Systems.pdf">“The knowledge complexity of interactive proof systems</a>”. Recently, this concept has been introduced into the blockchain for the purposes of online privacy and scalability. <a href="https://twitter.com/leanthebean">Elena Nadolinski</a> gave a talk titled Demystifying Zero knowledge proofs where she went over the math behind this concept and then Jacob Eberhardt gave a workshop on ZoKrates, a toolbox to use zkSNARKS in your dapps.</p><p>Read more about Zero-Knowledge Proofs in <a href="https://medium.com/@argongroup/on-zero-knowledge-proofs-in-blockchains-14c48cfd1dd1">this Medium article</a> from The Argon Group.</p><h3>UX &amp; Design</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ra184Tb7vymL_K8OYimRCw.jpeg" /><figcaption>Taylor Monahan (Unintended Consequences of Product Design)</figcaption></figure><p>One of the challenges of the entire blockchain ecosystem is on-boarding users, so this year’s Devcon focused on UX &amp; design more than ever before. There were a handful of workshops addressing the topic. The first day kicked off with a UX workshop called “How to Design for Humans &amp; Get Users Onboard”, hosted by Connie Yang, the Director of Design at Coinbase and Tara Tan, a design director at IDEO CoLab. Their presentation included tips and tools for a human-centered approach to designing for DApps.</p><p>Metamask announced their <a href="https://media.consensys.net/metamask-at-devcon-privacy-standards-mobile-and-more-d826225b9b4b">mobile app</a>, a bridge to the decentralized web which includes intuitive on-boarding. Alex Van de Sande gave a talk about development for Universal Login for DApps, which can replace the usual login and does not require passwords, backing up private keys, or seed phrases. Taylor Monahan gave a <a href="https://medium.com/mycrypto/the-unintended-consequences-of-product-design-d35fcdfe777d">talk</a> about lessons learned while building out the user interface for MyEtherWallet and MyCrypto. It was exciting to see that a major topic of conversation around the extremely important topic of User Experience and Design.</p><p>There were countless presentations and workshops throughout Devcon and I wish I could have attended them all. Luckily, many of the presentations were <a href="https://slideslive.com/ethereum/devcon4-main-hall">recorded</a> so you are able to watch them from the comfort of your couch!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FbDTtPo3HyEluE%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FbDTtPo3HyEluE%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FbDTtPo3HyEluE%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="297" frameborder="0" scrolling="no"><a href="https://medium.com/media/79f14c2293d96ad5619060c5af9bfd2c/href">https://medium.com/media/79f14c2293d96ad5619060c5af9bfd2c/href</a></iframe><p>Aside from the workshops and presentations, it was awesome to meet so many developers from the community and explore the beautiful city of Prague. We are already looking forward to Devcon V!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g4RmOmx7U88fPzkmQDMuDQ.jpeg" /></figure><p>If you attended Devcon IV and live in the LA area, let’s grab coffee! <a href="https://twitter.com/kseniya292">Tweet me</a>.</p><p>☞ To stay up to date with <a href="http://upstate.agency/">our</a> work with smart contract development, <a href="http://blog.upstate.agency/">follow us on Medium</a> and <a href="https://twitter.com/upstateagency/">Twitter</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F682c6d%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F682c6d%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href">https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc0097f88406" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/what-you-missed-at-devcon-iv-fc0097f88406">What you missed at Devcon IV</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I learned from testing complex smart contracts]]></title>
            <link>https://medium.com/upstate-interactive/what-i-learned-from-testing-complex-smart-contracts-6760c839de34?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6760c839de34</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Wed, 03 Oct 2018 13:15:41 GMT</pubDate>
            <atom:updated>2018-10-03T13:15:41.201Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQ64sVCb1B9JSyCsa7_7aw.jpeg" /><figcaption><a href="http://upstate.agency/smart-contracts">http://upstate.agency/smart-contracts</a></figcaption></figure><p>In a <a href="https://blog.upstate.agency/a-simple-guide-for-how-to-write-unit-tests-for-smart-contracts-8ec4b645f57b">previous article</a>, we provide a simple guide on how to write unit tests for smart contracts. Luckily, we can use our favorite tools to test smart contracts: the Mocha framework and Chai assertion library.</p><p>Personally, I love writing tests. There is something satisfying about seeing those little green check marks in your terminal. However, when you come across a function with 3 modifiers,7 require statements, 3 if statements, and then if statements nested in if statements, things can get tricky. That leads to so many possible combinations that your head starts to spin.</p><p>Mapping out your unit tests before writing any code definitely helps. As I mapped out the functions I was working on, I decided to nest my describe statements. This method helped me to keep my tests organized and minimized the amount of code I needed to write.</p><p>Let’s see a simplified example.</p><p>Rather than writing several long it statements to account for every possible scenario :</p><pre>describe(&#39;buyTokens(_amount)&#39;, function () {<br>  it(&#39;it should return true if contract has been activated, contract  is not paused, when offering period has started, when offering period has not ended&#39;, async function () {<br>    // test code<br>  });  </pre><pre>  it(&#39;it should transfer tokens if contract has been activated, contract  is not paused, when offering period has started, when offering period has not ended&#39;, async function () {<br>    // test code<br>  });</pre><pre>  it(&#39;it should revert if contract has not been activated, contract is not paused, when offering period has started, when offering period has not ended&#39;, async function () {<br>    // test code<br>  });</pre><pre>  it(&#39;it should revert if contract has been activated, contract is paused, when offering period has started, when offering period has not ended&#39;, async function () {<br>    // test code<br>  });</pre><pre>  it(&#39;it should revert if contract has been activated, contract is not paused, when offering period has not started, when offering period has not ended&#39;, async function () {<br>    // test code<br>  });<br>});</pre><p>You can use the nesting method :</p><pre>describe(&#39;buyTokens(_amount)&#39;, function () {<br>  describe(&#39;when the contract is activated&#39;, function () {<br>    describe(&#39;when the contract is not paused&#39;, function () {<br>      describe(&#39;when the offering period has started&#39;, function () {<br>        describe(&#39;when the offering period has not ended&#39;, function                                                 () {<br>          it(&#39;it should return true&#39;, async function () {<br>           // test code<br>          });<br>          it(&#39;it should transfer tokens&#39;, async function () {<br>           // test code<br>          });        <br>        });<br>        describe(&#39;when the offering period has ended&#39;, function () {<br>          it(&#39;it should revert&#39;, async function () {<br>            // test code<br>          });<br>        });<br>      });<br>      describe(&#39;when the offering period has not started&#39;, function () {<br>        // further describes or it tests<br>      });<br>    });<br>    describe(&#39;when the contract is paused&#39;, function () {<br>      // further it tests<br>    });<br>  });<br>  it(&#39;it should revert if contract has not been activated&#39;, async function () {<br>    // unit test<br>  });   <br>});</pre><p>I started with addressing modifiers, then require statements, and lastly the if statements. I nested my describe statements until I got the test to pass, and then worked my way out. In the example above, I knew that in order to get the test to pass (effectively returning true and transferring tokens), I needed to set my test up to have the contract activated, not paused, the offering period started and not ended. Once I got down to the level that would pass the test, I worked my way out. The describe statement outside the it should return true and it should transfer tokensfunctions was:</p><p>when the offering period has not ended</p><p>I added a describe at the same level to address what would happen conversely:</p><p>when the offering period has ended</p><p>I continued to work my way up each level until I addressed the very first describe function: when the contract is activated, and created a test for when the contract is not activated.</p><p>I encourage you to try this method next time you are testing complex smart contracts. Nesting and using the beforeEach function helps to eliminate duplicate code, and helps you stay organized.</p><p>How do you structure your tests? Comment below if you have any tips or tricks!</p><p>☞ To stay up to date with <a href="http://upstate.agency/">our</a> work with smart contract development, <a href="http://blog.upstate.agency/">follow us on Medium</a> and <a href="https://twitter.com/upstateagency/">Twitter</a>.</p><p>☞ Need help with writing tests? Contact us at <em>team@upstate.agency</em>!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F682c6d%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F682c6d%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href">https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6760c839de34" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/what-i-learned-from-testing-complex-smart-contracts-6760c839de34">What I learned from testing complex smart contracts</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mappings + Arrays in Solidity Explained]]></title>
            <link>https://medium.com/upstate-interactive/mappings-arrays-87afc697e64f?source=rss-3c9135e14c7d------2</link>
            <guid isPermaLink="false">https://medium.com/p/87afc697e64f</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Kseniya Lifanova]]></dc:creator>
            <pubDate>Thu, 07 Jun 2018 12:11:17 GMT</pubDate>
            <atom:updated>2018-06-07T12:14:06.243Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*957MogzRfKWmDlF8qTrT_g.jpeg" /></figure><p>In our Mappings in Solidity article, we gave a quick breakdown of how mappings work and why they are useful. Another important aspect of mappings that often confuses developers is that they <strong>cannot be iterated over</strong>.</p><p>Say it with me:</p><p>“Mappings cannot be iterated over. Mappings cannot be iterated over. Mappings cannot be iterated over.”</p><p>This is where arrays come in to save the day. If you think you will need to iterate over information in a mapping, you can create an array of the keys in the mapping. To better explain this, let’s look at an example.</p><p>Say you have a User struct:</p><pre>struct User {<br>  string name;<br>  uint level;<br>}</pre><p>You also have a mapping called userStructs to map a User address to their User struct:</p><pre>mapping (address =&gt; User) userStructs;</pre><p>If you had three users, this is what their mappings would visually look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*IpVgYVLjzBkGaynKZ9H89g.png" /><figcaption>userStructs mapping</figcaption></figure><p>Looking at this visual, you would think you could iterate over the mapping to return a list of every address, but you can’t! There is no way to iterate over a mapping to list all the key/value pairs. What you can do is create an array:</p><pre>address[] public userAddresses;</pre><p>Every time you add a User you can push their address into the array. Here is a createUser function where you set a User struct with a name and level, and then push their address into the userAddresses array:</p><pre>function createUser(string name, uint level) {<br>  <br>  // set User name using our userStructs mapping<br>  userStructs[msg.sender].name = name;</pre><pre>  // set User level using our userStructs mapping<br>  userStructs[msg.sender].level = level;</pre><pre>  // push user address into userAddresses array<br>  userAddresses.push(msg.sender);</pre><pre>}</pre><p>Now you can return the userAddresses array to get a list of all of the addresses:</p><pre>function getAllUsers() external view returns (address[]) {<br>  return userAddresses;<br>}</pre><p>Voila!</p><p>In my next article, I’ll be showing you how to write a function to list the addresses of users with a specific property value. In our example, say we wanted a list of user addresses who are in a specific level. How would you do that?</p><p>Stay tuned….</p><h3>☞ <a href="http://upstate.agency/">We build decentralized applications (DApps) on the Ethereum blockchain</a></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F682c6d%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F682c6d%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href">https://medium.com/media/4dbf487062d26d986a25e2baf2031fd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87afc697e64f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/upstate-interactive/mappings-arrays-87afc697e64f">Mappings + Arrays in Solidity Explained</a> was originally published in <a href="https://medium.com/upstate-interactive">Upstate Interactive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>