Skip to content

Commit a020cd6

Browse files
committed
Fix no remaining allowance error
1 parent 563b26b commit a020cd6

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

fplus-lib/src/core/mod.rs

+20-5
Original file line numberDiff line numberDiff line change
@@ -970,10 +970,16 @@ impl LDNApplication {
970970
.await
971971
.map_err(|e| LDNError::Load(format!("Failed to get an allocator. /// {}", e)))?
972972
.ok_or(LDNError::Load("Allocator not found.".to_string()))?;
973-
let db_multisig_address = db_allocator.multisig_address.ok_or(LDNError::Load(
974-
"Failed to get multisig address.".to_string(),
975-
))?;
976-
Self::is_allowance_sufficient(&db_multisig_address.clone(), &allocation_amount_parsed)
973+
let address_to_check_allowance = match db_allocator.tooling {
974+
Some(ref tooling) if tooling.contains("smart_contract_allocator") => db_allocator
975+
.address
976+
.ok_or_else(|| LDNError::Load("Failed to get address.".to_string())),
977+
_ => db_allocator
978+
.multisig_address
979+
.ok_or_else(|| LDNError::Load("Failed to get multisig address.".to_string())),
980+
}?;
981+
982+
Self::is_allowance_sufficient(&address_to_check_allowance, &allocation_amount_parsed)
977983
.await?;
978984

979985
let uuid = uuidv4::uuid::v4();
@@ -1125,7 +1131,16 @@ impl LDNApplication {
11251131

11261132
if let Some(new_allocation_amount) = new_allocation_amount {
11271133
if app_file.allocation.0.len() > 1 {
1128-
Self::is_allowance_sufficient(&db_multisig_address, &new_allocation_amount).await?;
1134+
let address_to_check_allowance = match db_allocator.tooling {
1135+
Some(ref tooling) if tooling.contains("smart_contract_allocator") => {
1136+
db_allocator
1137+
.address
1138+
.ok_or_else(|| LDNError::Load("Failed to get address.".to_string()))?
1139+
}
1140+
_ => db_multisig_address,
1141+
};
1142+
Self::is_allowance_sufficient(&address_to_check_allowance, &new_allocation_amount)
1143+
.await?;
11291144

11301145
let parsed_allocation_amount = process_amount(new_allocation_amount);
11311146

0 commit comments

Comments
 (0)