-
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.
- Loading branch information
Showing
3 changed files
with
189 additions
and
0 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,78 @@ | ||
#[starknet::interface] | ||
pub trait IFastTokenRouter<TState> { | ||
fn initialize(ref self: TState); | ||
fn fill_fast_transfer( | ||
ref self: TState, | ||
recipient: u256, | ||
amount: u256, | ||
fast_fee: u256, | ||
origin: u32, | ||
fast_transfer_id: u256 | ||
); | ||
fn fast_transfer_remote( | ||
ref self: TState, destination: u32, recipient: u256, amount_or_id: u256, fast_fee: u256 | ||
) -> u256; | ||
} | ||
|
||
#[starknet::contract] | ||
pub mod FastTokenRouter { | ||
#[storage] | ||
struct Storage {} | ||
|
||
fn constructor() {} | ||
|
||
impl FastTokenRouterImpl of super::IFastTokenRouter<ContractState> { | ||
fn initialize(ref self: ContractState) {} | ||
|
||
fn fill_fast_transfer( | ||
ref self: ContractState, | ||
recipient: u256, | ||
amount: u256, | ||
fast_fee: u256, | ||
origin: u32, | ||
fast_transfer_id: u256 | ||
) {} | ||
|
||
fn fast_transfer_remote( | ||
ref self: ContractState, | ||
destination: u32, | ||
recipient: u256, | ||
amount_or_id: u256, | ||
fast_fee: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
} | ||
|
||
#[generate_trait] | ||
impl InternalImpl of InternalTrait { | ||
fn handle(self: @ContractState, origin: u32, message: u256) {} | ||
|
||
fn fast_transfer_to(ref self: ContractState, recipient: u256, amount: u256) {} | ||
|
||
fn fast_recieve_from(ref self: ContractState, sender: u256, amount: u256) {} | ||
|
||
fn get_token_recipient( | ||
self: @ContractState, recipient: u256, amount: u256, origin: u32, metadata: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
|
||
fn get_fast_transfers_key( | ||
self: @ContractState, | ||
origin: u32, | ||
fast_transfer_id: u256, | ||
amount: u256, | ||
fast_fee: u256, | ||
recipient: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
|
||
fn fast_transfer_from_sender( | ||
ref self: ContractState, amount: u256, fast_fee: u256, fast_transfer_id: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
} | ||
} |
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,22 @@ | ||
pub mod TokenMessage { | ||
pub fn format(recipient: felt252, amount: u256, metadata: u256) -> u256 { | ||
0 | ||
} | ||
|
||
pub fn recipient(message: felt252) -> u256 { | ||
0 | ||
} | ||
|
||
pub fn amount(message: felt252) -> u256 { | ||
0 | ||
} | ||
|
||
pub fn token_id(message: felt252) -> u256 { | ||
amount(message) | ||
} | ||
|
||
pub fn metadata(message: felt252) -> u256 { | ||
0 | ||
} | ||
} | ||
|
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,92 @@ | ||
#[starknet::interface] | ||
pub trait ITokenRouter<TState> { | ||
fn initialize(ref self: TState); | ||
fn transfer_remote( | ||
self: @TState, destination: u32, recipient: Array<u8>, amount_or_id: u256 | ||
) -> u256; | ||
fn transfer_remote_with_hook( | ||
self: @TState, | ||
destination: u32, | ||
// TODO: make this fixed size once we switch to 2.7.0 | ||
recipient: Array<u8>, | ||
amount_or_id: u256, | ||
hook_metadata: u256, | ||
hook: u256 | ||
) -> u256; | ||
fn balance_of(self: @TState, account: u256) -> u256; | ||
} | ||
|
||
#[starknet::component] | ||
pub mod TokenRouter { | ||
use starknet::ContractAddress; | ||
#[storage] | ||
struct Storage {} | ||
|
||
fn constructor() {} | ||
|
||
impl TokenRouterImpl< | ||
TContractState, +HasComponent<TContractState>, | ||
> of super::ITokenRouter<ComponentState<TContractState>> { | ||
fn initialize(ref self: ComponentState<TContractState>) {} | ||
|
||
fn transfer_remote( | ||
self: @ComponentState<TContractState>, | ||
destination: u32, | ||
// TODO: make this fixed size once we switch to 2.7.0 | ||
recipient: Array<u8>, | ||
amount_or_id: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
|
||
fn transfer_remote_with_hook( | ||
self: @ComponentState<TContractState>, | ||
destination: u32, | ||
// TODO: make this fixed size once we switch to 2.7.0 | ||
recipient: Array<u8>, | ||
amount_or_id: u256, | ||
hook_metadata: u256, | ||
hook: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
|
||
fn balance_of(self: @ComponentState<TContractState>, account: u256) -> u256 { | ||
0 | ||
} | ||
} | ||
|
||
#[generate_trait] | ||
impl InternalImpl< | ||
TContractState, +HasComponent<TContractState> | ||
> of InternalTrait<TContractState> { | ||
fn _transfer_remote( | ||
ref self: ComponentState<TContractState>, | ||
destination: u32, | ||
// TODO: make this fixed size once we switch to 2.7.0 | ||
recipient: Array<u8>, | ||
amount_or_id: u256, | ||
value: u256, | ||
hook_metadata: Option<Array<u8>>, | ||
hook: Option<ContractAddress> | ||
) -> u256 { | ||
0 | ||
} | ||
|
||
fn _transfer_from_sender( | ||
ref self: ComponentState<TContractState>, amount_or_id: u256 | ||
) -> u256 { | ||
0 | ||
} | ||
|
||
fn _handle(ref self: ComponentState<TContractState>, origin: u32, message: u256) {} | ||
|
||
fn _transfer_to( | ||
ref self: ComponentState<TContractState>, | ||
recipient: ContractAddress, | ||
amount_or_id: u256, | ||
metadata: Array<u8> | ||
) {} | ||
} | ||
} | ||
|