General Thread for practicing question formatting #1838
Replies: 5 comments 2 replies
-
function transfer(uint256 amount, address receiver) public {
balance[receiver] += amount;
balance[msg.sender] -= amount;
} this is a practice code for formatting. |
Beta Was this translation helpful? Give feedback.
-
Only for practice: function fund() public {
// payable change the function to be able to get currency
// Want to be able to set a minimum amount of ETH
// 1. How do we send ETH to this co
require(msg.value.getConversionRate() >= MINIMUM_USD, "Did not send enough"); // // 1e18 == 1 * 10 ** 18
funders.push(msg.sender); //
addressToAmountFunded[msg.sender] += msg.value; //
} On this function I am running into an error:
Can someone help? |
Beta Was this translation helpful? Give feedback.
-
For Practice: function oldWay() public pure returns (uint8){
uint8 num = 255;
unchecked{num = num+1;}
return num;
} Is there any reason to use unchecked{} nowadays? The only use case I can think of is a hacky way to intentionally overflow as an alternative to resetting a value manually. |
Beta Was this translation helpful? Give feedback.
-
For practicing question formattingfunction addPerson(string memory _name) public{
people.push(People(_favoriteNumber,_name));
nameToFavouriteNumber[_name]=_favoriteNumber;
} Hey, i ran into an error and it says:
Looking forward for answers, Thanks! |
Beta Was this translation helpful? Give feedback.
-
For practice only pragma solidity 0.8.0; On this solidity version I'm running into an error:
Can someone provide assistance? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have this function for getting conversion rate:
and I am getting following error when trying to compile:
Can somebody help?
Beta Was this translation helpful? Give feedback.
All reactions