Skip to content

Enhancement: is_zero_stellar_account is duplicated verbatim across DripFactory and DripGovernor instead of living in drip_common #310

Description

@Jaydbrown

contracts/factory/src/lib.rs and contracts/governor/src/lib.rs both define an identical private fn is_zero_stellar_account(env: &Env, address: &Address) -> bool, including the same hardcoded zero-account string literal ("GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF"). The workspace already has a drip_common crate specifically for sharing this kind of thing across contracts (it currently holds TTL_THRESHOLD/TTL_EXTEND_TO), but this function — including the magic string, which would be easy to typo differently in the two copies without anyone noticing — was copy-pasted instead of centralized. TwapOracle doesn't have an equivalent zero-address check at all, which is its own inconsistency (see set_fee_recipient's zero-address guard on the governor vs. no equivalent guard on any oracle admin-address setter).

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions