-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added function headers for contracts
- Loading branch information
Showing
17 changed files
with
491 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
cairo/src/contracts/token/extensions/fast_hyp_erc20_collateral.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
cairo/src/contracts/token/extensions/hyp_erc20_collateral_vault_deposit.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
cairo/src/contracts/token/extensions/hyp_erc721_URI_collateral.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
47
cairo/src/contracts/token/extensions/hyp_erc721_URI_storage.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
35
cairo/src/contracts/token/extensions/hyp_native_scaled.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
37
cairo/src/contracts/token/extensions/hyp_xerc20_lockbox.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) {} | ||
} | ||
} |
Oops, something went wrong.