Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Cargo.lock
*.pdb

.DS_Store
.idea/
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Today, `soliris` **is not production-ready** and might report false information.

Below is a list of the scanners implementation statuses:

| Name | Goal | Status |
|:-------------------:|----------------------------------------------------------------------------------------------------------------|:--------:|
| Missing Comments | Reports missing comments in your code. | |
| Unused Imports | Reports unused `import` declarations in your contracts. | |
| Mutable Functions | Reports functions able to mutate your contract's state. | |
| Mutable Variables | Reports variables likely to mutate. | |
| Mutation Grapher | Creates a graph showing the variables likely to mutate connected to the places where they undergo mutations. | |
| Struct Repacker | Suggests an alternative way to define a struct such that it takes less storage slots. | |
| Name | Goal | Status |
|:-----------------: |-------------------------------------------------------------------------------------------------------------- |:------: |
| Missing Comments | Reports missing comments in your code. | |
| Unused Imports | Reports unused `import` declarations in your contracts. | |
| Mutable Functions | Reports functions able to mutate your contract's state. | |
| Mutable Variables | Reports variables likely to mutate. | |
| Mutation Grapher | Creates a graph showing the variables likely to mutate connected to the places where they undergo mutations. | |
| Struct Repacker | Suggests an alternative way to define a struct such that it takes less storage slots. | |

## Getting Started

Expand Down
1 change: 1 addition & 0 deletions src/scanners/implementations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod missing_comments;
pub mod mutable_functions;
pub mod mutable_variables;
pub mod mutation_grapher;
pub mod struct_repacker;
pub mod unused_imports;
14 changes: 14 additions & 0 deletions src/scanners/implementations/mutation_grapher.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use syn_solidity::{Item, ItemContract, ItemFunction};

use crate::scanners::{memory::Metadata, Scanner};

#[derive(Default)]
pub struct MutationGrapher {}

impl MutationGrapher {}

impl Scanner for MutationGrapher {
fn execute(&self, _ast: &[Item], _metadata: &Metadata) {
println!("todo!")
}
}
9 changes: 5 additions & 4 deletions src/scanners/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pub mod memory;

use self::implementations::{
missing_comments::MissingComments, mutable_functions::MutableFunctions,
mutable_variables::MutableVariables, struct_repacker::StructRepacker,
unused_imports::UnusedImports,
mutable_variables::MutableVariables, mutation_grapher::MutationGrapher,
struct_repacker::StructRepacker, unused_imports::UnusedImports,
};
use crate::scanners::memory::Metadata;
use syn_solidity::Item;
Expand Down Expand Up @@ -37,6 +37,7 @@ impl Default for Registry {
Box::<MutableVariables>::default(),
Box::<MutableFunctions>::default(),
Box::<StructRepacker>::default(),
Box::<MutationGrapher>::default(),
],
}
}
Expand All @@ -60,7 +61,7 @@ mod tests {
fn it_creates_default_scanners_registry() {
let scanners_registry = Registry::default();

assert_eq!(scanners_registry.get_scanners().len(), 5)
assert_eq!(scanners_registry.get_scanners().len(), 6)
}

#[test]
Expand All @@ -69,6 +70,6 @@ mod tests {

scanners_registry.register_scanner(Box::new(MockScanner::default()));

assert_eq!(scanners_registry.get_scanners().len(), 6)
assert_eq!(scanners_registry.get_scanners().len(), 7)
}
}
11 changes: 11 additions & 0 deletions tests/contracts/MutableContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.15;

function IsAmethystBeautiful() public returns (bool) {
return true;
}

contract MutableContract {

}