Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
foundrytest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
explorer-for-cmp20
foundrytest
Commits
47f9989d
Commit
47f9989d
authored
Jan 30, 2026
by
Developer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f8f2596d
Pipeline
#923
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
18 deletions
+32
-18
.gitmodules
.gitmodules
+3
-0
foundry.lock
foundry.lock
+8
-0
forge-std
lib/forge-std
+1
-0
DeployAll.s.sol
script/DeployAll.s.sol
+14
-15
InternalTransfer.t.sol
test/InternalTransfer.t.sol
+6
-3
No files found.
.gitmodules
0 → 100644
View file @
47f9989d
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
foundry.lock
0 → 100644
View file @
47f9989d
{
"lib/forge-std": {
"tag": {
"name": "v1.14.0",
"rev": "1801b0541f4fda118a10798fd3486bb7051c5dd6"
}
}
}
\ No newline at end of file
forge-std
@
1801b054
Subproject commit 1801b0541f4fda118a10798fd3486bb7051c5dd6
script/DeployAll.s.sol
View file @
47f9989d
console.log("");
// 3. 进行一些初始化操作
address testUser = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8; // 测试账户
uint256 transferAmount = 10000 * 10**18;
// 给测试账户转一些代币
token.transfer(testUser, transferAmount);
console.log("=== Initial Setup ===");
console.log("Transferred", transferAmount, "tokens to", testUser);
console.log("Test user balance:", token.balanceOf(testUser));
vm.stopBroadcast();
}
}
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
pragma solidity ^0.8.20;
...
@@ -40,4 +25,18 @@ contract DeployAll is Script {
...
@@ -40,4 +25,18 @@ contract DeployAll is Script {
console.log("=== InternalTransfer Deployed ===");
console.log("=== InternalTransfer Deployed ===");
console.log("Address:", address(transferContract));
console.log("Address:", address(transferContract));
console.log("Owner:", transferContract.owner());
console.log("Owner:", transferContract.owner());
console.log("");
// 3. 进行一些初始化操作
address testUser = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8; // 测试账户
uint256 transferAmount = 10000 * 10**18;
// 给测试账户转一些代币
token.transfer(testUser, transferAmount);
console.log("=== Initial Setup ===");
console.log("Transferred", transferAmount, "tokens to", testUser);
console.log("Test user balance:", token.balanceOf(testUser));
vm.stopBroadcast();
}
}
test/InternalTransfer.t.sol
View file @
47f9989d
...
@@ -14,6 +14,10 @@ contract InternalTransferTest is Test {
...
@@ -14,6 +14,10 @@ contract InternalTransferTest is Test {
address public user2;
address public user2;
address public user3;
address public user3;
// 声明事件用于测试
event BatchTransfer(address indexed token, address indexed from, uint256 totalAmount, uint256 recipientCount);
event ProxyTransfer(address indexed token, address indexed from, address indexed to, uint256 amount);
function setUp() public {
function setUp() public {
owner = address(this);
owner = address(this);
user1 = address(0x1);
user1 = address(0x1);
...
@@ -94,7 +98,7 @@ contract InternalTransferTest is Test {
...
@@ -94,7 +98,7 @@ contract InternalTransferTest is Test {
function testProxyTransferFailNoApproval() public {
function testProxyTransferFailNoApproval() public {
uint256 amount = 500 * 10**18;
uint256 amount = 500 * 10**18;
vm.expectRevert("
Proxy transfer failed
");
vm.expectRevert("
ERC20: insufficient allowance
");
transferContract.proxyTransfer(address(token), user1, user2, amount);
transferContract.proxyTransfer(address(token), user1, user2, amount);
}
}
...
@@ -181,8 +185,7 @@ contract InternalTransferTest is Test {
...
@@ -181,8 +185,7 @@ contract InternalTransferTest is Test {
vm.prank(user1);
vm.prank(user1);
vm.expectEmit(true, true, false, true);
vm.expectEmit(true, true, false, true);
emit
InternalTransfer.
BatchTransfer(address(token), user1, amount1 + amount2, 2);
emit BatchTransfer(address(token), user1, amount1 + amount2, 2);
transferContract.batchTransfer(address(token), recipients, amounts);
transferContract.batchTransfer(address(token), recipients, amounts);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment