A look into the $WXM smart contract (2024)

While the code of the $WXM token smart contract is not publicly available yet, it’s very close to being finalized. Here are some insights on its design and the decisions we’ve made.

A look into the $WXM smart contract (1)

Published in

WeatherXM

·

5 min read

·

Feb 28, 2023

--

WeatherXM stands at the intersection of Meteorology, Internet of Things (IoT) and Web3. This is the first article in a series that will present various Web3 aspects of the project, while explaining the fundamentals of Web3 to members of our community that don’t have a Web3 background.

For the purposes of this article, you can think of an ERC20 token as a two-column table together with some code that lives on the Ethereum blockchain: one column holds wallet addresses and the other one their token balances.

A look into the $WXM smart contract (3)

Each token implements its own table and functions, so there’s one for $UNI, one for $DAI, one for $AAVE and so on.

The contents of this table can usually be changed using the transferFrom function which is implemented by the code of the token smart contract:

transferFrom(from, to, amount) deducts an amount from one wallet and adds the amount to an other. It can only be called by the wallet that holds the amount (the “from” address).

According to the standard, an ERC20 smart contract has to implement some more functions such as balanceOf(), approve() and allowance() that are not important for the scope of this article.

Also, a token contract may have more functions to support functionality like minting new tokens, burning tokens, pausing/unpausing the contract, staking or do other exotic stuff. For example, some ERC20 tokens have an blacklist that blocks transfers to or from blacklisted addresses.

Most users do not check the source code of a token’s smart contract. They trust that auditors, the developer community and that other users with higher stakes than them have done a good job checking it. This is why most smart contracts make their source code available to the public.

However, it’s good to have in mind that:

  1. ERC20 tokens are not “in your wallet”. Your balance is kept in a smart contract that the creator of the token wrote and it’s governed by the rules implemented by the smart contract code. (This is why we call it a “contract”.)
  2. When you transfer ERC20 tokens, you (usually your wallet) just tell the token’s smart contract to reduce your balance and increase someone else’s balance.
  3. The reason why such a system can be trusted is that the smart contract “lives” on the blockchain which means that its rules will be followed to the letter and that they can not change (unless the smart contract has said so in advance, something known as upgradable contracts).

Now that we have an understanding of how ERC20 tokens work, let’s see how $WXM, the token of the WeatherXM Network was designed.

$WXM is programmed to have a maximum supply of 100,000,000 tokens. But it does not have a fixed supply: After reaching the 100,000,000 limit, if tokens are burned and the total supply drops, then new tokens can be minted again as long as the total supply does not exceed 100,000,000.

In addition to the standard ERC20 functions, like transferFrom() described above, there is a mint() function that creates new tokens, and a burn() function that burns tokens.

The mint() function was implemented with the following in mind:

  • Anyone can call the mint() function at any time, but if it’s called more than once in a day, it will revert with an error. This means that while the WeatherXM company will make sure it’s called once daily, according to the schedule laid out in the Whitepaper, minting does not depend on the company.
  • If mint() is not called for more than a day, then it can be called consecutive times. For example, if mint() has not been called for two days, mint() can be called three times and it will generate the tokens that corresponded to the “missed” days.
  • As expected, mint() can not generate new tokens if the total supply of $WXM exceeds 100,000,000, in which case it will revert with an error.
  • The $WXM contract is Ownable. There is an “owner” address that can pause/unpause the contract and also update the destination address where newly minted tokens are sent.

The destination of newly minted tokens will be an other smart contract that distributes them to station owners (rewards), the company, its investors, and the pools described in the Whitepaper.

No other special permissions are granted to the owner of the contract. Once the infrastructure has been tested and the WeatherXM ecosystem has matured, ownership of the contract can be transferred to the DAO or it can be renounced (after which point no one can use the “admin” functions).

The burn(amount) function can also be called by anyone. It will destroy the amount of tokens, provided that the caller has enough balance to do so. This is a very simple and “dumb” function and it will rarely be used on its own. It is intended to be used by the BurnPool contract that implements the burn mechanism as described in the Whitepaper (expect a separate article on this).

Finally, the $WXM smart contract is not upgradable, which means that the way it works cannot be changed by anyone.

The $WXM ERC20 contract is an ERC20 contract that has been kept simple on purpose because it is the foundation of the WeatherXM ecosystem and it will not be upgradable.

It ensures that new tokens are minted according to the schedule described in the Whitepaper and that the total supply does not exceed 100,000,000. It also allows minting of new tokens when the supply drops bellow 100,000,000 due to token burns.

The only special permissions granted to the contract owner are the ability to pause/unpause the contract and to change the destination address of the newly minted tokens. Ownership will eventually be renounced or transferred to a DAO.

WeatherXM is building the fastest growing global weather network in the world. You can learn more about the project at weatherxm.com.

A look into the $WXM smart contract (2024)

FAQs

What is smart contract answer? ›

Smart contracts are typically used to automate the execution of an agreement so that all participants can be immediately certain of the outcome, without any intermediary's involvement or time loss. They can also automate a workflow, triggering the next action when predetermined conditions are met.

How to check if a smart contract is legit? ›

Input the address into a block explorer's search bar. Many of these, including Etherscan, will tell you if the code is verified or not, as highlighted below. You can also check to see if the contract has a name — if it doesn't it could be either very new or untrustworthy.

How to cancel a smart contract on Trust Wallet? ›

How to revoke token approvals and permission of smart contracts on Ethereum
  1. Step 1: Revoke access tools. Users can track and revoke smart contracts connected to their addresses using several third-party revoke access tools. ...
  2. Step 2: Connect the wallet. ...
  3. Step 3: Select smart contract. ...
  4. Step 4: Revoke access.
