Last active
November 9, 2016 22:01
-
-
Save elenadimitrova/e04a3b1d6c7b4c68f57ee3ac009d83e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onHoldBalanceOf(address _storageContract, address _account) | |
constant returns (uint256 balance) | |
{ | |
return EternalStorage(_storageContract).getUIntValue(keccak256("onhold:", _account)); | |
} | |
function onHoldBalanceSet(address _storageContract, address _account, uint256 _balance) | |
{ | |
var onHoldBalance = EternalStorage(_storageContract).getUIntValue(keccak256("onhold:", _account)); | |
EternalStorage(_storageContract).setUIntValue(keccak256("onhold:", _account), onHoldBalance + _balance); | |
} | |
function releaseTokens(address _storageContract, address _account) | |
{ | |
var onHoldBalance = onHoldBalanceOf(_storageContract, _account); | |
if (onHoldBalance > 0) { | |
EternalStorage(_storageContract).setUIntValue(keccak256("onhold:", _account), 0); | |
var balance = balanceOf(_storageContract, _account); | |
EternalStorage(_storageContract).setUIntValue(keccak256("balance:", _account), balance + onHoldBalance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment