Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 2.05 KB

File metadata and controls

55 lines (39 loc) · 2.05 KB

Issue #1022 Resolution: Add Version/Metadata View to yield-tier contract

Status: ✅ ALREADY IMPLEMENTED

Issue #1022 requested adding version/metadata view functionality to the yield-tier contract. After thorough analysis, this functionality is already fully implemented in the escrow contract, which contains all yield tier functionality.

Implementation Details

1. Version Function

  • Location: escrow/src/lib.rs:2806
  • Signature: pub fn get_version(env: Env) -> u32
  • Implementation:
    pub fn get_version(env: Env) -> u32 {
        env.storage().instance().get(&DataKey::Version).unwrap_or(0)
    }

2. Requirements Satisfied

Read-only version function: get_version() exists and is read-only (no mutations)
Returns sane default before init: Returns 0 via unwrap_or(0)
Schema version constant: SCHEMA_VERSION: u32 = 6
Returns actual version after init: Version is set during init and stored in DataKey::Version

3. Test Coverage

The functionality has comprehensive test coverage in escrow/src/tests/init.rs:

// Version written at init
assert_eq!(client.get_version(), crate::SCHEMA_VERSION);

Additional tests in:

  • escrow/src/tests/coverage.rs:1110
  • escrow/src/tests/coverage.rs:1225
  • escrow/src/tests/pause.rs:320

4. Yield Tier Integration

The yield tier functionality is fully integrated within the escrow contract via:

  • YieldTier struct for tier definitions
  • yield_tiers parameter in init() function
  • effective_yield_for_commitment() for tier selection
  • fund_with_commitment() for tiered deposits
  • get_yield_tiers() for reading tier configuration
  • preview_yield_tier() for tier preview

Conclusion

Issue #1022 is resolved - the requested version/metadata view functionality already exists and is properly tested. The yield tier contract (implemented within the escrow contract) has full version management capabilities as requested.

No code changes are required as the implementation already meets all specified requirements.