Skip to content

Commit

Permalink
added function headers for contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Aug 10, 2024
1 parent 5c2d1b9 commit 27e4d7e
Show file tree
Hide file tree
Showing 17 changed files with 491 additions and 11 deletions.
32 changes: 32 additions & 0 deletions cairo/src/contracts/token/extensions/fast_hyp_erc20.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
#[starknet::interface]
pub trait IFastHypERC20Collateral<TState> {
fn initialize(ref self: TState);
fn balance_of(self: @TState) -> u256;
}

#[starknet::contract]
pub mod FastHypERC20Collateral {
#[storage]
struct Storage {
wrapped_token: u256,
mailbox: u256,
}

fn constructor() {}

impl FastHypERC20CollateralImpl of super::IFastHypERC20Collateral<ContractState> {
fn initialize(ref self: ContractState) {}

fn balance_of(self: @ContractState) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn handle(ref self: ContractState, origin: u32, sender: u256, message: u256) {}

fn fast_transfer_to(ref self: ContractState, recipient: u256, amount: u256) {}

fn fast_receive_from(ref self: ContractState, sender: u256, amount: u256) {}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
#[starknet::interface]
pub trait IFastHypERC20<TState> {
fn initialize(ref self: TState);
fn balance_of(self: @TState, account: u256) -> u256;
}

// Since this contract inherits form HyerErc20, to avoid having it as component,
// we need to reimplement all the methods of the IHyerErc20 trait.
#[starknet::contract]
pub mod FastHypERC20 {
#[storage]
struct Storage {}

fn constructor() {}

impl FastHypERC20Impl of super::IFastHypERC20<ContractState> {
fn initialize(ref self: ContractState) {}

fn balance_of(self: @ContractState, account: u256) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn handle(ref self: ContractState, origin: u32, sender: u256, message: u256) {}

fn fast_transfer_to(ref self: ContractState, recipient: u256, amount: u256) {}

fn fast_receive_from(ref self: ContractState, sender: u256, amount: u256) {}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
#[starknet::interface]
pub trait IHypERC20CollateralVaultDeposit<TState> {
fn initialize(ref self: TState);
fn sweep(ref self: TState);
fn balance_of(self: @TState) -> u256;
}

#[starknet::contract]
pub mod HypERC20CollateralVaultDeposit {
#[storage]
struct Storage {
vault: u256,
asset_deposited: u256,
}

fn constructor() {}

impl HypERC20CollateralVaultDepositImpl of super::IHypERC20CollateralVaultDeposit<
ContractState
> {
fn initialize(ref self: ContractState) {}

fn sweep(ref self: ContractState) {}

fn balance_of(self: @ContractState) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn deposit_into_vault(ref self: ContractState, amount: u256) {}

fn withdraw_from_vault(ref self: ContractState, amount: u256, recipient: u256) {}

fn transfer_from_sender(ref self: ContractState, amount: u256) -> u256 {
0
}

fn transfer_to(ref self: ContractState, recipient: u256, amount: u256) {}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
#[starknet::interface]
pub trait IHypERC721URICollateral<TState> {
fn initialize(ref self: TState);
fn owner_of(self: @TState, token_id: u256) -> u256;
fn balance_of(self: @TState, account: u256) -> u256;
}

#[starknet::contract]
pub mod HypERC721URICollateral {
#[storage]
struct Storage {
wrapped_token: u256,
mailbox: u256,
}

fn constructor() {}

impl HypERC721URICollateralImpl of super::IHypERC721URICollateral<ContractState> {
fn initialize(ref self: ContractState) {}

fn owner_of(self: @ContractState, token_id: u256) -> u256 {
0
}

fn balance_of(self: @ContractState, account: u256) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn transfer_from_sender(ref self: ContractState, token_id: u256) {}
}
}
47 changes: 47 additions & 0 deletions cairo/src/contracts/token/extensions/hyp_erc721_URI_storage.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
#[starknet::interface]
pub trait IHypERC721URIStorage<TState> {
fn initialize(ref self: TState);
fn balance_of(self: @TState, account: u256) -> u256;
fn token_uri(self: @TState, token_id: u256) -> u256;
fn supports_interface(self: @TState, interface_id: u256) -> bool;
}

#[starknet::contract]
pub mod HypERC721URIStorage {
#[storage]
struct Storage {
mailbox: u256,
}

fn constructor() {}

impl HypERC721URIStorageImpl of super::IHypERC721URIStorage<ContractState> {
fn initialize(ref self: ContractState) {}

fn balance_of(self: @ContractState, account: u256) -> u256 {
0
}

fn token_uri(self: @ContractState, token_id: u256) -> u256 {
0
}

fn supports_interface(self: @ContractState, interface_id: u256) -> bool {
false
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn transfer_from_sender(ref self: ContractState, token_id: u256) -> u256 {
0
}

fn transfer_to(ref self: ContractState, recipient: u256, token_id: u256, token_uri: u256) {}

fn before_token_transfer(
ref self: ContractState, from: u256, to: u256, token_id: u256, batch_size: u256
) {}

fn burn(ref self: ContractState, token_id: u256) {}
}
}
32 changes: 32 additions & 0 deletions cairo/src/contracts/token/extensions/hyp_fiat_token.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
#[starknet::interface]
pub trait IHypFiatToken<TState> {
fn initialize(ref self: TState);
fn balance_of(self: @TState) -> u256;
}

#[starknet::contract]
pub mod HypFiatToken {
#[storage]
struct Storage {
fiat_token: u256,
mailbox: u256,
}

fn constructor() {}

impl HypFiatTokenImpl of super::IHypFiatToken<ContractState> {
fn initialize(ref self: ContractState) {}

fn balance_of(self: @ContractState) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn transfer_from_sender(ref self: ContractState, amount: u256) -> u256 {
0
}

fn transfer_to(ref self: ContractState, recipient: u256, amount: u256, metadata: u256) {}
}
}
35 changes: 35 additions & 0 deletions cairo/src/contracts/token/extensions/hyp_native_scaled.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
#[starknet::interface]
pub trait IHypNativeScaled<TState> {
fn initialize(ref self: TState);
fn transfer_remote(self: @TState, destination: u32, recipient: u256, amount: u256) -> u256;
fn balance_of(self: @TState, account: u256) -> u256;
}

#[starknet::contract]
pub mod HypNativeScaled {
#[storage]
struct Storage {
scale: u256,
mailbox: u256,
}

fn constructor() {}

impl HypNativeScaledImpl of super::IHypNativeScaled<ContractState> {
fn initialize(ref self: ContractState) {}

fn transfer_remote(
self: @ContractState, destination: u32, recipient: u256, amount: u256
) -> u256 {
0
}

fn balance_of(self: @ContractState, account: u256) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn transfer_to(ref self: ContractState, recipient: u256, amount: u256, metadata: u256) {}
}
}
34 changes: 34 additions & 0 deletions cairo/src/contracts/token/extensions/hyp_xerc20.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
#[starknet::interface]
pub trait IHypXERC20<TState> {
fn initialize(ref self: TState);
fn balance_of(self: @TState) -> u256;
}

#[starknet::contract]
pub mod HypXERC20 {
#[storage]
struct Storage {
xerc20: u256,
mailbox: u256,
}

fn constructor() {}

impl HypXERC20Impl of super::IHypXERC20<ContractState> {
fn initialize(ref self: ContractState) {}

fn balance_of(self: @ContractState) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn transfer_from_sender(ref self: ContractState, amount_or_id: u256) -> u256 {
0
}

fn transfer_to(
ref self: ContractState, recipient: u256, amount_or_id: u256, metadata: u256
) {}
}
}
37 changes: 37 additions & 0 deletions cairo/src/contracts/token/extensions/hyp_xerc20_lockbox.cairo
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
#[starknet::interface]
pub trait IHypXERC20Lockbox<TState> {
fn initialize(ref self: TState, hook: u256, ism: u256, owner: u256);
fn approve_lockbox(ref self: TState);
fn balance_of(self: @TState) -> u256;
}

#[starknet::contract]
pub mod HypXERC20Lockbox {
#[storage]
struct Storage {
lockbox: u256,
xerc20: u256,
wrapped_token: u256,
mailbox: u256,
}

fn constructor() {}

impl HypXERC20LockboxImpl of super::IHypXERC20Lockbox<ContractState> {
fn initialize(ref self: ContractState, hook: u256, ism: u256, owner: u256) {}

fn approve_lockbox(ref self: ContractState) {}

fn balance_of(self: @ContractState) -> u256 {
0
}
}

#[generate_trait]
impl InternalImpl of InternalTrait {
fn transfer_from_sender(ref self: ContractState, amount: u256) -> u256 {
0
}

fn transfer_to(ref self: ContractState, recipient: u256, amount: u256, metadata: u256) {}
}
}
26 changes: 18 additions & 8 deletions cairo/src/contracts/token/hyp_erc20.cairo
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
#[starknet::interface]
pub mod IHypErc20<TState> {
pub trait IHypErc20<TState> {
fn initialize(ref self: TState);
fn decimals() -> u8;
fn balance_of(ref self: TState) -> Uint256;
fn decimals(self: @TState) -> u8;
fn balance_of(self: @TState) -> u256;
}

#[starknet::contract]
pub mod HypErc20 {

#[storage]
struct Storage {}

fn constructor() {}

impl HypErc20Impl of super::IHypErc20<ContractState> {
fn initialize() {}
fn initialize(ref self: ContractState) {}

fn decimals() -> u8 {0}
fn decimals(self: @ContractState) -> u8 {
0
}

fn balance_of(ref self: ContractState) -> Uint256 {0}
fn balance_of(self: @ContractState) -> u256 {
0
}
}
}

#[generate_trait]
impl InternaImpl of InternalTrait {
fn transfer_from_sender(ref self: ContractState) {}

fn transfer_to_recipient(ref self: ContractState) {}
}
}
Loading

0 comments on commit 27e4d7e

Please sign in to comment.