Skip to content

Conversation

@liobrasil
Copy link
Contributor

@liobrasil liobrasil commented Jan 13, 2026

Summary

  • Adds pre-condition to createYieldVaultManager that calls FlowYieldVaultsClosedBeta.validateBeta
  • Makes the Beta gating behavior explicit and consistent with other Beta-gated methods

Quantstamp Audit Finding

FLOW-10: Unused betaRef Parameter in YieldVaultManager Creation (Undetermined)

The createYieldVaultManager function accepts a betaRef parameter but did not use it in the function body. The recommendation was to invoke FlowYieldVaultsClosedBeta.validateBeta inside the function for consistency with other Beta-gated methods.

Test plan

  • Verify that createYieldVaultManager rejects invalid betaRef
  • Verify that valid betaRef still allows creation of YieldVaultManager

Closes #141

🤖 Generated with Claude Code

Add pre-condition to createYieldVaultManager that invokes
FlowYieldVaultsClosedBeta.validateBeta to verify the betaRef
is valid, making the Beta gating behavior explicit and consistent
with other Beta-gated methods.

Addresses Quantstamp audit finding FLOW-10.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@liobrasil liobrasil requested a review from a team as a code owner January 13, 2026 13:10
@liobrasil liobrasil changed the title Fix: FLOW-10 - Validate betaRef parameter in createYieldVaultManager FLOW-10 - Validate betaRef parameter in createYieldVaultManager Jan 15, 2026
@vishalchangrani
Copy link

Please can you a add a test for this change? ty

access(all) let capID: UInt64
access(all) let isRevoked: Bool

init(_ capID: UInt64, _ isRevoked: Bool) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below: Use the argument label to document what the parameters mean, they make the call-sites easier to understand:

Suggested change
init(_ capID: UInt64, _ isRevoked: Bool) {
init(capID: UInt64, isRevoked: Bool) {

/// Issue a capability from the contract/deployer account and record its ID
access(contract) fun _issueBadgeCap(_ addr: Address): Capability<auth(Beta) &BetaBadge> {
let p = self._badgePath(addr)
let cap: Capability<auth(Beta) &BetaBadge> =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type annotation is unnecessary and can be inferred

Suggested change
let cap: Capability<auth(Beta) &BetaBadge> =
let cap =

Comment on lines +114 to +115
if info.isRevoked {
assert(info.isRevoked, message: "Beta access revoked")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert is a no-op, in this branch info.isRevoked is always true


/// Per-user badge storage path (under the *contract/deployer* account)
access(contract) fun _badgePath(_ addr: Address): StoragePath {
return StoragePath(identifier: "FlowYieldVaultsBetaBadge_".concat(addr.toString()))!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use string templates:

Suggested change
return StoragePath(identifier: "FlowYieldVaultsBetaBadge_".concat(addr.toString()))!
return StoragePath(identifier: "FlowYieldVaultsBetaBadge_\(addr.toString())")!


/// Ensure the admin-owned badge exists for the user
access(contract) fun _ensureBadge(_ addr: Address) {
let p = self._badgePath(addr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below: Use descriptive variable names:

Suggested change
let p = self._badgePath(addr)
let path = self._badgePath(addr)

Comment on lines +27 to +29
access(all) view fun getOwner(): Address {
return self.assignedTo
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just make assignedTo access(all) and remove this unnecessary getter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FLOW-10 Unused betaRef Parameter in Yieldvaultmanager Creation

4 participants