Skip to content

Commit

Permalink
refactor: withdraw only handlede by sender
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Aug 27, 2024
1 parent e1dd5df commit 394552f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
4 changes: 2 additions & 2 deletions contracts/RightsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ contract RightsManager is

/// @inheritdoc IFundsManager
/// @notice Withdraws funds from the contract to a specified recipient's address.
/// @param recipient The address that will receive the withdrawn funds.
/// @param amount The amount of funds to withdraw.
/// @param currency The address of the ERC20 token to withdraw, or address(0) to withdraw native coins.
function withdraw(
address recipient,
uint256 amount,
address currency
) external onlyValidCurrency(currency) {
// TODO only sender can withdraw o recipient = _msdSender()
address recipient = _msdSender();
uint256 available = getLedgerEntry(recipient, currency);
if (available < amount) revert NoFundsToWithdraw(recipient);
recipient.transfer(amount, currency);
Expand Down
3 changes: 1 addition & 2 deletions contracts/interfaces/IFundsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ pragma solidity ^0.8.24;
/// or an authorized entity can initiate a withdrawal.
interface IFundsManager {
/// @notice Withdraws funds from the contract to a specified recipient's address.
/// @param recipient The address that will receive the withdrawn funds.
/// @param amount The amount of funds to withdraw.
/// @param currency The currency to associate fees with. Use address(0) for the native coin.
function withdraw(address recipient, uint256 amount, address currency) external;
function withdraw(uint256 amount, address currency) external;
// function getBalance
}
20 changes: 0 additions & 20 deletions test/Distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,5 @@ describe('Distributor', function () {
})
})

describe('Financial', function () {

it("Should calculate expected negotiation based on constant fee .", async function () {

})

it("Should calculate expected negotiation based on variant fee.", async function () {

})

it("Should calculate expected negotiation based on variant fee + flatten factor.", async function () {

})

it("Should calculate expected negotiation auto adjusted flatten factor.", async function () {

})

})


})

0 comments on commit 394552f

Please sign in to comment.