Skip to content

Commit

Permalink
Contracts/Tests: store UUID params on and confirm UUID in contructor …
Browse files Browse the repository at this point in the history
…for UtilityTokenAbstract; expose conversion rate. Relates to #91
  • Loading branch information
Jason Banks committed Jan 30, 2018
1 parent 5dc342c commit 520d4c3
Show file tree
Hide file tree
Showing 12 changed files with 960 additions and 767 deletions.
102 changes: 55 additions & 47 deletions contracts/BrandedToken.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* solhint-disable-next-line compiler-fixed */
pragma solidity ^0.4.17;

// Copyright 2017 OpenST Ltd.
Expand Down Expand Up @@ -27,6 +28,7 @@ import "./SafeMath.sol";
import "./EIP20Token.sol";
import "./UtilityTokenAbstract.sol";


/// @dev Branded Token is an EIP20 token minted by staking Simple Token
/// on Ethereum mainnet. Branded tokens are designed to be used
/// within a (decentralised) application and support:
Expand All @@ -38,59 +40,65 @@ import "./UtilityTokenAbstract.sol";
/// their equivalent part of the Simple Token stake
/// on Ethereum (before v1.0)
contract BrandedToken is EIP20Token, UtilityTokenAbstract {
using SafeMath for uint256;

/*
* Public functions
*/
function BrandedToken(
address _openSTProtocol,
bytes32 _uuid,
string _symbol,
string _name,
uint8 _decimals)
EIP20Token(_symbol, _name, _decimals)
UtilityTokenAbstract(_openSTProtocol, _uuid)
public
{
using SafeMath for uint256;

}
/*
* Public functions
*/
function BrandedToken(
bytes32 _uuid,
string _symbol,
string _name,
uint8 _decimals,
uint256 _chainIdValue,
uint256 _chainIdUtility,
uint256 _conversionRate)
public
EIP20Token(_symbol, _name, _decimals)
UtilityTokenAbstract(
_uuid,
_symbol,
_name,
_chainIdValue,
_chainIdUtility,
_conversionRate)
{ }

function claim(
address _beneficiary)
public
returns (bool /* success */)
{
uint256 amount = claimInternal(_beneficiary);
function claim(
address _beneficiary)
public
returns (bool /* success */)
{
uint256 amount = claimInternal(_beneficiary);

return claimEIP20(_beneficiary, amount);
}
return claimEIP20(_beneficiary, amount);
}

function mint(
address _beneficiary,
uint256 _amount)
public
onlyProtocol
returns (bool /* success */)
{
mintEIP20(_amount);
function mint(
address _beneficiary,
uint256 _amount)
public
onlyProtocol
returns (bool /* success */)
{
mintEIP20(_amount);

return mintInternal(_beneficiary, _amount);
}
return mintInternal(_beneficiary, _amount);
}

function burn(
address _burner,
uint256 _amount)
public
onlyProtocol
payable
returns (bool /* success */)
{
// force non-payable, as only ST' handles in base tokens
require(msg.value == 0);
function burn(
address _burner,
uint256 _amount)
public
onlyProtocol
payable
returns (bool /* success */)
{
// force non-payable, as only ST' handles in base tokens
require(msg.value == 0);

burnEIP20(_amount);
burnEIP20(_amount);

return burnInternal(_burner, _amount);
}
return burnInternal(_burner, _amount);
}
}
Loading

0 comments on commit 520d4c3

Please sign in to comment.