ERC644 Token
The idea is to abstract user balances away from the token's business logic making the tokens upgradeable, and opens the door for modular functionality to be added over time.
Preamble
Abstract
As it stands now, if any ERC20 tokens were to encounter any sort of fatal flaw, ever balance on that token would be at risk and recovering from the flaw would be cumbersome at best. This ERC proposes a way to accomplish the tasks below by abstracting the user balances away from the business logic.
Makes tokens upgradeable
Allows for modular functionality
Creates a way to insulate user balances from exploitable code
Motivation
Protecting consumers from potential exploits.
Specification
Balances.sol
Methods
getBalances
Returns an account's token balance.
function getBalance(address _acct) returns(uint balance)
incBalance
Increases an account's token balance.
function incBalance(address _acct, uint _val) onlyModule returns(bool success)
decBalance
Decreases an account's token balance.
function decBalance(address _acct, uint _val) onlyModule returns(bool success)
getAllowance
Returns an accounts allowed balance to be spent on behalf of owner
.
function getAllowance(address _owner, address _spender) returns(uint remaining)
setApprove
Allows _spender
to spend from _sender's account. When the function is called it over writes the current allowance with
_value`.
function setApprove(address _sender, address _spender, uint256 _value) onlyModule returns(bool success)
decApprove
Decreases an accounts allowance amount by _value
.
function decApprove(address _from, address _spender, uint _value) onlyModule returns(bool success)
getModule
Returns if module _acct
is active or not.
function getModule(address _acct) returns (bool success)
setModule
Sets module _acct
to true or false.
function setModule(address _acct, bool _set) onlyRoot returns(bool success)
getTotalSupply
Returns the total supply.
function getTotalSupply() returns(uint)
incTotalSupply
Increases the total supply.
function incTotalSupply(uint _val) onlyModule returns(bool success)
decTotalSupply
Decreases the total supply.
function decTotalSupply(uint _val) onlyModule returns(bool success)
transferRoot
Transfers to a new account.
function transferRoot(address _new) onlyRoot returns(bool success)
Events
BalanceAdj
Triggered when balances are adjusted.
event BalanceAdj(address indexed Module, address indexed Account, uint Amount, string Polarity);
ModuleSet
Triggered when modules are updated.
event ModuleSet(address indexed Module, bool indexed Set);
Implementation
https://github.com/expanse-org/Tokens/tree/master/Token_Contracts/contracts
Last updated