This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content="IPFS-Website With Unstoppable Domain"/> | |
<meta name="author" content="IPFS-Website With Unstoppable Domain" /> | |
<title>0xpampam.blockchain</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract Parent { | |
function add(uint _a, uint _b) public pure returns (uint) { | |
return _a + _b; | |
} | |
function getBalance() public view returns (uint) { | |
return address(this).balance; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract VariablePacking { | |
//Example of an unpacked variable | |
Struct Unpacked { | |
uint128 a, | |
uint256 b, | |
uint128 c | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract A { | |
function foo() virtual public pure returns (string memory) { | |
return "Foo from A"; | |
} | |
function boo() public pure returns (string memory) { | |
return "Boo from A"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract CustomError { | |
error InsufficientBalance(uint balance, uint withdrawAmount); | |
function testCustomError(uint _withdrawAmount) public view { | |
uint bal = address(this).balance; | |
if (bal < _withdrawAmount) { | |
revert InsufficientBalance({balance: bal, withdrawAmount: _withdrawAmount}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.0; | |
contract Donation { | |
// input your default donor address | |
address public donor = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4; | |
uint constant DONATION_FEE = 2 ether; | |
modifier onlyDonor() { | |
require(msg.sender == donor,"Only buyer can call this."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library arithmetic { | |
function add(uint _a, uint _b) returns (uint) { | |
return _a + _b; | |
} | |
} | |
contract C { | |
using arithmetic for uint; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library arithmetic { | |
function multiply(uint _a, uint _b) returns (uint) { | |
return _a * _b; | |
} | |
} | |
contract C { | |
uint timesUp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.0; | |
contract DepositEther { | |
event Deposit( | |
address indexed _from, | |
uint indexed _id, | |
uint _value | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: Unlicensed | |
pragma solidity ^0.8.0; | |
abstract contract HelloWorld { | |
string public message; | |
constructor(string memory _message){ | |
message = _message; | |
} |
NewerOlder