ConsenSysDiligence / ConsenSysDiligence/scribble

Idea: #define usage for functions

Open
#209 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
334
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Currently `#define` annotations are quite limited, being only applicable at the contract level.
It would be nice to be able to use a `#define`, rather than supplying a function, simply replacing the code inside other annotations.

Example:
```c++
#define voterId uint256 = voterList[_wallet]; // _wallet is a function parameter
#define voter Voter = listOfVoters[voterId];

#if_succeeds "registered the update"
voter.isActive == _isActive;
```

Would be translated into
```c++
#if_succeeds "registered the update"
listOfVoters[voterList[_wallet]].isActive == _isActive;
```

This would give `#define` a second purpose for functions and help clean up annotations.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.