avatarMichele Pittman

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>

How to Shop While Black

Don’t lose your cool but do assert your right to be there

Photo by Lotus Head from FreeImages

Christmas is over, but plenty of people continue to crowd the stores, returning unwanted gifts, taking advantage of after-holiday sales, and spending their gift cards on items they’ve been eyeing for months.

And all across America, across the world, sales clerks will follow Black customers, or any customers of color, around those stores in pursuit of confirmation of their biases.

It happens. That sounds flippant, I know, but it’s a fact of life for Black people. You won’t get past the Clinique counter before you pick up a shadow.

The point is, it’s no longer surprising. But what it does to your psyche...

You feel less than. You feel resigned. You feel shame.

That’s how I felt when my sister and I were followed around a store while out Christmas shopping recently.

I need to give you the context from which this guide was born. Each person’s context will be slightly different, tinged by their own experiences and biases. Still, it may help to imagine yourself following my advice if you can first picture yourself in my shoes.

My sister and I are what some people, mostly Black people, refer to as “light-skinned,” which is to say we’re Black. Black is black. Outside actual hue, there is no degree of Blackness. The one-drop rule is in full force and effect.

So there we are, shopping in a small local store that I frequent often. The store sells things like body jewelry, incense, crystals. You get the picture.

I’ve never had any issue being Black in this store, but that day, we were the only customers — at least to the sales clerk who glued herself to us. Each time one of us turned around, there she was. If one of the White customers had needed help, that would be a problem because the sales clerk had made it her full-time job to accompany us everywhere we went instead of helping customers.

It became painfully obvious that she was following us because we were two Black women in a store full of white folks, and by our skin color, we were not to be trusted. I can’t tell you why she arrived at her conclusion or why she understood us to be inferior. Who knows why anyone chooses to hate?

You want to know how this story ends, and we’ll get to that. But it’s still kinda sorta the holiday season, so you must know how to handle the situation if you are caught shopping while Black.

As soon as you realize you’re being followed, watch your hands.

I can’t stress enough how important this step is. It’s the same concept behind keeping your hands on the wheel in full view if police ever pull you over.

This is not the time to go digging into your purse for anything, got it? You know you’re looking for something to remove presumably, such as your phone or wallet or even a list. What it looks like to the follower? The exact opposite. If you choose to skip this step, be prepared to be subjected to a “new store policy” where all customers’ bags are searched for absolutely no reason.

Don’t start whipping your head around to look for your shopping companion or see where the store clerk is now. That action will be seen as furtive, inviting further scrutiny.

Don’t let on that you’re aware of being followed. You run the risk of the entire incident becoming a farce. You’re staring at them, they’re staring at you, it devolves into dirty looks, and once again, you’ve confirmed their bias. What could have been an opportunity has become a passive-aggressive game of chicken. And this is too important to be reduced to a game.

Continue to shop.

This step is super important for two reasons:

  1. If you leave the store at that moment, you risk validating the sales clerk’s bigotry. She assumes you’re on to her, and unwilling to be caught stealing, you decide to exit. You’ve done no favors for future Black customers.
  2. You belong there! If you allow the sales clerk’s racism to drive you from the store, you’ll always feel like the person she thinks you are. You’ve made yourself less than, and I can promise that you will relive that incident over and over, ashamed you didn’t stay and searching inside yourself for the reason why.

Try not to engage with the follower.

The thing is, confrontational outcomes can’t be predicted. It’s going to end in a peaceful resolution satisfactory to all, or it’s going to end badly. The outcome can land somewhere in the middle, but none of it is satisfying to the shopper.

There’s another, bigger reason you shouldn’t engage with the follower. White fragility has given birth to the Angry Black Woman trope. You must do everything you can to avoid perpetuating this myth.

Carolyn West, an associate professor of psychology at the University of Washington Tacoma, defines the Angry Black Woman stereotype as:

“…a template for portraying almost all Black women…where passion and righteous indignation is misread as irrational anger and used to silence and shame Black women who dare to challenge social inequalities, complain about their circumstances, or demand fair treatment.”

The Angry Black Woman is the Ineffective Black Woman.

And finally, make management aware.

You would be surprised how often one sales clerk's actions are perceived to be their workplace culture. Anyone with a social media account knows that they wield particular power as an aggrieved consumer. Be careful with this power. Irreparable harm to someone’s business is not a resolution to the bigger problem they urgently have and may not be aware of.

Make them aware. Ask to speak to the manager and do so privately. Give the benefit of the doubt. Please don’t assume the store is aware and has cosigned their employee’s behavior.

But wait…

You want to know if I followed my own advice when this happened to me. I did, but I’ll be honest, I didn’t want to. I wanted to drop my purchases right there in the middle of the store and scream, “Why am I untrustworthy because my skin is darker than yours?!” But I knew that would serve neither my sister nor me nor future Black customers.

And I really needed the items I had come for.

As soon as I realized that I was being followed, I subtly confirmed with my sister that what was happening was really happening.

We continued to shop.

We were careful to keep our hands out in the open and not dig in our purses for anything until we were at the register, and our actions were fully visible.

We left the store.

We sat in the car. Tears threatened to spill over my eyes, but my sister is a little more hardened to this kind of behavior in the small, predominantly White town she lives in.

“What do you want to do,” she asked me.

“I don’t think I can let this go,” I said.

“So you’re going back in?”

“I’ll be right back.”

I headed back in and explained to the store manager what happened. I didn’t use language that allowed him to make me doubt what I saw and felt. I didn’t say, “I think your employee…,” but instead said, “My sister and I were followed around your store …” I let him know that I shopped there frequently and I didn’t think our experience today was indicative of the store’s culture but was compelled to let them know what happened.

I felt it was important to speak to this man as an educated, intelligent, and articulate Black woman. And I hated that even this part of the incident had to be well thought out and strategic with words chosen for their ability to convey something about me that I didn't feel I needed to prove. But I did if I wanted to be taken seriously.

He was horrified. He was mortified and could not apologize enough.

I left the store again, knowing that I could live with myself and that maybe I had made it a little easier for the next Black customer. At least in that store.

Be Open Says;

Culture
Life Lessons
Black Women
Be Open
BlackLivesMatter
Recommended from ReadMedium