Skip to content

Instantly share code, notes, and snippets.

View Zeegaths's full-sized avatar
🎯
Focusing

Mary Wangui Zeegaths

🎯
Focusing
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
// import "@openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
// import "@openzeppelin-contracts/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract Artify is ERC721URIStorage {
use starknet::ContractAddress;
#[starknet::interface]
pub trait ITodoList<TContractState> {
fn addTodo(ref self: TContractState, description: felt252, deadline: u32) -> bool;
fn updateTodo(ref self: TContractState, index: u8, description: felt252, deadline: u32) -> bool;
fn getTodos(self: @TContractState) -> Array<Todo::Todo>;
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {SideEntranceLenderPool} from "./SideEntranceLenderPool.sol";
interface IFlashLoanEtherReceiver {
function execute() external payable;
}
contract Exploit is IFlashLoanEtherReceiver {
using Address for address payable;
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
contract VIP_Bank {
address public manager;
mapping(address => uint) public balances;
mapping(address => bool) public VIP;
uint public maxETH = 0.5 ether;
constructor() {
function withdraw(uint _amount) public onlyVIP {
require(
_amount <= maxETH,
"Cannot withdraw more than 0.5 ETH per transaction"
);
require(balances[msg.sender] >= _amount, "Not enough ether");
balances[msg.sender] -= _amount;
(bool success, ) = payable(msg.sender).call{value: _amount}("");
require(success, "Withdraw Failed!");
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract DepositFunds {
//track the balance
mapping(address => uint) deposits;
//deposit function
function deposit(uint _amount) external payable {
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract ZarahToken is ERC721URIStorage, Ownable {
constructor() ERC721("ZarahToken", "ZT") Ownable (msg.sender) {}
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs";
import { expect } from "chai";
import { ethers } from "hardhat";
describe("Todo List", function () {
async function deployTodoList() {
@Zeegaths
Zeegaths / Storage.sol
Created February 11, 2024 12:01
A smart contract that has both storage and memory types of variables in it
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract Storage {
struct student{
string Name;
uint Age;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "./School.sol";
contract SchoolFactory {
School public schoolSystem;