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.4; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
contract Exchange is ERC20 { | |
address public cryptoDevTokenAddress; | |
// Exchange is inheriting ERC20, becase our exchange would keep track of Crypto Dev LP tokens | |
constructor(address _CryptoDevtoken) ERC20("CryptoDev LP Token", "CDLP") { |
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; | |
contract Wallet { | |
address[] public approvers; | |
uint256 public quorum; | |
struct Transfer { | |
uint256 id; | |
uint256 amount; | |
address payable to; |
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.4; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; | |
contract Erc20Token is ERC20("Chop I Chop", "CIC") { | |
address owner; | |
constructor() { | |
owner = msg.sender; |
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.4; | |
contract Energy{ | |
//have total supply | |
//transferrable | |
//name | |
//symbol |
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.4; | |
contract Vault { | |
// a contract where the owner create grant for a beneficiary: | |
// allows beneficiary to withdraw only when time elapse | |
// allows owner to withdraw before time elapse | |
// get information of the beneficiary | |
// amount of ethers in the smart contract |
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.13; | |
interface IERC721 { | |
function safeTransferFrom( | |
address from, | |
address to, | |
uint tokenId | |
) external; |
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; | |
contract Deposit { | |
mapping(address => uint) balances; | |
function deposit() public payable { | |
require(msg.value > 0, "No value sent"); | |
balances[msg.sender] += msg.value; |
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.13; | |
contract ByteCodeManager { | |
function getBytecode(address _owner, uint _foo) public pure returns (bytes memory) { | |
bytes memory bytecode = type(TestContract).creationCode; | |
return abi.encodePacked(bytecode, abi.encode(_owner, _foo)); | |
} |
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; | |
contract RevStake { | |
event Stake(address sender, uint256 value); | |
mapping(address => uint) balances; | |
uint deadline = block.timestamp + 5 minutes; |
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; | |
contract TypeCasting { | |
bytes32 public x = "This is the beginning of Adddddd"; | |
string public y = "This is the beginning of Adddddd"; | |
function convertByteToString() public view returns(string memory) { | |
string memory result = string(abi.encodePacked(x)); | |
return result; |