Skip to content

Commit

Permalink
chore: fix utils
Browse files Browse the repository at this point in the history
  • Loading branch information
HinsonSIDAN committed Sep 5, 2024
1 parent 52f3307 commit b69f0f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 44 deletions.
2 changes: 1 addition & 1 deletion aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1725528951, nanos_since_epoch = 960054000 }, "d79382d2b6ecb3aee9b0755c31d8a5bbafe88a7b3706d7fb8a52fd4d05818501"]
"aiken-lang/stdlib@v2" = [{ secs_since_epoch = 1725540811, nanos_since_epoch = 417440000 }, "d79382d2b6ecb3aee9b0755c31d8a5bbafe88a7b3706d7fb8a52fd4d05818501"]
46 changes: 4 additions & 42 deletions lib/aiken-virtual-dex/placeholder.ak
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use aiken_virtual_dex/types.{
AccountDatum, AccountOracleDatum, DexOracleDatum, EmergencyUnlockDatum,
VirtualDexDatum,
}
use cardano/address.{Address}
use cardano/assets.{PolicyId, Value, add, from_asset}
use cardano/transaction.{InlineDatum, Input, NoDatum, Output, OutputReference}
use cardano/transaction.{InlineDatum, Input, NoDatum, Output}
use mocktail/virgin_address.{mock_pub_key_address, mock_script_address}
use mocktail/virgin_key_hash.{
mock_policy_id, mock_pub_key_hash, mock_script_hash,
Expand Down Expand Up @@ -265,39 +264,10 @@ pub fn mock_another_account_address() {
mock_script_address(4, None)
}

pub fn mock_emergency_unlock_phase1_utxo(variation: Int) -> OutputReference {
mock_utxo_ref(0, 20 + variation)
}

pub fn mock_emergency_unlock_phase2_output(minted_at: Int, minter: ByteArray) {
Output {
address: mock_account_address(),
value: from_asset("", "", 2_000_000)
|> add(mock_emergency_token(), minter, 1),
datum: InlineDatum(EmergencyUnlockDatum { minted_at }),
reference_script: None,
}
}

pub fn mock_emergency_unlock_phase2_utxo(variation: Int) -> OutputReference {
mock_utxo_ref(0, 30 + variation)
}

pub fn mock_emergency_unlock_address() {
mock_script_address(7, None)
}

pub fn mock_emergency_unlock_phase2_input(
variation: Int,
minted_at: Int,
minter: ByteArray,
) -> Input {
Input {
output_reference: mock_emergency_unlock_phase2_utxo(variation),
output: mock_emergency_unlock_phase2_output(minted_at, minter),
}
}

pub fn mock_account_input(variation: Int) -> Input {
Input {
output_reference: mock_utxo_ref(0, 10 + variation),
Expand All @@ -321,13 +291,9 @@ pub fn mock_trade_input(variation: Int) -> Input {
}
}

pub fn mock_emergency_action_output(
minted_at: Int,
emergency_unlock_address: Address,
minter: ByteArray,
) {
pub fn mock_emergency_action_output(minted_at: Int, minter: ByteArray) {
Output {
address: emergency_unlock_address,
address: mock_emergency_unlock_address(),
value: from_asset("", "", 2_000_000)
|> add(mock_emergency_token(), minter, 1),
datum: InlineDatum(EmergencyUnlockDatum { minted_at }),
Expand All @@ -342,10 +308,6 @@ pub fn mock_emergency_action_input(
) -> Input {
Input {
output_reference: mock_utxo_ref(0, 30 + variation),
output: mock_emergency_action_output(
minted_at,
mock_emergency_unlock_address(),
minter,
),
output: mock_emergency_action_output(minted_at, minter),
}
}
1 change: 0 additions & 1 deletion validators/tests/unit-tests/emergency_token.ak
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ fn mint_test_case(test_case: TestCase) {
} else {
50
},
mock_emergency_unlock_address(),
mock_user_vkey_hex(),
),
]
Expand Down

0 comments on commit b69f0f0

Please sign in to comment.