Skip to content

Commit

Permalink
Merge pull request #1785 from radixdlt/feature/access-controller-vault
Browse files Browse the repository at this point in the history
Access Controller Fee Vault.
  • Loading branch information
0xOmarA authored Apr 29, 2024
2 parents b82a7db + ce29b21 commit b0aa203
Show file tree
Hide file tree
Showing 37 changed files with 5,023 additions and 1,430 deletions.
14 changes: 1 addition & 13 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
{
"rust-analyzer.linkedProjects": [
// Root Workspace & CLIs.
"Cargo.toml",
"radix-clis/Cargo.toml",
// Various blueprints we have.
"examples/everything/Cargo.toml",
"examples/hello-world/Cargo.toml",
"examples/no-std/Cargo.toml",
"radix-clis/tests/blueprints/Cargo.toml",
"radix-engine-tests/assets/blueprints/Cargo.toml",
"radix-engine/assets/blueprints/Cargo.toml",
"radix-transaction-scenarios/assets/blueprints/Cargo.toml",
"scrypto-compiler/tests/assets/scenario_1/Cargo.toml",
"scrypto-compiler/tests/assets/scenario_2/Cargo.toml",
"scrypto-test/assets/blueprints/Cargo.toml",
"scrypto-test/tests/blueprints/Cargo.toml",
],
"cSpell.words": [
"accesscontroller",
Expand All @@ -36,6 +23,7 @@
"decompiler",
"descendents",
"eddsa",
"endregion",
"flamegraph",
"Formattable",
"generification",
Expand Down
13 changes: 13 additions & 0 deletions radix-blueprint-schema-init/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ pub enum TypeRef<T> {
// TODO: How to represent a structure containing a generic?
}

impl<T> TypeRef<T> {
pub fn into_static(self) -> Option<T> {
let Self::Static(value) = self else {
return None;
};
Some(value)
}

pub fn assert_static(self) -> T {
self.into_static().expect("Must be static")
}
}

#[derive(Debug, Clone, PartialEq, Eq, ScryptoSbor, ManifestSbor)]
pub struct BlueprintKeyValueSchema<T> {
pub key: T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct AccessControllerCreateManifestInput {
pub address_reservation: Option<ManifestAddressReservation>,
}

pub type AccessControllerCreateGlobalOutput = Global<AccessControllerMarker>;
pub type AccessControllerCreateOutput = Global<AccessControllerMarker>;

//================================
// Access Controller Create Proof
Expand Down Expand Up @@ -264,3 +264,51 @@ pub struct AccessControllerMintRecoveryBadgesInput {
}

pub type AccessControllerMintRecoveryBadgesOutput = Bucket;

// region:bottlenose

//==================
// Lock Recovery Fee
//==================

pub const ACCESS_CONTROLLER_LOCK_RECOVERY_FEE_IDENT: &str = "lock_recovery_fee";

#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
pub struct AccessControllerLockRecoveryFeeInput {
pub amount: Decimal,
}

pub type AccessControllerLockRecoveryFeeOutput = ();

//========================
// Withdraw Recovery Fee
//=======================

pub const ACCESS_CONTROLLER_WITHDRAW_RECOVERY_FEE_IDENT: &str = "withdraw_recovery_fee";

#[derive(Debug, Clone, Eq, PartialEq, ScryptoSbor, ManifestSbor)]
pub struct AccessControllerWithdrawRecoveryFeeInput {
pub amount: Decimal,
}

pub type AccessControllerWithdrawRecoveryFeeOutput = Bucket;

//=========================
// Contribute Recovery Fee
//=========================

pub const ACCESS_CONTROLLER_CONTRIBUTE_RECOVERY_FEE_IDENT: &str = "contribute_recovery_fee";

#[derive(Debug, Eq, PartialEq, ScryptoSbor)]
pub struct AccessControllerContributeRecoveryFeeInput {
pub bucket: Bucket,
}

#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor)]
pub struct AccessControllerContributeRecoveryFeeManifestInput {
pub bucket: ManifestBucket,
}

pub type AccessControllerContributeRecoveryFeeOutput = ();

// endregion:bottlenose
5 changes: 5 additions & 0 deletions radix-engine-interface/src/blueprints/package/substates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ pub enum NativeCodeId {
/// * Changes : N/A
AccessControllerCode1 = 6u64,

/// * Introduced: Babylon
/// * Coverage : All access controller blueprints
/// * Changes : Introduce fee vault
AccessControllerCode2 = 23u64,

/// * Introduced: Babylon
/// * Coverage : All pool blueprints
/// * Changes : N/A
Expand Down
Binary file not shown.
Loading

0 comments on commit b0aa203

Please sign in to comment.