Skip to content

Commit b7f7795

Browse files
committed
fixed: gov target in para and deposit return
1 parent 7c61ec7 commit b7f7795

File tree

3 files changed

+64
-23
lines changed

3 files changed

+64
-23
lines changed

packages/mesh-contract/src/crowdfund/aiken-workspace-v3/gov-crowdfund/specs/1_spend.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
## Parameter
44

55
- `delegate_pool_id`: ByteArray
6-
- `gov_action`: GovernanceAction
6+
- `gov_action`: VGovernanceAction
77
- `proposer_key_hash`: ByteArray
88
- `stake_register_deposit`: Lovelace
99
- `drep_register_deposit`: Lovelace
10+
- `gov_deposit`: Lovelace
1011

1112
## Datum
1213

@@ -35,18 +36,16 @@ pub type Datum {
3536
start_hash: ByteArray,
3637
share_token: ByteArray,
3738
funds_controlled: Int,
38-
deadline: Int,
3939
}
4040
}
4141
```
4242

4343
## User Action
4444

4545
1. RegisterCerts
46-
47-
- Only one input and output from current address
46+
- Only one input and output from current address with token of policy `start_hash`
4847
- Input datum in state of `Init`
49-
- Output value has deducted with 502 ADA exactly
48+
- Output value has deducted with 502 + 100k ADA exactly
5049
- Output datum in state of `Proposed`
5150
- fields exactly the same
5251
- Registering stake cert
@@ -55,32 +54,29 @@ pub type Datum {
5554
- Propose gov action
5655

5756
2. VoteOnGovAction
58-
59-
- Only one input and output from current address
57+
- Only one input and output from current address with token of policy `start_hash`
6058
- Input datum in state of `Proposed`
61-
- Check output value (deducted by 100k ADA exactly)
6259
- Output datum in state of `Voted`, with `gov_tx_id` composed by own's input `TransactionId` + `proposal_procedure` as 0
6360
- fields exactly the same
61+
- Voted yes by drep
6462

6563
3. DeregisterCerts
66-
64+
- collecting 100k ada from reward address to spending address
6765
- deadline is passed
68-
- Only one input and output from current address
66+
- Only one input and output from current address with token of policy `start_hash`
6967
- Input datum in state of `Voted`
7068
- Output datum in state of `Refundable`
7169
- fields exactly the same
7270
- Deregistering both certs
7371
- Refunds (502ADA) go into the output
7472

7573
4. ContributorWithdrawal
76-
74+
- Input with token of policy `start_hash`
7775
- Input datum in state of Refundable
78-
- `deadline` is passed
7976
- The lovelace unlocking from current equal exactly the amount that the `share_token` with token name of `completion_script` is burnt
8077

8178
5. RemoveEmptyInstance
82-
79+
- Input with token of policy `start_hash`, which is burnt
8380
- Input datum in state of Refundable
84-
- `deadline` is passed
8581
- share token with token name `completion_script` burning in current tx == `current_fundraised_amount`
8682
- signed by `proposer_key_hash`

packages/mesh-contract/src/crowdfund/aiken-workspace-v3/gov-crowdfund/validators/spend.ak

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ validator spend(
2727
proposer_key_hash: ByteArray,
2828
stake_register_deposit: Lovelace,
2929
drep_register_deposit: Lovelace,
30+
gov_deposit: Lovelace,
3031
) {
3132
spend(
3233
datum_opt: Option<CrowdfundGovDatum>,
@@ -70,7 +71,7 @@ validator spend(
7071
check_lovelace_diff(
7172
only_input,
7273
only_output,
73-
-(stake_register_deposit + drep_register_deposit + 100000000000),
74+
-(stake_register_deposit + drep_register_deposit + gov_deposit),
7475
)
7576
expect only_output_datum: CrowdfundGovDatum =
7677
output_inline_datum(only_output)
@@ -114,8 +115,8 @@ validator spend(
114115
let proposal_check =
115116
check_proposal_procedure(
116117
proposal_procedures,
117-
100000000000,
118-
current_address.payment_credential,
118+
gov_deposit,
119+
Script(start_hash),
119120
gov_action,
120121
)
121122
lovelace_check? && output_datum_check? && is_only_output_value_clean? && reg_stake_cert_check? && reg_drep_cert_check? && delegate_check? && proposal_check?
@@ -176,7 +177,7 @@ validator spend(
176177
check_lovelace_diff(
177178
only_input,
178179
only_output,
179-
stake_register_deposit + drep_register_deposit,
180+
stake_register_deposit + drep_register_deposit + gov_deposit,
180181
)
181182

182183
expect only_output_datum: CrowdfundGovDatum =

0 commit comments

Comments
 (0)