Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vocabluary of coin and ost instead of base token and token #686

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/gateway/EIP20CoGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,8 @@ contract EIP20CoGateway is GatewayBase {
* @param _stakerNonce Nonce of the staker address.
* @param _beneficiary The address in the auxiliary chain where the utility
* tokens will be minted. This is payable so that it
* provides flexibility of transferring base token
* to account on minting.
* provides flexibility of transferring coin to account
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
* on minting.
* @param _amount Staked amount.
* @param _gasPrice Gas price that staker is ready to pay to get the stake
* and mint process done
Expand Down Expand Up @@ -850,7 +850,7 @@ contract EIP20CoGateway is GatewayBase {
* @dev In order to redeem the redeemer needs to approve CoGateway contract
* for redeem amount. Redeem amount is transferred from redeemer
* address to CoGateway contract.
* This is a payable function. The bounty is transferred in base token.
* This is a payable function. The bounty is transferred in coin.
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
* Redeemer is always msg.sender.
*
* @param _amount Redeem amount that will be transferred from redeemer
Expand Down
49 changes: 24 additions & 25 deletions contracts/gateway/OSTPrime.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pragma solidity ^0.5.0;

/*
* Simple Token Prime [OST'] is equivalently staked for with Simple Token
* on the value chain and is the base token that pays for gas on the auxiliary
* on the value chain and is the base coin that pays for gas on the auxiliary
* chain. The gasprice on auxiliary chains is set in [OST'-Wei/gas] (like
* Ether pays for gas on Ethereum mainnet) when sending a transaction on
* the auxiliary chain.
Expand All @@ -40,7 +40,7 @@ import "../lib/SafeMath.sol";
* @notice A freely tradable equivalent representation of Simple Token [OST]
* on Ethereum mainnet on the auxiliary chain.
*
* @dev OSTPrime functions as the base token to pay for gas consumption on the
* @dev OSTPrime functions as the base coin to pay for gas consumption on the
* utility chain.
*/
contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {
Expand All @@ -49,20 +49,20 @@ contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {

using SafeMath for uint256;

/** Emitted whenever OST Prime token is converted to OST Prime base token. */
event TokenUnwrapped(
/** Emitted whenever OST is converted to coin. */
event OSTUnwrapped(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TokenUnwrapped is still correct, because the ERC20 token is unwrapped to become a base coin. Please update the comment along the same line

address indexed _account,
uint256 _amount
);

/** Emitted whenever OST Prime base token is converted to OST Prime token. */
event TokenWrapped(
/** Emitted whenever coin is converted to OST. */
event OSTWrapped(
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
address indexed _account,
uint256 _amount
);

/**
* Set when OST Prime has received TOKENS_MAX tokens;
* Set when OST Prime has received TOKENS_MAX coins;
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
* when uninitialized wrap and unwrap is not allowed.
*/
bool public initialized;
Expand Down Expand Up @@ -115,10 +115,10 @@ contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {
* @notice Public function initialize.
*
* @dev It must verify that the genesis exactly specified TOKENS_MAX
* so that all base tokens are held by OSTPrime.
* On setup of the auxiliary chain the base tokens need to be
* transferred in full to OSTPrime for the base tokens to be
* minted as OST Prime.
* so that all coins are held by this contract.
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
* On setup of the auxiliary chain the coins need to be
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
* transferred in full to this contract for ost to be
* minted as coin.
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
*
* @return success_ `true` if initialize was successful.
*/
Expand Down Expand Up @@ -146,9 +146,9 @@ contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {
/* External functions. */

/**
* @notice Convert the OST Prime token to OST Prime base token.
* @notice Unwrap converts OST to coin.
0xsarvesh marked this conversation as resolved.
Show resolved Hide resolved
*
* @param _amount Amount of OST Prime token to convert to base token.
* @param _amount Amount of OST to convert to coin.
*
* @return success_ `true` if unwrap was successful.
*/
Expand All @@ -170,23 +170,22 @@ contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {
);

/*
* The OST Prime base token balance of contract should always be
* greater than the amount if the above conditions are satisfied
* received payable amount.
* This contract's coin balance must always be greater than unwrap
* amount.
*/
assert(address(this).balance >= _amount);

transferBalance(msg.sender, address(this), _amount);

msg.sender.transfer(_amount);

emit TokenUnwrapped(msg.sender, _amount);
emit OSTUnwrapped(msg.sender, _amount);

success_ = true;
}

/**
* @notice Convert OST Prime base token to OST Prime token.
* @notice Wrap converts coin to OST.
*
* @return success_ `true` if claim was successfully progressed.
*/
Expand All @@ -205,28 +204,28 @@ contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {
);

/*
* The OST Prime balance of contract should always be greater than the
* The OST balance of contract should always be greater than the
* received payable amount.
*/
assert(balances[address(this)] >= amount);

transferBalance(address(this), account, amount);

emit TokenWrapped(account, amount);
emit OSTWrapped(account, amount);

success_ = true;
}

/**
* @notice This method performs following operations:
* - Adds number of OST Prime EIP20 tokens to this contract address.
* - Adds number of OST EIP20 tokens to this contract address.
* - Increases the total token supply.
* - Transfers base token to the beneficiary address.
* - Transfers coin to the beneficiary address.
* It can be called by CoGateway address and when contract is
* initialized.
*
* @param _account Account address for which the OST Prime balance will be
* increased. This is payable so that base token can be
* @param _account Account address for which the coin balance will be
* increased. This is payable so that coin can be
* transferred to the account.
* @param _amount Amount of tokens.
*
Expand All @@ -247,7 +246,7 @@ contract OSTPrime is UtilityToken, OSTPrimeConfig, Mutex {
}

/**
* @notice Decreases the OST Prime token balance from the msg.sender
* @notice Decreases the OST balance from the msg.sender
* address and decreases the total token supply count. Can be
* called only when contract is initialized and only by CoGateway
* address.
Expand Down
6 changes: 3 additions & 3 deletions test/gateway/ost_prime/unwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ contract('OSTPrime.unwrap()', (accounts) => {
const event = EventDecoder.getEvents(tx, ostPrime);

assert.isDefined(
event.TokenUnwrapped,
'Event `TokenUnwrapped` must be emitted.',
event.OSTUnwrapped,
'Event `OSTUnwrapped` must be emitted.',
);

const eventData = event.TokenUnwrapped;
const eventData = event.OSTUnwrapped;

assert.strictEqual(
eventData._account,
Expand Down
6 changes: 3 additions & 3 deletions test/gateway/ost_prime/wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ contract('OSTPrime.wrap()', (accounts) => {
const event = EventDecoder.getEvents(tx, ostPrime);

assert.isDefined(
event.TokenWrapped,
'Event `TokenWrapped` must be emitted.',
event.OSTWrapped,
'Event `OSTWrapped` must be emitted.',
);

const eventData = event.TokenWrapped;
const eventData = event.OSTWrapped;

assert.strictEqual(
eventData._account,
Expand Down