Skip to content

Commit

Permalink
Merge pull request #12 from memechan-gg/fix/unstake
Browse files Browse the repository at this point in the history
🔧  fix: unstake fn
  • Loading branch information
avernikoz authored May 8, 2024
2 parents 0122ce3 + 725940b commit bcaa7f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion memechan/sources/live_phase/go_live.move
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ module memechan::go_live {
);

let pool_id = object::id(&amm_pool);

// 4. Create staking pool
let staking_pool = staking_pool::new<S, Meme, LP>(
pool_id,
Expand Down
13 changes: 3 additions & 10 deletions memechan/sources/live_phase/staking_pool.move
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module memechan::staking_pool {
use sui::balance::Balance;
use sui::token::{Self, Token, TokenPolicy, TokenPolicyCap};
use sui::clock::{Self, Clock};
use sui::balance;
use sui::coin::{Self, Coin, TreasuryCap};
use sui::tx_context::{sender, TxContext};

Expand All @@ -24,7 +23,6 @@ module memechan::staking_pool {
struct StakingPool<phantom S, phantom Meme, phantom LP> has key, store {
id: UID,
amm_pool: ID,
balance_meme: Balance<Meme>,
balance_lp: Balance<LP>,
vesting_table: Table<address, VestingData>,
meme_cap: TreasuryCap<Meme>,
Expand All @@ -48,7 +46,6 @@ module memechan::staking_pool {
let staking_pool = StakingPool {
id: object::new(ctx),
amm_pool,
balance_meme: balance::zero(),
balance_lp,
meme_cap,
policy_cap,
Expand Down Expand Up @@ -94,15 +91,11 @@ module memechan::staking_pool {

vesting::release(vesting_data, release_amount);

coin::burn(
&mut staking_pool.meme_cap,
token_ir::to_coin(policy, coin_x, ctx),
);

balance::join(&mut balance_meme, balance::split(&mut staking_pool.balance_meme, release_amount));
let coin_m = coin::from_balance(balance_meme, ctx);
coin::join(&mut coin_m, token_ir::to_coin(policy, coin_x, ctx));

(
coin::from_balance(balance_meme, ctx),
coin_m,
coin::from_balance(balance_sui, ctx)
)
}
Expand Down

0 comments on commit bcaa7f3

Please sign in to comment.