Skip to content

Commit b4a7446

Browse files
committed
Attempt to fix failing CI
1 parent c11cb54 commit b4a7446

File tree

14 files changed

+1995
-3683
lines changed

14 files changed

+1995
-3683
lines changed

.DS_Store

8 KB
Binary file not shown.

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "smart_contract/lib/forge-std"]
2+
path = smart_contract/lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std.git
4+

discord-bot/.DS_Store

6 KB
Binary file not shown.

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"foundry-test-utility": "^0.1.1"
4+
}
5+
}

smart_contract/.DS_Store

6 KB
Binary file not shown.

smart_contract/contracts/test/Faucet.t.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pragma solidity ^0.8.0;
55
* @title Faucet - Test
66
*/
77

8-
import { CheatCodes } from 'foundry-test-utility/contracts/utils/cheatcodes.sol';
8+
// forge-std provides Vm via Test base; explicit CheatCodes import not needed
99
import { Constants } from "./utils/constants.t.sol";
1010

1111
import { Faucet } from "../Faucet.sol";
@@ -21,6 +21,10 @@ contract FaucetTest is Constants {
2121

2222
faucet.addMinter(address(this));
2323

24+
// Align contract config with test constants
25+
faucet.setWithdrawalAmount(BASIC_MINT_AMOUNT);
26+
faucet.setLockTime(BASIC_TIME_LOCK);
27+
2428
vm.deal(address(faucet), BASIC_MINT_AMOUNT);
2529

2630
vm.stopPrank();

smart_contract/contracts/test/utils/constants.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.0;
33

4-
import 'foundry-test-utility/contracts/utils/console.sol';
4+
import 'forge-std/console.sol';
55
import { Errors } from './errors.t.sol';
66

77
contract Constants is Errors {

smart_contract/contracts/test/utils/errors.t.sol

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.0;
33

4-
import { stdJson } from 'foundry-test-utility/contracts/utils/stdJson.sol';
5-
import { Vm } from 'foundry-test-utility/contracts/utils/vm.sol';
6-
import { DSTest } from 'foundry-test-utility/contracts/utils/test.sol';
4+
import { stdJson } from 'forge-std/StdJson.sol';
5+
import { Test } from 'forge-std/Test.sol';
76

8-
contract Errors is DSTest {
7+
contract Errors is Test {
98
using stdJson for string;
109

11-
Vm public constant vm = Vm(address(uint160(uint256(keccak256('hevm cheat code')))));
12-
1310
mapping(RevertStatus => string) private _errors;
1411

15-
// Add a revert error to the enum of errors.
1612
enum RevertStatus {
1713
SUCCESS,
1814
SKIP_VALIDATION,
@@ -25,7 +21,10 @@ contract Errors is DSTest {
2521

2622
// Associate your error with a revert message and add it to the mapping.
2723
constructor() {
28-
string memory json = vm.readFile('./constants/errors.json');
24+
// Resolve path from the Foundry project root to avoid CI working-directory issues
25+
string memory root = vm.projectRoot();
26+
string memory path = string.concat(root, '/constants/errors.json');
27+
string memory json = vm.readFile(path);
2928

3029
// Faucet
3130
_errors[RevertStatus.Faucet_FailSendingNativeToken] = json.readString('.Faucet.FailSendingNativeToken');

smart_contract/lib/forge-std

Submodule forge-std added at 8bbcf6e

0 commit comments

Comments
 (0)