Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions contracts/crossmint-contract-factory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ soroban-sdk = { workspace = true }
stellar-default-impl-macro = { git = "https://github.com/OpenZeppelin/stellar-contracts", tag = "v0.3.0" }
stellar-access-control = { git = "https://github.com/OpenZeppelin/stellar-contracts", tag = "v0.3.0" }
stellar-access-control-macros = { git = "https://github.com/OpenZeppelin/stellar-contracts", tag = "v0.3.0" }
stellar-upgradeable = { git = "https://github.com/OpenZeppelin/stellar-contracts", tag = "v0.3.0" }
stellar-upgradeable-macros = { git = "https://github.com/OpenZeppelin/stellar-contracts", tag = "v0.3.0" }
Comment on lines +16 to +17

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using these libraries? If not, why not


[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
17 changes: 17 additions & 0 deletions contracts/crossmint-contract-factory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use soroban_sdk::{contract, contractimpl, symbol_short, Address, Bytes, BytesN,
use stellar_access_control::{grant_role, set_admin, AccessControl};
use stellar_access_control_macros::only_role;
use stellar_default_impl_macro::default_impl;
use stellar_upgradeable::UpgradeableInternal;
use stellar_upgradeable_macros::Upgradeable;

#[derive(Upgradeable)]
#[contract]
pub struct CrossmintContractFactory;

Expand Down Expand Up @@ -75,6 +78,20 @@ impl CrossmintContractFactory {
#[contractimpl]
impl AccessControl for CrossmintContractFactory {}

impl UpgradeableInternal for CrossmintContractFactory {
fn _require_auth(e: &Env, operator: &Address) {
operator.require_auth();
let admin = e
.storage()
.instance()
.get::<_, Address>(&symbol_short!("admin"))
.unwrap();
if *operator != admin {
panic!("Unauthorized");
}
}
}

mod test;

#[cfg(test)]
Expand Down