Skip to content

Commit

Permalink
Add pseudocode
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed Feb 28, 2024
1 parent a8321c3 commit 2a3c1ca
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/staking.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#[starknet::interface]
trait IAirdrop<TContractState> {
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::<u64, f128> // 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
//}
}

0 comments on commit 2a3c1ca

Please sign in to comment.