diff --git a/contracts/transfer-proxy/src/lib.rs b/contracts/transfer-proxy/src/lib.rs index 79807ad8f1..dbf8292eb1 100644 --- a/contracts/transfer-proxy/src/lib.rs +++ b/contracts/transfer-proxy/src/lib.rs @@ -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. /// diff --git a/contracts/transfer-proxy/src/state.rs b/contracts/transfer-proxy/src/state.rs index 822ce08ff5..a3b185afb2 100644 --- a/contracts/transfer-proxy/src/state.rs +++ b/contracts/transfer-proxy/src/state.rs @@ -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") + } }