|
1 |
| -use aiken/transaction.{NoDatum, Output} |
2 |
| -use aiken/transaction/credential.{Address, VerificationKeyCredential} |
| 1 | +use aiken/transaction.{Output} |
3 | 2 | use aiken/transaction/value.{Value, ada_policy_id, ada_asset_name}
|
4 | 3 | use calculation/shared.{PoolState} as calc_shared
|
5 | 4 | use shared.{SingletonValue}
|
6 |
| -use sundae/multisig |
7 |
| -use types/order.{Destination, OrderDatum} |
| 5 | +use types/order.{Destination} |
8 | 6 |
|
9 | 7 | /// A donation describes an amount of assets to deposit into the pool, receiving nothing in return (except for the extra change on the UTXO).
|
10 | 8 | /// Because every LP token holder has an entitlement to a percentage of the assets in the pool, the donation is distributed to all LP token holders
|
@@ -76,57 +74,3 @@ pub fn do_donation(
|
76 | 74 | has_remainder,
|
77 | 75 | )
|
78 | 76 | }
|
79 |
| - |
80 |
| -test donation() { |
81 |
| - let addr = |
82 |
| - Address( |
83 |
| - VerificationKeyCredential( |
84 |
| - #"6af53ff4f054348ad825c692dd9db8f1760a8e0eacf9af9f99306513", |
85 |
| - ), |
86 |
| - None, |
87 |
| - ) |
88 |
| - let ada = (#"", #"") |
89 |
| - let rberry = |
90 |
| - (#"01010101010101010101010101010101010101010101010101010101", "RBERRY") |
91 |
| - let lp = (#"99999999999999999999999999999999999999999999999999999999", "LP") |
92 |
| - let pool_state = |
93 |
| - PoolState { |
94 |
| - quantity_a: (#"", #"", 1_000_000_000), |
95 |
| - quantity_b: (rberry.1st, rberry.2nd, 1_000_000_000), |
96 |
| - quantity_lp: (lp.1st, lp.2nd, 1_000_000_000), |
97 |
| - } |
98 |
| - let input_value = |
99 |
| - value.from_lovelace(3_500_000) |
100 |
| - |> value.add(rberry.1st, rberry.2nd, 1_000_000) |
101 |
| - let assets = ( |
102 |
| - (ada.1st, ada.2nd, 1_000_000), |
103 |
| - (rberry.1st, rberry.2nd, 1_000_000), |
104 |
| - ) |
105 |
| - let order = |
106 |
| - OrderDatum { |
107 |
| - pool_ident: None, |
108 |
| - owner: multisig.Signature( |
109 |
| - #"6af53ff4f054348ad825c692dd9db8f1760a8e0eacf9af9f99306513", |
110 |
| - ), |
111 |
| - max_protocol_fee: 2_500_000, |
112 |
| - destination: Destination { address: addr, datum: NoDatum }, |
113 |
| - details: order.Donation { |
114 |
| - assets: assets, |
115 |
| - }, |
116 |
| - extension: Void, |
117 |
| - } |
118 |
| - // There's no remainder so do_donation totally ignores this Output record |
119 |
| - let output = |
120 |
| - Output { |
121 |
| - address: addr, |
122 |
| - value: value.from_lovelace(999_999_999_999_999_999), |
123 |
| - datum: NoDatum, |
124 |
| - reference_script: None, |
125 |
| - } |
126 |
| - let (final_pool_state, has_remainder) = |
127 |
| - do_donation(pool_state, input_value, assets, order.destination, 2_500_000, output) |
128 |
| - expect !has_remainder |
129 |
| - expect final_pool_state.quantity_a.3rd == 1_001_000_000 |
130 |
| - expect final_pool_state.quantity_b.3rd == 1_001_000_000 |
131 |
| - True |
132 |
| -} |
0 commit comments