Skip to content

Commit

Permalink
add mint and burn
Browse files Browse the repository at this point in the history
  • Loading branch information
olga24912 committed Feb 4, 2025
1 parent 8150d74 commit 751d745
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 30 deletions.
79 changes: 50 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions eth-connector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub enum Role {
UpgradableCodeDeployer,
DAO,
Migrator,
Factory
}

/// Eth-connector contract data. It's stored in the storage.
Expand Down Expand Up @@ -335,6 +336,30 @@ impl EthConnectorContract {
pub fn get_config(&self) -> EthConnector {
self.connector.clone()
}

#[payable]
#[access_control_any(roles(Role::Factory))]
pub fn mint(
&mut self,
account_id: AccountId,
amount: U128,
msg: Option<String>,
) -> PromiseOrValue<U128> {
self.register_if_not_exists(&account_id);
if let Some(msg) = msg {
self.mint_eth_on_near(&env::predecessor_account_id(), amount.into());
self.ft_transfer_call(account_id, amount, None, msg)
} else {
self.mint_eth_on_near(&account_id, amount.into());
PromiseOrValue::Value(amount)
}
}

#[access_control_any(roles(Role::Factory))]
pub fn burn(&mut self, amount: U128) {
self.ft
.internal_withdraw(&env::predecessor_account_id(), amount.into());
}
}

#[near_bindgen]
Expand Down
Binary file modified res/aurora-eth-connector-mainnet-migration.wasm
Binary file not shown.
Binary file modified res/aurora-eth-connector-mainnet.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.74.1"
channel = "1.81.0"
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]
profile = "minimal"

0 comments on commit 751d745

Please sign in to comment.