Skip to content

Instantly share code, notes, and snippets.

View codeWhizperer's full-sized avatar
🎯
Focusing

Adegbite Ademola Kelvin codeWhizperer

🎯
Focusing
View GitHub Profile
// starknet3.cairo
// Joe liked Jill's work very much. He really likes how useful storage can be.
// Now they decided to write a contract to track the number of exercises they
// complete successfully. Jill says they can use the owner code and allow
// only the owner to update the contract, they agree.
// Can you help them write this contract?
// I AM NOT DONE
use starknet::ContractAddress;
#[starknet::contract]
mod A{
use starknet::ContractAddress;
#[storage]
struct Storage{
owner: ContractAddress
}
#[constructor]
#[contract]
mod ERC20{
////////////////
// LIBRARY IMPORTS
//////////////
use starknet::ContractAddress;
use zeroable::Zeroable;
use starknet::ContractAddress;
////////////////////////
// IERC721 interface
///////////////////////
#[abi]
trait IERC721{
fn name() -> felt252;
fn symbol() -> felt252;
#[abi]
trait IERC20 {
#[view]
fn get_name() -> felt252;
#[view]
fn get_symbol() -> felt252;
#[view]
fn total_supply() -> felt252;
//@Ademola Kelvin
contract Conversions {
function explicit256To8() public pure returns (uint8) {
uint256 a = 2022;
uint8 b = uint8(a);
return b; // 230.
}
}
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;
contract Energy{
//have total supply
//transferrable
//name
//symbol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
/// ogbeni
error Unauthorized();
/// @custom:experimental This is an experimental contract.
contract VendingMachine {
address payable owner = payable(msg.sender);
function withdraw() public {
if (msg.sender != owner)
// 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)
// SPDX-License-Identifier:MIT;
pragma solidity 0.8.0;
contract DB {
// 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2 //1
// 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db //2
// 0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB //3