Skip to content

Commit

Permalink
Merge pull request #1531 from sphinx-labs/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
RPate97 authored Mar 6, 2024
2 parents 1ae79ad + a7b6d14 commit de1d5c3
Show file tree
Hide file tree
Showing 40 changed files with 24,778 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .changeset/spotty-poems-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sphinx-labs/contracts': patch
'@sphinx-labs/plugins': patch
---

Support installing Sphinx Library contracts via NPM
8 changes: 0 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ jobs:
keys:
- v2-cache-source-{{ .Branch }}-{{ .Revision }}
- v2-cache-source-{{ .Branch }}
- run:
name: Reset Head
command: git reset --hard || true
- checkout
- run:
name: Initialize submodules
command: |
git submodule init
git submodule update
- save_cache:
key: v2-cache-source-{{ .Branch }}-{{ .Revision }}
paths:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ jobs:
- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Build
run: yarn build
run: yarn build:release

- name: Setup canary snapshot
run: yarn changeset version --snapshot
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "packages/contracts/lib/forge-std"]
path = packages/contracts/lib/forge-std
url = https://github.com/sphinx-labs/forge-std
url = https://github.com/foundry-rs/forge-std
36 changes: 36 additions & 0 deletions packages/contracts/contracts/forge-std/src/Base.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.9.0;

import { StdStorage } from "./StdStorage.sol";
import { Vm, VmSafe } from "./Vm.sol";

abstract contract CommonBase {
// Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
// console.sol and console2.sol work by executing a staticcall to this address.
address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67;
// Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.
address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
// Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38.
address internal constant DEFAULT_SENDER =
address(uint160(uint256(keccak256("foundry default caller"))));
// Address of the test contract, deployed by the DEFAULT_SENDER.
address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f;
// Deterministic deployment address of the Multicall3 contract.
address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11;
// The order of the secp256k1 curve.
uint256 internal constant SECP256K1_ORDER =
115792089237316195423570985008687907852837564279074904382605163141518161494337;

uint256 internal constant UINT256_MAX =
115792089237316195423570985008687907853269984665640564039457584007913129639935;

Vm internal constant vm = Vm(VM_ADDRESS);
StdStorage internal stdstore;
}

abstract contract TestBase is CommonBase {}

abstract contract ScriptBase is CommonBase {
VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS);
}
27 changes: 27 additions & 0 deletions packages/contracts/contracts/forge-std/src/Script.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.9.0;

// 💬 ABOUT
// Forge Std's default Script.

// 🧩 MODULES
import { console } from "./console.sol";
import { console2 } from "./console2.sol";
import { safeconsole } from "./safeconsole.sol";
import { StdChains } from "./StdChains.sol";
import { StdCheatsSafe } from "./StdCheats.sol";
import { stdJson } from "./StdJson.sol";
import { stdMath } from "./StdMath.sol";
import { StdStorage, stdStorageSafe } from "./StdStorage.sol";
import { StdStyle } from "./StdStyle.sol";
import { StdUtils } from "./StdUtils.sol";
import { VmSafe } from "./Vm.sol";

// 📦 BOILERPLATE
import { ScriptBase } from "./Base.sol";

// ⭐️ SCRIPT
abstract contract Script is ScriptBase, StdChains, StdCheatsSafe, StdUtils {
// Note: IS_SCRIPT() must return true.
bool public IS_SCRIPT = true;
}
Loading

0 comments on commit de1d5c3

Please sign in to comment.