From 2a3c1ca9cb7f0dd9b0b1bfe8b2eb9c9cd78b356b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sojka?= Date: Wed, 28 Feb 2024 10:41:58 +0000 Subject: [PATCH] Add pseudocode --- src/staking.cairo | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/staking.cairo diff --git a/src/staking.cairo b/src/staking.cairo new file mode 100644 index 00000000..225b9b71 --- /dev/null +++ b/src/staking.cairo @@ -0,0 +1,31 @@ +#[starknet::interface] +trait IAirdrop { + fn stake( + ref self: TContractState, length: u64, amount: u128 + ) -> u32; // returns stake ID + fn unstake( + ref self: TContractState, id: u32 + ); + + + // owner only + // set_curve_point +} + +#[starknet::component] +mod staking { + use cubit::f128; + + #[storage] + struct Storage { + stake: LegacyMap::<(ContractAddress, u32), (u128, u128, u64, u64)>, // STAKE(address, ID) → (amount staked, amount veCARM, start date, length of stake) + curve: LegacyMap:: // length of stake > CARM to veCARM conversion rate (in cubit f128) + } + + // impl, etc, embeddable_as StakingImpl... + // fn stake() + // fn unstake(){ + // here, keep in mind the special case where the user has veCARM and no corresponding entry in the stake storage var. + // what id to use? to be decided + //} +} \ No newline at end of file