Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ex/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
_build/
deps/
target/
priv/index.html
priv/native/*.so
amadeusd
2 changes: 1 addition & 1 deletion ex/lib/consensus/models/entry_genesis.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ defmodule EntryGenesis do
pop = BlsEx.sign!(sk, pk, BLS12AggSig.dst_pop())

DB.Entry.insert(entry_signed, %{rtx: rtx})
DB.Entry.apply_into_main_chain(entry_signed, mutations_hash, [], [], "", "", %{rtx: rtx})
DB.Entry.apply_into_main_chain(entry_signed, mutations_hash, [], {[], []}, "", "", %{rtx: rtx})
RocksDB.put("temporal_tip", entry_signed.hash, %{rtx: rtx, cf: cf.sysconf})
RocksDB.put("rooted_tip", entry_signed.hash, %{rtx: rtx, cf: cf.sysconf})

Expand Down
4 changes: 2 additions & 2 deletions ex/native/rdb/src/consensus/bic/lockup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ pub fn call_unlock(env: &mut crate::consensus::consensus_apply::ApplyEnv, args:
let unlock_height = vault_parts[0].as_slice();
let unlock_height = std::str::from_utf8(&unlock_height).ok().and_then(|s| s.parse::<u64>().ok()).unwrap_or_else(|| panic_any("invalid_unlock_height"));
let amount = vault_parts[1].as_slice();
let amount = std::str::from_utf8(&amount).ok().and_then(|s| s.parse::<u64>().ok()).unwrap_or_else(|| panic_any("invalid_unlock_amount"));
let amount = std::str::from_utf8(&amount).ok().and_then(|s| s.parse::<i128>().ok()).unwrap_or_else(|| panic_any("invalid_unlock_amount"));
let symbol = vault_parts[2].as_slice();

if env.caller_env.entry_height < unlock_height {
panic_any("vault_is_locked")
} else {
kv_increment(env, &bcat(&[b"account:", &env.caller_env.account_caller, b":balance:", symbol]), amount as i128);
kv_increment(env, &bcat(&[b"account:", &env.caller_env.account_caller, b":balance:", symbol]), amount);
kv_delete(env, vault_key);
}
}
17 changes: 9 additions & 8 deletions ex/native/rdb/src/consensus/consensus_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,25 +768,26 @@ pub fn call_bic(env: &mut ApplyEnv, contract: Vec<u8>, function: Vec<u8>, args:

(b"Coin", b"transfer") => consensus::bic::coin::call_transfer(env, args),

(b"Lockup", b"lock") => consensus::bic::lockup::call_lock(env, args),
(b"Lockup", b"unlock") => consensus::bic::lockup::call_unlock(env, args),

(b"LockupPrime", b"lock") => consensus::bic::lockup_prime::call_lock(env, args),
(b"LockupPrime", b"unlock") => consensus::bic::lockup_prime::call_unlock(env, args),
(b"LockupPrime", b"daily_checkin") => consensus::bic::lockup_prime::call_daily_checkin(env, args),
_ => std::panic::panic_any("invalid_bic_action")

/*
(b"Coin", b"create_and_mint") => consensus::bic::coin::call_create_and_mint(env, args),
(b"Coin", b"mint") => consensus::bic::coin::call_mint(env, args),
(b"Coin", b"pause") => consensus::bic::coin::call_pause(env, args),
(b"Nft", b"transfer") => consensus::bic::nft::call_transfer(env, args),
(b"Nft", b"create_collection") => consensus::bic::nft::call_create_collection(env, args),
(b"Nft", b"mint") => consensus::bic::nft::call_mint(env, args),
(b"Lockup", b"lock") => consensus::bic::lockup::call_lock(env, args),
(b"Lockup", b"unlock") => consensus::bic::lockup::call_unlock(env, args),
(b"Contract", b"deploy") => {
consensus_kv::exec_budget_decr(env, protocol::COST_PER_DEPLOY);
consensus::bic::contract::call_deploy(env, args)
},
(b"LockupPrime", b"lock") => consensus::bic::lockup_prime::call_lock(env, args),
(b"LockupPrime", b"unlock") => consensus::bic::lockup_prime::call_unlock(env, args),
(b"LockupPrime", b"daily_checkin") => consensus::bic::lockup_prime::call_daily_checkin(env, args),
*/

_ => std::panic::panic_any("invalid_bic_action")
*/
}
}

Expand Down