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

Refactor/reviewing contract code and comments #234

Merged
merged 12 commits into from Aug 26, 2019

Refactoring partially used function.

  • Loading branch information
Freydal committed Aug 22, 2019
commit 265d89e282ae7f1214d5b61c8820fe3ba48388ea
@@ -87,7 +87,9 @@ contract Treasury is Authorizable {
function claimTokens(address account, uint amount) isAuthorized public {
//Attempt to get more balance if balance is insufficient
if(getCurrentBalance(account) < amount) {
updateBalance(account, amount);
uint currentBalance = getCurrentBalance(account);
uint amountToDeposit = amount.sub(currentBalance);
_deposit(account, amountToDeposit);
}

//Transfer to requesting contract and update balance held in contract
@@ -132,23 +134,6 @@ contract Treasury is Authorizable {
setSystemBalance(account, getSystemBalance(account).add(amount));
}

/** @dev Allows contracts to set balance.
@notice Allows contracts to set balance.
@param account User to modify tokens for
@param amount Number of tokens to set to current balance
*/
function updateBalance(address account, uint amount) isAuthorized public {
//Adjust balance to requested value. Increase or decrease based on current balance
uint currentBalance = getCurrentBalance(account);
if(currentBalance > amount) {
uint amountToWithdraw = currentBalance.sub(amount);
_withdraw(account, amountToWithdraw);
} else if (currentBalance < amount) {
uint amountToDeposit = amount.sub(currentBalance);
_deposit(account, amountToDeposit);
}
}

/** @dev Allows contracts to burn an accounts held tokens.
@notice Allows contracts to burn an accounts held tokens.
@param account Account to burn tokens for.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.