diff --git a/src/safe_db/db.rs b/src/safe_db/db.rs index 942b11a..1abc7da 100644 --- a/src/safe_db/db.rs +++ b/src/safe_db/db.rs @@ -34,6 +34,8 @@ impl DB { continue; } if let Some(receiver_safe) = self.safes.get(send_to) { + // TODO should return "limited or not" + // edge should contain token balance and transfer limit (which can be unlimited) let limit = safe.trust_transfer_limit(receiver_safe, *percentage); if limit != U256::from(0) { edges.push(Edge { @@ -53,6 +55,7 @@ impl DB { from: *user, to: *owner, token: *owner, + // TODO capacity should be only limited by own balance. capacity: *balance, }) } diff --git a/src/types/safe.rs b/src/types/safe.rs index 967065b..9dd4504 100644 --- a/src/types/safe.rs +++ b/src/types/safe.rs @@ -21,6 +21,7 @@ impl Safe { pub fn trust_transfer_limit(&self, receiver: &Safe, trust_percentage: u8) -> U256 { if receiver.organization { // TODO treat this as "return to owner" + // i.e. limited / only constrained by the balance edge. self.balance(&self.token_address) } else { let receiver_balance = receiver.balance(&self.token_address); @@ -30,6 +31,8 @@ impl Safe { if amount < receiver_balance { U256::from(0) } else { + // TODO it should not be "min" - the second constraint + // is set by the balance edge. min(amount - receiver_balance, self.balance(&self.token_address)) } }