Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Merge 7b8ab85 into 020083d
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-es committed Jul 30, 2020
2 parents 020083d + 7b8ab85 commit be56d4c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/ap-contracts/contracts/Tokenization/Forwarder.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pragma solidity ^0.5.2;

import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";


contract Forwarder is Ownable {

mapping(address => address) public beneficiaries;


function setBeneficiary(address token, address beneficiary) external onlyOwner {
require(
beneficiaries[token] == address(0),
"Forwarder.setBeneficiary: Beneficary already set for token."
);

beneficiaries[token] = beneficiary;
}

function pushAccruedToBeneficiary(address token) external returns(bool) {
require(
beneficiaries[token] != address(0),
"Forwarder.pushAccruedFundsToBeneficiary: No beneficiary set for token."
);

uint256 accruedFunds = IERC20(token).balanceOf(beneficiaries[token]);

return IERC20(token).transfer(beneficiaries[token], accruedFunds);
}
}

0 comments on commit be56d4c

Please sign in to comment.