avatarT.S. Johnson

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3786

Abstract

arison operators, and bitwise operators on this type too.</p><p id="c4da">It’s important to note that there is another type, called <code>bytes</code> which is different from the above in that it is a dynamically sized array, and not a value type but a reference type. It is basically shorthand for <code>byte[]</code>.</p><p id="ad39">When you can limit the length of your data to a predefined amount of bytes, it is always good practice to use some of <code>bytes1</code> to <code>bytes32</code> because it is much cheaper.</p><h2 id="0118">Enums</h2><p id="aea7"><b>Enums</b> in Solidity are a way to create user-defined types. Enums are explicitly convertible to integer types, but not implicitly. Enum values are numbered in the order they are defined, starting from 0.</p><p id="ed00">Enums are not part of the ABI (Application Binary Interface — more on this in a later lesson, but it’s basically how you encode Solidity code for the Ethereum Virtual Machine, and how you get data back). This means that if your function returns an <code>enum</code> for example, it will be automatically converted to a <code>uint8</code> behind the scenes. The integer returned is just large enough to hold all enum values. With more values, the size gets increased too (<code>uint16</code> and up).</p><p id="cdb6">The below code, taken from the <a href="https://docs.soliditylang.org/en/v0.4.24/index.html">Solidity docs</a>, defines an enum with four possible values, creates a variable of that enum named <code>choice</code> and a constant called <code>defaultChoice</code>that will hold a default value.</p><div id="cf29"><pre><span class="hljs-keyword">enum</span> <span class="hljs-title class_">ActionChoices</span> { GoLeft, GoRight, GoStraight, SitStill } ActionChoices choice; ActionChoices <span class="hljs-type">constant</span> <span class="hljs-variable">defaultChoice</span> <span class="hljs-operator">=</span> ActionChoices.GoStraight;</pre></div><p id="66a9">Now we can define some functions to interact with our <code>enum</code>.</p><div id="c0bb"><pre><span class="hljs-title function_"><span class="hljs-keyword">function</span> <span class="hljs-title">setGoStraight</span></span>() <span class="hljs-keyword">public</span> { choice = ActionChoices.GoStraight; }

<span class="hljs-title function_"><span class="hljs-keyword">function</span> <span class="hljs-title">setChoice</span></span>(ActionChoices <span class="hljs-keyword">new</span><span class="hljs-type">Choice</span>) <span class="hljs-keyword">public</span> { choice = <span class="hljs-keyword">new</span><span class="hljs-type">Choice</span>; }</pre></div><p id="6bc2">The first one simply sets the <code>choice</code> to <code>GoStraight</code> while the second one sets it to the choice that the caller passes into the function. As we can see after deployment, the <code>setChoice</code> function expects a <code>uint8</code> value, which corresponds to the <code>enum</code> value declared at that number.</p><figure id="e997"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1pKNPVy4UUBCSLi2-SIckg.png"><figcaption>Testing enums in Remix</figcaption></figure><p id="7917">If we want to get the value of <code>choice</code> and <code>defaultChoice</code>, we can define the following functions:</p><div id="1f02"><pre><span class="hljs-keyword">function</span> <span class="hljs-title">getChoice</span>() public view returns (ActionChoices) { <span class="hljs-keyword">return</span> <span class="hljs-type">choice</span>; }</pre></div><div id="43e7"><pre><span class="hljs-function">function <span class="hljs-title">getDefaultChoice</span>() <span class="hljs-keyword">public</span> pure <span class="hljs-title">returns</span> (<span class="hljs-params"><span class=

Options

"hljs-built_in">uint</span></span>)</span> { <span class="hljs-keyword">return</span> <span class="hljs-built_in">uint</span>(defaultChoice); }</pre></div><p id="c2f2">As we can see if we try this out in Remix, the first function returns a <code>uint8</code> while the second returns a <code>uint256</code>.</p><figure id="e514"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*jmaOFb9GhXz7FWC4ONMa_A.png"><figcaption>Testing enums in Remix</figcaption></figure><h2 id="3c7c">Fixed point numbers</h2><p id="2ecc"><b>Fixed point numbers </b>represent fractional numbers by storing a fixed number of digits of their fractional part. No matter how large or small the fractional part is, it will always use the same number of bits.</p><p id="cdcd" type="7">Fixed point numbers are not fully supported by Solidity yet. They can be declared, but cannot be assigned to or from.</p><p id="f872">We can differentiate between signed fixed point numbers, declared with the <code>fixed</code> keyword, and unsigned fixed point numbers, declared with the <code>ufixed</code> keyword.</p><p id="3c1c">It can also be declared as <code>fixedMxN</code> or <code>ufixedMxN</code> where <code>M</code> represents the number of bits the type takes, and <code>N</code> represents the number of decimal points. <code>M</code> has to be divisible by 8 and a number between 8 and 256. <code>N</code> has to be a number between 0 and 80.</p><p id="96e1">They function with the following operators:</p><ul><li>Comparisons: <code><=</code>, <code><</code>, <code>==</code>, <code>!=</code>, <code>>=</code>, <code>></code> (evaluate to <code>bool</code>)</li><li>Arithmetic operators: <code>+</code>, <code>-</code>, unary <code>-</code>, unary <code>+</code>, <code>*</code>, <code>/</code>, <code>%</code> (remainder)</li></ul><h2 id="09b7">Conclusion</h2><p id="bd3a">In this lesson, we looked at what value types are available in Solidity and how each one works.</p><p id="28de">Thank you for staying with us till the end. If you enjoyed reading this piece please keep in touch and follow Solidify to keep up with our lessons on Solidity. In the upcoming articles, we will deep dive into the intricacies of the language, progressing from beginner to advanced level.</p><p id="067c">If you are new to Solidity, check out the previous lessons about setting up a local development environment and writing your first smart contract.</p><div id="6b76" class="link-block"> <a href="https://readmedium.com/how-to-setup-your-local-solidity-development-environment-c4c8195810f3"> <div> <div> <h2>How to Setup Your Local Solidity Development Environment</h2> <div><h3>Get started with smart contract development</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*HHko-o9m1sVngmTeRVYgKA.jpeg)"></div> </div> </div> </a> </div><div id="3ad1" class="link-block"> <a href="https://readmedium.com/lesson-1-your-first-solidity-smart-contract-1ba7e641f9a3"> <div> <div> <h2>Lesson 1: Your First Solidity Smart Contract</h2> <div><h3>In the previous lesson, we looked at how to set up your local Solidity development environment. Here we will continue…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*7r7HSYkbn73NrmR_skvh5w.jpeg)"></div> </div> </div> </a> </div></article></body>

