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.24; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
contract MyToken is ERC20 { | |
constructor() ERC20("MyToken", "MT") { | |
_mint(msg.sender, 1000000 * (10 ** uint256(decimals()))); | |
} | |
} |
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: MIT | |
pragma solidity ^0.8.20; | |
contract MessageApp { | |
string name; | |
function setTheName(string memory _name) public { | |
name = _name; | |
} |
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: MIT | |
pragma solidity ^0.8.23; | |
contract pureView{ | |
struct Class{ | |
uint year; | |
uint id; | |
} |
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: MIT | |
pragma solidity ^0.8.7; | |
contract Message { | |
address public sender; | |
uint256 public value; | |
uint256 public gas; | |
uint256 public gasPrice; | |
uint256 public blockNumber; |
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: MIT | |
pragma solidity ^0.8.17; | |
contract EventContract { | |
uint public counter = 0; | |
event LogAddress(address indexed _sender, string _message); | |
event LogDeposit(address indexed _from, uint _amount, string _message); | |
event LogValueIncrease(address indexed _owner, uint _oldValue, uint _newValue, string _message); | |
function emitEvents() public payable { |
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: MIT | |
pragma solidity ^0.8.24; | |
contract Deposit { | |
// this maps the balance to the address of the depositor | |
mapping(address => uint256) public balances; | |
function deposit() external payable { |
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: MIT | |
pragma solidity 0.8.22; | |
import "contracts/school.sol"; | |
contract factory { | |
School public cms; // Here we are defining the variable cms with the type School which corresponds with the name of the contract we imported. | |
function CreateSchoolCms() public { | |
cms = new School(); | |
} |
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: MIT | |
pragma solidity ^0.8.18; | |
contract School { | |
address public principal; | |
mapping(address => bool) public teachers; | |
mapping(address => Student) public students; | |
struct Student { | |
string name; |
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: MIT | |
pragma solidity ^0.8.20; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
// import "@openzeppelin/contracts/utils/math/Math.sol"; | |
// import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; | |
import "./Blessed.sol"; | |
import "./BlessedWETH.sol"; | |
import "./interface/IWETH.sol"; |