In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the etheric unit and time unit of Solidity". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the Solidity etheric unit and time unit"?
Monetary unit (Ether Units)
A numeric constant (literal) is followed by a suffix wei, finney,szabo, or ether, which is the monetary unit. Different units can be changed. The default unit without any suffix is wei. The different conversion relationships of etheric currency units are as follows:
1 ether = = 10 ^ 3 finney = = 1000 finney
1 ether = = 10 ^ 6 szabo
1 ether = = 10 ^ 18 wei
Episode: the etheric coin unit is actually the name of the cryptographer, the founder of etherifang to commemorate their contribution in the field of digital currency. They are: wei: Wei Dai Dai Wei cryptographer, published B-money finney: Hal Finney Finney cryptographer, workload proof mechanism (POW) proposed szabo: Nick Szabo Nixabo cryptographer and originator of the intelligent contract.
We can use the following code to verify a transformation relationship:
Pragma solidity ^ 0.4.16 X contract testUnit {function tf () public pure returns (bool) {if (1 ether = = 1000 finney) {return true;} return false;} function ts () public pure returns (bool) {if (1 ether = = 1000000 szabo) {return true;} return false } function tgw () public pure returns (bool) {if (1 ether = = 100000000000000000000 wei) {return true;} return false;}} time Unit (Time Units)
Unit of time: seconds, minutes, hours, days, weeks, years can be used as suffixes and converted to each other. The rules are as follows:
1 = 1 seconds (default is seconds)
1 minutes = = 60 seconds
1 hours = = 60 minutes
1 days = = 24 hours
1 weeks = 7 days
1 years = 365 days
Using these units to calculate dates requires special care, because there are not 365 days a year, and there are not 24 hours a day, because there are leap seconds. Since leap seconds cannot be predicted, it must be updated by external predictions (oracle) to obtain an accurate calendar library.
These suffixes cannot be used for variables. If you want to specify different units for the variables you enter, you can use the following ways:
Pragma solidity ^ 0.4.16 X contract testTUnit {function currTimeInSeconds () public pure returns (uint256) {return now;} function f (uint start, uint daysAfter) public {if (now > = start + daysAfter * 1 days) {/ /.}} so far, I believe you have a deeper understanding of "Solidity etheric unit and time unit". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 257
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.