Skip to content
This repository was archived by the owner on Dec 28, 2019. It is now read-only.

Commit 340166c

Browse files
committed
Limit the amount the beneficiary receives (rest goes into the owner's multisig)
1 parent 2d89c6f commit 340166c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

contracts/Market.sol

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import "./IProperty.sol";
99

1010
// @title Radical Bodies market.
1111
contract Market is IMarket, Ownable, Pausable {
12+
uint256 private constant beneficiaryLimit = 42 ether;
13+
1214
// 6 digits precision
1315
uint256 private constant _taxPrecision = 1000000;
1416

@@ -21,6 +23,8 @@ contract Market is IMarket, Ownable, Pausable {
2123
mapping (uint256 => uint256) private tokenPrice;
2224
mapping (uint256 => uint256) private tokenTaxedUntil;
2325

26+
uint256 private totalWithdrawn = 0;
27+
2428
constructor(
2529
IProperty token,
2630
uint256 interval,
@@ -70,7 +74,13 @@ contract Market is IMarket, Ownable, Pausable {
7074

7175
// The beneficiary can retrieve already released funds via this.
7276
function withdrawAvailableFunds() external payable {
73-
_beneficiary.transfer(this.balance);
77+
if (totalWithdrawn >= beneficiaryLimit)
78+
owner().transfer(this.balance);
79+
else {
80+
uint256 amonut = Math.min(this.balance, beneficiaryLimit);
81+
totalWithdrawn += amount;
82+
_beneficiary.transfer(amount);
83+
}
7484
}
7585

7686
// The current price of the given token.

0 commit comments

Comments
 (0)