diff --git a/packages/vault_allocator/src/decoders_and_sanitizers/defi_spring_snf_style/defi_spring_snf_style_decoder_and_sanitizer.cairo b/packages/vault_allocator/src/decoders_and_sanitizers/defi_spring_snf_style/defi_spring_snf_style_decoder_and_sanitizer.cairo new file mode 100644 index 00000000..7ac5067b --- /dev/null +++ b/packages/vault_allocator/src/decoders_and_sanitizers/defi_spring_snf_style/defi_spring_snf_style_decoder_and_sanitizer.cairo @@ -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, + > of IDefiSpringSNFStyleDecoderAndSanitizer> { + fn claim( + self: @ComponentState, + amount: u128, + proof: Span, + ) -> Span { + let mut serialized_struct: Array = ArrayTrait::new(); + serialized_struct.span() + } + } +} diff --git a/packages/vault_allocator/src/decoders_and_sanitizers/defi_spring_snf_style/interface.cairo b/packages/vault_allocator/src/decoders_and_sanitizers/defi_spring_snf_style/interface.cairo new file mode 100644 index 00000000..92609cfe --- /dev/null +++ b/packages/vault_allocator/src/decoders_and_sanitizers/defi_spring_snf_style/interface.cairo @@ -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 { + fn claim( + self: @T, + amount: u128, + proof: Span, + ) -> Span; +} \ No newline at end of file diff --git a/packages/vault_allocator/src/decoders_and_sanitizers/simple_decoder_and_sanitizer.cairo b/packages/vault_allocator/src/decoders_and_sanitizers/simple_decoder_and_sanitizer.cairo index f92ced6a..dc20d0f6 100644 --- a/packages/vault_allocator/src/decoders_and_sanitizers/simple_decoder_and_sanitizer.cairo +++ b/packages/vault_allocator/src/decoders_and_sanitizers/simple_decoder_and_sanitizer.cairo @@ -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, @@ -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 = @@ -69,6 +75,11 @@ pub mod SimpleDecoderAndSanitizer { impl MultiplyDecoderAndSanitizerImpl = MultiplyDecoderAndSanitizerComponent::MultiplyDecoderAndSanitizerImpl; + #[abi(embed_v0)] + impl DefiSpringSNFStyleDecoderAndSanitizerImpl = + DefiSpringSNFStyleDecoderAndSanitizerComponent::DefiSpringSNFStyleDecoderAndSanitizerImpl< + ContractState, + >; #[storage] pub struct Storage { @@ -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] @@ -101,5 +114,7 @@ pub mod SimpleDecoderAndSanitizer { StarknetVaultKitDecoderAndSanitizerEvent: StarknetVaultKitDecoderAndSanitizerComponent::Event, #[flat] MultiplyDecoderAndSanitizerEvent: MultiplyDecoderAndSanitizerComponent::Event, + #[flat] + DefiSpringSNFStyleDecoderAndSanitizerEvent: DefiSpringSNFStyleDecoderAndSanitizerComponent::Event, } } diff --git a/packages/vault_allocator/src/lib.cairo b/packages/vault_allocator/src/lib.cairo index 5701d8b5..53d69041 100644 --- a/packages/vault_allocator/src/lib.cairo +++ b/packages/vault_allocator/src/lib.cairo @@ -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 {