Skip to content

Commit

Permalink
add (success, netAmount) return to riskpool fund/defundBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaszimmermann committed Jul 18, 2022
1 parent 4ae68f1 commit 20e7784
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions contracts/components/IRiskpool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ interface IRiskpool is IComponent {
event LogRiskpoolBalanceDecreased(bytes32 processId, uint256 amount, uint256 newBalance);

function createBundle(bytes calldata filter, uint256 initialAmount) external returns(uint256 bundleId);
function fundBundle(uint256 bundleId, uint256 amount) external;
function defundBundle(uint256 bundleId, uint256 amount) external;
function fundBundle(uint256 bundleId, uint256 amount) external returns(bool success, uint256 netAmount);
function defundBundle(uint256 bundleId, uint256 amount) external returns(bool success, uint256 netAmount);

function lockBundle(uint256 bundleId) external;
function unlockBundle(uint256 bundleId) external;
Expand Down
6 changes: 4 additions & 2 deletions contracts/components/Riskpool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,17 @@ abstract contract Riskpool is
function fundBundle(uint256 bundleId, uint256 amount)
external override
onlyBundleOwner(bundleId)
returns(bool success, uint256 netAmount)
{
_riskpoolService.fundBundle(bundleId, amount);
(success, netAmount) = _riskpoolService.fundBundle(bundleId, amount);
}

function defundBundle(uint256 bundleId, uint256 amount)
external override
onlyBundleOwner(bundleId)
returns(bool success, uint256 netAmount)
{
_riskpoolService.defundBundle(bundleId, amount);
(success, netAmount) = _riskpoolService.defundBundle(bundleId, amount);
}

function lockBundle(uint256 bundleId)
Expand Down
4 changes: 2 additions & 2 deletions contracts/services/IRiskpoolService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.0;
interface IRiskpoolService {

function createBundle(address owner_, bytes calldata filter_, uint256 amount_) external returns(uint256 bundleId);
function fundBundle(uint256 bundleId, uint256 amount) external;
function defundBundle(uint256 bundleId, uint256 amount) external;
function fundBundle(uint256 bundleId, uint256 amount) external returns(bool success, uint256 netAmount);
function defundBundle(uint256 bundleId, uint256 amount) external returns(bool success, uint256 netAmount);

function lockBundle(uint256 bundleId) external;
function unlockBundle(uint256 bundleId) external;
Expand Down

0 comments on commit 20e7784

Please sign in to comment.