wrapped_azero/traits.rs
1use psp22::PSP22Error;
2
3#[ink::trait_definition]
4pub trait WrappedAZERO {
5 /// Deposits the transferred amount of AZERO and mints that much wAZERO to the callers account.
6 ///
7 /// # Events
8 ///
9 /// On success a `Transfer` event is emitted for newly minted wAZERO (with `from` being `None`).
10 ///
11 /// No-op if the transferred value is zero, returns success and no events are emitted.
12 ///
13 /// # Errors
14 ///
15 /// Reverts with `Custom` error variant if minting new tokens would cause the total token supply
16 /// to exceed maximal `u128` value.
17 #[ink(message, payable)]
18 fn deposit(&mut self) -> Result<(), PSP22Error>;
19
20 /// Burns `value` wAZERO tokens from the callers account and transfers that much AZERO to them.
21 ///
22 /// # Events
23 ///
24 /// On success a `Transfer` event is emitted for burned wAZERO (with `to` being `None`).
25 ///
26 /// No-op if the `value` is zero, returns success and no events are emitted.
27 ///
28 /// # Errors
29 ///
30 /// Reverts with `InsufficientBalance` if the `value` exceeds the caller's wAZERO balance.
31 #[ink(message)]
32 fn withdraw(&mut self, value: u128) -> Result<(), PSP22Error>;
33}
34
35/// Mainnet deployment address
36pub const MAINNET: &str = "5CtuFVgEUz13SFPVY6s2cZrnLDEkxQXc19aXrNARwEBeCXgg";
37/// Testnet deployment address
38pub const TESTNET: &str = "5EFDb7mKbougLtr5dnwd5KDfZ3wK55JPGPLiryKq4uRMPR46";