-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathMockRedemptionManager.sol
More file actions
45 lines (37 loc) · 1.52 KB
/
MockRedemptionManager.sol
File metadata and controls
45 lines (37 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pragma solidity ^0.4.24;
import "../modules/Experimental/Burn/TrackedRedemption.sol";
/**
* @title Burn module for burning tokens and keeping track of burnt amounts
*/
contract MockRedemptionManager is TrackedRedemption {
mapping (address => uint256) tokenToRedeem;
event RedeemedTokenByOwner(address _investor, address _byWhoom, uint256 _value, uint256 _timestamp);
/**
* @notice Constructor
* @param _securityToken Address of the security token
*/
constructor (address _securityToken) public
TrackedRedemption(_securityToken)
{
}
/**
* @notice Transfers tokens to Module to burn
* @param _value The number of tokens to redeem
*/
function transferToRedeem(uint256 _value) public {
require(ISecurityToken(securityToken).transferFrom(msg.sender, address(this), _value), "Insufficient funds");
tokenToRedeem[msg.sender] = _value;
}
/**
* @notice Used to redeem tokens by the module
* @param _value The number of tokens to redeem
*/
function redeemTokenByOwner(uint256 _value) public {
require(tokenToRedeem[msg.sender] >= _value, "Insufficient tokens redeemable");
tokenToRedeem[msg.sender] = tokenToRedeem[msg.sender].sub(_value);
redeemedTokens[msg.sender] = redeemedTokens[msg.sender].add(_value);
ISecurityToken(securityToken).burnWithData(_value, "");
/*solium-disable-next-line security/no-block-members*/
emit RedeemedTokenByOwner(msg.sender, address(this), _value, now);
}
}