Skip to content

Instantly share code, notes, and snippets.

require("dotenv").config({ path: ".env" });
import { BytesLike } from "ethers";
import { ethers } from "hardhat";
// import * as dotenv from "dotenv";
// import IMultiSig from "../typechain-types/Imultisig.sol"
// deployed contract address = 0x6e828b59fc799b6ef92e42d2f39e438a7477f469
async function main() {
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "./multisig.sol";
contract MultiSigFactory {
//a factory contract that create multiple clones of multisig.sol
//a function that create a new multisig
//an array that holds contract addresses created
//a function that calls the approve function in multisig.sol
@Jesserc
Jesserc / DelegateCall.sol
Last active August 11, 2022 23:11
Smart contract implementing delegatecall in solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract TestDelegateCall{
//this contract is to test delegatecall in solidity
//to do this, the storage layout in both contract must be same
//delegate call, calls another contract but the storage of the calling
//contract is set instead while using the called contracts logic
uint64 public num;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Bridge is ERC20{
address owner;
modifier onlyOnwer(){
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Energy {
/// State Variable
uint constant totalSupply = 100000;
uint public circulatingSupply;
string constant name = "Energy";
string constant symbol = "ENG";
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Staking {
mapping(address => uint256) balances;
uint256 public deadline = 0;
event Stake(address sender, uint256 amount);
function stake() public payable {
require(msg.value > 0, "Input value");
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Enum {
enum Status {
Done,
AlmostDone,
Failed
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
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 a beneficiary
//amount of ethers in the smart contract
// SPDX-License-Identifier: MIT;
pragma solidity >=0.7.0 <=0.8.15;
contract Test {
mapping(address => uint256) balances;
function deposit() public payable {
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
@title Counter Contract
@author Jesse Raymond
@notice This is a simple counter contract, where users can increment and decrement the value of the variable count(see below), once every 30 seconds.
@dev Key concepts in solidity i used:
- Modifier,
- Internal function,