Skip to content

Commit

Permalink
transfer-proxy: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
miloszm committed Jan 19, 2024
1 parent ec15864 commit 73cdc25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contracts/transfer-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ unsafe fn add_module_balance(arg_len: u32) -> u32 {
})
}

#[no_mangle]
unsafe fn sub_module_balance(arg_len: u32) -> u32 {
rusk_abi::wrap_call(arg_len, |(module, value)| {
STATE.sub_module_balance(module, value)
})
}

/// Asserts the call is made "from the outside", meaning that it's not an
/// inter-contract call.
///
Expand Down
10 changes: 10 additions & 0 deletions contracts/transfer-proxy/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,14 @@ impl TransferProxy {
)
.expect("message call should succeed")
}

pub fn sub_module_balance(&self, contract: ContractId, value: u64) {
let caller = rusk_abi::caller();
rusk_abi::call::<(ContractId, u64, ContractId), ()>(
self.target,
"sub_module_balance",
&(contract, value, caller),
)
.expect("sub_module_balance call should succeed")
}
}

0 comments on commit 73cdc25

Please sign in to comment.