-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from karnotxyz/enroll-token
Enroll token
- Loading branch information
Showing
17 changed files
with
1,262 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target | ||
.DS_Store | ||
.snfoundry_cache/ |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
scarb 2.6.5 | ||
starknet-foundry 0.26.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "openzeppelin" | ||
version = "0.14.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.14.0#f091c4f51ddeb10297db984acae965328c5a4e5b" | ||
|
||
[[package]] | ||
name = "piltover" | ||
version = "0.1.0" | ||
source = "git+https://github.com/byteZorvin/piltover?branch=bridge-testing#a4021a0bb5e1638e3aebf634f5810ebb17da6a38" | ||
dependencies = [ | ||
"openzeppelin", | ||
] | ||
|
||
[[package]] | ||
name = "snforge_std" | ||
version = "0.26.0" | ||
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.26.0#50eb589db65e113efe4f09241feb59b574228c7e" | ||
|
||
[[package]] | ||
name = "starknet_bridge" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"openzeppelin", | ||
"piltover", | ||
"snforge_std", | ||
] |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "starknet_bridge" | ||
version = "0.1.0" | ||
edition = "2023_11" | ||
|
||
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html | ||
|
||
[dependencies] | ||
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.14.0" } | ||
starknet = "2.6.4" | ||
piltover = { git = "https://github.com/byteZorvin/piltover", branch="bridge-testing"} | ||
|
||
[dev-dependencies] | ||
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.26.0" } | ||
|
||
[[target.starknet-contract]] | ||
casm = true | ||
build-external-contracts = ["piltover::appchain::appchain"] | ||
|
||
[scripts] | ||
test = "snforge test" |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "my_script" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"sncast_std", | ||
] | ||
|
||
[[package]] | ||
name = "sncast_std" | ||
version = "0.26.0" | ||
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.26.0#50eb589db65e113efe4f09241feb59b574228c7e" |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "my_script" | ||
version = "0.1.0" | ||
edition = "2023_11" | ||
|
||
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html | ||
|
||
[dependencies] | ||
sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.26.0" } | ||
starknet = ">=2.6.4" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
mod my_script; |
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
use starknet::ContractAddress; | ||
use starknet_bridge::bridge::types::{TokenStatus, TokenSettings}; | ||
|
||
#[starknet::interface] | ||
pub trait ITokenBridgeAdmin<TContractState> { | ||
fn set_appchain_token_bridge(ref self: TContractState, appchain_bridge: ContractAddress); | ||
fn block_token(ref self: TContractState, token: ContractAddress); | ||
fn deactivate_token(ref self: TContractState, token: ContractAddress); | ||
fn enable_withdrawal_limit(ref self: TContractState, token: ContractAddress); | ||
fn disable_withdrawal_limit(ref self: TContractState, token: ContractAddress); | ||
fn set_max_total_balance( | ||
ref self: TContractState, token: ContractAddress, max_total_balance: u256 | ||
); | ||
} | ||
|
||
#[starknet::interface] | ||
pub trait ITokenBridge<TContractState> { | ||
fn appchain_bridge(self: @TContractState) -> ContractAddress; | ||
fn get_identity(self: @TContractState) -> felt252; | ||
fn get_version(self: @TContractState) -> felt252; | ||
fn get_status(self: @TContractState, token: ContractAddress) -> TokenStatus; | ||
fn is_servicing_token(self: @TContractState, token: ContractAddress) -> bool; | ||
|
||
fn enroll_token(ref self: TContractState, token: ContractAddress); | ||
fn check_deployment_status(ref self: TContractState, token: ContractAddress); | ||
|
||
fn deposit( | ||
ref self: TContractState, | ||
token: ContractAddress, | ||
amount: u256, | ||
appchain_recipient: ContractAddress | ||
); | ||
fn deposit_with_message( | ||
ref self: TContractState, | ||
token: ContractAddress, | ||
amount: u256, | ||
appchain_recipient: ContractAddress, | ||
message: Span<felt252> | ||
); | ||
|
||
fn withdraw( | ||
ref self: TContractState, token: ContractAddress, amount: u256, recipient: ContractAddress | ||
); | ||
|
||
fn deposit_cancel_request( | ||
ref self: TContractState, | ||
token: ContractAddress, | ||
amount: u256, | ||
appchain_recipient: ContractAddress, | ||
nonce: felt252 | ||
); | ||
fn deposit_with_message_cancel_request( | ||
ref self: TContractState, | ||
token: ContractAddress, | ||
amount: u256, | ||
appchain_recipient: ContractAddress, | ||
message: Span<felt252>, | ||
nonce: felt252 | ||
); | ||
|
||
fn deposit_with_message_reclaim( | ||
ref self: TContractState, | ||
token: ContractAddress, | ||
amount: u256, | ||
appchain_recipient: ContractAddress, | ||
message: Span<felt252>, | ||
nonce: felt252 | ||
); | ||
fn deposit_reclaim( | ||
ref self: TContractState, | ||
token: ContractAddress, | ||
amount: u256, | ||
appchain_recipient: ContractAddress, | ||
nonce: felt252 | ||
); | ||
fn get_remaining_intraday_allowance(self: @TContractState, token: ContractAddress) -> u256; | ||
} | ||
|
||
#[starknet::interface] | ||
pub trait IWithdrawalLimitStatus<TContractState> { | ||
fn is_withdrawal_limit_applied(self: @TContractState, token: ContractAddress) -> bool; | ||
} |
Oops, something went wrong.