Skip to content

Commit

Permalink
fix reward per stage
Browse files Browse the repository at this point in the history
  • Loading branch information
JSHan94 committed Mar 27, 2024
1 parent 277af23 commit 46844c0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
Binary file modified precompile/binaries/stdlib/vip_vault.mv
Binary file not shown.
38 changes: 2 additions & 36 deletions precompile/modules/initia_stdlib/sources/vip/vault.move
Original file line number Diff line number Diff line change
Expand Up @@ -122,50 +122,16 @@ module initia_std::vip_vault {

#[view]
public fun reward_per_stage(): u64 acquires ModuleStore {
let vault_store_addr = get_vault_store_address();
primary_fungible_store::balance(vault_store_addr, vip_reward::reward_metadata())
let vault_store = borrow_global<ModuleStore>(@initia_std);
vault_store.reward_per_stage
}

//
// Tests
//

#[test_only]
use std::string;

#[test_only]
use std::option;

#[test_only]
use initia_std::coin;

#[test_only]
use initia_std::fungible_asset::Metadata;

#[test_only]
use initia_std::object::Object;

#[test_only]
public fun init_module_for_test(chain: &signer){
init_module(chain);
}

#[test_only]
fun initialize_coin(
account: &signer,
symbol: string::String,
): (coin::BurnCapability, coin::FreezeCapability, coin::MintCapability, Object<Metadata>) {
let (mint_cap, burn_cap, freeze_cap) = coin::initialize(
account,
option::none(),
string::utf8(b""),
symbol,
6,
string::utf8(b""),
string::utf8(b""),
);
let metadata = coin::metadata(signer::address_of(account), symbol);

(burn_cap, freeze_cap, mint_cap, metadata)
}
}
1 change: 1 addition & 0 deletions precompile/modules/initia_stdlib/sources/vip/vip.move
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,7 @@ module initia_std::vip {
);

let total_reward_per_stage = 100_000_000_000;
assert!(vip_vault::reward_per_stage() == total_reward_per_stage, 0);
let portion = 10;
let reward_per_stage = total_reward_per_stage/portion;
let vesting_period = 10;
Expand Down

0 comments on commit 46844c0

Please sign in to comment.