# ERC644 Token

### Preamble

```
EIP: <to be assigned>
Title: Token standard for upgradeable and modular tokens
Author: christopher@expanse.tech
Type: Standard Track
Category ERC
Status: Draft
Created: 2017/06/16
```

### 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eggs.cool/knowledge-base/erc644-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
