avatarPatrick Paul Garlinger

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>

Spiritual Healing

Why Forgiveness Is Your Superpower

It’s your power to rewrite the past.

Image by Eduin Escobar from Pixabay

When I was 10 years old, my father abruptly left our family. For years, I resented him for leaving. I remember the look on my mother’s face as she came home from an EMT overnight shift, and was standing there holding a letter, tears running down her face. The day before, while she was at work, he had pulled me and my two siblings together in the living room to announce that he was asking her for a divorce.

Most of our post-divorce visits were perfunctory trips to fast-food joints where he would buy us a soda, and we’d sit and listen to him ramble about getting his Master’s degree in physics (he was working on light optics of some kind), and his work in electronics (he would eventually work for Panasonic). As you might imagine, my siblings, who were all younger than me, and I did not have much to contribute to the conversation.

When I was 18, he sent another letter to my mother, informing her that as of my 18th birthday, his “obligation” to me was over and that would be his final child support payment. It was the beginning of a deep fracture that, while we tried to mend, never really did. While in college, despite making efforts to call and write letters, I didn’t feel any connection to him, and our relationship faded.

Many years later I would learn that my father died from complications related to diabetes.

It took several more years for me to forgive him.

Forgiveness Is An Act of Self Love

What it really comes down to is the clearness of heart to stop defining who I am by those who have hurt me….

— Mark Nepo, The Book of Awakening

The common sense understanding of forgiveness is that we release someone from some claim that they did us wrong. Just like “forgiving” a debt, we let go of our grievance to another person. And the way we typically forgive, by saying “I forgive so-and-so,” suggests that it’s something you do to or for the other person. You’re somehow reaching a judgment that calls for benevolence rather than vengeance, and you relinquish any claim or demand for justice.

But the reality is that forgiveness is primarily for ourselves. It is an act that allows us to let go of the anger, frustration, pain, sadness, and grief that we carry around in our hearts and that is directed at this other person. The reason we forgive is that carrying around deep anger and resentment is like poison to our souls. You and the other person remain tethered by your feelings. So when you forgive, you are freeing yourself, and this other person, from that emotional strife and baggage.

We should start to think of forgiveness as a kind of superpower. Yes, a superpower to heal yourself and others. It’s not just an act where you let go of your pain. It’s an act of liberation from a moment in time in which you and another person are still imprisoned.

It’s important to say what forgiveness is not: It’s not saying that what the person did was right. It’s not saying that the person should be allowed to do it again. It’s not saying that you have to forget that it happened. Forgiveness is, ultimately, an act of love for yourself because it’s simply saying that you let go of the anger and despair that this occurred.

In that way, forgiveness is also not a way to bypass our feelings. It’s okay to feel anger and grief, especially if those feelings are fresh. Feelings and emotions are meant to be experienced fully. It’s just that we don’t want to live from those places. We don’t want to live from our wounds. So when you forgive, you are saying that you are a powerful person who can take responsibility for your emotions and, therefore, this event doesn’t have emotional power over your life.

Forgiveness Is Your Power to Rewrite the Past

[When] we re-imagine the past in the light of our new identity, we allow ourselves to be gifted by a story larger than the story that first hurt us and left us bereft.

— David Whyte, “Forgiveness”

For me, the true power of forgiveness is that it resets the clock by rewriting the past. That doesn’t mean the event goes away or that the event didn’t happen. It means that you are now creating a new meaning for that event, with a new emotional relationship to what transpired. The pain and interpretation you had for that moment in your life, which is what really matters, is what you get to rewrite

The meaning that you gave that event, the grievance you continue to nurse, is a story. You created a story line to reflect your feelings. That story line is almost always one of pain and victimization and harm by another. What happened emotionally, rather than the plain facts of what occurred, turns on your perception and perspective.

A typical story that requires forgiveness goes something like this: Someone in your life said or did something to you, and you felt a lot of pain around it. What this person did or said caused you harm, and now you hold anger and resentment toward this person, waiting for an apology or some kind of amends. If you haven’t forgiven, you’re still telling yourself that same story, and you’re still nursing the same grievance. Those feelings may have softened a bit, but they can usually be stoked by thinking about what happened.

Forgiveness doesn’t deny the past, but it allows you to create a new story of empowerment and jettison the old one that made you a victim.

It starts by recognizing a fundamental truth — and many people recoil when they first hear it — but you need to listen closely: The reason what this person said or did hurt you is because it had meaning for you. You believed that what they did or said meant something, that it said something about you. And you believe it to be true.

You have to accept that you’ve created this meaning because that’s what the wounded part of you can’t give up. It was hurt by this meaning, what this story said about you, and the emotions that story brought with it. The way to unwind that meaning is to recognize that it’s not necessarily true. Instead, go in search of the story that identifies the wound from which your perpetrator acted.

How Do You Rewrite Your Pain Story?

So we will be able to forgive if we can place ourselves in another’s shoes; if we are less concerned with judgment, and more with understanding….

— Piero Ferrucci, The Power of Kindness

Allow me to circle back to my father. While I still carried around the resentment of his abandonment, my ten-year-old self had internalized the belief that there was something wrong with me. My only solution — the only hope of getting his attention and, by extension, his love — was to be smart, the kind of guy who could talk about smart things like my father liked to discuss.

When I learned my father had died, I was reconnected with his sister, my aunt, whom I had cherished as a kid. We reunited in person, and I began to learn about my father’s life during the previous 20 years when we had been estranged. And what I learned inspired great sympathy. I learned that his father had belittled him ceaselessly, criticizing his intellect and making my father profoundly insecure. His solution was to become very smart — to try to win his father’s affection.

The pattern had replicated itself with me, except that we ended up not being a part of each other’s lives — his wound begat my wound. But when I understood what he had gone through, and how his life had been spent trying to prove that he was smarter than the next guy, and how it had embittered him, I finally understood that my father didn’t know how to love any differently. The afternoons in the fast-food joint with him prattling about optics and electronics was his language of love, and as boring as it was to me, it was the only way he knew how to express love.

In that way, I was able to rewrite the story: I forgave him because it wasn’t the story of a young boy whose father didn’t love him and spent every other Saturday narcissistically talking about himself. No, it was the story of a father whose only language of love was science and math, and who spent his time talking about science and math with his kids.

And that’s what you realize when you genuinely forgive: The story you told was about the emotional impact on you. But the real story is the other person’s wound. That’s not to invalidate your feelings. Yes, you felt pain — I did. It was painful to feel like my dad didn’t love me. But that pain was not the truth — it was the pain of my story about what happened. The true story was that my father didn’t know how to love me so that I recognized it as love. That was his limitation.

This is the long and often bumpy road to forgiveness. You won’t always know what the other person’s wound is, but you can begin by recognizing that most often, you need to let go of the part of you that felt, or maybe still feels, wounded, and find a new story, a new meaning to that event. In that way, you can feel compassion for someone’s deep pain and how they never healed it. When you do, you give yourself the freedom to forgive them for their actions, and yourself for holding onto the story of your pain for so long.

Thanks to Diana C. for this week’s prompt:

Forgiveness
Spiritual Growth
Self Improvement
Self Love
Relationships
Recommended from ReadMedium