Jan 27, 2024

What is the smart contract? ›

A smart contract is defined as a digital agreement that is signed and stored on a blockchain network, which executes automatically when the contract's terms and conditions (T&C) are met. The T&C is written in blockchain-specific programming languages such as Solidity.

What is an example of a smart contract? ›

Think of a smart contract like a vending machine. When you insert a dollar, you get a co*ke. The machine follows built-in rules, similar to if-then statements in code.

Is a smart contract legal? ›

But while a smart contract can be a legally binding agreement, it isn't necessarily always legally binding. A smart contract still has to meet all the legal requirements of a contract, such as intent to form a contract. And these legal requirements might also vary by jurisdiction.

How to spot a bitcoin scammer? ›

Signs of crypto scams include poorly written white papers, excessive marketing pushes, and get-rich-quick claims. Regulatory agencies, such as your state's consumer protection office or the Consumer Protection Bureau, are the best places to contact if you suspect you've been the victim of a scam.

Who actually uses smart contracts? ›

Real estate transactions, stock and commodity trading, lending, corporate governance, supply chain, dispute resolution, and healthcare are only a few examples where smart contracts are theorized to have use.

How do you make money with smart contracts? ›

Opportunities to Earn with Smart Contracts
  1. Lending and borrowing - Supply assets to liquidity pools and earn interest from protocols like Aave and Compound.
  2. Liquidity mining - Provide liquidity to DEXs like Uniswap and Balancer to earn trading fees and rewards.
Nov 13, 2023

Can you destroy a smart contract? ›

The destroy function can only be called by an owner and will only succeed if all owners have confirmed their agreement. If these conditions are met, the selfdestruct function is called, and all Ether stored in the contract is sent to the receiver address.

Can a smart contract drain wallet? ›

The fact that attackers can set up a contract before deploying it (before it even exists), using a wallet address that doesn't have a history of malicious activity, means that if they can get the victim to approve a contract they can drain their funds.

Can you withdraw from a smart contract? ›

Add a Withdraw Function

This function will send all funds stored in the Smart Contract to the person who calls the "withdrawMoney()" function.

What are smart contract hacks? ›

Smart contract hacking involves identifying and exploiting vulnerabilities within decentralized applications. White hat hackers play a crucial role in securing blockchain protocols and smart contracts. Building a foundation in blockchain fundamentals and Solidity programming language is essential.

What are the top 10 smart contracts? ›

The top 10 best smart contract platforms in 2024 are Ethereum, Binance Smart Chain (BSC), TRON, Arbitrum, Cardano, Solana, Polygon, Algorand, Avalanche, and Tezos.

Can anyone call a smart contract? ›

Generally speaking, anyone can call a smart contract. Smart contracts can even call other smart contracts. This functionality is useful when minting new tokens.

What is the best description of smart contract? ›

A smart contract is a self-executing program that automates the actions required in a blockchain transaction. Once completed, the transactions are trackable and irreversible.

What is the main advantage of a smart contract? ›

Benefits of Smart Contracts

Smart contracts do not need brokers or other intermediaries to confirm the agreement; thus, they eliminate the risk of manipulation by third parties. Moreover, the absence of an intermediary in smart contracts results in cost savings.

Are smart contracts a good idea? ›

Pros of Smart Contracts

Trustworthiness: If stored on a decentralised blockchain, such as Ethereum, there's no risk of tampering or altering the contract once deployed. Both parties can have complete trust in the contract's execution.

Top Articles
Tularämie - Infektionen - MSD Manual Ausgabe für Patienten
Inmate Commissary Purchases and FAQ
Mickey Moniak Walk Up Song
Avonlea Havanese
Heska Ulite
Snowflake Activity Congruent Triangles Answers
Strange World Showtimes Near Cmx Downtown At The Gardens 16
Declan Mining Co Coupon
Whitley County Ky Mugshots Busted
Purple Crip Strain Leafly
C Spire Express Pay
Lenscrafters Huebner Oaks
finaint.com
6813472639
Best Nail Salon Rome Ga
Breckie Hill Mega Link
Boscov's Bus Trips
Georgia Cash 3 Midday-Lottery Results & Winning Numbers
Somewhere In Queens Showtimes Near The Maple Theater
Azur Lane High Efficiency Combat Logistics Plan
Academy Sports Meridian Ms
Construction Management Jumpstart 3Rd Edition Pdf Free Download
2000 Ford F-150 for sale - Scottsdale, AZ - craigslist
Bolsa Feels Bad For Sancho's Loss.
No Limit Telegram Channel
Usa Massage Reviews
1636 Pokemon Fire Red U Squirrels Download
Delta Math Login With Google
Federal Express Drop Off Center Near Me
Calvin Coolidge: Life in Brief | Miller Center
Prévisions météo Paris à 15 jours - 1er site météo pour l'île-de-France
Ripsi Terzian Instagram
Tra.mypatients Folio
Kelsey Mcewen Photos
How to Destroy Rule 34
Frcp 47
3302577704
Bianca Belair: Age, Husband, Height & More To Know
Dispensaries Open On Christmas 2022
Mugshots Journal Star
Saline Inmate Roster
Is Ameriprise A Pyramid Scheme
Craigslist Rooms For Rent In San Fernando Valley
Toomics - Die unendliche Welt der Comics online
Gabrielle Abbate Obituary
Random Animal Hybrid Generator Wheel
Rescare Training Online
Menu Forest Lake – The Grillium Restaurant
Erica Mena Net Worth Forbes
Craigslist Psl
Amourdelavie
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6120

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.