@@ -34,6 +34,7 @@ contract Auction4Reputation is Ownable {
3434 uint public numberOfAuctions;
3535 uint public auctionReputationReward;
3636 uint public auctionPeriod;
37+ uint public redeemEnableTime;
3738 StandardToken public token;
3839 address public wallet;
3940
@@ -44,24 +45,28 @@ contract Auction4Reputation is Ownable {
4445 * for the token locking
4546 * @param _auctionsStartTime auctions period start time
4647 * @param _auctionsEndTime auctions period end time.
47- * redeem reputation can be done after this period.
4848 * bidding is disable after this time.
4949 * @param _numberOfAuctions number of auctions.
50+ * @param _redeemEnableTime redeem enable time .
51+ * redeem reputation can be done after this time.
5052 * @param _token the bidding token
53+ * @param _wallet the address of the wallet the token will be transfer to.
5154 */
5255 function initialize (
5356 Avatar _avatar ,
5457 uint _reputationReward ,
5558 uint _auctionsStartTime ,
5659 uint _auctionsEndTime ,
5760 uint _numberOfAuctions ,
61+ uint _redeemEnableTime ,
5862 StandardToken _token ,
5963 address _wallet )
6064 external
6165 onlyOwner
6266 {
6367 require (avatar == Avatar (0 ), "can be called only one time " );
6468 require (_avatar != Avatar (0 ), "avatar cannot be zero " );
69+ require (_redeemEnableTime >= _auctionsEndTime, "_redeemEnableTime >= _auctionsEndTime " );
6570 // number of auctions cannot be zero
6671 // auctionsEndTime should be greater than auctionsStartTime
6772 auctionPeriod = (_auctionsEndTime.sub (_auctionsStartTime)).div (_numberOfAuctions);
@@ -74,6 +79,7 @@ contract Auction4Reputation is Ownable {
7479 wallet = _wallet;
7580 auctionReputationReward = _reputationReward / _numberOfAuctions;
7681 reputationRewardLeft = _reputationReward;
82+ redeemEnableTime = _redeemEnableTime;
7783 }
7884
7985 /**
@@ -84,7 +90,7 @@ contract Auction4Reputation is Ownable {
8490 */
8591 function redeem (address _beneficiary , uint _auctionId ) public returns (bool ) {
8692 // solium-disable-next-line security/no-block-members
87- require (now > auctionsEndTime , "check the auctions period pass " );
93+ require (now > redeemEnableTime , "now > redeemEnableTime " );
8894 Auction storage auction = auctions[_auctionId];
8995 uint bid = auction.bids[_beneficiary];
9096 require (bid > 0 , "bidding amount should be > 0 " );
@@ -109,7 +115,7 @@ contract Auction4Reputation is Ownable {
109115 require (now <= auctionsEndTime, "bidding should be within the allowed bidding period " );
110116 // solium-disable-next-line security/no-block-members
111117 require (now >= auctionsStartTime, "bidding is enable only after bidding auctionsStartTime " );
112- require (token.transferFrom (msg .sender , wallet , _amount), "transferFrom should success " );
118+ require (token.transferFrom (msg .sender , this , _amount), "transferFrom should success " );
113119 // solium-disable-next-line security/no-block-members
114120 auctionId = (now - auctionsStartTime) / auctionPeriod;
115121 Auction storage auction = auctions[auctionId];
@@ -128,4 +134,15 @@ contract Auction4Reputation is Ownable {
128134 return auctions[_auctionId].bids[_bidder];
129135 }
130136
137+ /**
138+ * @dev transferToWallet transfer the tokens to the wallet.
139+ * can be called only after auctionsEndTime
140+ */
141+ function transferToWallet () public {
142+ // solium-disable-next-line security/no-block-members
143+ require (now > auctionsEndTime, "now > auctionsEndTime " );
144+ uint tokenBalance = token.balanceOf (this );
145+ require (token.transfer (wallet,tokenBalance), "transfer should success " );
146+ }
147+
131148}
0 commit comments