Skip to content

Commit

Permalink
push up recent fixes and changes to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Jul 12, 2024
1 parent 9a591c4 commit 47a83df
Show file tree
Hide file tree
Showing 9 changed files with 554 additions and 227 deletions.
2 changes: 1 addition & 1 deletion aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ requirements = []
source = "github"

[etags]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1720544737, nanos_since_epoch = 494989000 }, "a8294651f1577c671d580c99c9bc5445ef1fd44e4aa3dde550434a4cbc8d50b6"]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1720810832, nanos_since_epoch = 123744000 }, "a8294651f1577c671d580c99c9bc5445ef1fd44e4aa3dde550434a4cbc8d50b6"]
2 changes: 1 addition & 1 deletion currentPreviewRoot.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80f929d8b9221541dfca898c6d8d544f337326e32026ec86edae85647f67e5c9
be61c2c6c950fc8513963c7acfa01e31dd281c11fabe052520405f656587cce8
2 changes: 1 addition & 1 deletion genesis/previewV2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion governance/previewV2.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/fortuna/parameters.ak
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub const halving_number = 210000
pub const epoch_number = 50

/// The target time for each epoch to be mined in milliseconds
pub const epoch_target = 1_209_600_000
pub const epoch_target = 30_000_000

pub const initial_payout = 5000000000

Expand All @@ -19,7 +19,7 @@ pub const latest_merkle_root =
// pub const latest_merkle_root =
// #"08f6adda95e55efab85705f7b3313559db6750f5d7385de9b11d932a8db86204"

pub const voting_days = 1
pub const voting_days = 14

/// Minimum supply threshold for the upgrade contract vote to be successful
/// In thousandth percentage i.e. 250 = 25%
Expand Down
46 changes: 24 additions & 22 deletions lib/fortunav2.ak
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn genesis_v2(tx, own_policy, fortuna_v1_hash: Data, fork_script_hash: Data)
// Voting and governance functions
// TODO change back to normal before launch
pub fn voting_period() -> Int {
1000 * 60 * 20 * 1 * voting_days
1000 * 60 * 60 * 24 * voting_days
}

/// Flips the bits of a hash
Expand Down Expand Up @@ -207,31 +207,31 @@ pub fn vote(
} else {
for_count
},
deadline,
anti_script_hash,
against_count: if for {
against_count
} else {
votes_in_tx
},
deadline,
},
)

and {
quantity_of(
(quantity_of(
in_value |> value.to_dict |> dict.to_pairs,
own_hash,
bytearray.concat(nominated_prefix, script_hash),
) == 1,
in_address == out_address,
upper_range <= deadline,
value.without_lovelace(in_value) == value.without_lovelace(out_value),
) == 1)?,
(in_address == out_address)?,
(upper_range <= deadline)?,
(value.without_lovelace(in_value) == value.without_lovelace(out_value))?,
if for {
votes_in_tx > for_count
} else {
votes_in_tx > against_count
},
expected_datum == out_datum,
}?,
(expected_datum == out_datum)?,
}
}

Expand All @@ -254,20 +254,22 @@ pub fn count_votes(
) + count_votes(rest, own_hash, script_hash, stake_cred)
} else {
when value |> tokens2(own_hash) is {
[Pair(tuna_name, tuna_quantity), Pair(value_script_hash, 1)] ->
if
tuna_name == fortuna.token_name && value_script_hash == script_hash{

tuna_quantity + count_votes(
rest,
own_hash,
script_hash,
stake_cred,
)
[Pair(name1, quantity1), Pair(name2, quantity2)] ->
if and {
name1 == script_hash,
quantity1 == 1,
name2 == fortuna.token_name,
} {
quantity2
} else if and {
name2 == script_hash,
quantity2 == 1,
name1 == fortuna.token_name,
} {
quantity1
} else {
count_votes(rest, own_hash, script_hash, stake_cred)
}

0
} + count_votes(rest, own_hash, script_hash, stake_cred)
_ -> count_votes(rest, own_hash, script_hash, stake_cred)
}
}
Expand Down
Loading

0 comments on commit 47a83df

Please sign in to comment.