@shieldedpools/contracts 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +66 -2
- package/contract/managed/shielded-pools/compiler/contract-info.json +134 -0
- package/contract/managed/shielded-pools/compiler/contract-manifest.json +79 -0
- package/contract/managed/shielded-pools/contract/index.d.ts +67 -0
- package/contract/managed/shielded-pools/contract/index.js +791 -0
- package/contract/managed/shielded-pools/contract/index.js.map +8 -0
- package/contract/managed/shielded-pools/keys/shield.prover +0 -0
- package/contract/managed/shielded-pools/keys/shield.verifier +0 -0
- package/contract/managed/shielded-pools/keys/unshield.prover +0 -0
- package/contract/managed/shielded-pools/keys/unshield.verifier +0 -0
- package/contract/managed/shielded-pools/zkir/shield.bzkir +0 -0
- package/contract/managed/shielded-pools/zkir/shield.zkir +178 -0
- package/contract/managed/shielded-pools/zkir/unshield.bzkir +0 -0
- package/contract/managed/shielded-pools/zkir/unshield.zkir +210 -0
- package/contract/shielded-pools.compact +31 -0
- package/package.json +53 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Shielded Pool Contract
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A 1:1 shielded wrapper for Midnight's native unshielded tokens. Lock a token, receive a private version of it, and redeem the original. For NIGHT, that private version is sNIGHT.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **1:1 backing:** every mint and return is paired with a transfer of the same token and amount in the same circuit.
|
|
8
|
+
- **Immutable:** `npm run deploy` gives the contract no maintenance authority, an empty committee with a threshold of 1 that no signature can meet. It is impossible to change the circuits or pause the contract after deployment.
|
|
9
|
+
- **Any ledger token:** one contract wraps NIGHT and any other token that uses the ledger's unshielded coins.
|
|
10
|
+
- **Private transfers:** wrapped tokens are ordinary shielded coins, which hide the sender, recipient, amount and token. A transfer's fee and time stay public.
|
|
11
|
+
- **Public entry and exit:** `shield` shows the depositor, token and amount, and `unshield` shows the recipient, token and amount. Matching amounts can link the two.
|
|
12
|
+
|
|
13
|
+
## Circuits
|
|
14
|
+
|
|
15
|
+
### `shield`
|
|
16
|
+
|
|
17
|
+
Locks `amount` of `token` in the contract and mints the same amount of its wrapped token to the caller's coin key. The depositor, token and amount are public. The new coin's key stays private, which needs a fresh secret `nonce` for each call.
|
|
18
|
+
|
|
19
|
+
```compact
|
|
20
|
+
export circuit shield(token: Bytes<32>, amount: Uint<64>, nonce: Bytes<32>): ShieldedCoinInfo {
|
|
21
|
+
const underlying = disclose(token);
|
|
22
|
+
const value = disclose(amount);
|
|
23
|
+
|
|
24
|
+
receiveUnshielded(underlying, value);
|
|
25
|
+
return mintShieldedToken(
|
|
26
|
+
underlying,
|
|
27
|
+
value,
|
|
28
|
+
disclose(nonce),
|
|
29
|
+
left<ZswapCoinPublicKey, ContractAddress>(ownPublicKey())
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `unshield`
|
|
35
|
+
|
|
36
|
+
Takes a wrapped coin the caller pays in, checks that it wraps `token`, and releases the same amount of `token` to `recipient`. The recipient, token and amount are public, but whose funds paid for it stays private. The wallet funds the coin from the wrapped coins it holds and keeps the change, so amounts don't have to match an earlier `shield`.
|
|
37
|
+
|
|
38
|
+
```compact
|
|
39
|
+
export circuit unshield(token: Bytes<32>, coin: ShieldedCoinInfo, recipient: UserAddress): [] {
|
|
40
|
+
const underlying = disclose(token);
|
|
41
|
+
const paid = disclose(coin);
|
|
42
|
+
const to = disclose(recipient);
|
|
43
|
+
// Only this contract's wrapped form of `token` may release its backing.
|
|
44
|
+
assert(paid.color == tokenType(underlying, kernel.self()), "shielded-pools: wrong token");
|
|
45
|
+
assert(to != default<UserAddress>, "shielded-pools: zero recipient");
|
|
46
|
+
|
|
47
|
+
receiveShielded(paid);
|
|
48
|
+
sendUnshielded(underlying, paid.value, right<ContractAddress, UserAddress>(to));
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Deploying
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm ci
|
|
56
|
+
npm run build
|
|
57
|
+
export MIDNIGHT_SEED=0000000000000000000000000000000000000000000000000000000000000001
|
|
58
|
+
npm run -s deploy
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This pays the fee from the wallet with that seed, using a proof server on `127.0.0.1:6300`, and fails unless the chain shows that nobody can change the contract. No maintenance key is ever created. `MIDNIGHT_NETWORK` picks the network, which defaults to the local one. Public networks use the [deploy workflow](.github/workflows/deploy.yml) once they run ledger 9.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
Copyright 2026 The Shielded Pool Authors. Apache-2.0: see [`LICENSE`](LICENSE). Contributions are made under the same license.
|
|
66
|
+
|
|
67
|
+
The license doesn't cover the Shielded Pool names or logos. Don't imply that your project is official or endorsed, and give a modified version its own name.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compiler-version": "0.35.0",
|
|
3
|
+
"compiler-commit": "debb05f9414b9d1e176741c2be289bb32233f0fc",
|
|
4
|
+
"language-version": "0.27.0",
|
|
5
|
+
"runtime-version": "0.20.0",
|
|
6
|
+
"circuits": [
|
|
7
|
+
{
|
|
8
|
+
"name": "shield",
|
|
9
|
+
"pure": false,
|
|
10
|
+
"proof": true,
|
|
11
|
+
"arguments": [
|
|
12
|
+
{
|
|
13
|
+
"name": "token",
|
|
14
|
+
"type": {
|
|
15
|
+
"type-name": "Bytes",
|
|
16
|
+
"length": 32
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "amount",
|
|
21
|
+
"type": {
|
|
22
|
+
"type-name": "Uint",
|
|
23
|
+
"maxval": 18446744073709551615
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "nonce",
|
|
28
|
+
"type": {
|
|
29
|
+
"type-name": "Bytes",
|
|
30
|
+
"length": 32
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"result-type": {
|
|
35
|
+
"type-name": "Struct",
|
|
36
|
+
"name": "ShieldedCoinInfo",
|
|
37
|
+
"elements": [
|
|
38
|
+
{
|
|
39
|
+
"name": "nonce",
|
|
40
|
+
"type": {
|
|
41
|
+
"type-name": "Bytes",
|
|
42
|
+
"length": 32
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "color",
|
|
47
|
+
"type": {
|
|
48
|
+
"type-name": "Bytes",
|
|
49
|
+
"length": 32
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "value",
|
|
54
|
+
"type": {
|
|
55
|
+
"type-name": "Uint",
|
|
56
|
+
"maxval": 340282366920938463463374607431768211455
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "unshield",
|
|
64
|
+
"pure": false,
|
|
65
|
+
"proof": true,
|
|
66
|
+
"arguments": [
|
|
67
|
+
{
|
|
68
|
+
"name": "token",
|
|
69
|
+
"type": {
|
|
70
|
+
"type-name": "Bytes",
|
|
71
|
+
"length": 32
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "coin",
|
|
76
|
+
"type": {
|
|
77
|
+
"type-name": "Struct",
|
|
78
|
+
"name": "ShieldedCoinInfo",
|
|
79
|
+
"elements": [
|
|
80
|
+
{
|
|
81
|
+
"name": "nonce",
|
|
82
|
+
"type": {
|
|
83
|
+
"type-name": "Bytes",
|
|
84
|
+
"length": 32
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "color",
|
|
89
|
+
"type": {
|
|
90
|
+
"type-name": "Bytes",
|
|
91
|
+
"length": 32
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "value",
|
|
96
|
+
"type": {
|
|
97
|
+
"type-name": "Uint",
|
|
98
|
+
"maxval": 340282366920938463463374607431768211455
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "recipient",
|
|
106
|
+
"type": {
|
|
107
|
+
"type-name": "Struct",
|
|
108
|
+
"name": "UserAddress",
|
|
109
|
+
"elements": [
|
|
110
|
+
{
|
|
111
|
+
"name": "bytes",
|
|
112
|
+
"type": {
|
|
113
|
+
"type-name": "Bytes",
|
|
114
|
+
"length": 32
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"result-type": {
|
|
122
|
+
"type-name": "Tuple",
|
|
123
|
+
"types": [
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"witnesses": [
|
|
129
|
+
],
|
|
130
|
+
"contracts": [
|
|
131
|
+
],
|
|
132
|
+
"ledger": [
|
|
133
|
+
]
|
|
134
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest-version": "1",
|
|
3
|
+
"compiler-version": "0.35.0",
|
|
4
|
+
"compiler-commit": "debb05f9414b9d1e176741c2be289bb32233f0fc",
|
|
5
|
+
"language-version": "0.27.0",
|
|
6
|
+
"runtime-version": "0.20.0",
|
|
7
|
+
"compiler": {
|
|
8
|
+
"type": "directory",
|
|
9
|
+
"contract-info.json": {
|
|
10
|
+
"type": "file",
|
|
11
|
+
"size": 2898,
|
|
12
|
+
"hash": "ed307e636a7c5d10fc638abbd87aa7be4e4ca554595e633e4d2bbfbf2fe9fde3"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"contract": {
|
|
16
|
+
"type": "directory",
|
|
17
|
+
"index.d.ts": {
|
|
18
|
+
"type": "file",
|
|
19
|
+
"size": 3210,
|
|
20
|
+
"hash": "20f6a432941f69b0b581753dec383d1e201ed44a25050a3c02bb166e11cf7730"
|
|
21
|
+
},
|
|
22
|
+
"index.js": {
|
|
23
|
+
"type": "file",
|
|
24
|
+
"size": 45994,
|
|
25
|
+
"hash": "d4f69ac72b32fd062938d71f4d364eedbd68187ad39b6900b6d1abd21240fb5e"
|
|
26
|
+
},
|
|
27
|
+
"index.js.map": {
|
|
28
|
+
"type": "file",
|
|
29
|
+
"size": 2282,
|
|
30
|
+
"hash": "ac16995bc8b4b07c047e4cde0c15ba803c2db2c9201f1ec58d551340ca6f6f1c"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"zkir": {
|
|
34
|
+
"type": "directory",
|
|
35
|
+
"shield.bzkir": {
|
|
36
|
+
"type": "file",
|
|
37
|
+
"size": 572,
|
|
38
|
+
"hash": "b28228e9b0ea86d14182c13ad747613519eb7ef9ab406a0704013b06468008fb"
|
|
39
|
+
},
|
|
40
|
+
"shield.zkir": {
|
|
41
|
+
"type": "file",
|
|
42
|
+
"size": 8638,
|
|
43
|
+
"hash": "2cbba928f34e794b2743a5c8741bb5d0387278f250bb8bf1a8d102df9e6a86a3"
|
|
44
|
+
},
|
|
45
|
+
"unshield.bzkir": {
|
|
46
|
+
"type": "file",
|
|
47
|
+
"size": 655,
|
|
48
|
+
"hash": "f266afd79d4674c7cf32a03bbd341c9441292276f7ccc84b2490899830154537"
|
|
49
|
+
},
|
|
50
|
+
"unshield.zkir": {
|
|
51
|
+
"type": "file",
|
|
52
|
+
"size": 10198,
|
|
53
|
+
"hash": "1d7d979af0d1dfd105fd1c2bf5166123fc251d428b984bc9bb32680db26fd96a"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"keys": {
|
|
57
|
+
"type": "directory",
|
|
58
|
+
"shield.prover": {
|
|
59
|
+
"type": "file",
|
|
60
|
+
"size": 5204641,
|
|
61
|
+
"hash": "6b3ad6f1c5053e028f5afe6845c2bb06040641e05e3b91f5794a7d5f4673e08c"
|
|
62
|
+
},
|
|
63
|
+
"shield.verifier": {
|
|
64
|
+
"type": "file",
|
|
65
|
+
"size": 2119,
|
|
66
|
+
"hash": "7d87eb5ab1bd2f753d3ba7290983ff1b81868aee789bc48c8979290627aec892"
|
|
67
|
+
},
|
|
68
|
+
"unshield.prover": {
|
|
69
|
+
"type": "file",
|
|
70
|
+
"size": 5205028,
|
|
71
|
+
"hash": "a6c00ba3a1dad1bcfee501db31ee37acb257731a55567841a6005ab396191113"
|
|
72
|
+
},
|
|
73
|
+
"unshield.verifier": {
|
|
74
|
+
"type": "file",
|
|
75
|
+
"size": 2119,
|
|
76
|
+
"hash": "8968d3bc80b8d03c21edf5d3363ac0b0f404e72f31457ee8ea1d0632df3bf546"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type * as __compactRuntime from '@midnight-ntwrk/compact-runtime';
|
|
2
|
+
|
|
3
|
+
export type Witnesses<PS> = {
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type ImpureCircuits<PS> = {
|
|
7
|
+
shield(context: __compactRuntime.CircuitContext<PS>,
|
|
8
|
+
token_0: Uint8Array,
|
|
9
|
+
amount_0: bigint,
|
|
10
|
+
nonce_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, { nonce: Uint8Array,
|
|
11
|
+
color: Uint8Array,
|
|
12
|
+
value: bigint
|
|
13
|
+
}>>;
|
|
14
|
+
unshield(context: __compactRuntime.CircuitContext<PS>,
|
|
15
|
+
token_0: Uint8Array,
|
|
16
|
+
coin_0: { nonce: Uint8Array, color: Uint8Array, value: bigint },
|
|
17
|
+
recipient_0: { bytes: Uint8Array }): Promise<__compactRuntime.CircuitResults<PS, []>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ProvableCircuits<PS> = {
|
|
21
|
+
shield(context: __compactRuntime.CircuitContext<PS>,
|
|
22
|
+
token_0: Uint8Array,
|
|
23
|
+
amount_0: bigint,
|
|
24
|
+
nonce_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, { nonce: Uint8Array,
|
|
25
|
+
color: Uint8Array,
|
|
26
|
+
value: bigint
|
|
27
|
+
}>>;
|
|
28
|
+
unshield(context: __compactRuntime.CircuitContext<PS>,
|
|
29
|
+
token_0: Uint8Array,
|
|
30
|
+
coin_0: { nonce: Uint8Array, color: Uint8Array, value: bigint },
|
|
31
|
+
recipient_0: { bytes: Uint8Array }): Promise<__compactRuntime.CircuitResults<PS, []>>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type PureCircuits = {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type Circuits<PS> = {
|
|
38
|
+
shield(context: __compactRuntime.CircuitContext<PS>,
|
|
39
|
+
token_0: Uint8Array,
|
|
40
|
+
amount_0: bigint,
|
|
41
|
+
nonce_0: Uint8Array): Promise<__compactRuntime.CircuitResults<PS, { nonce: Uint8Array,
|
|
42
|
+
color: Uint8Array,
|
|
43
|
+
value: bigint
|
|
44
|
+
}>>;
|
|
45
|
+
unshield(context: __compactRuntime.CircuitContext<PS>,
|
|
46
|
+
token_0: Uint8Array,
|
|
47
|
+
coin_0: { nonce: Uint8Array, color: Uint8Array, value: bigint },
|
|
48
|
+
recipient_0: { bytes: Uint8Array }): Promise<__compactRuntime.CircuitResults<PS, []>>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type Ledger = {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export declare class Contract<PS = any, W extends Witnesses<PS> = Witnesses<PS>> {
|
|
55
|
+
witnesses: W;
|
|
56
|
+
circuits: Circuits<PS>;
|
|
57
|
+
impureCircuits: ImpureCircuits<PS>;
|
|
58
|
+
provableCircuits: ProvableCircuits<PS>;
|
|
59
|
+
constructor(witnesses: W);
|
|
60
|
+
initialState(context: __compactRuntime.ConstructorContext<PS>): Promise<__compactRuntime.ConstructorResult<PS>>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare function ledger(state: __compactRuntime.StateValue | __compactRuntime.ChargedState): Ledger;
|
|
64
|
+
export declare const pureCircuits: PureCircuits;
|
|
65
|
+
export declare const expectedVk: Record<string, string>;
|
|
66
|
+
export declare const circuitSignatures: __compactRuntime.CircuitSignatures;
|
|
67
|
+
export declare const declaredInterfaces: __compactRuntime.DeclaredInterfaces;
|