Curation is a Completely Arbitrary Process So Stop Beating Yourself Up About Not Being Curated

Once some baseline metrics are passed, getting curated simply comes down to whether the curator reading your article likes it or not.

Spending time in the Medium Facebook Groups, you will quickly find people who are worrying themselves to death about why they haven’t been curated or why they are currently experiencing a curation drought.

Now I’m going to preface the rest of this article by saying if you’re following the curation guidelines, you’re not making these common mistakes, and your writing is at a certain level, there’s nothing more you can do to get curated.

Well, work on your titles.

Please, goodness, work on your titles.

Once you’ve hit those benchmarks, the only thing you can do is hope the curators like what you’ve written.

Ultimately curation is more about luck than anything else.

And I know this flies in the face of what many Medium gurus will tell you.

They will say if you’re not getting curated, you’re not following the rules.

You aren’t writing well enough for Medium.

You should just try harder.

They’ll also point out to their 80 to 90 percent curation rate and tell you Medium doesn’t play favorites and they just really, really, REALLY worked hard and figured Medium out, and if you just follow their tips you too could boast such an impressive curation rate.

I’m going to call bullshit on all of that.

Here’s why: Once you reach the benchmarks that I mentioned, the only thing that’s going to determine whether or not you’re curated is who is reading your article that day. That’s it.

How do I know that’s the case?

Let’s look at a few of my curated articles to demonstrate how arbitrary the curation process really is:

Article 1: Was Curated on Main Account. Not On the New One.

This was my second most successful article money wise on this account. It was curated in no time at all when I originally published it a couple of months ago.

Since it was finally losing steam, it is one of the first articles I published on my new account, where I was moving all of my sexy content.

I published it in a popular publication in hopes of ensuring it was curated on the new account.

It wasn’t.

Article 2: Not Curated On Orignal Account. Curated On New Account.

This article is an old blog post that I specifically updated with Medium-Esque elements when I published it to the site a couple of months ago in hopes of it being curated.

I thought it had a good shot of being curated.

It wasn’t.

It was also a dud too. It didn’t catch on at all like some of my other non-curated articles, and I don’t think it even had ten fans.

Fast forward to the new account. I publish the exact same article. No changes. It’s curated almost immediately and then goes mini viral racking up 500+ views in less than 48 hours.

Article 3: Not Curated On Original Account. Curated On New Account

This article was published on my original account right before I made the decision to split up my writing and my sexy content.

It wasn’t curated, and I wasn’t expecting it to be. I wasn’t sure how Medium felt about sex toy content, so I wasn’t surprised it got the old “Not distributed in topics” message.

This was one of the first articles published on the new account, and it was almost immediately curated. It is also the most successful post by earnings on the new account.

Article 4: Third Time’s the Charm

Long story short, this is an article I just kept submitting until it got curated. It took three tries, but I got it done, and no, I didn’t change anything in the process.

I thought, when I first wrote it, that it was a curation worthy article. When it wasn’t curated, I decided I would try until it was and one month, and three tries later, it got the curation I thought it deserved when I first published it.

There you have it.

Four really clear cases of the arbitrary nature of curation.

Now because Medium is trying to curate the reading experience for its paid members, timing may play a small role in what gets curated or not.

For example, if two posts on the same topic, both well-written and following the curation guidelines, are published in close proximity to each other, one may get curated, and the other one won’t because they don’t want topic pages filled with similar content.

With that said, that’s likely rare and really has little if anything to do with why the exact same article of mine can be curated in one place and not curated in another with nothing changing but the day it was published.

And these aren’t my only examples just the four I chose to feature.

The above examples are why it is so important that you don’t take not getting curated as a reflection on you or your writing ability. If you can honestly and objectively say you’re meeting all of the curation guidelines and writing quality work, then walk away once you’ve published something and recognize it is completely out of your hands, and there’s nothing you can do about it.

There’s nothing for you to improve on, learn, or stress over.

At the end of the day, most of curations benefits are highly overstated and often perpetuated by people who were writing on Medium at a time when getting curated really had value and mattered in a way that it just doesn’t now.

So, to end this, yes, you should write to get curated. No, you should not stress yourself out about not being curated if you are following all the rules and producing high-quality content that Medium members will find useful and valuable.

Just remember this if you are doing all of the above and still feeling down about your curation woes:

It’s not you. It’s Medium. So you have nothing to feel badly about.

This is How I Made $135 Dollars in My First 30 Days On Medium

Only seven to nine percent of writers make at least $100 each month on Medium. I did it in my first month. Here is what I did each week to achieve my goal, hopefully, you can use my journey to $100 a month to achieve yours.

If you enjoyed this case study check out my latest case study:

How to make $100 a week on Medium.

Content Marketing
Curation
Medium
Writing
Life Lessons
Recommended from ReadMedium