Skip to content

Commit

Permalink
Merge b82632c into a7eb504
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar authored Apr 29, 2021
2 parents a7eb504 + b82632c commit 38a47cd
Show file tree
Hide file tree
Showing 83 changed files with 3,116 additions and 994 deletions.
5 changes: 4 additions & 1 deletion config/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ static MIN_BLOCK_TIME_TARGET: u64 = 5000;
static MAX_BLOCK_TIME_TARGET: u64 = 60000;
static BASE_MAX_UNCLES_PER_BLOCK: u64 = 2;

pub static TOTAL_STC_AMOUNT: Lazy<TokenValue<STCUnit>> =
Lazy::new(|| STCUnit::STC.value_of(318513600));

//for Private funding
static DEFAULT_PRE_MINT_AMOUNT: Lazy<TokenValue<STCUnit>> =
Lazy::new(|| STCUnit::STC.value_of(15925680));
Expand Down Expand Up @@ -784,7 +787,7 @@ pub static TEST_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
reward_delay: 1,
pre_mine_amount: DEFAULT_PRE_MINT_AMOUNT.scaling(),
time_mint_amount: DEFAULT_TIME_LOCKED_AMOUNT.scaling(),
time_mint_period: 3600,
time_mint_period: DEFAULT_TIME_LOCKED_PERIOD,
vm_config: VMConfig {
gas_schedule: TEST_GAS_SCHEDULE.clone(),
},
Expand Down
2 changes: 1 addition & 1 deletion config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod account_vault_config;
mod api_config;
mod api_quota;
mod available_port;
mod genesis_config;
pub mod genesis_config;
mod helper;
mod logger_config;
mod metrics_config;
Expand Down
Binary file modified genesis/generated/halley/genesis
Binary file not shown.
124 changes: 0 additions & 124 deletions vm/functional-tests/tests/testsuite/token/fixed_mint_key.move

This file was deleted.

182 changes: 0 additions & 182 deletions vm/functional-tests/tests/testsuite/token/linear_mint_key.move

This file was deleted.

32 changes: 10 additions & 22 deletions vm/functional-tests/tests/testsuite/token/mint_stc.move
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//! account: alice, 0 0x1::STC::STC

// Minting from a privileged account should work
// Minting by genesis
//! sender: genesis
script {
use 0x1::STC::{STC};
Expand All @@ -20,39 +20,27 @@ fun main(account: signer) {
}
}

// check: EXECUTED

//! new-transaction
// Minting from a non-privileged account should not work
script {
use 0x1::STC::{STC};
use 0x1::Token;
use 0x1::Account;
fun main(account: signer) {
let coin = Token::mint<STC>(&account, 100);
Account::deposit_to_self<STC>(&account, coin)
}
}

// will fail with MISSING_DATA because sender doesn't have the mint capability
// will fail with MISSING_DATA because STC mint capability has been destroyed
// check: MISSING_DATA
// check: Keep


//! new-transaction
//! sender: genesis
//! sender: association
script {
use 0x1::STC::{Self, STC};
use 0x1::Token;
use 0x1::Account;
fun test_burn(account: signer) {
// mint 100 coins and check that the market cap increases appropriately
let old_market_cap = Token::market_cap<STC>();
let coin = Token::mint<STC>(&account, 100);

let market_cap = Token::market_cap<STC>();
let coin = Account::withdraw<STC>(&account, 100);
assert(Token::value<STC>(&coin) == 100, 8000);
assert(Token::market_cap<STC>() == old_market_cap + 100, 8001);

// burn 100 coins and check that the market cap decreases appropriately
// burn the coin
STC::burn(coin);
assert(Token::market_cap<STC>() == old_market_cap, 8002);
assert(Token::market_cap<STC>() == market_cap - 100, 8002);
}
}

Expand Down
Loading

0 comments on commit 38a47cd

Please sign in to comment.