Skip to content
Merged
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
4 changes: 2 additions & 2 deletions contracts/vault/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl CalloraVault {
caller.require_auth();
assert!(amount > 0, "amount must be positive");
assert!(
Self::is_authorized_depositor(env.clone(), caller.clone()),
Self::is_authorized_depositor(env.clone(), depositor.clone()),
"unauthorized: only owner or allowed depositor can deposit"
);
let meta = Self::get_meta(env.clone());
Expand All @@ -367,7 +367,7 @@ impl CalloraVault {
.get(&StorageKey::UsdcToken)
.expect("vault not initialized");
let usdc = token::Client::new(&env, &usdc_addr);
usdc.transfer(&caller, &env.current_contract_address(), &amount);
usdc.transfer(&depositor, &env.current_contract_address(), &amount);
let mut meta = Self::get_meta(env.clone());
meta.balance = meta
.balance
Expand Down
6 changes: 3 additions & 3 deletions docs/interfaces/vault.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@

{
"name": "deposit",
"description": "Transfer USDC from the caller into the vault and increase the tracked balance. Blocked when paused.",
"description": "Transfer USDC from depositor into vault and increase tracked balance. Blocked when paused.",
"access": "owner OR allowed depositor",
"params": [
{ "name": "caller", "type": "Address", "optional": false, "description": "Must be the owner or an allowed depositor; must authorize." },
{ "name": "depositor", "type": "Address", "optional": false, "description": "Must be owner or an allowed depositor; must authorize." },
{ "name": "amount", "type": "i128", "optional": false, "description": "Amount to deposit; must be > 0 and >= min_deposit." }
],
"returns": "i128 (new balance)",
Expand All @@ -70,7 +70,7 @@
"\"balance overflow\" — extremely unlikely arithmetic overflow."
],
"events": [
{ "topics": ["\"deposit\"", "caller"], "data": "amount (i128)" }
{ "topics": ["\"deposit\"", "depositor"], "data": "(amount, new_balance) tuple" }
]
},

Expand Down
Loading