Skip to content

sum from mapping of structs? #144

@naps62

Description

@naps62

Is it possible to achieve something like this?

contract Vault {
  struct Account {
    uint256 id;
    uint256 shares;
  }

  mapping(address => Account) accounts;
  uint256 totalShares;

  /// #invariant unchecked_sum(accounts.shares) == totalShares;
  function deposit() {
    /// ...
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions