Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2025 Starknet Vault Kit
// Licensed under the MIT License. See LICENSE file for details.

// Helps claim rewards from Defi spring rewards and any possible rewards
// with similar claim contract structure
// This is called as SNFStyle because there can be other reward contracts (e.g. Ekubo)
// This is the default contract structure by SNF for rewards

#[starknet::component]
pub mod DefiSpringSNFStyleDecoderAndSanitizerComponent {
use vault_allocator::decoders_and_sanitizers::defi_spring_snf_style::interface::IDefiSpringSNFStyleDecoderAndSanitizer;

#[storage]
pub struct Storage {}

#[event]
#[derive(Drop, Debug, PartialEq, starknet::Event)]
pub enum Event {}

#[embeddable_as(DefiSpringSNFStyleDecoderAndSanitizerImpl)]
impl DefiSpringSNFStyleDecoderAndSanitizer<
TContractState, +HasComponent<TContractState>,
> of IDefiSpringSNFStyleDecoderAndSanitizer<ComponentState<TContractState>> {
fn claim(
self: @ComponentState<TContractState>,
amount: u128,
proof: Span<felt252>,
) -> Span<felt252> {
let mut serialized_struct: Array<felt252> = ArrayTrait::new();
serialized_struct.span()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2025 Starknet Vault Kit
// Licensed under the MIT License. See LICENSE file for details.

#[starknet::interface]
pub trait IDefiSpringSNFStyleDecoderAndSanitizer<T> {
fn claim(
self: @T,
amount: u128,
proof: Span<felt252>,
) -> Span<felt252>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod SimpleDecoderAndSanitizer {
use vault_allocator::decoders_and_sanitizers::multiply_decoder_and_sanitizer::multiply_decoder_and_sanitizer::MultiplyDecoderAndSanitizerComponent;
use vault_allocator::decoders_and_sanitizers::starknet_vault_kit_decoder_and_sanitizer::starknet_vault_kit_decoder_and_sanitizer::StarknetVaultKitDecoderAndSanitizerComponent;
use vault_allocator::decoders_and_sanitizers::vesu_decoder_and_sanitizer::vesu_decoder_and_sanitizer::VesuDecoderAndSanitizerComponent;
use vault_allocator::decoders_and_sanitizers::defi_spring_snf_style::defi_spring_snf_style_decoder_and_sanitizer::DefiSpringSNFStyleDecoderAndSanitizerComponent;

component!(
path: BaseDecoderAndSanitizerComponent,
Expand Down Expand Up @@ -46,6 +47,11 @@ pub mod SimpleDecoderAndSanitizer {
event: MultiplyDecoderAndSanitizerEvent,
);

component!(
path: DefiSpringSNFStyleDecoderAndSanitizerComponent,
storage: defi_spring_snf_style_decoder_and_sanitizer,
event: DefiSpringSNFStyleDecoderAndSanitizerEvent,
);

#[abi(embed_v0)]
impl BaseDecoderAndSanitizerImpl =
Expand All @@ -69,6 +75,11 @@ pub mod SimpleDecoderAndSanitizer {
impl MultiplyDecoderAndSanitizerImpl =
MultiplyDecoderAndSanitizerComponent::MultiplyDecoderAndSanitizerImpl<ContractState>;

#[abi(embed_v0)]
impl DefiSpringSNFStyleDecoderAndSanitizerImpl =
DefiSpringSNFStyleDecoderAndSanitizerComponent::DefiSpringSNFStyleDecoderAndSanitizerImpl<
ContractState,
>;

#[storage]
pub struct Storage {
Expand All @@ -84,6 +95,8 @@ pub mod SimpleDecoderAndSanitizer {
pub starknet_vault_kit_decoder_and_sanitizer: StarknetVaultKitDecoderAndSanitizerComponent::Storage,
#[substorage(v0)]
pub multiply_decoder_and_sanitizer: MultiplyDecoderAndSanitizerComponent::Storage,
#[substorage(v0)]
pub defi_spring_snf_style_decoder_and_sanitizer: DefiSpringSNFStyleDecoderAndSanitizerComponent::Storage,
}

#[event]
Expand All @@ -101,5 +114,7 @@ pub mod SimpleDecoderAndSanitizer {
StarknetVaultKitDecoderAndSanitizerEvent: StarknetVaultKitDecoderAndSanitizerComponent::Event,
#[flat]
MultiplyDecoderAndSanitizerEvent: MultiplyDecoderAndSanitizerComponent::Event,
#[flat]
DefiSpringSNFStyleDecoderAndSanitizerEvent: DefiSpringSNFStyleDecoderAndSanitizerComponent::Event,
}
}
5 changes: 5 additions & 0 deletions packages/vault_allocator/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ pub mod decoders_and_sanitizers {
pub mod interface;
pub mod multiply_decoder_and_sanitizer;
}

pub mod defi_spring_snf_style {
pub mod defi_spring_snf_style_decoder_and_sanitizer;
pub mod interface;
}
}

pub mod mocks {
Expand Down