Skip to content

Instantly share code, notes, and snippets.

View casweeney's full-sized avatar
👨‍💻
Building Platforms

Coding Cas casweeney

👨‍💻
Building Platforms
View GitHub Profile
// 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") {
// 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;
// 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;
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;
contract Energy{
//have total supply
//transferrable
//name
//symbol
// 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
@casweeney
casweeney / English auction.sol
Created August 4, 2022 02:24 — forked from developeruche/English auction.sol
Solidity English Auction
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IERC721 {
function safeTransferFrom(
address from,
address to,
uint tokenId
) external;
@casweeney
casweeney / SecondTest.sol
Last active August 4, 2022 16:58
This is the a second test at Web3Bridge Cohort VII
// 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;
@casweeney
casweeney / btyesmanager.sol
Created August 3, 2022 15:02 — forked from developeruche/btyesmanager.sol
Explains Bytes Code and Init Code
// 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));
}
@casweeney
casweeney / RevisionStake.sol
Last active August 4, 2022 21:50
Class revision
// 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;
@casweeney
casweeney / TypeCasting.sol
Created August 2, 2022 23:04
Contract to typecast bytes32 to string
// 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;