Skip to content

Instantly share code, notes, and snippets.

View amarachiugwu's full-sized avatar

Amarachi Ugwu amarachiugwu

View GitHub Profile
@amarachiugwu
amarachiugwu / vaultAssignment.sol
Created August 5, 2022 10:33
A simple vault contract that disbursts grant to beneficiaries, allowing them to only withdraw all or part of their grant after an elapse time
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract Vault {
// a contract where the owner creat grant for a beneficiary;
// allow beneficiary to withdrawl only when time elapse
// allow owner to withdrawl before elapse time
// get information of a beneficiary
// amount of ethers in the smart contract
@amarachiugwu
amarachiugwu / vaultClassWork.sol
Created August 4, 2022 20:15
A smart contract that implements dispersion of a grant in a vault
// SPDX-License-Identifier: GPL-3.0
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 a beneficiary
@amarachiugwu
amarachiugwu / simpleDepositContract.sol
Last active August 5, 2022 00:02
a simple deposit contract
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract simpleDepositContract {
// emit an event when an end users deposits
event depositEvent(address user, uint amount);
// track individual balances
@amarachiugwu
amarachiugwu / increamentDecreament.sol
Last active August 1, 2022 16:40
increment and decrement a count in solidity
// SPDX-License-Identifier:MIT
pragma solidity ^0.8.0;
contract increamentDecreament {
// counter
uint count = 1;
uint256 deadline = block.timestamp + 30 seconds;
// Collect funds in a payable `stake()` function and track individual `balances` with a mapping:
// ( Make sure to add a `Stake(address,uint256)` event and emit)
// After some `deadline` allow anyone to call an `execute()` function
// If the `threshold` was not met, allow everyone to call a `withdraw()` function
// Add a `withdraw()` function to let users withdraw their balance