-
Notifications
You must be signed in to change notification settings - Fork 1
v5 for dynamic spread #60
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?
Conversation
WalkthroughActivated multiple networks (flare, base, polygon), refreshed subgraph/metaboard Goldsky endpoints, added local-db remotes/sync and wired Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant GUI as GUI / Client
participant Claims as Claims Strategy
participant R as Raindex Subparser
participant M as MerkleWords Subparser
participant OB as On-chain Orderbook
rect rgb(245,250,255)
Note over GUI,Claims: Claim submission & verification (high level)
GUI->>Claims: submit claim (order, signed-context, proof)
Claims->>R: fetch signed-context components / expected-amount
Claims->>M: fetch merkle root / merkle‑words
Claims->>Claims: leaf = get-leaf-node(signed-context, counterparty)
Claims->>Claims: check-claim(leaf, claimed-key)
Claims->>Claims: verify-proof(leaf, proof, root)
alt proof valid and not claimed
Claims->>OB: validate vault decrease == expected-amount
Claims->>Claims: mark leaf as claimed
Claims-->>GUI: success (expected-amount)
else invalid or already claimed
Claims-->>GUI: reject (error)
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/dynamic-spread.rain(3 hunks)
🔇 Additional comments (3)
src/dynamic-spread.rain (3)
921-921: Good: replace magic constant with min-positive-value().This is safer across numeric backends and communicates intent (seed to avoid zero divisors).
861-861: Approve: all address/token comparisons usebinary-equal-toVerified no remaining plainequal-tocalls in src/dynamic-spread.rain (onlybinary-equal-toat lines 861 and 928).
905-907: Clamp halflife underflow and verify fractional exponent supportUse a temporary
rawvalue and clamp it to avoid underflow to zero. Confirm thatpower()supports non-integer exponents (as it’s used inauction-dca.rain:1222) before merging.-epoch:, -val: power(0.5 epoch); +epoch:, +raw: power(0.5 epoch), +# Guard against underflow to zero. +val: any(raw min-positive-value());
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.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/auction-dca.rain (4)
1184-1192: Clamp is correct; add zero-division guards for epoch ratios.trade-epochs now saturates at zero (good), but div(duration time-per-trade-epoch) and div(total-duration time-per-amount-epoch) will fault if the denominators are 0. Add ensures when the order is added.
Apply near handle-add-order:
#handle-add-order using-words-from raindex-subparser subparser-0 -:call<'set-initial-time>(); +:ensure(greater-than(time-per-amount-epoch 0) "time-per-amount-epoch must be > 0"), +:ensure(greater-than(time-per-trade-epoch 0) "time-per-trade-epoch must be > 0"), +:ensure(greater-than(amount-per-epoch 0) "amount-per-epoch must be > 0"), +:ensure(greater-than-or-equal-to(max-trade-amount min-trade-amount) "max-trade-amount must be >= min-trade-amount"), +:ensure(greater-than(initial-io baseline) "initial-io must be > baseline"), +:call<'set-initial-time>();
1194-1204: Prevent negative unused/target amounts.If used > total-available or min-trade-amount > max-trade-amount (user error), values can go negative. Clamp defensively.
total-available: linear-growth(0 amount-per-epoch amount-epochs), used: get(hash(order-hash() amount-used-key)), -unused: sub(total-available used), +unused: max(0 sub(total-available used)), -decay: call<'halflife>(trade-epochs), +decay: call<'halflife>(trade-epochs), shy-decay: every(greater-than(trade-epochs shy-epoch) decay), -variable-component: sub(max-trade-amount min-trade-amount), +variable-component: max(0 sub(max-trade-amount min-trade-amount)), target-amount: add(min-trade-amount mul(variable-component shy-decay)), capped-unused: min(unused target-amount);
1260-1265: Enforce max-trade-amount at IO time.We ensure a minimum, but not an upper bound. Add a check to prevent oversized fills.
#handle-io min-amount: mul(min-trade-amount 0.9), :ensure(greater-than-or-equal-to(output-vault-decrease() min-amount) "Min trade amount."), +:ensure(greater-than-or-equal-to(max-trade-amount output-vault-decrease()) "Exceeds max trade amount."), used: get(hash(order-hash() amount-used-key)), :set(hash(order-hash() amount-used-key) add(used output-vault-decrease()));
295-298: Typo in user-facing text: “halvening” → “halving”.Use the conventional “halving” throughout the GUI copy.
Example fix (repeat for all occurrences):
- The auction period is the time between each auction price halvening. + The auction period is the time between each auction price halving.Also applies to: 423-426, 551-554, 677-680, 805-808, 931-934, 1051-1054, 1111-1114
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/auction-dca.rain(2 hunks)
🔇 Additional comments (1)
src/auction-dca.rain (1)
1215-1217: Saturating the variable-component is correct.max(0, max-next-trade − real-baseline) prevents negative above-baseline and aligns with saturating-sub semantics.
| epoch:, | ||
| /** | ||
| * Shrinking the multiplier like this | ||
| * then applying it 10 times allows for | ||
| * better precision when max-io-ratio | ||
| * is very large, e.g. ~1e10 or ~1e20+ | ||
| * | ||
| * This works because `power` loses | ||
| * precision on base `0.5` when the | ||
| * exponent is large and can even go | ||
| * to `0` while the io-ratio is still | ||
| * large. Better to keep the multiplier | ||
| * higher precision and drop the io-ratio | ||
| * smoothly for as long as we can. | ||
| */ | ||
| multiplier: | ||
| power(0.5 div(epoch 10)), | ||
| val: | ||
| mul( | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| multiplier | ||
| ); | ||
| val: power(0.5 epoch); | ||
|
|
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.
🧹 Nitpick (assertive)
Halflife simplification looks good; guard against negative epoch.
Power(0.5, epoch) is correct; ensure epoch ≥ 0 to keep val ∈ (0,1].
#halflife
epoch:,
-val: power(0.5 epoch);
+:ensure(greater-than-or-equal-to(epoch 0) "epoch must be >= 0"),
+val: power(0.5 epoch);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| epoch:, | |
| /** | |
| * Shrinking the multiplier like this | |
| * then applying it 10 times allows for | |
| * better precision when max-io-ratio | |
| * is very large, e.g. ~1e10 or ~1e20+ | |
| * | |
| * This works because `power` loses | |
| * precision on base `0.5` when the | |
| * exponent is large and can even go | |
| * to `0` while the io-ratio is still | |
| * large. Better to keep the multiplier | |
| * higher precision and drop the io-ratio | |
| * smoothly for as long as we can. | |
| */ | |
| multiplier: | |
| power(0.5 div(epoch 10)), | |
| val: | |
| mul( | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| multiplier | |
| ); | |
| val: power(0.5 epoch); | |
| #halflife | |
| epoch:, | |
| ensure(greater-than-or-equal-to(epoch 0) "epoch must be >= 0"), | |
| val: power(0.5 epoch); |
🤖 Prompt for AI Agents
In src/auction-dca.rain around lines 1206 to 1208, the halflife computation uses
power(0.5, epoch) but does not guard against negative epoch; ensure epoch is
non-negative before computing val so val stays in (0,1]. Fix by clamping epoch
to ≥0 (e.g. epoch = max(epoch, 0) or conditional epoch < 0 -> epoch = 0) and
then compute val = power(0.5, epoch).
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.
what is wrong with a negative epoch? val doesn't need to be between 0,1 it just needs to be normalized relative to the starting point
| epoch:, | ||
| last-io: call<'get-last-trade>(), | ||
| max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()), | ||
| baseline-next-trade: mul(last-io next-trade-baseline-multiplier), | ||
| real-baseline: max(baseline-next-trade call<'baseline-fn>()), | ||
| variable-component: saturating-sub(max-next-trade real-baseline), | ||
| variable-component: max(0 sub(max-next-trade real-baseline)), | ||
| above-baseline: mul(variable-component call<'halflife>(epoch)), | ||
| _: add(real-baseline above-baseline); |
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.
💡 Verification agent
🧩 Analysis chain
Use max() instead of any() so the larger start price wins.
any(...) may select the left argument even if the right is larger. Intent here appears to be “start next auction at the larger of (last-io×multiplier) and initial-io-fn()”.
max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),
+-- Prefer:
+max-next-trade: max(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),Run to confirm there are no other any(...) places that should be max(...):
🏁 Script executed:
#!/bin/bash
rg -n "max-next-trade:\s*any\(" -C2Length of output: 379
Use max() instead of any() for max-next-trade
Replace the any(...) call on line 1212 in src/auction-dca.rain with max(...) so the larger of (last-io × next-trade-multiplier) and initial-io-fn() wins:
- max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),
+ max-next-trade: max(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),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.
Actionable comments posted: 6
♻️ Duplicate comments (2)
src/dynamic-spread.rain (1)
924-929: inv(stored-last-io) branch — acknowledged invariant, no extra guard.Past discussion established io > 0 by construction; keeping it guardless saves gas.
src/auction-dca.rain (1)
1210-1217: Prefer max(...) over any(...) for max-next-trade.any(a, b) may pick a non-zero a even if b > a. max(...) guarantees the larger start price.
- max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()), + max-next-trade: max(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
settings.yaml(1 hunks)src/auction-dca.rain(5 hunks)src/dynamic-spread.rain(8 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
PR: rainlanguage/rain.strategies#59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/auction-dca.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-09-08T12:50:27.047Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-08T12:50:27.047Z
Learning: Gas efficiency is a key consideration in Rain Strategies smart contracts, and redundant safety checks that are mathematically impossible due to business logic constraints should be avoided to minimize gas costs.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-07-15T09:19:34.859Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#53
File: src/claims.rain:0-0
Timestamp: 2025-07-15T09:19:34.859Z
Learning: In Rain language, the evaluation uses a stack-based model where stack indexes start from the bottom. In the calculate-io function, stack[0] represents the ratio and stack[1] represents the amount. This means when a function returns two values like `(expected-amount, 0)`, the first value is the ratio and the second value is the amount.
Applied to files:
src/dynamic-spread.rain
🔇 Additional comments (8)
src/dynamic-spread.rain (5)
861-861: Switch to binary-equal-to for token comparison — correct.Bytewise equality is appropriate for addresses.
898-901: VWAIO calculation hardened against zero with max-positive-value — nice.The any(..., max-positive-value()) + every(...) gating prevents div/0 without extra branches.
921-922: Initialize totals with min-positive-value — good for positivity invariants.Prevents zero edge-cases later in ratio math.
948-951: cost-basis-io uses max-positive-value in denominator — correct.Avoids div/0 while preserving intended weighting.
8-8: raindex-subparser binding verified on Arbitrum Bytecode retrieval confirms non-empty code at address 0x8Bbed81063E6A8d51E246f5F04552b692d00dDdd.src/auction-dca.rain (3)
1191-1191: Clamp trade-epochs via max(0, …) — good replacement for saturating-sub.Prevents negative epochs feeding halflife.
1207-1207: Halflife simplified — OK given non-negative epoch above.
149-149: Contract code present at updated raindex-subparser address — changes approved
Contract bytecode returned by eth_getCode confirms deployment at 0x8Bbed81063E6A8d51E246f5F04552b692d00dDdd.
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.
Actionable comments posted: 1
♻️ Duplicate comments (3)
src/dynamic-spread.rain (2)
928-928: get-last-trade inversion branch — accepted without zero guard per strategy constraints.Acknowledging prior discussion that io cannot be zero under normal operation.
915-922: Add one-time ensure for time-per-epoch > 0 at order creation.Prevents div-by-zero in get-epoch with negligible gas at creation.
Apply:
#handle-add-order using-words-from raindex-subparser +:ensure(greater-than(time-per-epoch 0) "time-per-epoch must be > 0"), :set(hash(order-hash() last-trade-time-key) now()), :set(hash(order-hash() last-trade-io-key) initial-io), :set(hash(order-hash() last-trade-output-token-key) initial-output-token), this-total-out-key: hash(order-hash() initial-input-token initial-output-token), :set(this-total-out-key min-positive-value()), :set(hash(this-total-out-key vwaio-key) initial-io);src/auction-dca.rain (1)
1212-1216: Replace any() with max() for max-next-trade selectionany(a, b) prefers the first operand; use max(a, b) to pick the larger of last-io×multiplier and initial-io.
File: src/auction-dca.rain (around line 1212)
- max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()), + max-next-trade: max(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
settings.yaml(3 hunks)src/auction-dca.rain(5 hunks)src/dynamic-spread.rain(8 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
src/auction-dca.rainsrc/dynamic-spread.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-09-08T12:50:27.087Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-08T12:50:27.087Z
Learning: Gas efficiency is a key consideration in Rain Strategies smart contracts, and redundant safety checks that are mathematically impossible due to business logic constraints should be avoided to minimize gas costs.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
PR: rainlanguage/rain.strategies#59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/dynamic-spread.rain
🔇 Additional comments (11)
src/dynamic-spread.rain (5)
145-146: Arbitrum orderbook/deployer updated — alignment looks correct.Addresses and block match settings.yaml and auction-dca.rain.
Run the cross-file check in the settings.yaml comment to validate.
Also applies to: 166-166
861-861: Token equality switched to binary-equal-to — good.Avoids semantic pitfalls of non-binary equality on addresses.
905-907: Halflife simplified to power(0.5, epoch) — OK.Matches the rework; no redundant guards added (keeps gas tight).
921-921: Initialize this-total-out to min-positive-value — good default.Prevents 0-denominator paths without adding runtime branches.
899-899: Safe VWAIO: verify any(..., uint256-max-value()) before dividing; add safe-div if needed
- Instances found: src/dynamic-spread.rain — lines 898–899, 921, 948, 950.
- Verify that any(... uint256-max-value()) produces the UINT_MAX sentinel on the “no-value” path and that div(, uint256-max-value()) yields 0 (no overflow/incorrect result). If semantics aren’t guaranteed, replace these divisions with a small helper (e.g., safe-div(n,d) → returns 0 when d == uint256-max-value(), otherwise div(n,d)).
src/auction-dca.rain (3)
59-60: Public config updates (orderbook, deployer, subparser) — consistent across files.These match settings.yaml and dynamic-spread.rain.
Run the cross-file check in the settings.yaml comment to validate.
Also applies to: 74-74, 149-149
1191-1191: Explicit zero‑clamp on trade-epochs — good.Avoids negative epochs post freeze; matches the intent of the rework.
1206-1208: Halflife = power(0.5, epoch) — good simplification.Keeps math clear and gas‑efficient.
settings.yaml (3)
48-48: Bump to new Arbitrum subgraph — endpoint reachable (HTTP 200); confirm pin consistency before merge.settings.yaml (line 48): endpoint returned HTTP 200. Confirm 2025-09-08-b1a7 is the intended pinned revision across all configs/deployments and on the Goldsky dashboard, and ensure consumers are compatible.
74-77: Verified — Arbitrum orderbook address and deployment-block are consistent across files.
settings.yaml (lines 74–77) match src/dynamic-spread.rain (lines 145–146) and src/auction-dca.rain (lines 59–60).
102-102: Deployer address verified — no stale Arbitrum deployer found.Arbitrum deployer 0x6B36e02409BD60cA5C17049c7188de180857902D is identical in settings.yaml (L102), src/dynamic-spread.rain (L166) and src/auction-dca.rain (L74). Other repo addresses are commented examples.
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
registry(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
PR: rainlanguage/rain.strategies#45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
PR: rainlanguage/rain.strategies#59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
registry
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registry
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
registry
🔇 Additional comments (2)
registry (2)
1-5: Incorrect — embedded commit SHA and URLs are valid; no change needed.Verified commit: 68bd365 (40 chars). All listed raw.githubusercontent.com URLs returned HTTP 200.
Likely an incorrect or invalid review comment.
1-5: Confirm merge strategy or plan a post-merge bump of the pinned SHA.
Repo allows squash merges (mergeCommitAllowed=true, rebaseMergeAllowed=true, squashMergeAllowed=true) — if this PR is squash-merged the pre-merge SHAs in the registry will not exist on main; use merge-commit/rebase when merging or update the registry to the final main commit in a follow-up.
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.
Actionable comments posted: 1
♻️ Duplicate comments (4)
src/dynamic-spread.rain (2)
905-907: Halflife simplification — LGTM; no extra guard needed.
924-929: Last-trade retrieval and token-branching via binary-equal-to — LGTM.Division-by-zero on inv(last-io) is ruled out per established model constraints.
src/auction-dca.rain (2)
1206-1208: Halflife power(0.5, epoch) — LGTM.
1212-1216: Prefer max(...) over any(...) for max-next-trade (if “largest wins” is intended).any(...) picks first non-zero; max(...) chooses the larger value.
- max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()), + max-next-trade: max(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
settings.yaml(3 hunks)src/auction-dca.rain(5 hunks)src/dynamic-spread.rain(8 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-09-08T12:50:27.087Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-08T12:50:27.087Z
Learning: Gas efficiency is a key consideration in Rain Strategies smart contracts, and redundant safety checks that are mathematically impossible due to business logic constraints should be avoided to minimize gas costs.
Applied to files:
src/dynamic-spread.rain
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
src/dynamic-spread.rainsrc/auction-dca.rain
🔇 Additional comments (13)
settings.yaml (3)
74-77: Arbitrum orderbook address + deployment block aligned across repo — LGTM.
102-103: Arbitrum deployer updated and consistent — LGTM.
48-48: Subgraph bump — endpoint healthy and repo values match.Endpoint (settings.yaml:48) returned HTTP 200. Orderbook 0x8df8075e4077dabf1e95f49059e4c1eea33094ab, deployment-block 380203894, and deployer 0xb1869a4FA6436832bb0AD5420170B8CF17CaF934 match the values in settings.yaml and src (src/dynamic-spread.rain:144-166, src/auction-dca.rain:57-75).
src/dynamic-spread.rain (6)
145-146: Orderbook address/block match settings.yaml — LGTM.
166-166: Deployer address matches settings.yaml — LGTM.
861-861: Correct: use binary-equal-to for token address equality.
898-901: VWAIO guard with uint256-max-value and cap logic — LGTM.Div-by-zero avoided without extra gas; cap computation reads correctly.
921-922: Initialize totals to min-positive-value — good sentinel choice.
944-949: Cost-basis-io uses inv(any(other-vwaio, uint256-max-value)) — solid guard.src/auction-dca.rain (4)
59-60: Arbitrum orderbook address/block updated — LGTM.
74-74: Arbitrum deployer updated — LGTM.
1191-1191: Clamp trade-epochs with max(0, …) — LGTM.
149-150: Mixed parser addresses — confirm intent or align.src/auction-dca.rain (lines 149–150) binds raindex-subparser = 0xcCf3E6e16E40B26618d216b4385d086664876782 and subparser-0 = 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666; the address 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 is also used as raindex-subparser in src/grid.rain:128, src/canary.rain:121 and src/fixed-limit.rain:153. Either make the bindings consistent across files or document why they intentionally differ.
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.
Actionable comments posted: 1
♻️ Duplicate comments (2)
registry (2)
1-5: Adopt the earlier CI check to validate registry entriesEchoing the existing bot suggestion: add a CI step that asserts SHA length (40/64) and that each URL returns 200 to prevent bad entries.
1-5: Add CI assertion to prevent mixed SHAs in registryVerified: registry entries all use commit 6dc16d5. Add a CI job running the supplied script to fail the build if multiple SHAs are detected.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
registry(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
PR: rainlanguage/rain.strategies#45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
PR: rainlanguage/rain.strategies#59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
registry
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registry
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
registry
🔇 Additional comments (1)
registry (1)
1-5: LGTM: pinned to a single full commit SHA across all entriesAll five rows consistently reference the same 40‑char commit and follow the repo policy to pin registry URLs to full SHAs. Good.
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
settings.yaml(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
🔇 Additional comments (2)
settings.yaml (2)
102-103: Normalize deployer address to EIP‑55 and verify cross-file consistencyFile: settings.yaml (lines 102–103)
address: 0xb1869a4FA6436832bb0AD5420170B8CF17CaF934 network: arbitrumEnsure this address is EIP‑55 checksummed and that every strategy referencing the deployer uses this exact string to avoid mixed deployer lookups. Automated verification failed here (ModuleNotFoundError: No module named 'eth_utils'); re-run locally with the script below to compute the checksum and list mismatches:
#!/bin/bash set -euo pipefail DEP='0xb1869a4FA6436832bb0AD5420170B8CF17CaF934' python3 - <<'PY' import sys, subprocess addr=sys.argv[1] try: from eth_utils import to_checksum_address except Exception: subprocess.check_call([sys.executable, "-m", "pip", "install", "--user", "eth-utils"]) from eth_utils import to_checksum_address print(to_checksum_address(addr)) PY "$DEP" echo "== Ensure no stale deployer addresses remain ==" rg -nP '(?i)0x[0-9a-f]{40}' settings.yaml src/**/*.rain | rg -v "$DEP" || true
74-77: Update Arbitrum address to EIP‑55 checksum and verify deployment block.Computed checksum: 0x8dF8075e4077dAbf1e95F49059E4C1eEA33094ab — replace the lowercase address in settings.yaml (arbitrum entry, ~lines 74–77).
Suggested replacement (run locally):
gsed -i 's|0x8df8075e4077dabf1e95f49059e4c1eea33094ab|0x8dF8075e4077dAbf1e95F49059E4C1eEA33094ab|g' settings.yaml || sed -i '' 's|0x8df8075e4077dabf1e95f49059e4c1eea33094ab|0x8dF8075e4077dAbf1e95F49059E4C1eEA33094ab|g' settings.yamlVerify deployment-block: confirm 380203894 is the contract creation or earliest relevant event (check Etherscan/subgraph) and adjust if off‑by‑one.
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
registry(1 hunks)settings.yaml(4 hunks)src/auction-dca.rain(9 hunks)src/dynamic-spread.rain(9 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
PR: rainlanguage/rain.strategies#45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
PR: rainlanguage/rain.strategies#59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
registrysrc/dynamic-spread.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
registrysrc/dynamic-spread.rain
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
PR: rainlanguage/rain.strategies#42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registrysrc/dynamic-spread.rain
📚 Learning: 2025-09-08T12:50:27.087Z
Learnt from: thedavidmeister
PR: rainlanguage/rain.strategies#60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-08T12:50:27.087Z
Learning: Gas efficiency is a key consideration in Rain Strategies smart contracts, and redundant safety checks that are mathematically impossible due to business logic constraints should be avoided to minimize gas costs.
Applied to files:
src/dynamic-spread.rain
🔇 Additional comments (28)
registry (1)
1-5: Pinned to full commit SHAs — LGTM. Add/keep CI URL/SHA smoke-check.URLs look correct and use full SHAs.
Run a quick health/sanity check for the pinned entries (HTTP 200 and expected content):
#!/bin/bash set -euo pipefail awk '{print $1,$2}' registry | while read -r name url; do echo "Checking $name -> $url" # SHA length check sha="$(sed -n 's#^.*/rain\.strategies/\([^/]*\)/.*#\1#p' <<<"$url")" [[ ${#sha} -eq 40 || ${#sha} -eq 64 ]] || { echo "Bad SHA length for $name: $sha"; exit 1; } # HTTP availability curl -fsSI "$url" >/dev/null || { echo "Unreachable: $url"; exit 1; } # Content smoke-checks for strategy files most sensitive in this PR if [[ "$name" == "dynamic-spread" || "$name" == "auction-dca" ]]; then body="$(curl -fsSL "$url")" grep -qE 'power\s*\(\s*0\.5' <<<"$body" || { echo "$name: halflife power(0.5, ...) not found"; exit 1; } ! grep -q 'saturating-sub' <<<"$body" || { echo "$name: saturating-sub still present"; exit 1; } grep -q 'binary-equal-to' <<<"$body" || { echo "$name: binary-equal-to not found"; exit 1; } fi done echo "Registry URLs and content checks OK."src/dynamic-spread.rain (10)
34-43: Enable polygon scenario — LGTM.
145-149: Orderbook addresses/blocks updated — LGTM.Matches settings.yaml and auction-dca.rain per this PR.
166-168: Deployers updated — LGTM.
861-861: Use binary-equal-to for token equality — LGTM.Correct for raw address/bytes equality.
898-901: VWAIO: safe denominator with uint256-max-value — LGTM.Avoids div-by-zero without extra branches; gas-friendly.
905-907: Halflife simplified to power(0.5, epoch) — LGTM.
921-921: Initialize this-total-out with min-positive-value — LGTM.Cleaner than magic 1e-18.
924-929: Last-trade: binary-equal-to and inv(last-io) — LGTM.Division-by-zero not possible per established IO invariants.
949-949: Cost-basis IO uses uint256-max-value fallback — LGTM.
8-8: Stale raindex-subparser addresses remain — update/remove all occurrences
- Active 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 at: src/auction-dca.rain:151, src/grid.rain:128, src/fixed-limit.rain:153, src/canary.rain:121 — replace with 0xcCf3E6e16E40B26618d216b4385d086664876782 (or intended new address).
- Active 0x662dFd6d5B6DF94E07A60954901D3001c24F856a at: src/fixed-limit.rain:165, src/fixed-limit.rain:189 — replace or remove.
- Commented remnants of 0x662dFd6d5B6DF94E07A60954901D3001c24F856a at: src/auction-dca.rain:159,160,168,169; src/dynamic-spread.rain:18,48; src/grid.rain:134,146; src/canary.rain:126,141 — remove or annotate as intentional.
settings.yaml (5)
14-19: Polygon network block enabled — LGTM.
55-55: Metaboards polygon enabled — LGTM. Ensure arbitrum metadata revision mismatch is intentional.Metaboards.arbitrum still on 2025-07-06-135f while ob4-arbitrum subgraph is 2025-09-18-da5d. Confirm this split is intended.
69-79: Orderbooks updated — cross-file consistency confirmed.
Addresses and deployment-blocks match across settings.yaml, src/dynamic-spread.rain, and src/auction-dca.rain.
47-48: Subgraph endpoints verified — OK to merge.
Both polygon and arbitrum endpoints returned HTTP 200.
99-104: Cross-file deployer address consistency verifiedsettings.yaml (lines 100,103) addresses match entries in src/auction-dca.rain (lines 75,85) and src/dynamic-spread.rain (lines 166,168).
src/auction-dca.rain (12)
34-39: Polygon network block enabled — LGTM.
55-55: Metaboards polygon enabled — LGTM.
59-61: Arbitrum orderbook address/block — LGTM.
70-71: Polygon orderbook address/block — LGTM.
75-75: Arbitrum deployer — LGTM.
85-85: Polygon deployer — LGTM.
126-131: Polygon order mapping — LGTM.
173-181: Polygon scenario enabled — LGTM.
227-229: Polygon deployment mapping — LGTM.
1192-1192: Clamp trade-epochs at zero — LGTM.Prevents negative decay inputs after freeze period.
1208-1208: Halflife simplified to power(0.5, epoch) — LGTM.
1212-1218: Use max(...) for max-next-trade instead of any(...).any(...) can select the smaller value; intent here is the larger of last-io×multiplier and initial-io-fn().
- max-next-trade: any(mul(last-io next-trade-multiplier) call<'initial-io-fn>()), + max-next-trade: max(mul(last-io next-trade-multiplier) call<'initial-io-fn>()),
| runs: 1 | ||
| bindings: | ||
| raindex-subparser: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 | ||
| raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782 |
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.
🧩 Analysis chain
raindex-subparser updated; align subparser-0 on arbitrum scenario.
Line 151 still references old 0xe80e…; update or delete if unused to avoid mixed parser versions.
arbitrum:
orderbook: arbitrum
runs: 1
bindings:
- raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782
- subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666
+ raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782
+ subparser-0: 0xcCf3E6e16E40B26618d216b4385d086664876782Also ensure any other stale 0xe80e…/0x662d… are removed.
🏁 Script executed:
#!/bin/bash
rg -n 'subparser-0:\s*0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666|subparser-0:\s*0x662dFd6d5B6DF94E07A60954901D3001c24F856a' --type=rain || trueLength of output: 28
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Searching repo for 'raindex-subparser' or 'subparser-0'..."
rg -n --hidden -S 'raindex-subparser|subparser-0' || true
echo
echo "Searching repo for specific hashes (old and new)..."
rg -n --hidden -S '0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666|0x662dFd6d5B6DF94E07A60954901D3001c24F856a|0xcCf3E6e16E40B26618d216b4385d086664876782' || true
echo
echo "If src/auction-dca.rain exists, print lines 130-160 for context:"
if [ -f src/auction-dca.rain ]; then
nl -ba src/auction-dca.rain | sed -n '130,160p'
else
echo "src/auction-dca.rain not found at that path."
echo "Attempt to locate any file named '*auction-dca.rain'..."
rg --files | rg 'auction-dca\.rain' || true
for f in $(rg --files | rg 'auction-dca\.rain' || true); do
echo "---- $f ----"
nl -ba "$f" | sed -n '130,160p'
done
fiLength of output: 6531
raindex-subparser updated; align subparser-0 on Arbitrum
src/auction-dca.rain line 151 still has subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 — change it to 0xcCf3E6e16E40B26618d216b4385d086664876782 (or remove if unused) to avoid mixed parser versions. Also update/remove other stale occurrences of 0xe80e7438… and 0x662dFd6d5B6D… found at src/grid.rain:128, src/fixed-limit.rain:153, src/canary.rain:121 and several commented lines in src/auction-dca.rain and src/dynamic-spread.rain.
🤖 Prompt for AI Agents
In src/auction-dca.rain around line 150–151 update the raindex-subparser /
subparser-0 address so both use 0xcCf3E6e16E40B26618d216b4385d086664876782 (or
remove subparser-0 if it's unused); also search and replace any stale
occurrences of 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 and 0x662dFd6d5B6D…
across the repo (notably src/grid.rain line 128, src/fixed-limit.rain line 153,
src/canary.rain line 121 and commented lines in src/auction-dca.rain and
src/dynamic-spread.rain) so no mixed parser addresses remain, ensuring each
subparser entry is either updated to 0xcCf3E6e16E40B26618d216b4385d086664876782
or removed if unused.
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.
Actionable comments posted: 3
♻️ Duplicate comments (8)
src/fixed-spread.rain (5)
219-219: Verify call<'baseline-fn>() syntax is supported.Line 219 uses
call<'baseline-fn>()with a quoted binding name. According to past review findings, RainLang'scallsyntax iscall<index>(inputs)with numeric indices, not string binding references. RainLang does not support runtime string-based function dispatch.Verify this code compiles and executes correctly. If it fails, refactor to use numeric indices per RainLang documentation:
-io: mul(call<'baseline-fn>() baseline-multiplier); +io: mul(call<0>() baseline-multiplier); # Replace 0 with actual source indexThe same pattern appears throughout the file and other strategy files (grid.rain, dynamic-spread.rain, claims.rain, auction-dca.rain), so this may require broader changes if unsupported.
12-12: Replace placeholder subgraph URLs before deployment.Lines 12 and 18 contain placeholder URLs (
https://example.com/subgraph) that will prevent the strategy from functioning. The base subgraph endpoint is needed to query order data, and the raindex remote is required for local database synchronization.Update both URLs to the actual production endpoints:
subgraphs: - base: https://example.com/subgraph + base: <actual-base-subgraph-goldsky-url> local-db-remotes: - raindex: https://example.com/subgraph + raindex: <actual-raindex-endpoint-url>Also applies to: 18-18
46-46: Fix unbalanced quoting in baseline-fn bindings.Lines 46 and 54 use the pattern
'''pyth-price-baseline'with unbalanced quotes (three opening, one closing). According to Rainlang syntax, identifiers should use balanced single or double quotes:'pyth-price-baseline'or"pyth-price-baseline".Apply this fix:
- baseline-fn: '''pyth-price-baseline' + baseline-fn: 'pyth-price-baseline'- baseline-fn: '''pyth-price-baseline-inv' + baseline-fn: 'pyth-price-baseline-inv'Also applies to: 54-54
132-132: Fix typo in description.Line 132 contains "trategy" which should be "strategy", and "an" should be "a".
- description: Deploy an fixed-spread trategy on Base using Pyth price feeds to buy shares. + description: Deploy a fixed-spread strategy on Base using Pyth price feeds to buy shares.
85-109: Consider extracting duplicate pyth-pair presets.The same 12 equity pair presets appear in both
base-pyth(lines 85-109) andbase-pyth-inv(lines 143-167). This duplication creates maintenance burden—any update must be applied twice.If the YAML parser supports anchors, define the presets once and reference them:
# Define once at file/section level .pyth-presets: &pyth-presets - name: Equity.US.GOOG/USD value: 0x924571756974792e55532e474f4f472f55534400000000000000000000000000 # ... remaining presets # Reference in both deployments gui: deployments: base-pyth: fields: - binding: pyth-pair presets: *pyth-presets base-pyth-inv: fields: - binding: pyth-pair presets: *pyth-presetsOtherwise, document that both sections must be kept synchronized.
Also applies to: 143-167
src/auction-dca.rain (3)
42-42: Replace all placeholder URLs with production endpoints.Lines 42, 44, 47, and 58 contain placeholder URLs (
https://example.com/subgraph) that will prevent the strategy from functioning across arbitrum, base, and polygon networks, as well as local database synchronization.Replace with actual production Goldsky subgraph endpoints. Reference the correct URLs from your settings.yaml or deployment configuration:
subgraphs: - arbitrum: https://example.com/subgraph + arbitrum: <actual-arbitrum-subgraph-url> - base: https://example.com/subgraph + base: <actual-base-subgraph-url> - polygon: https://example.com/subgraph + polygon: <actual-polygon-subgraph-url> local-db-remotes: - raindex: https://example.com/subgraph + raindex: <actual-raindex-endpoint-url>Also applies to: 44-44, 47-47, 58-58
157-158: Align subparser-0 with updated raindex-subparser address.Line 157 updates
raindex-subparserto0xcCf3E6e16E40B26618d216b4385d086664876782, but line 158 still references the oldsubparser-0address0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666. Mixing parser versions will cause incorrect IO calculations.Update to use consistent parser addresses:
arbitrum: orderbook: arbitrum runs: 1 bindings: raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782 - subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 + subparser-0: 0xcCf3E6e16E40B26618d216b4385d086664876782
177-178: Fix unbalanced quoting in function bindings.Lines 177-178, 187-188, 198-199, and 208-209 use unbalanced quote patterns like
'''constant-baseline'and'''pyth-price-baseline'. Rainlang syntax requires balanced quoting.Apply balanced quotes throughout:
- baseline-fn: '''constant-baseline' + baseline-fn: 'constant-baseline' - initial-io-fn: '''constant-initial-io' + initial-io-fn: 'constant-initial-io'Repeat for all affected scenarios (base, pyth-price-baseline-base, pyth-price-baseline-base-inv, polygon).
Also applies to: 187-188, 198-199, 208-209
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
registry(1 hunks)src/auction-dca.rain(13 hunks)src/fixed-spread.rain(1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-04-30T06:32:49.466Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 29
File: settings.yaml:1-35
Timestamp: 2025-04-30T06:32:49.466Z
Learning: In the Rain Strategies project, the `matchain` network referenced in `orderbooks` and `deployers` sections of the configuration YAML doesn't require an explicit definition in the `networks` section.
Applied to files:
src/fixed-spread.rain
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.strategies PR: 45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-07-03T09:47:14.894Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:115-122
Timestamp: 2025-07-03T09:47:14.894Z
Learning: In Rain language folio strategy, the zero balance check using `every(input-vault-before() output-vault-before())` is specifically implemented to prevent trades from executing while users are depositing or withdrawing from vaults, serving as a safety mechanism against race conditions during vault operations.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registrysrc/auction-dca.rain
📚 Learning: 2025-07-25T04:36:42.979Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 56
File: settings.yaml:74-74
Timestamp: 2025-07-25T04:36:42.979Z
Learning: In the Rain Strategies project settings.yaml file, Ethereum addresses should use checksum format (EIP-55 with mixed case) rather than all lowercase, as the checksum format provides error detection benefits that outweigh visual consistency concerns.
Applied to files:
src/auction-dca.rain
🔇 Additional comments (3)
src/fixed-spread.rain (2)
207-207: Verify 300-second staleness is appropriate for equity price feeds.Lines 207 and 212 use
pyth-price(pyth-pair 300)with a 5-minute staleness threshold for equity feeds. While this is more conservative than the 24-hour threshold flagged in past reviews, equity markets can be volatile during trading hours.Confirm that:
- Pyth's equity price feeds support and publish updates frequently enough for a 5-minute window
- Your trading strategy can safely operate with prices up to 5 minutes old
- Consider market hours—during closures, older prices may be acceptable, but during active trading this window might be too wide
For reference, Pyth's recommended staleness for pull-style feeds is commonly 240 seconds (4 minutes). Your 300-second (5-minute) threshold is slightly higher but may be acceptable depending on your risk tolerance.
Also applies to: 212-212
222-224: LGTM: Trade amount constraints properly enforced.The
handle-iosection correctly validates that trades fall within the configured min/max bounds using the output vault decrease, which represents the actual amount being sold.src/auction-dca.rain (1)
1465-1465: LGTM: Logic simplifications are correct improvements.The changes correctly simplify the codebase:
- Line 1465: Replaced
saturating-subwithmax(0 sub(...))for trade-epochs calculation, providing explicit bounds- Line 1481: Simplified halflife to
power(0.5 epoch), removing unnecessary intermediate multiplier construction- Line 1489: Replaced
saturating-subwithmax(0 sub(...))for variable-component, making bounds explicitThese improvements align with past review recommendations and make the logic clearer.
Also applies to: 1481-1481, 1489-1489
| - name: Equity.US.GOOG/USD | ||
| value: 0x924571756974792e55532e474f4f472f55534400000000000000000000000000 | ||
| - name: Equity.US.AMZN/USD | ||
| value: 0x924571756974792e55532e414d5a4e2f55534400000000000000000000000000 | ||
| - name: Equity.US.AAPL/USD | ||
| value: 0x924571756974792e55532e4141504c2f55534400000000000000000000000000 | ||
| - name: Equity.US.MSFT/USD | ||
| value: 0x924571756974792e55532e4d5346542f55534400000000000000000000000000 | ||
| - name: Equity.US.TSLA/USD | ||
| value: 0x924571756974792e55532e54534c412f55534400000000000000000000000000 | ||
| - name: Equity.US.NVDA/USD | ||
| value: 0x924571756974792e55532e4e5644412f55534400000000000000000000000000 | ||
| - name: Equity.US.META/USD | ||
| value: 0x924571756974792e55532e4d4554412f55534400000000000000000000000000 | ||
| - name: Equity.US.GME/USD | ||
| value: 0x914571756974792e55532e474d452f5553440000000000000000000000000000 | ||
| - name: Equity.US.MSTR/USD | ||
| value: 0x924571756974792e55532e4d5354522f55534400000000000000000000000000 | ||
| - name: Equity.US.BRK-B/USD | ||
| value: 0x934571756974792e55532e42524b2d422f555344000000000000000000000000 | ||
| - name: Equity.US.SPLG/USD | ||
| value: 0x924571756974792e55532e53504c472f55534400000000000000000000000000 | ||
| - name: Equity.US.IAU/USD | ||
| value: 0x914571756974792e55532e4941552f5553440000000000000000000000000000 |
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.
🧹 Nitpick | 🔵 Trivial
Consider extracting duplicate equity pair presets.
The same 12 equity pair presets appear in both base-pyth (lines 813-836) and base-pyth-inv (lines 931-954), violating DRY principles. This creates maintenance burden where updates must be applied in multiple locations.
If YAML anchors are supported, extract to a shared definition. Otherwise, document that both sections must be kept synchronized during updates.
Also applies to: 931-954
🤖 Prompt for AI Agents
In src/auction-dca.rain around lines 813-836 (and duplicate block at 931-954),
the same 12 equity pair presets are repeated; extract them to a single shared
definition and reference it from both `base-pyth` and `base-pyth-inv` (use YAML
anchors/aliases if supported by the parser) so updates are made once, or if
anchors are not supported, move the preset list to a single documented shared
section and replace the duplicates with a clear comment pointing to that
canonical block and a note that both must be kept synchronized.
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.
Actionable comments posted: 1
♻️ Duplicate comments (12)
src/fixed-spread.rain (6)
264-267: Verify late-bound call syntax is supported.Line 267 uses
call<'baseline-fn>()with a single-quoted binding name. Past reviews noted that RainLang documentation specifiescall<index>(inputs)with numeric indices, not string binding names. Verify this syntax compiles and executes correctly, or refactor to use numeric indices per documented syntax.
11-12: Replace placeholder subgraph URL before deployment.Line 12 uses
https://example.com/subgraphas the Base subgraph endpoint. This will prevent the deployment from querying order data and must be replaced with the actual Goldsky subgraph URL before release.
17-18: Replace placeholder raindex remote URL.Line 18 uses
https://example.com/subgraphfor the raindex remote. Local database synchronization will fail until this is replaced with the actual raindex endpoint.
38-54: Fix unbalanced quote syntax in baseline-fn bindings.Lines 46 and 54 use
'''pyth-price-baseline'and'''pyth-price-baseline-inv'respectively. This unbalanced quoting pattern ('''identifier') is not valid syntax—identifiers should use balanced single quotes ('identifier') or double quotes ("identifier").
148-148: Fix typo in GUI description."an fixed-spread trategy" should be "a fixed-spread strategy".
78-207: Extract duplicate equity pair presets to reduce maintenance burden.The same 24 equity pair presets are duplicated between
base-pyth(lines 85-133) andbase-pyth-inv(lines 159-207). This violates DRY principles—updates must be applied in both locations.If YAML anchors are supported, extract to a shared definition. Otherwise, document that both sections must be kept synchronized.
registry (1)
1-9: Add CI validation for registry integrity.Consider adding a CI check to validate:
- All commit SHAs are 40 characters
- All URLs are reachable (HTTP 200)
- Referenced files don't contain placeholder URLs
This prevents merging broken registry entries.
src/auction-dca.rain (5)
41-47: Replace placeholder subgraph URLs for all active networks.Lines 42, 44, and 47 use
https://example.com/subgraphfor Arbitrum, Base, and Polygon subgraph endpoints. These deployments cannot query order data until replaced with actual Goldsky URLs.
57-58: Replace placeholder raindex remote URL.Line 58 uses
https://example.com/subgraphfor the raindex remote. Local database synchronization will fail until this is replaced with the actual raindex endpoint.
157-158: Align subparser-0 with updated raindex-subparser.Line 157 updates
raindex-subparserto0xcCf3E6e16E40B26618d216b4385d086664876782, but line 158 still references the oldsubparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666. Mixing parser versions will yield incorrect IO calculations. Updatesubparser-0to match the new address or remove if unused.
813-860: Extract duplicate equity pair presets to reduce maintenance burden.The same 24 equity pair presets are duplicated between
base-pyth(lines 813-860) andbase-pyth-inv(lines 955-1002). This creates maintenance overhead where updates must be applied in both locations.If YAML anchors are supported, extract to a shared definition. Otherwise, document that both sections must be kept synchronized.
Also applies to: 955-1002
1570-1577: Reduce excessive 72-hour staleness threshold for equity price feeds.Lines 1571 and 1576 use
pyth-price(pyth-pair 259200)with a 259,200-second (72-hour) staleness threshold. This is extremely permissive for equity markets and poses significant risk during volatile periods. Pyth recommends 240 seconds (4 minutes) for equity feeds—your threshold is 1,080× more permissive.Update to a much shorter staleness period (240-300 seconds).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
registry(1 hunks)src/auction-dca.rain(13 hunks)src/fixed-spread.rain(1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-04-30T06:32:49.466Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 29
File: settings.yaml:1-35
Timestamp: 2025-04-30T06:32:49.466Z
Learning: In the Rain Strategies project, the `matchain` network referenced in `orderbooks` and `deployers` sections of the configuration YAML doesn't require an explicit definition in the `networks` section.
Applied to files:
src/fixed-spread.rain
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.strategies PR: 45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:14.894Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:115-122
Timestamp: 2025-07-03T09:47:14.894Z
Learning: In Rain language folio strategy, the zero balance check using `every(input-vault-before() output-vault-before())` is specifically implemented to prevent trades from executing while users are depositing or withdrawing from vaults, serving as a safety mechanism against race conditions during vault operations.
Applied to files:
registry
📚 Learning: 2025-07-25T04:36:42.979Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 56
File: settings.yaml:74-74
Timestamp: 2025-07-25T04:36:42.979Z
Learning: In the Rain Strategies project settings.yaml file, Ethereum addresses should use checksum format (EIP-55 with mixed case) rather than all lowercase, as the checksum format provides error detection benefits that outweigh visual consistency concerns.
Applied to files:
src/auction-dca.rain
🔇 Additional comments (3)
src/auction-dca.rain (2)
1513-1513: LGTM: Trade-epochs calculation correctly prevents negative values.Line 1513 uses
max(0 sub(...))to ensuretrade-epochsis non-negative. This is the correct approach for preventing negative epoch values in the auction logic.
1528-1529: LGTM: Halflife simplification is mathematically correct.Line 1529 simplifies the halflife calculation to
power(0.5 epoch), which correctly implements exponential decay. This is cleaner than the previous multi-line implementation.registry (1)
1-9: Placeholder subgraph URLs in configuration files are intentionally temporary.The registry correctly uses commit
8ba39a83b21a7c94bea90a3a57bd33c900c50503to pin strategy URLs, following the established pattern. However,fixed-spread.rainandclaims.rainboth contain placeholder subgraph URLs (https://example.com/subgraphon lines 12 and 18). Per the team's broader configuration replacement effort, these placeholder values are intentionally temporary and will be updated alongside other contract addresses and deployment blocks. This is not a production blocker and does not require resolution before merging.
| - binding: oracle-price-timeout | ||
| name: Oracle Price Timeout | ||
| description: | | ||
| How fresh (recent) the price is. | ||
| show-custom-field: true | ||
| default: 300 | ||
| presets: | ||
| - name: 5 minutes (300) | ||
| value: 300 | ||
| - name: 1 hour (3600) | ||
| value: 3600 | ||
| - name: 8 hour (28800) | ||
| value: 28800 | ||
| - name: 3 days (259200) | ||
| value: 259200 |
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.
Remove excessive 3-day staleness preset for equity price feeds.
The oracle-price-timeout presets include "3 days (259200)" which is far too permissive for equity markets. Pyth recommends 240 seconds (4 minutes) for equity feeds. A 3-day staleness threshold is 1,080× more permissive than recommended and poses significant risk during volatile periods.
Remove the 259200 preset and cap the maximum at 3600 seconds (1 hour).
🤖 Prompt for AI Agents
In src/fixed-spread.rain around lines 221 to 235, the presets for the
oracle-price-timeout include an unsafe "3 days (259200)" value; remove the
entire preset entry with value 259200 and ensure no preset exceeds 3600 seconds
(1 hour) — leave the default 300 and the 300/3600/28800 entries adjusted so the
maximum preset is 3600 (remove or replace any entries above 3600).
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.
Actionable comments posted: 1
♻️ Duplicate comments (9)
src/fixed-spread.rain (5)
12-12: Replace placeholder subgraph URL with production endpoint.
https://example.com/subgraphwill fail at runtime. Wire this to the actual Goldsky subgraph endpoint (e.g., theob4-baseURL pattern used in settings.yaml).
17-18: Replace placeholder raindex endpoint.The
raindexlocal-db-remote useshttps://example.com/subgraph, preventing local database synchronization.
175-175: Fix typo: "trategy" → "strategy" and grammar.- description: Deploy an fixed-spread trategy on Base using Pyth price feeds to buy shares. + description: Deploy a fixed-spread strategy on Base using Pyth price feeds to buy shares.
164-165: Remove 3-day staleness preset for equity price feeds.A 259,200-second (3-day) staleness threshold is excessively permissive for equity markets. Pyth recommends ~240 seconds for equity feeds. Cap the maximum preset at 3600 seconds (1 hour) or document why longer staleness is acceptable.
presets: - name: 5 minutes (300) value: 300 - name: 1 hour (3600) value: 3600 - - name: 8 hour (28800) - value: 28800 - - name: 3 days (259200) - value: 259200
85-137: Consider extracting duplicate pyth-pair presets.The same 25 equity pair presets are duplicated in
base-pyth(lines 85-137) andbase-pyth-inv(lines 186-238). If YAML anchors are supported, extract to a shared definition to reduce maintenance burden.src/auction-dca.rain (4)
42-47: Replace placeholder subgraph URLs for active networks.Lines 42, 44, and 47 use
https://example.com/subgraphfor Arbitrum, Base, and Polygon. These must be replaced with live Goldsky endpoints before deployment.
57-58: Replace placeholder raindex endpoint.Line 58 uses
https://example.com/subgraphfor the raindex remote, preventing local database synchronization.
157-158: Align subparser-0 with updated raindex-subparser.
raindex-subparserwas updated to0xcCf3E6e16E40B26618d216b4385d086664876782butsubparser-0still references the old0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666. Mixing parser versions may yield incorrect IO calculations.arbitrum: orderbook: arbitrum runs: 1 bindings: raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782 - subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 + subparser-0: 0xcCf3E6e16E40B26618d216b4385d086664876782
1578-1584: Reduce excessive 72-hour staleness for Pyth equity price feeds.Both
pyth-price-baselineandpyth-price-baseline-invusepyth-price(pyth-pair 259200)with a 259,200-second (72-hour) staleness threshold. This is 1,080× more permissive than Pyth's recommended 240 seconds for equity feeds and poses significant risk during volatile periods.#pyth-price-baseline -price _: pyth-price(pyth-pair 259200), +price _: pyth-price(pyth-pair 300), _: price; #pyth-price-baseline-inv -price _: pyth-price(pyth-pair 259200), +price _: pyth-price(pyth-pair 300), _: inv(price);
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
registry(1 hunks)src/auction-dca.rain(13 hunks)src/fixed-spread.rain(1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.strategies PR: 45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:14.894Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:115-122
Timestamp: 2025-07-03T09:47:14.894Z
Learning: In Rain language folio strategy, the zero balance check using `every(input-vault-before() output-vault-before())` is specifically implemented to prevent trades from executing while users are depositing or withdrawing from vaults, serving as a safety mechanism against race conditions during vault operations.
Applied to files:
registry
📚 Learning: 2025-07-25T04:36:42.979Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 56
File: settings.yaml:74-74
Timestamp: 2025-07-25T04:36:42.979Z
Learning: In the Rain Strategies project settings.yaml file, Ethereum addresses should use checksum format (EIP-55 with mixed case) rather than all lowercase, as the checksum format provides error detection benefits that outweigh visual consistency concerns.
Applied to files:
src/auction-dca.rain
🔇 Additional comments (8)
src/fixed-spread.rain (1)
295-305: Strategy logic implementation looks correct.The
calculate-iofunction correctly usescall<'baseline-fn>()to dispatch to the configured baseline function, and multiplies bybaseline-multiplierto compute the final IO ratio. Thehandle-ioandhandle-add-orderhooks are minimal placeholders as expected for this simple fixed-spread strategy.src/auction-dca.rain (6)
16-21: Base and Polygon network configurations look correct.The new network configurations for Base (chain-id 8453) and Polygon (chain-id 137) are properly structured with appropriate RPC endpoints and currency settings.
Also applies to: 34-39
67-78: Orderbook configurations for Base and Polygon look correct.The new orderbook entries include proper addresses, deployment blocks, and local-db-remote references. Based on learnings, deployment-block values may be placeholder and will be updated as part of a broader effort.
171-210: New scenarios for Base and Polygon are well-structured.The new scenarios (
base,pyth-price-baseline-base,pyth-price-baseline-base-inv,polygon) include proper bindings with consistent subparser addresses within each network.
799-943: New base-pyth GUI deployment configuration is complete.The
base-pythGUI section includes comprehensive field definitions for Pyth pair selection, budget periods, trade amounts, and auction settings. The equity pair presets are extensive.
1521-1521: Halflife simplification applied correctly.The
trade-epochscalculation now usesmax(0 sub(...))to ensure non-negative values, which is the correct approach.
1536-1537: Halflife function simplification looks good.The halflife calculation
val: power(0.5 epoch)is mathematically correct. Per previous discussion with the maintainer, negative epoch values are acceptable as they simply produce values > 1, which is normalized relative to the starting point.registry (1)
1-8: All 8 strategy files contain placeholder URLs and are not production-ready for the registry.Verification shows all referenced files contain
https://example.com/subgraphplaceholders:
- fixed-spread.rain (lines 12, 18)
- claims.rain (lines 12, 18)
- folio.rain (lines 15, 18)
- auction-dca.rain (lines 42-46)
- dynamic-spread.rain (lines 129-133)
- grid.rain (lines 42-46)
- fixed-limit.rain (lines 57-61)
- canary.rain (lines 36-40)
These placeholders must be replaced with actual subgraph URLs before merging, as they prevent the strategies from functioning. Ensure this is addressed as part of the broader deployment configuration update effort.
⛔ Skipped due to learnings
Learnt from: 0xgleb Repo: rainlanguage/rain.strategies PR: 45 File: registry:0-0 Timestamp: 2025-07-26T15:31:37.916Z Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.Learnt from: findolor Repo: rainlanguage/rain.strategies PR: 59 File: src/fixed-limit.rain:68-68 Timestamp: 2025-09-01T12:19:42.343Z Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.Learnt from: findolor Repo: rainlanguage/rain.strategies PR: 29 File: settings.yaml:36-44 Timestamp: 2025-04-30T06:33:10.474Z Learning: URLs in YAML files for the rain.strategies repository don't need to be quoted according to the project maintainer's preference, even though they contain characters like "://" that might be misinterpreted by some YAML parsers.Learnt from: thedavidmeister Repo: rainlanguage/rain.strategies PR: 60 File: src/dynamic-spread.rain:924-929 Timestamp: 2025-09-04T12:59:34.219Z Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.Learnt from: thedavidmeister Repo: rainlanguage/rain.strategies PR: 28 File: src/folio.rain:28-42 Timestamp: 2025-07-03T09:47:48.019Z Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.Learnt from: thedavidmeister Repo: rainlanguage/rain.strategies PR: 28 File: src/folio.rain:115-122 Timestamp: 2025-07-03T09:47:14.894Z Learning: In Rain language folio strategy, the zero balance check using `every(input-vault-before() output-vault-before())` is specifically implemented to prevent trades from executing while users are depositing or withdrawing from vaults, serving as a safety mechanism against race conditions during vault operations.Learnt from: Siddharth2207 Repo: rainlanguage/rain.strategies PR: 42 File: src/fixed-limit.rain:19-23 Timestamp: 2025-06-19T03:59:46.063Z Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
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.
Actionable comments posted: 5
🤖 Fix all issues with AI Agents
In @src/auction-dca.rain:
- Around line 1598-1604: The staleness threshold for Pyth price feeds is far too
high: replace the 259200-second (72h) value with a short equity-appropriate
window (~240 seconds) in both occurrences; specifically update the pyth-price
call inside the pyth-price-baseline rule (price _: pyth-price(pyth-pair 259200))
and the pyth-price-baseline-inv rule (price _: pyth-price(pyth-pair 259200)) to
use pyth-pair 240 so both normal and inv variants use the reduced 240s
staleness.
- Around line 42-47: The config still contains placeholder URLs for the active
networks: replace the placeholder "https://example.com/subgraph" values for the
arbitrum, base, and polygon entries with the correct production Goldsky subgraph
endpoints; update the arbitrum, base, and polygon keys in the same block to
point to the live Goldsky URLs (ensure they are the canonical production
endpoints and not staging/test URLs) and verify they follow the same URL format
as the other network entries after replacement.
In @src/fixed-spread.rain:
- Line 74: The description string uses incorrect grammar "an fixed-spread";
update the description value (the line containing description: Deploy an
fixed-spread strategy on Base using Pyth price feeds to sell shares.) to read "a
fixed-spread" instead so it becomes "Deploy a fixed-spread strategy on Base
using Pyth price feeds to sell shares." Ensure you only change the article and
leave the rest of the description intact.
- Line 185: Update the GUI description string in src/fixed-spread.rain (the
description field shown as "Deploy an fixed-spread trategy on Base using Pyth
price feeds to buy shares.") to correct the typos: change "an" to "a" and
"trategy" to "strategy" so the description reads "Deploy a fixed-spread strategy
on Base using Pyth price feeds to buy shares."
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
registrysrc/auction-dca.rainsrc/fixed-spread.rain
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.strategies PR: 45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:14.894Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:115-122
Timestamp: 2025-07-03T09:47:14.894Z
Learning: In Rain language folio strategy, the zero balance check using `every(input-vault-before() output-vault-before())` is specifically implemented to prevent trades from executing while users are depositing or withdrawing from vaults, serving as a safety mechanism against race conditions during vault operations.
Applied to files:
registry
📚 Learning: 2025-07-25T04:36:42.979Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 56
File: settings.yaml:74-74
Timestamp: 2025-07-25T04:36:42.979Z
Learning: In the Rain Strategies project settings.yaml file, Ethereum addresses should use checksum format (EIP-55 with mixed case) rather than all lowercase, as the checksum format provides error detection benefits that outweigh visual consistency concerns.
Applied to files:
src/auction-dca.rain
🔇 Additional comments (12)
src/fixed-spread.rain (5)
38-55: Scenarios configuration looks correct.The scenario bindings for
pyth-price-baseline-baseandpyth-price-baseline-base-invare properly configured with the appropriate raindex-subparser and subparser-0 addresses for Base network.
305-318: Rain DSL implementation looks correct.The price baseline functions correctly fetch the Pyth price and the calculate-io function properly applies the baseline multiplier. The
call<'baseline-fn>()syntax follows the established pattern used across other strategy files.
321-325: Minimal handler implementations are appropriate.The empty
handle-ioandhandle-add-orderfunctions are acceptable for this fixed-spread strategy that relies solely oncalculate-iofor pricing without state management. Based on learnings, the team prefers intentionally oversimplified setups in initial implementations.
11-18: Replace placeholder subgraph and local-db-remote URLs before merging.Lines 12 and 18 still use
https://example.com/subgraph. These placeholder URLs will prevent the Base deployment from querying order data and local database synchronization.⛔ Skipped due to learnings
Learnt from: findolor Repo: rainlanguage/rain.strategies PR: 59 File: src/fixed-limit.rain:68-68 Timestamp: 2025-09-01T12:19:42.343Z Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
167-175: Remove excessive 3-day staleness preset for equity price feeds.The
oracle-price-timeoutpresets include "3 days (259200)" which is far too permissive for equity markets. Pyth recommends ~240 seconds (4 minutes) for equity feeds. A 3-day staleness threshold is 1,080× more permissive than recommended and poses significant risk during volatile periods.Likely an incorrect or invalid review comment.
src/auction-dca.rain (7)
1-1: Version bump to 4 is appropriate.The version bump aligns with the addition of new networks (base, polygon) and deployments.
60-78: Orderbook configurations are properly structured.The orderbook entries for arbitrum, base, and polygon include valid addresses (EIP-55 checksum format), deployment blocks, and local-db-remote references. The addresses and deployment blocks appear production-ready.
171-210: New Base and Polygon scenarios are properly configured.The new scenarios have properly aligned parser addresses:
- Base constant-baseline: both parsers at
0x22839F...- Polygon constant-baseline: both parsers at
0xAD4DeD...- Pyth scenarios correctly use a different
subparser-0(0x545d46...) for Pyth price feed support
1541-1567: Improved guards and halflife simplification look good.The changes properly ensure non-negative values:
- Line 1541:
max(0 sub(...))guards against negative trade epochs- Line 1557:
power(0.5 epoch)is the correct halflife simplification- Line 1565:
max(0 sub(...))ensures variable-component is non-negative
1511-1512: Pyth-pair binding declaration is correct.The new
#pyth-pairbinding is properly declared to support the Pyth price feed scenarios.
57-58: Replace placeholder local-db-remote URL.Line 58 uses
https://example.com/subgraphfor the raindex remote, which will prevent local database synchronization.Likely an incorrect or invalid review comment.
813-874: Consider extracting duplicate equity pair presets.The same 31 equity pair presets appear in both
base-pyth(lines 813-874) andbase-pyth-inv(lines 969-1030), violating DRY principles. If YAML anchors are supported, extract to a shared definition. Otherwise, document that both sections must be kept synchronized during updates.Likely an incorrect or invalid review comment.
| arbitrum: https://example.com/subgraph | ||
| # bsc: https://example.com/subgraph | ||
| # base: https://example.com/subgraph | ||
| base: https://example.com/subgraph | ||
| # ethereum: https://example.com/subgraph | ||
| # flare: https://example.com/subgraph | ||
| # polygon: https://example.com/subgraph | ||
| polygon: https://example.com/subgraph |
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.
Replace placeholder subgraph URLs for all active networks.
Lines 42, 44, and 47 still use https://example.com/subgraph for Arbitrum, Base, and Polygon. These must be replaced with production Goldsky endpoints before merging.
🤖 Prompt for AI Agents
In @src/auction-dca.rain around lines 42 - 47, The config still contains
placeholder URLs for the active networks: replace the placeholder
"https://example.com/subgraph" values for the arbitrum, base, and polygon
entries with the correct production Goldsky subgraph endpoints; update the
arbitrum, base, and polygon keys in the same block to point to the live Goldsky
URLs (ensure they are the canonical production endpoints and not staging/test
URLs) and verify they follow the same URL format as the other network entries
after replacement.
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.
Actionable comments posted: 10
🤖 Fix all issues with AI Agents
In @registry:
- Around line 1-8: Several strategy files still contain the placeholder subgraph
URL "https://example.com/subgraph"; locate and replace every occurrence in the
listed strategy configs (fixed-limit.rain, auction-dca.rain, grid.rain,
dynamic-spread.rain, canary.rain — note canary has multiple occurrences — and
claims.rain, fixed-spread.rain, folio.rain for both base and raindex chain
entries) with the correct production subgraph endpoints; after replacing,
validate each URL is reachable and update any deployment/config comments to
reflect the new endpoints so the registry points to the real subgraphs before
production deploy.
In @src/auction-dca.rain:
- Around line 1598-1604: The staleness threshold for Pyth equity feeds is
dangerously high: replace the hardcoded 259200 (72h) in the pyth-price(pyth-pair
259200) calls used in the #pyth-price-baseline and #pyth-price-baseline-inv
rules with a much shorter window (e.g., 240 seconds) or make it configurable;
update both usages of pyth-price(pyth-pair 259200) to pyth-price(pyth-pair 240)
(or reference a STALENESS_SECONDS constant) so equity price reads adhere to
Pyth's ~240s recommendation.
- Around line 157-158: The file mixes parser addresses: raindex-subparser was
updated to 0xcCf3E6e16E40B26618d216b4385d086664876782 but subparser-0 still
points to the old 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666; update the
subparser-0 entry to use the same address as raindex-subparser
(0xcCf3E6e16E40B26618d216b4385d086664876782) so both parser references are
aligned and IO calculations remain correct.
In @src/fixed-spread.rain:
- Line 74: The description string in src/fixed-spread.rain contains a
grammatical error: change "an fixed-spread strategy on Base using Pyth price
feeds to sell shares." to use the correct article "a" (i.e., "a fixed-spread
strategy on Base using Pyth price feeds to sell shares.") so the description
reads correctly; update the description field accordingly.
- Line 185: Update the description string that currently reads "Deploy an
fixed-spread trategy on Base using Pyth price feeds to buy shares." to correct
grammar and spelling: change it to "Deploy a fixed-spread strategy on Base using
Pyth price feeds to buy shares." Locate the YAML/metadata key named description
and replace the existing value with the corrected sentence.
- Line 12: The config uses placeholder endpoints for the subgraph keys "base"
and "raindex" (currently set to https://example.com/subgraph); replace both
values with the actual Goldsky/raindex production URLs for the "base" subgraph
and the "raindex" local-db-remote endpoint respectively, ensuring you update
every occurrence in the file and verify the URLs are reachable before merging.
- Around line 85-147: The presets block for the 24 Equity.* pyth-pair entries is
duplicated between base-pyth and base-pyth-inv, so extract the shared list into
a single reusable definition and reference it from both places; specifically,
move the repeated presets (e.g., entries with names like Equity.US.GOOG/USD,
Equity.US.AMZN/USD(.PRE/.POST), Equity.US.TSLA/USD(.PRE/.POST), etc.) into a
single anchor or shared YAML node and replace the duplicated blocks under
base-pyth and base-pyth-inv with references to that anchor (or, if anchors
aren’t supported, add a clear comment/documentation indicating the master copy
location and ensure both sections are generated/updated from that single
source).
- Line 46: The baseline-fn bindings use unbalanced triple-single-quote syntax;
update the two occurrences of baseline-fn: '''pyth-price-baseline' and
baseline-fn: '''pyth-price-baseline-inv' to use balanced quotes such as
baseline-fn: 'pyth-price-baseline' and baseline-fn: 'pyth-price-baseline-inv'
(or use double quotes) so the identifiers are valid RainLang strings.
- Line 174: Remove the unsafe 3-day staleness preset by deleting or replacing
the preset entry "name: 3 days (259200)" in the staleness presets list; if you
need a fallback, cap it to a maximum of 3600 seconds (e.g., replace 259200 with
3600 and adjust the name accordingly) and apply the same change to the duplicate
occurrence of the exact "name: 3 days (259200)" preset elsewhere in the file so
no 259200 staleness value remains.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
registrysrc/auction-dca.rainsrc/fixed-spread.rain
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-09-01T12:19:42.343Z
Learnt from: findolor
Repo: rainlanguage/rain.strategies PR: 59
File: src/fixed-limit.rain:68-68
Timestamp: 2025-09-01T12:19:42.343Z
Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-09-04T12:59:34.219Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 60
File: src/dynamic-spread.rain:924-929
Timestamp: 2025-09-04T12:59:34.219Z
Learning: In the Rain Strategies dynamic spread system, the io values cannot be zero due to business logic constraints where baseline uses any(cost-basis-io last-io) and cost-basis-multiplier is positive, making division-by-zero in inv(stored-last-io) mathematically impossible under normal operation.
Applied to files:
src/fixed-spread.rainregistrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:48.019Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:28-42
Timestamp: 2025-07-03T09:47:48.019Z
Learning: In Rain language strategy files, thedavidmeister prefers intentionally oversimplified setups over complex validation logic, especially in initial implementations like the folio strategy configuration.
Applied to files:
src/fixed-spread.rainregistry
📚 Learning: 2025-07-26T15:31:37.916Z
Learnt from: 0xgleb
Repo: rainlanguage/rain.strategies PR: 45
File: registry:0-0
Timestamp: 2025-07-26T15:31:37.916Z
Learning: In the rain.strategies repository, the registry file uses full commit SHAs to pin strategy URLs as the current established pattern, rather than using tags or branches, as confirmed by project maintainer 0xgleb.
Applied to files:
registry
📚 Learning: 2025-06-19T03:59:46.063Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 42
File: src/fixed-limit.rain:19-23
Timestamp: 2025-06-19T03:59:46.063Z
Learning: In rain.strategies configuration files, `arbitrum2` is an intentional alias for the Arbitrum network (same chain-id 42161) but with updated contract addresses. It serves as a deployment target for newer contract versions while maintaining the existing `arbitrum` configuration during transition periods.
Applied to files:
registrysrc/auction-dca.rain
📚 Learning: 2025-07-03T09:47:14.894Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.strategies PR: 28
File: src/folio.rain:115-122
Timestamp: 2025-07-03T09:47:14.894Z
Learning: In Rain language folio strategy, the zero balance check using `every(input-vault-before() output-vault-before())` is specifically implemented to prevent trades from executing while users are depositing or withdrawing from vaults, serving as a safety mechanism against race conditions during vault operations.
Applied to files:
registry
📚 Learning: 2025-07-25T04:36:42.979Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.strategies PR: 56
File: settings.yaml:74-74
Timestamp: 2025-07-25T04:36:42.979Z
Learning: In the Rain Strategies project settings.yaml file, Ethereum addresses should use checksum format (EIP-55 with mixed case) rather than all lowercase, as the checksum format provides error detection benefits that outweigh visual consistency concerns.
Applied to files:
src/auction-dca.rain
🔇 Additional comments (3)
src/auction-dca.rain (3)
1541-1541: Good defensive coding for epoch calculation.The use of
max(0 sub(...))ensurestrade-epochsnever goes negative, which is the correct approach for the halflife calculation.
1556-1557: LGTM: Clean halflife implementation.The halflife calculation using
power(0.5 epoch)is correct and cleaner than alternative implementations.
42-42: Replace all placeholder URLs with production endpoints before merging.Critical placeholders that will cause runtime failures:
- Line 42:
arbitrumsubgraph- Line 44:
basesubgraph- Line 47:
polygonsubgraph- Line 58:
raindexlocal-db-remoteAll must be replaced with actual Goldsky/raindex production URLs.
Also applies to: 44-44, 47-47, 58-58
⛔ Skipped due to learnings
Learnt from: findolor Repo: rainlanguage/rain.strategies PR: 59 File: src/fixed-limit.rain:68-68 Timestamp: 2025-09-01T12:19:42.343Z Learning: In the rain.strategies repository, the team plans to replace contract addresses in the configuration files, and deployment-block values will be updated as part of that broader effort, so placeholder values like 1 are intentionally temporary.
| fixed-limit https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/fixed-limit.rain | ||
| auction-dca https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/auction-dca.rain | ||
| grid https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/grid.rain | ||
| dynamic-spread https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/dynamic-spread.rain | ||
| canary https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/canary.rain | ||
| claims https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/claims.rain | ||
| fixed-spread https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/fixed-spread.rain | ||
| folio https://raw.githubusercontent.com/rainlanguage/rain.strategies/ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e/src/folio.rain |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
SHA="ccfa3cd02a46a615aaa1647eb4cb7fc75c87302e"
# Verify SHA length
echo "=== SHA Verification ==="
echo "SHA: $SHA"
echo "SHA length: ${#SHA}"
if [[ ${#SHA} -eq 40 ]]; then
echo "✓ SHA is valid length (40 characters, standard git commit)"
elif [[ ${#SHA} -eq 64 ]]; then
echo "✓ SHA is valid length (64 characters, alternate format)"
else
echo "✗ SHA length invalid: ${#SHA}"
fi
# Check if URLs are accessible and get file contents
echo -e "\n=== Checking Strategy Files ==="
strategies=("fixed-limit" "auction-dca" "grid" "dynamic-spread" "canary" "claims" "fixed-spread" "folio")
for strategy in "${strategies[@]}"; do
url="https://raw.githubusercontent.com/rainlanguage/rain.strategies/$SHA/src/$strategy.rain"
echo -e "\nChecking: $strategy.rain"
# Try to fetch the file
if response=$(curl -fsSL "$url" 2>&1); then
echo "✓ URL reachable"
# Check for common placeholder patterns
if echo "$response" | grep -qi 'example\.com\|placeholder\|TODO\|FIXME\|xxx\|0x0*1 /' | head -5; then
echo "⚠ Found potential placeholder-like content"
echo "$response" | grep -in 'example\.com\|placeholder\|TODO\|FIXME' | head -3
fi
# Check for contract addresses (0x...)
addr_count=$(echo "$response" | grep -o '0x[a-fA-F0-9]\{40\}' | wc -l)
echo " Contract addresses found: $addr_count"
else
echo "✗ URL unreachable or error: $response"
fi
doneRepository: rainlanguage/rain.strategies
Length of output: 2060
All strategy files contain placeholder subgraph URLs that require updating.
Verification confirms all registry URLs are valid and reachable. However, all eight strategy files contain https://example.com/subgraph placeholders across their configurations:
- fixed-limit.rain, auction-dca.rain, grid.rain, dynamic-spread.rain, canary.rain (multiple occurrences)
- claims.rain, fixed-spread.rain, folio.rain (base and raindex chains)
Per the team's established process, these placeholder URLs are intentionally temporary and are being addressed as part of a broader contract address and configuration update effort. Ensure these are replaced with production subgraph endpoints before deploying to production.
🤖 Prompt for AI Agents
In @registry around lines 1 - 8, Several strategy files still contain the
placeholder subgraph URL "https://example.com/subgraph"; locate and replace
every occurrence in the listed strategy configs (fixed-limit.rain,
auction-dca.rain, grid.rain, dynamic-spread.rain, canary.rain — note canary has
multiple occurrences — and claims.rain, fixed-spread.rain, folio.rain for both
base and raindex chain entries) with the correct production subgraph endpoints;
after replacing, validate each URL is reachable and update any deployment/config
comments to reflect the new endpoints so the registry points to the real
subgraphs before production deploy.
| raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782 | ||
| subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666 |
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.
Align subparser-0 with updated raindex-subparser on Arbitrum.
Line 157 updated raindex-subparser to 0xcCf3E6e16E40B26618d216b4385d086664876782, but line 158 still references the old subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666. Mixing parser versions will yield incorrect IO calculations.
arbitrum:
orderbook: arbitrum
runs: 1
bindings:
raindex-subparser: 0xcCf3E6e16E40B26618d216b4385d086664876782
- subparser-0: 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666
+ subparser-0: 0xcCf3E6e16E40B26618d216b4385d086664876782🤖 Prompt for AI Agents
In @src/auction-dca.rain around lines 157 - 158, The file mixes parser
addresses: raindex-subparser was updated to
0xcCf3E6e16E40B26618d216b4385d086664876782 but subparser-0 still points to the
old 0xe80e7438ce6b1055c8e9CDE1b6336a4F9D53C666; update the subparser-0 entry to
use the same address as raindex-subparser
(0xcCf3E6e16E40B26618d216b4385d086664876782) so both parser references are
aligned and IO calculations remain correct.
| - name: Equity.US.GOOG/USD | ||
| value: 0x924571756974792e55532e474f4f472f55534400000000000000000000000000 | ||
| - name: Equity.US.AMZN/USD | ||
| value: 0x924571756974792e55532e414d5a4e2f55534400000000000000000000000000 | ||
| - name: Equity.US.AMZN/USD.PRE | ||
| value: 0x964571756974792e55532e414d5a4e2f5553442e505245000000000000000000 | ||
| - name: Equity.US.AMZN/USD.POST | ||
| value: 0x974571756974792e55532e414d5a4e2f5553442e504f53540000000000000000 | ||
| - name: Equity.US.AAPL/USD | ||
| value: 0x924571756974792e55532e4141504c2f55534400000000000000000000000000 | ||
| - name: Equity.US.MSFT/USD | ||
| value: 0x924571756974792e55532e4d5346542f55534400000000000000000000000000 | ||
| - name: Equity.US.TSLA/USD | ||
| value: 0x924571756974792e55532e54534c412f55534400000000000000000000000000 | ||
| - name: Equity.US.TSLA/USD.PRE | ||
| value: 0x964571756974792e55532e54534c412f5553442e505245000000000000000000 | ||
| - name: Equity.US.TSLA/USD.POST | ||
| value: 0x974571756974792e55532e54534c412f5553442e504f53540000000000000000 | ||
| - name: Equity.US.NVDA/USD | ||
| value: 0x924571756974792e55532e4e5644412f55534400000000000000000000000000 | ||
| - name: Equity.US.NVDA/USD.PRE | ||
| value: 0x964571756974792e55532e4e5644412f5553442e505245000000000000000000 | ||
| - name: Equity.US.NVDA/USD.POST | ||
| value: 0x974571756974792e55532e4e5644412f5553442e504f53540000000000000000 | ||
| - name: Equity.US.META/USD | ||
| value: 0x924571756974792e55532e4d4554412f55534400000000000000000000000000 | ||
| - name: Equity.US.GME/USD | ||
| value: 0x914571756974792e55532e474d452f5553440000000000000000000000000000 | ||
| - name: Equity.US.MSTR/USD | ||
| value: 0x924571756974792e55532e4d5354522f55534400000000000000000000000000 | ||
| - name: Equity.US.MSTR/USD.PRE | ||
| value: 0x964571756974792e55532e4d5354522f5553442e505245000000000000000000 | ||
| - name: Equity.US.MSTR/USD.POST | ||
| value: 0x974571756974792e55532e4d5354522f5553442e504f53540000000000000000 | ||
| - name: Equity.US.BRK-B/USD | ||
| value: 0x934571756974792e55532e42524b2d422f555344000000000000000000000000 | ||
| - name: Equity.US.SPLG/USD | ||
| value: 0x924571756974792e55532e53504c472f55534400000000000000000000000000 | ||
| - name: Equity.US.IAU/USD | ||
| value: 0x914571756974792e55532e4941552f5553440000000000000000000000000000 | ||
| - name: Equity.US.COIN/USD | ||
| value: 0x924571756974792e55532e434f494e2f55534400000000000000000000000000 | ||
| - name: Equity.US.COIN/USD.PRE | ||
| value: 0x964571756974792e55532e434f494e2f5553442e505245000000000000000000 | ||
| - name: Equity.US.COIN/USD.POST | ||
| value: 0x974571756974792e55532e434f494e2f5553442e504f53540000000000000000 | ||
| - name: Equity.US.SIVR/USD | ||
| value: 0x924571756974792e55532e534956522f55534400000000000000000000000000 | ||
| - name: Equity.US.CRCL/USD | ||
| value: 0x924571756974792e55532e4352434c2f55534400000000000000000000000000 | ||
| - name: Equity.US.CRCL/USD.PRE | ||
| value: 0x964571756974792e55532e4352434c2f5553442e505245000000000000000000 | ||
| - name: Equity.US.CRCL/USD.POST | ||
| value: 0x974571756974792e55532e4352434c2f5553442e504f53540000000000000000 | ||
| - name: Equity.US.BMNR/USD | ||
| value: 0x924571756974792e55532e424d4e522f55534400000000000000000000000000 | ||
| - name: Equity.US.BMNR/USD.PRE | ||
| value: 0x964571756974792e55532e424d4e522f5553442e505245000000000000000000 | ||
| - name: Equity.US.BMNR/USD.POST | ||
| value: 0x974571756974792e55532e424d4e522f5553442e504f53540000000000000000 | ||
| - name: Equity.US.PPLT/USD | ||
| value: 0x924571756974792e55532e50504c542f55534400000000000000000000000000 |
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.
🛠️ Refactor suggestion | 🟠 Major
Extract duplicate pyth-pair presets to reduce maintenance burden.
The same 24 equity pair presets appear in both base-pyth (lines 813-874) and base-pyth-inv (lines 969-1030). This violates DRY principles.
If YAML anchors are supported, extract to a shared definition. Otherwise, document that both sections must be kept synchronized during updates.
Also applies to: 969-1030
| #pyth-price-baseline | ||
| price _: pyth-price(pyth-pair 259200), | ||
| _: price; | ||
|
|
||
| #pyth-price-baseline-inv | ||
| price _: pyth-price(pyth-pair 259200), | ||
| _: inv(price); |
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.
Reduce excessive 72-hour staleness threshold for equity price feeds.
Lines 1599 and 1603 use pyth-price(pyth-pair 259200) with a 259,200-second (72-hour/3-day) staleness threshold. Pyth's recommended staleness for equity feeds is ~240 seconds (4 minutes), making this 1,080× more permissive than recommended and unsafe for volatile equity markets.
#pyth-price-baseline
-price _: pyth-price(pyth-pair 259200),
+price _: pyth-price(pyth-pair 240),
_: price;
#pyth-price-baseline-inv
-price _: pyth-price(pyth-pair 259200),
+price _: pyth-price(pyth-pair 240),
_: inv(price);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #pyth-price-baseline | |
| price _: pyth-price(pyth-pair 259200), | |
| _: price; | |
| #pyth-price-baseline-inv | |
| price _: pyth-price(pyth-pair 259200), | |
| _: inv(price); | |
| #pyth-price-baseline | |
| price _: pyth-price(pyth-pair 240), | |
| _: price; | |
| #pyth-price-baseline-inv | |
| price _: pyth-price(pyth-pair 240), | |
| _: inv(price); |
🤖 Prompt for AI Agents
In @src/auction-dca.rain around lines 1598 - 1604, The staleness threshold for
Pyth equity feeds is dangerously high: replace the hardcoded 259200 (72h) in the
pyth-price(pyth-pair 259200) calls used in the #pyth-price-baseline and
#pyth-price-baseline-inv rules with a much shorter window (e.g., 240 seconds) or
make it configurable; update both usages of pyth-price(pyth-pair 259200) to
pyth-price(pyth-pair 240) (or reference a STALENESS_SECONDS constant) so equity
price reads adhere to Pyth's ~240s recommendation.
| currency: ETH | ||
|
|
||
| subgraphs: | ||
| base: https://example.com/subgraph |
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.
Replace placeholder URLs with production endpoints before merging.
Lines 12 and 18 contain placeholder https://example.com/subgraph URLs that will cause runtime failures:
- Line 12:
basesubgraph endpoint - Line 18:
raindexlocal-db-remote endpoint
Both must be replaced with actual Goldsky/raindex production URLs.
Also applies to: 18-18
🤖 Prompt for AI Agents
In @src/fixed-spread.rain at line 12, The config uses placeholder endpoints for
the subgraph keys "base" and "raindex" (currently set to
https://example.com/subgraph); replace both values with the actual
Goldsky/raindex production URLs for the "base" subgraph and the "raindex"
local-db-remote endpoint respectively, ensuring you update every occurrence in
the file and verify the URLs are reachable before merging.
| bindings: | ||
| raindex-subparser: 0x22839F16281E67E5Fd395fAFd1571e820CbD46cB | ||
| subparser-0: 0xD8D7EA2b68F45db78CDAbB0e4C323705C9459d5E | ||
| baseline-fn: '''pyth-price-baseline' |
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.
Fix unbalanced quote syntax in baseline-fn bindings.
Lines 46 and 54 use invalid syntax '''identifier' (unbalanced triple quotes):
baseline-fn: '''pyth-price-baseline'
baseline-fn: '''pyth-price-baseline-inv'
RainLang requires balanced quoting. Use either 'identifier' or "identifier".
Also applies to: 54-54
🤖 Prompt for AI Agents
In @src/fixed-spread.rain at line 46, The baseline-fn bindings use unbalanced
triple-single-quote syntax; update the two occurrences of baseline-fn:
'''pyth-price-baseline' and baseline-fn: '''pyth-price-baseline-inv' to use
balanced quotes such as baseline-fn: 'pyth-price-baseline' and baseline-fn:
'pyth-price-baseline-inv' (or use double quotes) so the identifiers are valid
RainLang strings.
| deployments: | ||
| base-pyth: | ||
| name: Base pyth sell shares | ||
| description: Deploy an fixed-spread strategy on Base using Pyth price feeds to sell shares. |
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.
Fix grammar: "an fixed-spread" → "a fixed-spread".
- description: Deploy an fixed-spread strategy on Base using Pyth price feeds to sell shares.
+ description: Deploy a fixed-spread strategy on Base using Pyth price feeds to sell shares.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| description: Deploy an fixed-spread strategy on Base using Pyth price feeds to sell shares. | |
| description: Deploy a fixed-spread strategy on Base using Pyth price feeds to sell shares. |
🤖 Prompt for AI Agents
In @src/fixed-spread.rain at line 74, The description string in
src/fixed-spread.rain contains a grammatical error: change "an fixed-spread
strategy on Base using Pyth price feeds to sell shares." to use the correct
article "a" (i.e., "a fixed-spread strategy on Base using Pyth price feeds to
sell shares.") so the description reads correctly; update the description field
accordingly.
| presets: | ||
| - name: Equity.US.GOOG/USD | ||
| value: 0x924571756974792e55532e474f4f472f55534400000000000000000000000000 | ||
| - name: Equity.US.AMZN/USD | ||
| value: 0x924571756974792e55532e414d5a4e2f55534400000000000000000000000000 | ||
| - name: Equity.US.AMZN/USD.PRE | ||
| value: 0x964571756974792e55532e414d5a4e2f5553442e505245000000000000000000 | ||
| - name: Equity.US.AMZN/USD.POST | ||
| value: 0x974571756974792e55532e414d5a4e2f5553442e504f53540000000000000000 | ||
| - name: Equity.US.AAPL/USD | ||
| value: 0x924571756974792e55532e4141504c2f55534400000000000000000000000000 | ||
| - name: Equity.US.MSFT/USD | ||
| value: 0x924571756974792e55532e4d5346542f55534400000000000000000000000000 | ||
| - name: Equity.US.TSLA/USD | ||
| value: 0x924571756974792e55532e54534c412f55534400000000000000000000000000 | ||
| - name: Equity.US.TSLA/USD.PRE | ||
| value: 0x964571756974792e55532e54534c412f5553442e505245000000000000000000 | ||
| - name: Equity.US.TSLA/USD.POST | ||
| value: 0x974571756974792e55532e54534c412f5553442e504f53540000000000000000 | ||
| - name: Equity.US.NVDA/USD | ||
| value: 0x924571756974792e55532e4e5644412f55534400000000000000000000000000 | ||
| - name: Equity.US.NVDA/USD.PRE | ||
| value: 0x964571756974792e55532e4e5644412f5553442e505245000000000000000000 | ||
| - name: Equity.US.NVDA/USD.POST | ||
| value: 0x974571756974792e55532e4e5644412f5553442e504f53540000000000000000 | ||
| - name: Equity.US.META/USD | ||
| value: 0x924571756974792e55532e4d4554412f55534400000000000000000000000000 | ||
| - name: Equity.US.GME/USD | ||
| value: 0x914571756974792e55532e474d452f5553440000000000000000000000000000 | ||
| - name: Equity.US.MSTR/USD | ||
| value: 0x924571756974792e55532e4d5354522f55534400000000000000000000000000 | ||
| - name: Equity.US.MSTR/USD.PRE | ||
| value: 0x964571756974792e55532e4d5354522f5553442e505245000000000000000000 | ||
| - name: Equity.US.MSTR/USD.POST | ||
| value: 0x974571756974792e55532e4d5354522f5553442e504f53540000000000000000 | ||
| - name: Equity.US.BRK-B/USD | ||
| value: 0x934571756974792e55532e42524b2d422f555344000000000000000000000000 | ||
| - name: Equity.US.SPLG/USD | ||
| value: 0x924571756974792e55532e53504c472f55534400000000000000000000000000 | ||
| - name: Equity.US.IAU/USD | ||
| value: 0x914571756974792e55532e4941552f5553440000000000000000000000000000 | ||
| - name: Equity.US.COIN/USD | ||
| value: 0x924571756974792e55532e434f494e2f55534400000000000000000000000000 | ||
| - name: Equity.US.COIN/USD.PRE | ||
| value: 0x964571756974792e55532e434f494e2f5553442e505245000000000000000000 | ||
| - name: Equity.US.COIN/USD.POST | ||
| value: 0x974571756974792e55532e434f494e2f5553442e504f53540000000000000000 | ||
| - name: Equity.US.SIVR/USD | ||
| value: 0x924571756974792e55532e534956522f55534400000000000000000000000000 | ||
| - name: Equity.US.CRCL/USD | ||
| value: 0x924571756974792e55532e4352434c2f55534400000000000000000000000000 | ||
| - name: Equity.US.CRCL/USD.PRE | ||
| value: 0x964571756974792e55532e4352434c2f5553442e505245000000000000000000 | ||
| - name: Equity.US.CRCL/USD.POST | ||
| value: 0x974571756974792e55532e4352434c2f5553442e504f53540000000000000000 | ||
| - name: Equity.US.BMNR/USD | ||
| value: 0x924571756974792e55532e424d4e522f55534400000000000000000000000000 | ||
| - name: Equity.US.BMNR/USD.PRE | ||
| value: 0x964571756974792e55532e424d4e522f5553442e505245000000000000000000 | ||
| - name: Equity.US.BMNR/USD.POST | ||
| value: 0x974571756974792e55532e424d4e522f5553442e504f53540000000000000000 | ||
| - name: Equity.US.PPLT/USD | ||
| value: 0x924571756974792e55532e50504c542f55534400000000000000000000000000 |
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.
🛠️ Refactor suggestion | 🟠 Major
Extract duplicate pyth-pair presets to reduce maintenance burden.
The same 24 equity pair presets appear in both base-pyth (lines 85-147) and base-pyth-inv (lines 196-258). This violates DRY principles and creates risk when updating presets.
If YAML anchors are supported, extract to a shared definition. Otherwise, document that both sections must be kept synchronized.
Also applies to: 196-258
🤖 Prompt for AI Agents
In @src/fixed-spread.rain around lines 85 - 147, The presets block for the 24
Equity.* pyth-pair entries is duplicated between base-pyth and base-pyth-inv, so
extract the shared list into a single reusable definition and reference it from
both places; specifically, move the repeated presets (e.g., entries with names
like Equity.US.GOOG/USD, Equity.US.AMZN/USD(.PRE/.POST),
Equity.US.TSLA/USD(.PRE/.POST), etc.) into a single anchor or shared YAML node
and replace the duplicated blocks under base-pyth and base-pyth-inv with
references to that anchor (or, if anchors aren’t supported, add a clear
comment/documentation indicating the master copy location and ensure both
sections are generated/updated from that single source).
| value: 3600 | ||
| - name: 8 hour (28800) | ||
| value: 28800 | ||
| - name: 3 days (259200) |
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.
Remove excessive 3-day staleness preset for equity price feeds.
Lines 174 and 286 include a 3-day (259200 second) staleness threshold preset. Pyth's recommended staleness for equity feeds is ~240 seconds (4 minutes), making this 1,080× more permissive than recommended and unsafe for volatile equity markets.
Remove the 259200 preset or cap maximum at 3600 seconds (1 hour).
Also applies to: 286-286
🤖 Prompt for AI Agents
In @src/fixed-spread.rain at line 174, Remove the unsafe 3-day staleness preset
by deleting or replacing the preset entry "name: 3 days (259200)" in the
staleness presets list; if you need a fallback, cap it to a maximum of 3600
seconds (e.g., replace 259200 with 3600 and adjust the name accordingly) and
apply the same change to the duplicate occurrence of the exact "name: 3 days
(259200)" preset elsewhere in the file so no 259200 staleness value remains.
| description: Select the token you want to purchase | ||
| base-pyth-inv: | ||
| name: Base pyth buy shares | ||
| description: Deploy an fixed-spread trategy on Base using Pyth price feeds to buy shares. |
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.
Fix grammar and spelling: "an fixed-spread trategy" → "a fixed-spread strategy".
- description: Deploy an fixed-spread trategy on Base using Pyth price feeds to buy shares.
+ description: Deploy a fixed-spread strategy on Base using Pyth price feeds to buy shares.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| description: Deploy an fixed-spread trategy on Base using Pyth price feeds to buy shares. | |
| description: Deploy a fixed-spread strategy on Base using Pyth price feeds to buy shares. |
🤖 Prompt for AI Agents
In @src/fixed-spread.rain at line 185, Update the description string that
currently reads "Deploy an fixed-spread trategy on Base using Pyth price feeds
to buy shares." to correct grammar and spelling: change it to "Deploy a
fixed-spread strategy on Base using Pyth price feeds to buy shares." Locate the
YAML/metadata key named description and replace the existing value with the
corrected sentence.
Motivation
Solution
Checks
By submitting this for review, I'm confirming I've done the following:
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.