sum from mapping of structs?
See original GitHub issueIs 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() {
/// ...
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Grouping maps/structs by key, and summing the associated ...
go - Grouping maps/structs by key, and summing the associated values for an array - Stack Overflow. Stack Overflow for Teams – Start ......
Read more >How to sum up values of a struct? - Elixir Forum
I have a struct. s = %S{a: 1, b: 2} and, a list. l = [3, 4] and, I want a fn() to...
Read more >How to loop through mapping in solidity?
mapping (address => uint) public voterCount;. To calculate the total votes, I would like to loop through the mapping and sum the uint...
Read more >Solidity Tutorial: all about Mappings | by Jean Cvllr - Medium
This article covers in depth the mapping type in Solidity, how they are represented in a smart contract storage, getters, setters, ...
Read more >Summing up numeric properties of objects in an array in Swift
This a solution on how to sum up numeric properties of objects within an array. You can test the code with there snippet...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@GNSPS thanks for the offer (I will hold you up to that 😄 )
It’s both for a production project, and to potentially use in yAcademy which just started I had scribble on my todo list for a few months now, and decided to give it a try these days to see if it could be a better fit than echidna
@nettrino you’re correct - it is not currently possible. However could you post a sample of what you would like supported? If there is enough interest in this feature, and if we can figure out a way to implement it thats friendly to underlying tools (fuzzers/sym. exec engines/verifiers for example) then we can consider it.