-
-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Implement SafeERC20 for secure ERC20 token transfers #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| { | ||
| "lib/forge-std": { | ||
| "rev": "3b20d60d14b343ee4f908cb8079495c07f5e8981" | ||
| }, | ||
| "lib\\openzeppelin-contracts": { | ||
| "tag": { | ||
| "name": "v5.5.0", | ||
| "rev": "fcbae5394ae8ad52d8e580a3477db99814b9d565" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // SPDX-License-Identifier: Unlicense | ||
| pragma solidity ^0.8.13; | ||
| pragma solidity ^0.8.20; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Solidity tests touching invoice payment paths ==="
rg -n -C2 --type sol \
-g '**/*.t.sol' \
-g '**/test/**/*.sol' \
-g '**/tests/**/*.sol' \
'createInvoice\(|createInvoicesBatch\(|payInvoice\(|payInvoicesBatch\(|InsufficientAllowance|IncorrectNativeValue|FeeMustBeNative|ERC20|IERC20|Mock.*Token'Repository: StabilityNexus/Chainvoice Length of output: 167 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Searching for Solidity test files ==="
find . -name "*.t.sol" -o -name "*Test.sol" | head -20
echo ""
echo "=== Searching for payInvoice and token-related keywords in test files ==="
rg -n -C2 'payInvoice|createInvoice|InsufficientAllowance|MockToken|ERC20|IERC20' \
--glob='**/*.t.sol' \
--glob='**/test/**/*.sol'
echo ""
echo "=== Checking for any ERC20 mock files ==="
find . -type f -name "*Mock*.sol" -o -name "*Token*.sol" | grep -E "(test|spec)" | head -10Repository: StabilityNexus/Chainvoice Length of output: 2948 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Looking for the main Chainvoice contract ==="
find . -name "Chainvoice.sol" -not -path "*/test/*"
echo ""
echo "=== Checking contract structure (first 100 lines) ==="
find . -name "Chainvoice.sol" -not -path "*/test/*" -exec head -100 {} \;
echo ""
echo "=== Searching for ERC20 imports and token handling ==="
find . -name "Chainvoice.sol" -not -path "*/test/*" -exec grep -n "ERC20\|IERC20\|token\|Token" {} +
echo ""
echo "=== Searching for payInvoicesBatch function ==="
find . -name "*.sol" -not -path "*/test/*" -exec grep -n "payInvoicesBatch\|createInvoicesBatch" {} +Repository: StabilityNexus/Chainvoice Length of output: 7073 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Viewing payInvoice function (around line 220-265) ==="
sed -n '220,265p' ./contracts/src/Chainvoice.sol
echo ""
echo "=== Viewing payInvoicesBatch function (around line 267-335) ==="
sed -n '267,335p' ./contracts/src/Chainvoice.solRepository: StabilityNexus/Chainvoice Length of output: 4776 Add comprehensive test coverage for ERC20 payment flows and batch operations. The
Add test cases covering successful token payments plus all revert paths, or point to existing coverage if present elsewhere. 🤖 Prompt for AI Agents |
||
|
|
||
| import {Test} from "forge-std/Test.sol"; | ||
| import {console} from "forge-std/console.sol"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Remove or redact the private key from the comment.
Line 8 contains what appears to be a private key in a comment. Even if this is a test/example key, hardcoding private keys in version-controlled files is a serious security anti-pattern and can lead to accidental exposure of real credentials. Remove this line or replace the key with a placeholder like
YOUR_PRIVATE_KEY.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents