Skip to content

Commit 6c54ecc

Browse files
committed
s09
1 parent 311a042 commit 6c54ecc

File tree

4 files changed

+124
-238
lines changed

4 files changed

+124
-238
lines changed

src/components/multisig/proxy/aiken-workspace/plutus.json

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,6 @@
4646
"compiledCode": "59017b010100229800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cdc3a400130080024888966002600460106ea800e2646644b300130050018acc004c030dd5003c00a2c806a2b30013370e9001000c56600260186ea801e00516403516402880504c966002601e00313259800980298059baa0078acc004c8cc004004dd6180818069baa0052259800800c528456600266ebcc044c038dd5180880080a4528c4cc008008c04800500c201e899b8700148052294100a44cdc3800a40268050dd698059807000c5900c192cc004cdc3a400460146ea8006297adef6c6089bab300e300b37540028048c8cc004004dd59807180798079807980798059baa0032259800800c5300103d87a8000899192cc004cdc8802800c56600266e3c014006266e95200033010300e0024bd7045300103d87a80004031133004004301200340306eb8c030004c03c00500d18049baa005375c601860126ea800e2c8038601000260066ea802229344d9590011",
4747
"hash": "eaff18079b75649a8cfc35b99f8a145c4fabf5c02e239822316e9321"
4848
},
49-
{
50-
"title": "proxy/spend.proxy.spend",
51-
"datum": {
52-
"title": "_datum",
53-
"schema": {
54-
"$ref": "#/definitions/cardano~1transaction~1Datum"
55-
}
56-
},
57-
"redeemer": {
58-
"title": "redeemer",
59-
"schema": {
60-
"$ref": "#/definitions/types~1ProxyRedeemer"
61-
}
62-
},
63-
"parameters": [
64-
{
65-
"title": "auth_token",
66-
"schema": {
67-
"$ref": "#/definitions/cardano~1assets~1PolicyId"
68-
}
69-
}
70-
],
71-
"compiledCode": "590253010100229800aba2aba1aba0aab9faab9eaab9dab9a9bae0024888888896600264653001300900198049805000cc0240092225980099b8748008c020dd500144ca6002601a003300d300e00198049baa0048992cc004cdc3a400060146ea8016266e212000323300100132330010013758602000644b30010018a5eb8226644b3001323300100132330010013756602a602c60246ea8010896600200314bd7044c8cc88c8cc004004dd5980b802112cc00400620071323301b374e660366ea4014cc06cc060004cc06cc0640052f5c066006006603a004603600280c8dd7180980099801801980c001180b000a0282259800800c528456600266e3cdd7180a9bac301500100f8a51899801001180b000a020404d13301200233004004001899802002000a01c30110013012001403c44b30010018a40011337009001198010011808800a01c899912cc0040060051598009808800c4c8c96600266e3cdd71809001006456600266e3cdd71809000a44100899b87375a602460260029009c528201a8a50403460240026eb0c040006004807100e0a5032330010013756601e6020602000444b30010018a5eb82264664464660020026eacc044010896600200310038991980a9ba733015375200a6602a60240026602a602600297ae03300300330170023015001404c6eb8c034004cc00c00cc048008c04000500e2012300e300e300a375400491112cc004cdc3a400000515980098071baa008800c5900f456600266e1d20020028acc004c038dd500440062c807a2c806100c0c024dd50014590070c024004c010dd5004c52689b2b200401",
72-
"hash": "0dc0f294df05817b4471985a0fd255fa8c9b81fadc4c630a66783943"
73-
},
7449
{
7550
"title": "proxy/spend.proxy.else",
7651
"redeemer": {
@@ -84,64 +59,22 @@
8459
}
8560
}
8661
],
87-
"compiledCode": "590253010100229800aba2aba1aba0aab9faab9eaab9dab9a9bae0024888888896600264653001300900198049805000cc0240092225980099b8748008c020dd500144ca6002601a003300d300e00198049baa0048992cc004cdc3a400060146ea8016266e212000323300100132330010013758602000644b30010018a5eb8226644b3001323300100132330010013756602a602c60246ea8010896600200314bd7044c8cc88c8cc004004dd5980b802112cc00400620071323301b374e660366ea4014cc06cc060004cc06cc0640052f5c066006006603a004603600280c8dd7180980099801801980c001180b000a0282259800800c528456600266e3cdd7180a9bac301500100f8a51899801001180b000a020404d13301200233004004001899802002000a01c30110013012001403c44b30010018a40011337009001198010011808800a01c899912cc0040060051598009808800c4c8c96600266e3cdd71809001006456600266e3cdd71809000a44100899b87375a602460260029009c528201a8a50403460240026eb0c040006004807100e0a5032330010013756601e6020602000444b30010018a5eb82264664464660020026eacc044010896600200310038991980a9ba733015375200a6602a60240026602a602600297ae03300300330170023015001404c6eb8c034004cc00c00cc048008c04000500e2012300e300e300a375400491112cc004cdc3a400000515980098071baa008800c5900f456600266e1d20020028acc004c038dd500440062c807a2c806100c0c024dd50014590070c024004c010dd5004c52689b2b200401",
88-
"hash": "0dc0f294df05817b4471985a0fd255fa8c9b81fadc4c630a66783943"
62+
"compiledCode": "59011a010100229800aba2aba1aba0aab9faab9eaab9dab9a9bae0024888888896600266e212000323300100132330010013758601260146014600c6ea8c024c018dd5005912cc004006297ae0899912cc004c8cc004004c8cc004004dd59807180798059baa0042259800800c52f5c1132332232330010013756602000844b30010018801c4c8cc050dd39980a1ba90053301430110013301430120014bd7019801801980b001180a000a024375c6018002660060066022004601e0028068896600200314a115980099b8f375c601c6eb0c0380040222946266004004601e002804900c44cc02c008cc0100100062660080080028038c028004c02c005008112cc0040062900044cdc024004660040046014002803a29344d95900201",
63+
"hash": "2baa0c6ed4aa555c15d53f6b85062d8661f380fb8d023d1b1535b035"
8964
}
9065
],
9166
"definitions": {
9267
"ByteArray": {
9368
"title": "ByteArray",
9469
"dataType": "bytes"
9570
},
96-
"Data": {
97-
"title": "Data",
98-
"description": "Any Plutus data."
99-
},
10071
"Int": {
10172
"dataType": "integer"
10273
},
103-
"aiken/crypto/DataHash": {
104-
"title": "DataHash",
105-
"dataType": "bytes"
106-
},
10774
"cardano/assets/PolicyId": {
10875
"title": "PolicyId",
10976
"dataType": "bytes"
11077
},
111-
"cardano/transaction/Datum": {
112-
"title": "Datum",
113-
"description": "An output `Datum`.",
114-
"anyOf": [
115-
{
116-
"title": "NoDatum",
117-
"dataType": "constructor",
118-
"index": 0,
119-
"fields": []
120-
},
121-
{
122-
"title": "DatumHash",
123-
"description": "A datum referenced by its hash digest.",
124-
"dataType": "constructor",
125-
"index": 1,
126-
"fields": [
127-
{
128-
"$ref": "#/definitions/aiken~1crypto~1DataHash"
129-
}
130-
]
131-
},
132-
{
133-
"title": "InlineDatum",
134-
"description": "A datum completely inlined in the output.",
135-
"dataType": "constructor",
136-
"index": 2,
137-
"fields": [
138-
{
139-
"$ref": "#/definitions/Data"
140-
}
141-
]
142-
}
143-
]
144-
},
14578
"cardano/transaction/OutputReference": {
14679
"title": "OutputReference",
14780
"description": "An `OutputReference` is a unique reference to an output on-chain. The `output_index`\n corresponds to the position in the output list of the transaction (identified by its id)\n that produced that output",
@@ -179,23 +112,6 @@
179112
"fields": []
180113
}
181114
]
182-
},
183-
"types/ProxyRedeemer": {
184-
"title": "ProxyRedeemer",
185-
"anyOf": [
186-
{
187-
"title": "SpendFunds",
188-
"dataType": "constructor",
189-
"index": 0,
190-
"fields": []
191-
},
192-
{
193-
"title": "RemoveEmptyInstance",
194-
"dataType": "constructor",
195-
"index": 1,
196-
"fields": []
197-
}
198-
]
199115
}
200116
}
201117
}
Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,13 @@
11
use aiken/collection/list
22
use cardano/assets.{PolicyId}
3-
use cardano/transaction.{Datum,OutputReference, Transaction}
4-
use cocktail.{only_minted_token, outputs_with_policy}
5-
use types.{ProxyRedeemer, RemoveEmptyInstance, SpendFunds}
3+
use cardano/transaction.{Transaction}
4+
use cardano/script_context.{ScriptContext}
5+
use cocktail.{outputs_with_policy}
66

77
validator proxy(auth_token: PolicyId) {
8-
spend(
9-
_datum: Option<Datum>,
10-
redeemer: ProxyRedeemer,
11-
_input: OutputReference,
12-
self: Transaction,
13-
) {
14-
let Transaction { mint, outputs, .. } = self
15-
16-
when redeemer is {
17-
// check if one auth token is moved in the transaction
18-
SpendFunds -> {
19-
// Check if any token from the auth_token policy is present in the outputs
20-
// This means the token is being moved/transferred signalising that the proxy owners are spending funds
21-
let auth_tokens_in_outputs = outputs_with_policy(outputs, auth_token)
22-
// The token is considered "moved" if any auth token appears in outputs
23-
// (meaning it's being transferred somewhere)
24-
// This is used to ensure that the proxy owners are spending funds
25-
// and not someone else
26-
list.length(auth_tokens_in_outputs) > 0
27-
}
28-
29-
RemoveEmptyInstance -> only_minted_token(mint, auth_token, "", -10)?
30-
}
31-
}
32-
33-
else(_) {
34-
fail
8+
else(ctx: ScriptContext) {
9+
let Transaction { outputs, .. } = ctx.transaction
10+
let auth_tokens_in_outputs = outputs_with_policy(outputs, auth_token)
11+
list.length(auth_tokens_in_outputs) > 0
3512
}
36-
}
13+
}

src/components/multisig/proxy/aiken-workspace/validators/tests/proxy/spend.ak

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)