This file contains hidden or 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.9; | |
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
import "@openzeppelin/contracts/security/Pausable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; | |
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; |
This file contains hidden or 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.0; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
//import "@openzeppelin/contracts/token/extensions/ERC20Burnable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/security/Pausable.sol"; | |
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; | |
This file contains hidden or 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.7.0 <0.9.0; | |
contract CollegeData{ | |
struct Student{ | |
uint rollNo; | |
string name; | |
string class; |
This file contains hidden or 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.2 < 0.9.0; | |
contract EtherGame{ | |
uint public targetAmount; | |
address public winner; | |
constructor(){ | |
targetAmount = 7 ether; |
This file contains hidden or 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: GPL-3.0 | |
pragma solidity >=0.7.0 < 0.9.0; | |
contract CrowdFunder{ | |
//variables set by the creator | |
address public creator; | |
address payable public fundRecipient; | |
uint public minimumToRaise; | |
string campignUrl; |
This file contains hidden or 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: GPL-3.0 | |
pragma solidity >=0.7.0 < 0.9.0; | |
contract Freelancer{ | |
address public owner; | |
uint256 private coins; | |
uint256 private cash; | |
bytes32 private service; | |
This file contains hidden or 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: GPL-3.0 | |
pragma solidity >=0.7.0 < 0.9.0; | |
contract SimpleBank{ | |
mapping(address => uint) private balances; | |
address public owner; | |
This file contains hidden or 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
// Now, the basics of Solidity | |
// 1. DATA TYPES AND ASSOCIATED METHODS | |
// uint used for currency amount (there are no doubles | |
// or floats) and for dates (in unix time) | |
uint x; | |
// int of 256 bits, cannot be changed after instantiation | |
int constant a = 8; | |
int256 constant a = 8; // same effect as line above, here the 256 is explicit |
This file contains hidden or 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: GPL-3.0 | |
pragma solidity >= 0.7.0 < 0.8.18; | |
contract Ballot{ | |
struct Voter{ | |
uint weight; | |
bool voted; | |
address delegate; |
This file contains hidden or 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: GPL-3.0 | |
pragma solidity ^0.8.0; | |
contract Ownable{ | |
address public owner; | |
event OwnershipTransferred(address indexed _previousOwner, address indexed newOnwer); | |
modifier onlyOwner{ | |
require(owner == msg.sender,"Only Owner can access this"); |