Skip to content

Instantly share code, notes, and snippets.

View emmaglorypraise's full-sized avatar

Glory Praise emmaglorypraise

View GitHub Profile
@emmaglorypraise
emmaglorypraise / voting.sol
Last active June 3, 2024 16:58
A voting contract for football clubs
Deployed contract address(polygon mainnet) = 0x4bc4154b03B7fBbE72CBFA33aDe77BB820FbB337
// ABI
"abi": [
{
"inputs": [
{
"internalType": "string[]",
@emmaglorypraise
emmaglorypraise / NFT.sol
Created August 3, 2023 18:19
NFT with EIP 2535
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {ERC721AppStorage} from "../libraries/AppStorage.sol";
// import "../interfaces/IERC721.sol";
// import "../interfaces/IERC721Receiver.sol";
contract TwikklNFT {
ERC721AppStorage internal s;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract Santa1966 is ERC20, Ownable {
using SafeMath for uint256;
@emmaglorypraise
emmaglorypraise / create3.sol
Created October 17, 2022 22:32
A factory contract A deploys a child contract B using create 3. Contract B has a constructor which contains a struct as a parameter. Contract A must send 2 ether to contract B upon deployment. A function is available in contract that cryptographically checks that contract B was deployed by him(Contract A)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import {Create3} from "./lib.sol";
//https://github.com/0xsequence/create3 - imported library
struct Work {
uint8 number;
}
contract Factory {
@emmaglorypraise
emmaglorypraise / getStorageSlot.ts
Created October 17, 2022 22:30
Script to get data stored in slot
< --------------------- contract - contract.sol ---------------------- >
contract DataStore{
uint256[50] _____gap_____;
struct Data{
uint256[] numbers;
bool in__;
bytes32 key;
}
@emmaglorypraise
emmaglorypraise / cube.sol
Created October 13, 2022 18:40
Classwork 2 : each green represents true and the red represents false..write an array that represents this cube
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract cube {
bool[][] cube = [
[true,true, true, true, true, true, true, true, true, true, true, true],
[true, true, true, true, true, true, true, true, true, true, true, true],
[true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true],
[true, true, true, true, true, true, true, true, true, true, true, true],
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MultiArray {
string[1][4][3] public compoundTwo = [[["a"],["b"],["c"],["d"]],[["e"],["f"],["g"],["h"]],[["i"],["j"],["k"],["l"]]];
function nameRooms() public {
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.6.11;
Examine the DaoEscrowFarm contract provided.
This is a simple system that allows users to deposit 1 eth per block, and withdraw their deposits in a future date.
The implementation contains many flaws, including lack of optimisations and bugs that can be exploited to steal funds.
For this challenge we would like you to:
- Explain how someone could deposit more than 1 eth per block
@emmaglorypraise
emmaglorypraise / contractauditingexample.sol
Created October 12, 2022 16:50
Contract audit example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// CONTRACT AUDITING EXAMPLE
// @name MysteryBoxAuction
// @notice Treat each line like a new contract
contract MysteryBoxAuction {
address contractOwner;