Skip to content

Commit 1a3e36a

Browse files
committed
docs: doc events and upgrade
1 parent c73cf0e commit 1a3e36a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/token_migration/src/events.cairo

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub mod TokenMigrationEvents {
22
use starknet::{ContractAddress, EthAddress};
33

4+
/// Emitted when a swap succeeds using `swap_to_legacy` or `swap_to_new`.
45
#[derive(Drop, starknet::Event, Debug, PartialEq)]
56
pub struct TokenMigrated {
67
#[key]
@@ -12,28 +13,35 @@ pub mod TokenMigrationEvents {
1213
pub amount: u256,
1314
}
1415

16+
/// Emitted when the L1 recipient is successfully verified using `verify_l1_recipient`.
1517
#[derive(Drop, starknet::Event, Debug, PartialEq)]
1618
pub struct L1RecipientVerified {
1719
pub l1_recipient: EthAddress,
1820
}
1921

22+
/// Emitted when the token supplier is updated using `set_token_supplier`.
2023
#[derive(Drop, starknet::Event, Debug, PartialEq)]
2124
pub struct TokenSupplierSet {
2225
pub token_supplier: ContractAddress,
2326
}
2427

28+
/// Emitted when the legacy buffer is updated using `set_legacy_buffer`.
2529
#[derive(Drop, starknet::Event, Debug, PartialEq)]
2630
pub struct LegacyBufferSet {
2731
pub old_buffer: u256,
2832
pub new_buffer: u256,
2933
}
3034

35+
/// Emitted when the batch size is updated using `set_batch_size`.
3136
#[derive(Drop, starknet::Event, Debug, PartialEq)]
3237
pub struct BatchSizeSet {
3338
pub old_batch_size: u256,
3439
pub new_batch_size: u256,
3540
}
3641

42+
/// Emitted when sending the legacy to L1 fails. This may happen after a successful swap to the
43+
/// new token, or after updating the legacy buffer or batch size.
44+
/// Note: The overall operation does not revert.
3745
#[derive(Drop, starknet::Event, Debug, PartialEq)]
3846
pub struct SendToL1Failed {
3947
pub error: felt252,

packages/token_migration/src/token_migration.cairo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ pub mod TokenMigration {
113113

114114
#[abi(embed_v0)]
115115
impl UpgradeableImpl of IUpgradeable<ContractState> {
116+
/// Upgrades the contract to a new class hash.
117+
/// Caller must be the owner.
116118
fn upgrade(ref self: ContractState, new_class_hash: ClassHash) {
117119
self.ownable.assert_only_owner();
118120
self.upgradeable.upgrade(:new_class_hash);

0 commit comments

Comments
 (0)