Skip to content

Confusing day limit mapping #17

@joshuahannan

Description

@joshuahannan

WalletMainLib’s currentSpend mapping associates addresses to a uint256 array of length two. The address key corresponds to the address of an ERC20 token, or 0x0 if the “token” in question is ether. The first member of the array represents the day timestamp of the day whose expenditure is being accounted for, and the second member represents the amount of tokens spent on that day.
Even though this is well documented in the code, using an array of length two makes the code non declarative and difficult to understand. Despite the documentation being in place, it is only present in one place of the code and forces the programmer to remember this rather non trivial implementation. An example of this difficulty can be found in WalletMainLib, lines 209 and 210.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions