units in solidity

The solution for “units in solidity” can be found here. The following code will assist you in solving the problem.

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

contract MyUnits {
// 1 wei == 1;
// 1 gwei == 1e9;
// 1 ether == 1e18;
//we can use ether and gwei which will convert to wei automatically
uint256 costOfNFT = 0.05 ether;

// 1 == 1 seconds
// 1 minutes == 60 seconds
// 1 hours == 60 minutes
// 1 days == 24 hours
// 1 weeks == 7 days
//we can use hours,days and weeeks which will change to seconds
uint256 levelUpRate = 1 hours;
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts