Skip to content

Instantly share code, notes, and snippets.

View faytey's full-sized avatar

Faith M. Roberts faytey

View GitHub Profile
@faytey
faytey / day_one.cairo
Created August 2, 2024 20:48
cairo learnings
use core::option::OptionTrait;
use core::traits::TryInto;
use core::array::ArrayTrait;
use core::traits::Into;
use core::fmt::{Display, Formatter, Error};
fn mul(x: u16, y: u16) -> u32 {
let z: u32 = x.into() * y.into();
z
}
@faytey
faytey / Mayowa.cairo
Created July 22, 2024 20:57
Smart Contract Cairo
use starknet::ContractAddress;
#[starknet::interface]
trait IRoom<TContractState> {
fn register(ref self: TContractState,) -> bool;
fn join_room(ref self: TContractState, id: u8) -> bool;
fn create_room(
ref self: TContractState, title: felt252, description: felt252, members: u16
) -> Room::Room;
fn get_room_details(self: @TContractState, id: u8) -> Room::Room;
@faytey
faytey / lib.cairo
Created May 24, 2024 18:32
Todolist
mod todo;
@faytey
faytey / commitmentscheme.rs
Created May 16, 2024 19:05
commitment scheme
use std::{error::Error, hash::{DefaultHasher, Hash, Hasher}};
trait Auction {
fn commit(a: u8, b: u8) -> Result<Vec<u8>, Box<dyn Error>>;
fn open(input: u8, commitment: Vec<u8>) -> Result<bool, Box<dyn Error>>;
}
struct Auctioning {}
impl Auctioning {
fn to_hash(value: u8) -> Vec<u8> {
//SPDX-License-Identifier: MIT
///@author Faith M. Roberts
// Write a contract that deposit fund into a contract.
// And also keep track of funds transferred into the contract.
// Add a function to the balance of address that have deposited into the contract.
//FALLBACKS
//The fallback function is executed if none of the other functions matches the function identifier or no data was provided with the function call.
pragma solidity ^0.8.0;
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
///@author Faith M. Roberts
///@title Student Records
contract Records{
address public admin_address;
struct StudentsInfo{
string name;
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
/// @author Faith M. Roberts
/// @title A Simple Decentralized Domain Naming Service Contract.
contract Faytey7Dns {
address public owner;
@faytey
faytey / faytey7dns.sol
Last active February 3, 2023 12:56
Testing out the creation of a simple decentralised domain naming service
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author Faith M. Roberts
/// @title A Simple Decentralized Domain Naming Service Contract.
contract Faytey7Dns {
address public owner;