Skip to content

Commit dc5d615

Browse files
authored
Merge pull request #10 from slice-so/slice/internal
Sync slice/internal → master
2 parents 0366223 + 46a7b8d commit dc5d615

File tree

75 files changed

+149
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+149
-119
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Reusable contracts designed to support multiple products, automatically integrat
9494

9595
Custom smart contracts tailored for individual products, integrated using the `custom` onchain action or pricing strategy in Slice.
9696

97-
- **[Examples](./src/examples/)**: Reference implementations and templates
97+
- **[Custom](./src/custom/)**: Product-specific implementations
9898

9999
All hooks inherit from base contracts in `src/utils/`.
100100

@@ -146,7 +146,7 @@ src/
146146
│ ├── actions/ # Onchain actions (gating, rewards, etc.)
147147
│ ├── pricing/ # Pricing strategies (NFT discounts, VRGDA, etc.)
148148
│ └── pricingActions/ # Combined pricing + action hooks
149-
├── examples/ # Product-specific reference implementations
149+
├── custom/ # Product-specific custom hooks
150150
├── interfaces/ # Core hook interfaces
151151
└── utils/ # Base contracts and utilities
152152
```
@@ -156,4 +156,4 @@ src/
156156
- [Actions Guide](./src/hooks/actions/README.md)
157157
- [Pricing Strategies Guide](./src/hooks/pricing/README.md)
158158
- [Pricing + Actions Guide](./src/hooks/pricingActions/README.md)
159-
- [Example Implementations](./src/examples/README.md)
159+
- [Custom Implementations](./src/custom/README.md)

foundry.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dynamic_test_linking = true
77
libs = ["dependencies", "../core/src", "../core/dependencies"]
88
fs_permissions = [{ access = "read", path = "./src"}, { access= "read", path = "./broadcast/Deploy.s.sol/8453/run-latest.json"}, { access = "read-write", path = "./deployments"}, { access = "read", path = "./out"}]
99
remappings = [
10-
"slice/=dependencies/slice-0.0.8/",
10+
"slice/=dependencies/slice-0.0.9/",
1111
"@openzeppelin-4.8.0/=dependencies/@openzeppelin-contracts-4.8.0/",
1212
"@openzeppelin-upgradeable-4.8.0/=dependencies/@openzeppelin-contracts-upgradeable-4.8.0/",
1313
"@erc721a/=dependencies/erc721a-4.3.0/contracts/",
@@ -44,12 +44,12 @@ remappings_generate = false
4444
remappings_regenerate = false
4545

4646
[dependencies]
47-
slice = "0.0.8"
47+
slice = "0.0.9"
4848
forge-std = "1.9.7"
4949
"@openzeppelin-contracts" = "4.8.0"
5050
"@openzeppelin-contracts-upgradeable" = "4.8.0"
5151
erc721a = "4.3.0"
5252

5353
[lint]
54-
ignore = ["test/**/*.sol","script/**/*.sol", "src/interfaces/*.sol", "src/utils/*.sol", "src/hooks/actions/actions.sol", "src/hooks/pricing/pricing.sol", "src/hooks/pricingActions/pricingActions.sol", "src/examples/actions/BaseGirlsScout.sol"]
54+
ignore = ["test/**/*.sol","script/**/*.sol", "src/interfaces/*.sol", "src/utils/*.sol", "src/hooks/actions/actions.sol", "src/hooks/pricing/pricing.sol", "src/hooks/pricingActions/pricingActions.sol"]
5555
exclude_lints=["mixed-case-function", "mixed-case-variable", "pascal-case-struct"]

script/Deploy.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.20;
2+
pragma solidity ^0.8.30;
33

44
import {console} from "forge-std/console.sol";
55
import {VmSafe} from "forge-std/Vm.sol";

script/ScriptUtils.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.20;
2+
pragma solidity ^0.8.30;
33

44
import {console} from "forge-std/console.sol";
55
import {Script} from "forge-std/Script.sol";

script/Seed.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: UNLICENSED
2-
pragma solidity ^0.8.20;
2+
pragma solidity ^0.8.30;
33

44
import {Script} from "forge-std/Script.sol";
55
import {CommonStorage} from "slice/utils/CommonStorage.sol";

script/WriteAddresses.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.20;
2+
pragma solidity ^0.8.30;
33

44
import {SetUpContractsList} from "./ScriptUtils.sol";
55

script/generate-hook.sh

Lines changed: 67 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,31 @@ echo -e "${GREEN}✓ Contract name: ${CONTRACT_NAME}${NC}"
7979

8080
# Check for duplicate hook names
8181
EXISTING_DIRS=""
82-
case $TYPE in
83-
"action")
84-
EXISTING_DIRS="src/hooks/actions/${CONTRACT_NAME}"
85-
;;
86-
"pricing-strategy")
87-
EXISTING_DIRS="src/hooks/pricing/${CONTRACT_NAME}"
88-
;;
89-
"pricing-action")
90-
EXISTING_DIRS="src/hooks/pricingActions/${CONTRACT_NAME}"
91-
;;
92-
esac
82+
if [ "$SCOPE" = "registry" ]; then
83+
case $TYPE in
84+
"action")
85+
EXISTING_DIRS="src/hooks/actions/${CONTRACT_NAME}"
86+
;;
87+
"pricing-strategy")
88+
EXISTING_DIRS="src/hooks/pricing/${CONTRACT_NAME}"
89+
;;
90+
"pricing-action")
91+
EXISTING_DIRS="src/hooks/pricingActions/${CONTRACT_NAME}"
92+
;;
93+
esac
94+
else
95+
case $TYPE in
96+
"action")
97+
EXISTING_DIRS="src/custom/actions/${CONTRACT_NAME}"
98+
;;
99+
"pricing-strategy")
100+
EXISTING_DIRS="src/custom/pricing/${CONTRACT_NAME}"
101+
;;
102+
"pricing-action")
103+
EXISTING_DIRS="src/custom/pricingActions/${CONTRACT_NAME}"
104+
;;
105+
esac
106+
fi
93107

94108
if [ -d "$EXISTING_DIRS" ]; then
95109
echo -e "${RED}✗ Error: Hook '${CONTRACT_NAME}' already exists at ${EXISTING_DIRS}${NC}"
@@ -107,18 +121,33 @@ fi
107121
echo -e "${GREEN}✓ Author: ${AUTHOR}${NC}"
108122
echo
109123

110-
# Set directory based on type
111-
case $TYPE in
112-
"action")
113-
DIR="src/hooks/actions/${CONTRACT_NAME}"
114-
;;
115-
"pricing-strategy")
116-
DIR="src/hooks/pricing/${CONTRACT_NAME}"
117-
;;
118-
"pricing-action")
119-
DIR="src/hooks/pricingActions/${CONTRACT_NAME}"
120-
;;
121-
esac
124+
# Set directory based on scope and type
125+
if [ "$SCOPE" = "registry" ]; then
126+
case $TYPE in
127+
"action")
128+
DIR="src/hooks/actions/${CONTRACT_NAME}"
129+
;;
130+
"pricing-strategy")
131+
DIR="src/hooks/pricing/${CONTRACT_NAME}"
132+
;;
133+
"pricing-action")
134+
DIR="src/hooks/pricingActions/${CONTRACT_NAME}"
135+
;;
136+
esac
137+
else
138+
# Product-specific hooks go in custom directory
139+
case $TYPE in
140+
"action")
141+
DIR="src/custom/actions/${CONTRACT_NAME}"
142+
;;
143+
"pricing-strategy")
144+
DIR="src/custom/pricing/${CONTRACT_NAME}"
145+
;;
146+
"pricing-action")
147+
DIR="src/custom/pricingActions/${CONTRACT_NAME}"
148+
;;
149+
esac
150+
fi
122151

123152
# Create directory
124153
mkdir -p "$DIR"
@@ -132,7 +161,7 @@ echo -e "${BLUE}Generating contract at: ${FILE_PATH}${NC}"
132161
if [ "$SCOPE" = "registry" ] && [ "$TYPE" = "action" ]; then
133162
cat > "$FILE_PATH" << 'EOF'
134163
// SPDX-License-Identifier: MIT
135-
pragma solidity ^0.8.20;
164+
pragma solidity ^0.8.30;
136165
137166
import {
138167
RegistryProductAction,
@@ -209,7 +238,7 @@ EOF
209238
elif [ "$SCOPE" = "product" ] && [ "$TYPE" = "action" ]; then
210239
cat > "$FILE_PATH" << 'EOF'
211240
// SPDX-License-Identifier: MIT
212-
pragma solidity ^0.8.20;
241+
pragma solidity ^0.8.30;
213242
214243
import {ProductAction, IProductsModule, IProductAction} from "@/utils/ProductAction.sol";
215244
@@ -265,7 +294,7 @@ EOF
265294
elif [ "$SCOPE" = "registry" ] && [ "$TYPE" = "pricing-strategy" ]; then
266295
cat > "$FILE_PATH" << 'EOF'
267296
// SPDX-License-Identifier: MIT
268-
pragma solidity ^0.8.20;
297+
pragma solidity ^0.8.30;
269298
270299
import {
271300
RegistryProductPrice,
@@ -325,7 +354,7 @@ EOF
325354
elif [ "$SCOPE" = "product" ] && [ "$TYPE" = "pricing-strategy" ]; then
326355
cat > "$FILE_PATH" << 'EOF'
327356
// SPDX-License-Identifier: MIT
328-
pragma solidity ^0.8.20;
357+
pragma solidity ^0.8.30;
329358
330359
import {ProductPrice, IProductsModule, IProductPrice} from "@/utils/ProductPrice.sol";
331360
@@ -366,7 +395,7 @@ EOF
366395
elif [ "$SCOPE" = "registry" ] && [ "$TYPE" = "pricing-action" ]; then
367396
cat > "$FILE_PATH" << 'EOF'
368397
// SPDX-License-Identifier: MIT
369-
pragma solidity ^0.8.20;
398+
pragma solidity ^0.8.30;
370399
371400
import {
372401
RegistryProductPriceAction,
@@ -459,7 +488,7 @@ EOF
459488
elif [ "$SCOPE" = "product" ] && [ "$TYPE" = "pricing-action" ]; then
460489
cat > "$FILE_PATH" << 'EOF'
461490
// SPDX-License-Identifier: MIT
462-
pragma solidity ^0.8.20;
491+
pragma solidity ^0.8.30;
463492
464493
import {
465494
ProductPriceAction,
@@ -633,7 +662,7 @@ if [ "$SCOPE" = "registry" ]; then
633662
if [ "$TYPE" = "action" ]; then
634663
cat > "$TEST_FILE" << 'EOF'
635664
// SPDX-License-Identifier: MIT
636-
pragma solidity ^0.8.20;
665+
pragma solidity ^0.8.30;
637666
638667
import {RegistryProductAction, RegistryProductActionTest} from "@test/utils/RegistryProductActionTest.sol";
639668
import {CONTRACT_NAME} from "@/hooks/actions/CONTRACT_NAME/CONTRACT_NAME.sol";
@@ -708,7 +737,7 @@ EOF
708737
elif [ "$TYPE" = "pricing-strategy" ]; then
709738
cat > "$TEST_FILE" << 'EOF'
710739
// SPDX-License-Identifier: MIT
711-
pragma solidity ^0.8.20;
740+
pragma solidity ^0.8.30;
712741
713742
import {RegistryProductPrice, RegistryProductPriceTest} from "@test/utils/RegistryProductPriceTest.sol";
714743
import {CONTRACT_NAME} from "@/hooks/pricing/CONTRACT_NAME/CONTRACT_NAME.sol";
@@ -763,7 +792,7 @@ EOF
763792
elif [ "$TYPE" = "pricing-action" ]; then
764793
cat > "$TEST_FILE" << 'EOF'
765794
// SPDX-License-Identifier: MIT
766-
pragma solidity ^0.8.20;
795+
pragma solidity ^0.8.30;
767796
768797
import {RegistryProductPriceAction, RegistryProductPriceActionTest} from "@test/utils/RegistryProductPriceActionTest.sol";
769798
import {CONTRACT_NAME} from "@/hooks/pricingActions/CONTRACT_NAME/CONTRACT_NAME.sol";
@@ -866,8 +895,9 @@ fi
866895

867896
echo
868897
echo -e "${YELLOW}Next steps:${NC}"
869-
echo "1. Review and customize the generated contract"
870-
echo "2. Implement your specific contract logic"
871-
echo "3. Update the test file with your test cases"
872-
echo "4. Run tests with 'forge test'"
873-
echo "5. Deploy using the deployment scripts"
898+
echo "1. Customize the generated contract with your custom logic"
899+
echo "2. Update the test file with your test cases"
900+
echo "3. Run tests with 'forge test'"
901+
if [ "$SCOPE" = "registry" ]; then
902+
echo "4. Deploy by running './script/deploy.sh'"
903+
fi

soldeer.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ integrity = "9e60fdba82bc374df80db7f2951faff6467b9091873004a3d314cf0c084b3c7d"
2828

2929
[[dependencies]]
3030
name = "slice"
31-
version = "0.0.8"
32-
url = "https://soldeer-revisions.s3.amazonaws.com/slice/0_0_8_28-08-2025_00:55:13_src.zip"
33-
checksum = "0df8789a04d00a6577f9be207aec4ea0057d9e79569dda522facbd7f04dbed2f"
34-
integrity = "308b4ab7daad57e76ee001b55b2ebb19c707427bee3720fbbaad9d3c7b69021e"
31+
version = "0.0.9"
32+
url = "https://soldeer-revisions.s3.amazonaws.com/slice/0_0_9_28-08-2025_10:52:54_src.zip"
33+
checksum = "7fb47bafed059724f2b4a56719eec2e131c231d9f9a8cbcde5d88958b649cd5d"
34+
integrity = "7ef2c94c7be0d971da96d01d514903e007f957721da4bc0bd9fba004cebafd20"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Product-Specific Examples
1+
# Product-Specific Custom Hooks
22

3-
Reference implementations for custom product hooks without registry support.
3+
Custom product hooks tailored for individual products without registry support.
44

55
## When to Use
66

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.20;
2+
pragma solidity ^0.8.30;
33

44
import {IProductsModule, ProductAction} from "@/utils/ProductAction.sol";
55

0 commit comments

Comments
 (0)