<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>agrimony</title>
        <link>https://paragraph.com/@agrimony-2</link>
        <description>undefined</description>
        <lastBuildDate>Sun, 05 Apr 2026 04:18:04 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>agrimony</title>
            <url>https://storage.googleapis.com/papyrus_images/be94da1c5050e9bec9b44e5fb32e3af2cd1543891def90351c6b5e6596c3a3f6.jpg</url>
            <link>https://paragraph.com/@agrimony-2</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Efficient Staking Protocols]]></title>
            <link>https://paragraph.com/@agrimony-2/efficient-staking-protocols</link>
            <guid>5U8cTvHcUH0Gf7jNU91C</guid>
            <pubDate>Sat, 23 Dec 2023 02:13:27 GMT</pubDate>
            <description><![CDATA[BackgroundToo often I get asked, “How do you start contributing to a DAO?“ Most people assume you need to be a dev to contribute to a DAO, but code is just one of the many things which DAOs need. Crucial to DAO operations is figuring out what needs to be done to get our functions as decentralized, as autonomous, and as organized as possible. One such task was to design the AirSwap V4 staking contract.IntroductionThe AirSwap protocols consist of DAO and DEX components. The DAO builds the DEX, ...]]></description>
            <content:encoded><![CDATA[<h2 id="h-background" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Background</h2><p>Too often I get asked, “<em>How do you start contributing to a DAO?</em>“ Most people assume you need to be a dev to contribute to a DAO, but code is just one of the many things which DAOs need. Crucial to DAO operations is figuring out what needs to be done to get our functions as decentralized, as autonomous, and as organized as possible. One such task was to design the AirSwap V4 staking contract.</p><h1 id="h-introduction" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Introduction</h1><p>The AirSwap protocols consist of DAO and DEX components. The DAO builds the DEX, which then funds the DAO. Core to the AirSwap DAO protocol is the staking contract. By staking AST, members signal their intent to participate in governance and help steer the protocol to become the standard peer-to-peer trading system. A good staking contract design needs to be intuitive and accessible (gas-wise) to enable smaller stakers to participate in the AirSwap ecosystem as well.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/f815b2f2827ea522289060cf870f7552a0b5de8cc342b4cf608ecd911c5763cc.png" alt="AirSwap V3 protocols" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">AirSwap V3 protocols</figcaption></figure><h1 id="h-designing-the-contract" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Designing the Contract</h1><h3 id="h-simple-staking" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Simple staking</h3><p>Staking in AirSwap is a linear vesting over a period of 20 weeks. This logic is pretty simple, until you consider multiple stakes being vested at the same time. For example, Alice stakes 100 AST at week 0, 200 AST at week 1 and 500 AST at week 7. How many tokens are unlocked at week 10?</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/8065b627bea606b2e9031de45eea86c0d90f642c6e7122bd7c473e7e267ecd4e.png" alt="Alice vesting stakes" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Alice vesting stakes</figcaption></figure><p>To allow the contract to unlock the correct number of tokens would require looping over each stake and calculating how much tokens are vested as a function of</p><ol><li><p>Initial staked amount</p></li><li><p>Initial time of stake</p></li><li><p>Current block time</p></li></ol><p>Each loop requires additional gas each time the function is called. This means small stakers cannot slowly accumulate their positions without requiring a huge amount of gas to unstake later.</p><h3 id="h-dynamic-staking" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Dynamic staking</h3><p>Over the course of spring 2023, I worked with <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/SmartContrart">smartcontrart</a> to radically redesigned the staking contract based on a set of heuristics that the user would expect.</p><ol><li><p><strong>Max duration = 20 weeks</strong>.</p></li><li><p><strong>Deposits should not change available staking balance.</strong></p></li><li><p><strong>Deposits should increase the time left to unstake</strong>.</p></li><li><p><strong>Withdrawals should decrease the available staking balance.</strong></p></li><li><p><strong>Withdrawals should NOT change the time left to unstake.</strong></p></li></ol><p>Our final design tracked 3 variables for each staking address (vs 2 variables <em>per</em> staking tx): Staked balance, time of initial stake, time of full vest. Instead of creating a new stake for each tx, additional stakes simply increase the time to full vest (up to 20 weeks) based on the additional amount staked relative to its current balance.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/49c4e998959fbe389dd2d5541ca043118796878e1d4eccd45bbfeea1e60fc987.png" alt="Alive vesting stakes under the new contract" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Alive vesting stakes under the new contract</figcaption></figure><p>With the changes, we no longer need to loop over every single staking tx made but can simply update 3 variables. Our new dynamic staking contract has now been implemented in AirSwap V4, resulting in significant gas savings to DAO members!</p><h2 id="h-conclusion" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Conclusion</h2><p>You don’t need to be a dev to help out in DAOs! In AirSwap we had marketers, operations, designers, and devs all working together to promote our mission of fully decentralized peer-to-peer swap protocols.</p><p>It’s fun and you get to learn loads! If anyone wants to check out what AirSwap is doing, head over to our <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://chat.airswap.io">discord</a> and just chat with the folks there</p>]]></content:encoded>
            <author>agrimony-2@newsletter.paragraph.com (agrimony)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/6f866fe0d4bf9f06456881bf7ff908b2eeffa489b6380f64d58c237400e01fea.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Dying of the Lights]]></title>
            <link>https://paragraph.com/@agrimony-2/dying-of-the-lights</link>
            <guid>2ZwwPJ3eImsiXNDiCNdH</guid>
            <pubDate>Fri, 26 Aug 2022 13:59:53 GMT</pubDate>
            <description><![CDATA[Dying of the Lights envisions a futurescape where ancient civilizations have built megalithic structures to harness the power of the stars. These civilizations have long since passed away, but the ruins of these structures remain forever locked in a state of uncompletion. The project explores the relationship of structure and color to create otherworldly scenes. The code generates systems of swirling particles, with relationships first being defined by an underlying data structure tying both ...]]></description>
            <content:encoded><![CDATA[<p><em>Dying of the Lights</em> envisions a futurescape where ancient civilizations have built megalithic structures to harness the power of the stars. These civilizations have long since passed away, but the ruins of these structures remain forever locked in a state of uncompletion.</p><p>The project explores the relationship of structure and color to create otherworldly scenes. The code generates systems of swirling particles, with relationships first being defined by an underlying data structure tying both their physical and color space together before being deconstructed during the render. The final chaotic explosions hint at their original construction, encouraging the viewer to create their own stories about the <em>Dying of the Lights</em>.</p><h2 id="h-underlying-structures" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Underlying Structures</h2><p>DOTL uses a simple data structure primitive - a recursive quadtree (there are many <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.youtube.com/watch?v=OJxEcs0w_kE">tutorials</a> and <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://mattdesl.substack.com/p/subscapes-part-3?s=r">guides</a> for it). <code>split()</code> is called recursively, with the split axis and length randomly determined.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/f85825aa91a2488f028c8709ecf0a77c3e9c1154f82743e668d4e58e53c27895.png" alt="Underlying data structure" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Underlying data structure</figcaption></figure><h2 id="h-parent-child-hierarchy" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Parent-child hierarchy</h2><p>Quadtrees have an interesting hierarchy to the nodes. These hierarchies allow traits to be inherited from parent to child. For example, in DOTL, certain sections of the quadtree are filtered out based on their aspect ratios, which (1) limits the particle sizes and (2) generates a city-like structure with clusters of objects being formed.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/ffca633f03b8b25953d1dc1e674c9af248d2fd43cbbf26fa0fb5eb94e8d184ad.png" alt="Some early renders which removed sections of the tree produces a very interesting aesthetic" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Some early renders which removed sections of the tree produces a very interesting aesthetic</figcaption></figure><p>Traits can not just be inherited but also evolved as the tree is generated. Color is one such trait in DOTL. Evolution of the color trait is tied to their relationship in the quadtree. Every time the recursive <code>split()</code> is called, a new color is generated by applying a shift from the parent color. The shift itself is controlled by a perlin noise field dependent on the size of the node. Larger splits = larger shifts.</p><p>Thus, child nodes which are more closely related along the quadtree end up with more similar colors. This allows for larger sections of color to be formed and clustered in certain regions of the tree.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/92dae5232e58abd9dc7b45247de401cfb2e0efc4c69f5d167b881d34602d82ce.png" alt="An early iteration of the quad tree which paints blobs of color rather than draw rectangles" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">An early iteration of the quad tree which paints blobs of color rather than draw rectangles</figcaption></figure><h2 id="h-final-constructions" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Final Constructions</h2><p>The structure &lt;&gt; color relationship is further exposed by applying a set of rotations to the system as the tree is rendered. Particles closer in hierarchy form layers of colored geometric objects, with the end result a seemingly chaotic explosion of colors. The rotations are randomly determined, introducing variance in the final megalithic structure of each piece.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b4979dc87b9f99cabfdef21f8e245616a59bec4f69cd82cf1107653e95cd1b2a.png" alt="Early iterations of a Dying Light explosion" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Early iterations of a Dying Light explosion</figcaption></figure><p>The final piece is held together by a central light source which (in most cases) provides the bulk of the illumination in the scene. The environmental palettes in DOTL typically play instead with levels of illumination and contrast to achieve images which pay homage to the sci-fi classics which inspired this project. In rare cases, a more rigid color palette is applied (e.g. white-on-black) to achieve the intended aesthetics.</p><h2 id="h-thanks-for-tuning-in" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Thanks for tuning in</h2><p>Hope you enjoyed the creation process! Here are some curated renders of the various environmental palettes available in DOTL.</p><p>In the meantime, you can also generate your own Dying Lights over at my <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://dyinglights-web.agrimony.repl.co/">repl</a>. Have fun exploring!</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/86e6eb91b882c3797d5cbec122e8f0ae091f8f871c4c022d904a3d486eaa5f93.png" alt="Harsh lighting and saturated colors for that otherworldly effect" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Harsh lighting and saturated colors for that otherworldly effect</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/f1a6a9d2165a214245ada96a99ece68ec02ee21676b5f6df9c9c723ff43557c4.png" alt="Soft pastel palettes for its comic book vibes" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Soft pastel palettes for its comic book vibes</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/e310e8ce7846648b26af3457804ea999d9d44dd279af421b617602e14359be71.png" alt="Black and white palettes inspired by manga art" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Black and white palettes inspired by manga art</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/5152f4ff15f237430df83e8f94a114e711ed4b76aac862dbaaaf134038830627.png" alt="Black-on-light resembles a screen print" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Black-on-light resembles a screen print</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/ea7e75185ab102bf2aa8573552b717607198aa6eb2a0ef1bbcc5ef4b55103f85.png" alt="Light-on-light is a special palette which creates splashes of limited color only on a single face" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Light-on-light is a special palette which creates splashes of limited color only on a single face</figcaption></figure>]]></content:encoded>
            <author>agrimony-2@newsletter.paragraph.com (agrimony)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/0ff9ae7c911e9b450fea4cdb63df0fab37d1462d6d89ecf3a1591783735f70af.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Manual Unstaking from the deprecated AST Staking contract]]></title>
            <link>https://paragraph.com/@agrimony-2/manual-unstaking-from-the-deprecated-ast-staking-contract</link>
            <guid>O49cdNLKQzLu7ZxxN4DP</guid>
            <pubDate>Tue, 05 Apr 2022 01:03:52 GMT</pubDate>
            <description><![CDATA[I wrote this tutorial as a guide to those who are stuck on the deprecated AST contract.Manual UnstakingNavigate to the deprecated staking contract in etherscan (or the V2 contract) -> contract -> read contractCheck the AST balance in the contractUnder balanceOf, input your address and click query (querying the chain does not require gas) Check to ensure that the amount tallies with the amount of AST you have staked Note: The amount displayed is multiplied by 10,000 to account for the decimal ...]]></description>
            <content:encoded><![CDATA[<p>I wrote this tutorial as a guide to those who are stuck on the deprecated AST contract.</p><h2 id="h-manual-unstaking" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Manual Unstaking</h2><p>Navigate to the deprecated staking contract in <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://etherscan.io/address/0x704c5818b574358dfb5225563852639151a943ec#readContract">etherscan</a> (or the V2 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://etherscan.io/address/0x579120871266ccd8de6c85ef59e2ff6743e7cd15#code">contract</a>) -&gt; contract -&gt; read contract</p><h3 id="h-check-the-ast-balance-in-the-contract" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Check the AST balance in the contract</h3><p>Under <code>balanceOf</code>, input your <code>address</code> and click query (querying the chain does not require gas)</p><p>Check to ensure that the amount tallies with the amount of AST you have staked</p><p><em>Note: The amount displayed is multiplied by 10,000 to account for the decimal places</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/cc77bb57e18b46bc733a663d04853f6c5058c0776225948d095ee43373b76766.png" alt="Check your AST balance in the deprecated contract" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Check your AST balance in the deprecated contract</figcaption></figure><h3 id="h-check-the-balance-available-to-unstake" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Check the balance available to unstake</h3><p>Under <code>available</code>, input your <code>address</code> and under <code>index</code>, input <code>0</code></p><p>This number represents the amount of AST available to be unstaked currently. Make sure that this number tallies with the number of AST in <code>balanceOf</code> if you want to withdraw the full amount.</p><p><em>Note: If you have made multiple stakes into this contract, you can check the balance available for each staking event by changing</em> <code>index</code><em>.</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/af47bb36ef1f568009422b7abe3683907ff5c3d4becb74460fa5a37fe25bc486.png" alt="Check your AST balance available to unstake. If you have made multiple stakes, you can change the index to cycle through the various stakes" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Check your AST balance available to unstake. If you have made multiple stakes, you can change the index to cycle through the various stakes</figcaption></figure><p>If the number does not tally, either, you have to wait longer to unstake the full amount (20 weeks), or you had staked in multiple batches. Check your historical interactions with this contract in <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://etherscan.io/token/0x704c5818b574358dfb5225563852639151a943ec#balances">etherscan </a>to find out when you staked, and how many stakes you had made.</p><h3 id="h-unstake" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Unstake</h3><p>Finally, to unstake, head to <code>write contract</code> and scroll to the <code>unstake</code> function.</p><p>Input the amount you wish to unstake (it has to be less than the <code>available</code> balance from above). If you had staked multiple times, you can batch unstake by providing the input in an array format <code>[unstake1,unstake2,unstake3...]</code>.</p><p>Sign the transaction with your web3 wallet and pay the gas fee to unstake.</p><p><em>Note: Remember to multiply the AST you wish to unstake by 10,000 to account for decimals!</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/813ddef55c50480207c5cb0fab8066309936a8fe2684e617bb81112b8a125329.png" alt="Connect your wallet to etherscan" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Connect your wallet to etherscan</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/c3942d5e1836ab238bd33131e56e6d67112bca39ab7ab62536939a36e12130a8.png" alt="Enter the amount you wish to unstake, and hit &quot;Write&quot;. You will have to pay a gas fee to unstake" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Enter the amount you wish to unstake, and hit &quot;Write&quot;. You will have to pay a gas fee to unstake</figcaption></figure>]]></content:encoded>
            <author>agrimony-2@newsletter.paragraph.com (agrimony)</author>
        </item>
        <item>
            <title><![CDATA[zkSanta - An idea for a Web3 Secret Santa project]]></title>
            <link>https://paragraph.com/@agrimony-2/zksanta-an-idea-for-a-web3-secret-santa-project</link>
            <guid>MlKv6JpJ60fWPfLSKxqL</guid>
            <pubDate>Wed, 15 Dec 2021 13:00:09 GMT</pubDate>
            <description><![CDATA[Anyone in?This idea just popped into my head, so I’m trying to get it all down before I forget. My web3 dev skills are sorely inadequate for building such a project, so I’m leaving this as an open call to any web3 developer who wants to take it up and attempt to build it before Christmas. I will gladly be the first participant to join in.SummaryzkSanta is a smart contract which opens 1 month before Christmas. Anyone can deposit an NFT into the contract using depositPresent() until 25/12 @ 00:...]]></description>
            <content:encoded><![CDATA[<figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/af7c98c59417215d952c565369f2e1ccad8bbf1aa48f6b5cf6ea8c11041f9666.png" alt="Anyone in?" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Anyone in?</figcaption></figure><p>This idea just popped into my head, so I’m trying to get it all down before I forget. My web3 dev skills are sorely inadequate for building such a project, so I’m leaving this as an open call to any web3 developer who wants to take it up and attempt to build it before Christmas.</p><p>I will gladly be the first participant to join in.</p><h2 id="h-summary" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Summary</h2><p>zkSanta is a smart contract which opens 1 month before Christmas.</p><p>Anyone can deposit an NFT into the contract using <code>depositPresent()</code> until 25/12 @ 00:00 UTC.</p><p>After 25/12 00:00 UTC, all addresses which have deposited NFTs into the contract can call <code>getPresent()</code> which will transfer a random NFT from the contract into their wallet.</p><p><strong>As per the traditional rules of Secret Santa, the random generator should not allow for the wallet to get back the same NFT which was deposited. Furthermore, the contract will need to hide the address from which this present originated (hence the zk bit).</strong></p><p>I have no idea if this is even feasible, or if there are security exploits to watch out for.</p><p>I just want to play zkSanta.</p><p><em>Bonus points if you can make the contract automated every year. Also, if it could be deployed as a factory contract for communities to organize private zkSanta events.</em></p>]]></content:encoded>
            <author>agrimony-2@newsletter.paragraph.com (agrimony)</author>
        </item>
        <item>
            <title><![CDATA[Nishikigoi]]></title>
            <link>https://paragraph.com/@agrimony-2/nishikigoi</link>
            <guid>Ce4nw7IgHWroYVuMEbSo</guid>
            <pubDate>Sat, 20 Nov 2021 15:19:21 GMT</pubDate>
            <description><![CDATA[Some time back I started to learn some p5.js to create a generative art project which I had intended to publish on ArtBlocks. The premise was simple, a basic life simulator, not unlike Conway’s game of life, but focusing more on the animation of the animal itself. The lifeform I chose to emulate was a koi fish which would swim around in a pond. This article is meant to be a walk through the creation process.Starting outArtBlocks has some pretty useful code on their github docs. The code takes...]]></description>
            <content:encoded><![CDATA[<p>Some time back I started to learn some p5.js to create a generative art project which I had intended to publish on <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.artblocks.io/">ArtBlocks</a>. The premise was simple, a basic life simulator, not unlike Conway’s <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">game of life</a>, but focusing more on the animation of the animal itself. The lifeform I chose to emulate was a koi fish which would swim around in a pond.</p><p>This article is meant to be a walk through the creation process.</p><h2 id="h-starting-out" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Starting out</h2><p>ArtBlocks has some pretty useful code on their <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/ArtBlocks/artblocks-docs">github docs</a>. The code takes in a randomly generated hash string (e.g. <code>&quot;0x11ac128f8b54949c12d04102cf…&quot;</code>) and uses that to seed the random number generator (RNG). The RNG is then used to define various parameters of the generative artwork.</p><h2 id="h-lets-make-some-fish" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Let’s make some fish</h2><p>The hardest part is starting. In order to draw a fish using nothing but native shapes, I decided to go with a circle. Lots of circles. Each time it draws a new circle, it moves 1 step to the right and draws a new slightly bigger circle. I had to play around with several formulas for the radius of the circle before I could settle on something vaguely fish shaped.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/4cb62d660632d24e66f2fe48c673727cd644162a0493c2c5f343259827322a3c.png" alt="Looks a bit wrong here..." blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Looks a bit wrong here...</figcaption></figure><p>After that I manually defined several fin and tail looking shapes just to make it look a bit more like a fish. I wanted the fins and tail to be able to wiggle as the fish swims, so it was important to get the rigging set up right. The connection points between the fins / tail and the body of the fish were all manually defined by trial and error.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/484bcde31f602fcc4a25acf803d25c803d3d6fefe198b2171285011ee5dc8ee2.png" alt="Now that looks more like a fish." blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Now that looks more like a fish.</figcaption></figure><h2 id="h-animating-the-fish" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Animating the fish</h2><p>There were 2 animations I wanted the fish to be able to do. <strong>Swim</strong> and <strong>turn</strong>. Swimming was pretty straight forward, since it just meant redrawing the fish at position <code>x+1</code> each frame. Turning would be a bit more tricky since the body of the fish would have to bend.</p><p>This was achieved by drawing each circle slightly bent away from the middle segment of the fish to generate the illusion of turning. Next, I added two parameters which defined the positional <code>(x,y)</code> coordinates of the fish and the <code>angle</code> of facing. With these in place, it is now possible to define the position and heading of each fish.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/56549092d65f1d8eecce74eba7c80b6661a2d2517bd67ff69fbf4f353ef99914.gif" alt="Testing out the turning animation." blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Testing out the turning animation.</figcaption></figure><p>The animations were done in a simple draw loop to start, but there was still something lacking. I needed a way to govern <em>why</em> the fish would move the way they did. My first attempts used a random dice roll to determine when the fish would turn, and by how much - but it didn’t feel quite right.</p><pre data-type="codeBlock" text="for fish in fishes
  fish.display
  fish.move
  if random() &gt; 0.5
    fish.turn(random())
end
"><code><span class="hljs-keyword">for</span> fish in fishes
  fish.display
  fish.move
  <span class="hljs-keyword">if</span> random() <span class="hljs-operator">></span> <span class="hljs-number">0</span><span class="hljs-number">.5</span>
    fish.turn(random())
end
</code></pre><p>Going back to the drawing board, the solution I came up with is to introduce points of interest which the fish would swim towards. Limiting their rate of turning would allow them to keep swimming towards their goal. In my mind, these points might relate to a feeding event, or perhaps just a raindrop hitting the surface of the pond would be enough to pique the interest of the fish.</p><p>I animated this as a ripple on the surface of the water. In addition, it allowed me to include a limited form of interactivity - where once every so often you would be able to “feed“ the fish by clicking on a location and the fish would (slowly) react to it.</p><pre data-type="codeBlock" text="point = random(x,y)

for fish in fishes
  fish.display
  fish.move
  fish.turn(angleBetween(fish, point))
end
"><code>point <span class="hljs-operator">=</span> random(x,y)

<span class="hljs-keyword">for</span> fish in fishes
  fish.display
  fish.move
  fish.turn(angleBetween(fish, point))
end
</code></pre><h2 id="h-making-each-fish-unique" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Making each fish unique</h2><p>Now that we have gotten the basic fish animation down, it’s time to put the final aesthetics into place. We need a way to make each fish uniquely generated!</p><p>I adapted some code for making generative Rorschach patterns from <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://openprocessing.org/sketch/541006/">openprocessing</a> in order to (a) contain the pattern within the fish itself, and (b) to break the symmetry as needed.</p><p>I also created a color palette which I think best reflected the colors of Koi fish, and placed a drop shadow beneath each one to give it a more 3-dimensional feel. If you notice carefully, there are also alternative fin patterns which I built into the program as well to increase the variance.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/69b0f6fadd53f10b919e2032e986ffbbd0b441b1e6639cc8b9f2c17d8922818d.png" alt="Curated set of generated Koi fish" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Curated set of generated Koi fish</figcaption></figure><h2 id="h-putting-it-all-together" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Putting it all together</h2><p>Finally, I wanted to give the piece a bit more atmosphere - so I included some lotus leaves which could float on the top of the pond. The leaves would slowly collide and bounce off each other as they float around the pond. Here’s an easy <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.youtube.com/watch?time_continue=61&amp;v=LO3Awjn_gyU&amp;feature=emb_logo">tutorial</a> to learn how to make something similar!</p><p>Similarly, I created several environmental palettes which would be randomly generated depending on the initial seed. There are a total of 4 environmental palettes and 4 Koi palettes which could be combined, together with the practically infinite number of body patterns on each fish.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/ae734a1a21524b2d89092f664e02200f1ef2c6676658bbd31be12a6a938afebe.png" alt="Snapshots of different environments and fish palettes which could be generated" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Snapshots of different environments and fish palettes which could be generated</figcaption></figure><p>The end piece is intended to be something you could display on your wall as a zen statement piece. The artwork is also theoretically scalable to any display size and aspect ratio, although currently it works best at 800x800 (otherwise filling the space would require rendering too many objects and slows down the animation!).</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/4c9c1f1b25927e4b4eee931d3ba439c60e26dccadf98675c63074ae684da34df.gif" alt="Sample output generated" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Sample output generated</figcaption></figure><h2 id="h-closing-thoughts" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Closing thoughts</h2><p>One thing I was not too satisfied with is the need to hard code in rarity tables. This stops it from being truly generative in my opinion. For example, some palettes are harder to find than others, also the number of fish generated is hard coded according to a rarity table.</p><p>I’m hoping to improve how rarities are generated in future projects. But for now, I have hard coded in an additional surprise as an “ultra-rare“ attribute. Once in a while you might spot a rare lotus flower among the leaves!</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/94b0c6e11f5e94438c330314f8198d3576d320b8fe6308487d0bc4da5dda7495.png" alt="A rare lotus flower has bloomed!" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">A rare lotus flower has bloomed!</figcaption></figure><h2 id="h-et-voila" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Et Voila</h2><p>I hope you enjoyed the run through. While there currently does not exist any NFT for these, I have set up a web server (<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://replit.com/@agrimony/nishikigoi-web">full codebase</a> is open source under CC BY-SA3.0) as an additional utility for <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://metajam.asia/">metajam</a> METAPASS holders in order to showcase how NFTs allows anyone to build on each other in a completely open and permissionless manner.</p><p>The server generates the fish based on the <code>tokenID</code> of the METAPASS NFT(s) held in the connected wallet (in the same idea of <em>synthetic loot</em>). These are <strong>not</strong> NFTs, but you can play with them all the same.</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://nishikigoi-web.agrimony.repl.co/">https://nishikigoi-web.agrimony.repl.co/</a></p>]]></content:encoded>
            <author>agrimony-2@newsletter.paragraph.com (agrimony)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/d934b88f7149069dd98e3cb0330b72a13ffcde82d357e9b2f684c8419af56a4e.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Hello World]]></title>
            <link>https://paragraph.com/@agrimony-2/hello-world</link>
            <guid>bVJ1HpJ3GwLbod26scIk</guid>
            <pubDate>Sun, 07 Nov 2021 05:26:28 GMT</pubDate>
            <description><![CDATA[Starting up a mirror account to explore using this medium as a way to write down some thoughts. Generally interested in building on the web3 space. So far, I’ve helped to build a new community-based DEX with other contributors on AirSwap. You can also find me helping out the Zapper community. I’m also currently exploring the world of coding and generative art, and most likely going to be using this as a way to journal some tutorials and learnings from my experiments. Will also leave some of m...]]></description>
            <content:encoded><![CDATA[<p>Starting up a mirror account to explore using this medium as a way to write down some thoughts.</p><p>Generally interested in building on the web3 space. So far, I’ve helped to build a new community-based DEX with other contributors on <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.airswap.io">AirSwap</a>. You can also find me helping out the <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://zapper.fi">Zapper</a> community.</p><p>I’m also currently exploring the world of coding and generative art, and most likely going to be using this as a way to journal some tutorials and learnings from my experiments.</p><p>Will also leave some of my tests up as NFTs which people can mint if they are interested!</p>]]></content:encoded>
            <author>agrimony-2@newsletter.paragraph.com (agrimony)</author>
        </item>
    </channel>
</rss>