Skip to content

Commit

Permalink
Merge pull request #1 from getgrit/migrate-to-ts-solidity
Browse files Browse the repository at this point in the history
start migration
  • Loading branch information
Cosmin Radoi authored Feb 13, 2023
2 parents 212d70f + ef03e52 commit 87e08ef
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 22 deletions.
23 changes: 2 additions & 21 deletions .grit/patterns/NestedLoop.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,12 @@ contract HelloWorld {
string public greet = "Hello World!";
function foo(string memory _greet) public {
do {
while(other) {
greet = foo(bar);
while(foo) {
greet = foo(bar);
}
} while (condition);
}
}
```

```typescript
// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.13 and less than 0.9.0
pragma solidity ^0.8.9;

contract HelloWorld {
string public greet = "Hello World!";

function foo(string memory _greet) public {
do {
greet = foo(bar);
while(foo) {
greet = foo(bar);
}
} while (condition);
}
}
}
```
2 changes: 1 addition & 1 deletion .grit/patterns/UpgradableProxyPattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags: #reentrancy, #vulnerability

```grit
ContractDefinition(_, $inherited, _, _, "contract", _, _, _, _, _, _, _, _, []) where {
sol_contract_declaration(body = $inherited) where {
$inherited <: contains or { "Proxy", "ERC1967Upgrade", "TransparentUpgradeableProxy", "UUPSUpgradeable" }
}
Expand Down
13 changes: 13 additions & 0 deletions .grit/patterns/common.grit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pattern Loop($body) = bubble($body) orelse {
`while($_) { $body }`
`for ($_; $_; $_) { $body }`
}

pattern EtherTransfer($amount) = bubble($amount) or {
`$sender.call{value: $amount}($_)`
`$sender.call.value($amount)($_)`
`$call($amount)` where {
$call <: `$address.$functionName`
$functionName <: r".*transfer.*"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 87e08ef

Please sign in to comment.