Skip to content

Commit 18b3dd2

Browse files
use InsufficientDelegates error in delegate-auth example
1 parent ba98591 commit 18b3dd2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

docs/build/smart-contracts/example-contracts/delegate-auth.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ use soroban_sdk::{
8383
#[repr(u32)]
8484
pub enum Error {
8585
UnknownDelegate = 1,
86+
InsufficientDelegates = 2,
8687
}
8788

8889
#[contracttype]
@@ -125,9 +126,10 @@ impl CustomAccountInterface for ModularAccount {
125126
let delegates = env.custom_account().get_delegated_signers();
126127

127128
// With no delegates to forward to, the account would authenticate
128-
// nothing and be effectively unauthenticated, so reject it.
129+
// nothing and be effectively unauthenticated, so reject it. A real
130+
// account might require more than one delegate to meet a threshold.
129131
if delegates.is_empty() {
130-
return Err(Error::UnknownDelegate);
132+
return Err(Error::InsufficientDelegates);
131133
}
132134

133135
// Check if the delegates are accepted by the modular account.
@@ -187,7 +189,7 @@ type Signature = ();
187189
let delegates = env.custom_account().get_delegated_signers();
188190

189191
if delegates.is_empty() {
190-
return Err(Error::UnknownDelegate);
192+
return Err(Error::InsufficientDelegates);
191193
}
192194

193195
for delegate in delegates.iter() {

0 commit comments

Comments
 (0)