@indigo-labs/indigo-sdk 0.1.21 → 0.1.22

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.
Files changed (135) hide show
  1. package/.github/workflows/ci.yml +3 -8
  2. package/.github/workflows/test.yml +44 -0
  3. package/dist/index.d.mts +670 -1291
  4. package/dist/index.d.ts +670 -1291
  5. package/dist/index.js +2235 -4669
  6. package/dist/index.mjs +2216 -4618
  7. package/eslint.config.mjs +1 -7
  8. package/package.json +4 -9
  9. package/src/contracts/cdp.ts +746 -0
  10. package/src/contracts/collector.ts +98 -0
  11. package/src/contracts/gov.ts +1 -0
  12. package/src/contracts/interest-oracle.ts +149 -0
  13. package/src/contracts/{lrp/transactions.ts → lrp.ts} +14 -14
  14. package/src/contracts/{one-shot/transactions.ts → one-shot.ts} +3 -3
  15. package/src/contracts/stability-pool.ts +690 -0
  16. package/src/contracts/staking.ts +348 -0
  17. package/src/contracts/treasury.ts +112 -0
  18. package/src/helpers/asset-helpers.ts +57 -0
  19. package/src/{utils → helpers}/helper-txs.ts +0 -1
  20. package/src/{utils/utils.ts → helpers/helpers.ts} +10 -0
  21. package/src/{contracts/interest-oracle/helpers.ts → helpers/interest-oracle.ts} +9 -37
  22. package/src/{contracts/stability-pool/helpers.ts → helpers/stability-pool-helpers.ts} +6 -110
  23. package/src/helpers/staking-helpers.ts +94 -0
  24. package/src/helpers/time-helpers.ts +4 -0
  25. package/src/{utils → helpers}/value-helpers.ts +0 -10
  26. package/src/index.ts +33 -38
  27. package/src/{validators → scripts}/cdp-creator-validator.ts +50 -4
  28. package/src/{validators → scripts}/cdp-validator.ts +5 -3
  29. package/src/{validators → scripts}/collector-validator.ts +3 -2
  30. package/src/scripts/execute-validator.ts +52 -0
  31. package/src/{validators/governance-validator.ts → scripts/gov-validator.ts} +40 -3
  32. package/src/{validators → scripts}/interest-oracle-validator.ts +20 -4
  33. package/src/scripts/lrp-validator.ts +40 -0
  34. package/src/{contracts/one-shot/scripts.ts → scripts/one-shot-policy.ts} +1 -1
  35. package/src/scripts/poll-manager-validator.ts +52 -0
  36. package/src/{validators → scripts}/poll-shard-validator.ts +43 -3
  37. package/src/{contracts/price-oracle/scripts.ts → scripts/price-oracle-validator.ts} +4 -1
  38. package/src/{validators → scripts}/stability-pool-validator.ts +57 -4
  39. package/src/{validators → scripts}/staking-validator.ts +3 -2
  40. package/src/{validators → scripts}/treasury-validator.ts +3 -2
  41. package/src/{validators → scripts}/version-record-policy.ts +23 -4
  42. package/src/{validators/execute-validator.ts → scripts/version-registry.ts} +11 -3
  43. package/src/types/generic.ts +60 -78
  44. package/src/{contracts/cdp-creator/types.ts → types/indigo/cdp-creator.ts} +4 -6
  45. package/src/types/indigo/cdp.ts +88 -0
  46. package/src/types/indigo/execute.ts +21 -0
  47. package/src/types/indigo/gov.ts +51 -0
  48. package/src/{contracts/interest-oracle/types.ts → types/indigo/interest-oracle.ts} +1 -1
  49. package/src/{contracts/lrp/types.ts → types/indigo/lrp.ts} +2 -2
  50. package/src/types/indigo/poll-manager.ts +21 -0
  51. package/src/types/indigo/poll-shard.ts +16 -0
  52. package/src/{contracts/price-oracle/types.ts → types/indigo/price-oracle.ts} +4 -16
  53. package/src/types/indigo/stability-pool.ts +233 -0
  54. package/src/types/indigo/staking.ts +99 -0
  55. package/src/{contracts/version-registry/types.ts → types/indigo/version-record.ts} +1 -1
  56. package/src/types/on-chain-decimal.ts +0 -22
  57. package/src/types/system-params.ts +11 -22
  58. package/tests/datums.test.ts +108 -125
  59. package/tests/endpoints/initialize.ts +338 -240
  60. package/tests/hash-checks.test.ts +21 -26
  61. package/tests/indigo-test-helpers.ts +55 -1
  62. package/tests/initialize.test.ts +5 -10
  63. package/tests/interest-calculations.test.ts +18 -18
  64. package/tests/interest-oracle.test.ts +18 -20
  65. package/tests/lrp.test.ts +65 -191
  66. package/tests/queries/governance-queries.ts +16 -19
  67. package/tests/queries/iasset-queries.ts +23 -46
  68. package/tests/queries/interest-oracle-queries.ts +6 -3
  69. package/tests/queries/lrp-queries.ts +2 -2
  70. package/tests/queries/price-oracle-queries.ts +22 -5
  71. package/tests/queries/stability-pool-queries.ts +8 -10
  72. package/tests/queries/staking-queries.ts +19 -28
  73. package/tests/stability-pool.test.ts +71 -186
  74. package/tests/staking.test.ts +23 -30
  75. package/tests/test-helpers.ts +2 -11
  76. package/tsconfig.json +1 -3
  77. package/vitest.config.ts +1 -1
  78. package/src/contracts/cdp/helpers.ts +0 -167
  79. package/src/contracts/cdp/scripts.ts +0 -33
  80. package/src/contracts/cdp/transactions.ts +0 -1310
  81. package/src/contracts/cdp/types.ts +0 -161
  82. package/src/contracts/cdp-creator/scripts.ts +0 -39
  83. package/src/contracts/collector/scripts.ts +0 -32
  84. package/src/contracts/collector/transactions.ts +0 -44
  85. package/src/contracts/execute/scripts.ts +0 -48
  86. package/src/contracts/execute/types.ts +0 -57
  87. package/src/contracts/gov/helpers.ts +0 -157
  88. package/src/contracts/gov/scripts.ts +0 -34
  89. package/src/contracts/gov/transactions.ts +0 -1224
  90. package/src/contracts/gov/types-new.ts +0 -115
  91. package/src/contracts/gov/types.ts +0 -89
  92. package/src/contracts/interest-oracle/scripts.ts +0 -18
  93. package/src/contracts/interest-oracle/transactions.ts +0 -149
  94. package/src/contracts/lrp/scripts.ts +0 -27
  95. package/src/contracts/poll/helpers.ts +0 -55
  96. package/src/contracts/poll/scripts.ts +0 -72
  97. package/src/contracts/poll/types-poll-manager.ts +0 -38
  98. package/src/contracts/poll/types-poll-shard.ts +0 -38
  99. package/src/contracts/poll/types-poll.ts +0 -88
  100. package/src/contracts/price-oracle/transactions.ts +0 -112
  101. package/src/contracts/stability-pool/scripts.ts +0 -46
  102. package/src/contracts/stability-pool/transactions.ts +0 -660
  103. package/src/contracts/stability-pool/types-new.ts +0 -208
  104. package/src/contracts/stability-pool/types.ts +0 -42
  105. package/src/contracts/staking/helpers.ts +0 -116
  106. package/src/contracts/staking/scripts.ts +0 -41
  107. package/src/contracts/staking/transactions.ts +0 -268
  108. package/src/contracts/staking/types-new.ts +0 -81
  109. package/src/contracts/staking/types.ts +0 -41
  110. package/src/contracts/treasury/scripts.ts +0 -37
  111. package/src/contracts/treasury/transactions.ts +0 -44
  112. package/src/contracts/treasury/types.ts +0 -55
  113. package/src/contracts/version-registry/scripts.ts +0 -29
  114. package/src/contracts/version-registry/types-new.ts +0 -19
  115. package/src/contracts/vesting/helpers.ts +0 -267
  116. package/src/types/evolution-schema-options.ts +0 -16
  117. package/src/utils/bigint-utils.ts +0 -7
  118. package/src/utils/time-helpers.ts +0 -4
  119. package/src/validators/lrp-validator.ts +0 -7
  120. package/src/validators/poll-manager-validator.ts +0 -7
  121. package/src/validators/version-registry-validator.ts +0 -7
  122. package/tests/cdp.test.ts +0 -1565
  123. package/tests/gov.test.ts +0 -1874
  124. package/tests/mock/assets-mock.ts +0 -59
  125. package/tests/queries/cdp-queries.ts +0 -144
  126. package/tests/queries/collector-queries.ts +0 -26
  127. package/tests/queries/execute-queries.ts +0 -46
  128. package/tests/queries/poll-queries.ts +0 -97
  129. package/tests/queries/treasury-queries.ts +0 -19
  130. package/tests/utils/asserts.ts +0 -13
  131. package/tests/utils/index.ts +0 -50
  132. /package/src/{utils → helpers}/indigo-helpers.ts +0 -0
  133. /package/src/{utils → helpers}/lucid-utils.ts +0 -0
  134. /package/src/{contracts/price-oracle/helpers.ts → helpers/price-oracle-helpers.ts} +0 -0
  135. /package/src/{contracts/one-shot/types.ts → types/one-shot.ts} +0 -0
@@ -1,7 +1,26 @@
1
- // Automatically generated by the sdk-export.sh script in aiken smart contracts repository
2
- export const _versionRecordTokenPolicy = {
3
- type: 'PlutusScriptV2',
4
- description: 'Generated by Aiken',
1
+ import {
2
+ applyParamsToScript,
3
+ MintingPolicy,
4
+ ScriptType,
5
+ } from '@lucid-evolution/lucid';
6
+ import {
7
+ castVersionRecordTokenParams,
8
+ VersionRecordTokenParams,
9
+ } from '../types/indigo/version-record';
10
+
11
+ const versionRecordPolicyData = {
12
+ type: 'PlutusV2' as ScriptType,
5
13
  cborHex:
6
14
  '5901bd5901ba010000323232323232322225333004323253330063370e900018039baa300b300c00215333009300c32333232322232323300100100422533301200114bd700991929998089802980418099baa0021330150023300400400113300400400130160023014001533300c3370e900018069baa4c103d879800012300633300537566008601e6ea8004dd7180398079baa002375c6008601e6ea800848cdc42400066600a6eacc010c03cdd50009bae3007300f37540046eb8c010c03cdd5001118079808000911192999806180298069baa0011480004dd6980898071baa00132533300c3005300d3754002298103d87a80001323300100137566024601e6ea8008894ccc044004530103d87a8000132323253330113371e00e6eb8c04800c4cdd2a40006602a6ea00052f5c026600a00a0046eb4c048008c054008c04c004c8cc004004010894ccc040004530103d87a8000132323253330103371e00e6eb8c04400c4cdd2a4000660286e980052f5c026600a00a0046eacc044008c050008c048004dc3a40046eb0c004c024dd5001180098049baa0062300c00114a22c2c6014002600c6ea8004526136565734aae7555cf2ab9f5740ae855d11',
7
15
  };
16
+
17
+ export function mkVersionRecordTokenPolicy(
18
+ params: VersionRecordTokenParams,
19
+ ): MintingPolicy {
20
+ return {
21
+ type: versionRecordPolicyData.type,
22
+ script: applyParamsToScript(versionRecordPolicyData.cborHex, [
23
+ castVersionRecordTokenParams(params),
24
+ ]),
25
+ };
26
+ }
@@ -1,7 +1,15 @@
1
- // Automatically generated by the sdk-export.sh script in aiken smart contracts repository
2
- export const _executeValidator = {
3
- type: 'PlutusScriptV2',
1
+ import { ScriptType, SpendingValidator } from '@lucid-evolution/lucid';
2
+
3
+ const versionRegistryValidatorData = {
4
+ type: 'PlutusV2' as ScriptType,
4
5
  description: 'Generated by Aiken',
5
6
  cborHex:
6
7
  '59239a59239701000032323232323232322232323232323232323232323232322322533301432325333016300e301837546038603a0042646464646464646464646464646464646464646464646464a66605c66002920125476f7620696e707574206d75737420757365207468652072696768742072656465656d657200533302e00c132323375e00498103d87b8000325333030302d00113232323232323232533303c303f00213232498c0a8008c0ac00c58c0f4004c0f4008c0ec004c0ec008dd7181c800981c8011bad3037001303337540042a666060605000226464a66606c60720042930b1bad3037001303337540042a666060604a0022a66606860666ea80085261615333030302400115333034303337540042930b0b18189baa0013300230153031375401a02c29444c94ccc0bccc0092401174d697865642070726f746f636f6c2076657273696f6e73003370e6eb4c02cc0c8dd50051bad30013032375405a2646464a6660646600a9212243616e206f6e6c7920636f6e73756d65206f6e65207570677261646520746f6b656e00302a300133301301b301630353754062980103d87980001533303233005491224d7573742065786563757465206166746572206566666563746976652064656c617900325333033302b30353754002266e20cdc01bad300f303637540626eb4c03cc0d8dd5180b981b1baa00e375a6072606c6ea8004528180c981a9baa3019303537546010606a6ea807454ccc0c8cc0152411143616e6e6f7420626520657870697265640000713232533233035332253330373034303937540042a66607601e2a66070921475768656e2066756e64732066726f6d207472656173757279207265717565737465642069742068617320746f207370656e642061207574786f2066726f6d20747265617375727900161533303b303e00f13232300500232533303930360011533303d303c37540042930b0a99981c98188008a99981e981e1baa00214985854ccc0e4c0b800454ccc0f4c0f0dd50010a4c2c2a666072605a0022a66607a60786ea800852616153330393370e90040008a99981e981e1baa00214985854ccc0e4cdc3a40140022a66607a60786ea80085261616303a375400266016603c60746ea8c0f403c00454cc0e1241475768656e2066756e64732066726f6d207472656173757279207265717565737465642069742068617320746f207370656e642061207574786f2066726f6d207472656173757279001613300a49014b5768656e206e6f207472656173757279207769746864726177616c207265717565737465642069742063616e2774207370656e6420616e79207574786f2066726f6d207472656173757279003034300600f3002303837540666eacc00cc0e0dd501009980424812b4661696c20746f2065786563757465207570677261646520696e20657865637574696e6720706572696f640032323232323232323232323232323232325332330473301a49012c54686520646174756d206f6620676f7665726e616e6365206d757374207570646174652070726f7065726c7900323253233304a304700213333300d00730233304f0014bd701802198279919191819998291829801998291829801198291829800998291ba8301e375a604860a06ea80a0c150c150004c14c004c148004c134dd5002a5eb80c030c0c4c134dd5024a6103d87a80001533304a303f00213333300d00730233304f0014bd7018021982799181899828182880099828182898271baa00430523052001304d375400a97ae0300c3031304d375409298103d87a80001533304a303e00213333300d00730233304f0014bd7018021982799191819198289829001198289829000998289ba8301d375a6050609e6ea809cc14cc14c004c148004c134dd5002a5eb80c030c0c4c134dd5024a6103d87a80001533304a302c00613333300d00730233304f0014bd70180219827802a5eb80c030c0c4c134dd5024a60103d87a8000133304a0284a0944c0bccc138c0c0c130dd5181818261baa302d304c37540506609c980103d87a80004bd7018251baa001302b304a375408a2a66608e66034920122546865207472616e73616374696f6e206d757374206d696e742070726f7065726c79003375e6e98c8cc004004dd5980d18259baa03322533304d00114bd6f7b63009919191929998269808801080189982919bb037520046e98004cc01801800cdd598278019bae304d0023051002304f001374c64a666090608a00226601c6601c6014603e60966ea811cc028c090c12cdd502398079805181618259baa04715333048303c00113300e300a301a304b375408e601e6014605860966ea811c4c03cc028c0b0c12cdd502398249baa302b304a375408a2a66608e6603492119496e636f727265637420494173736574207370656e64696e6700325333048304000114a22a666090608a00229444c114c8c8cc004004020894ccc13c004520001337006600400460a4002660206eacc0bcc138dd5181798271baa30510010033024304b375408e60926ea8c0acc128dd502289919299199825182380109919191919191919191919191919191919191919191919191929998319981b24812153746162696c697479506f6f6c206f757470757420697320696e636f72726563740033333026020303c33068304933068303c330683069306a306a306a306a306a306a306637540c497ae0330684c103d87a80004bd7025eb80c074cc1a0c124cc1a0c124cc1a0dd480c198342611dd8799fd8799f1b0de0b6b3a7640000ffd8799f00ffd8799f00ff0000ff00330684c10ca1d8799f0000ffd8799f00ff004bd7025eb812f5c0604a607460cc6ea818930103d87a8000153330633060375a607460cc6ea80f84cc0d92412370726f706f73656420694173736574206f757470757420697320696e636f727265637400330014a2980103d87a8000133036490125496e636f72726563746c7920636f6e73756d6564207265666572656e6365206961737365740032325333069306c0021325333066305e3068375400226464a6660d860de00426464a6660d460ce0022a6660d464a6660de60dc0022a6660d660c660da002294454ccc1acc1a0c1b40045280b0b1baa3070307130713071307130713071307130713071307130713071306d37540062a6660d46607a92012370726f706f73656420694173736574206f757470757420697320696e636f727265637400330084a260a0660de60a260da6ea800d2f5c026607a92123636f6e73756d656420694173736574206f757470757420697320696e636f7272656374003333302d02700930243306f30433306f323232323232323232323232305c3307b307c00c3307b307c00b3307b307c00a3307b307c0093307b307c0083307b307c0073307b307c0063307b307c0053307b307c0043307b307c0033307b307c0023307b307c0013307b3330764a0980103d87a80004c0103d8798000307d307d001307c001307b001307a00130790013078001307700130760013075001307400130730013072001306d375400697ae04bd701816182318369baa0694c0103d87a800014a0294054ccc1a8c17c00454ccc1a8c94ccc1acc1a0c1b4dd50008981b998198101bae3071306e37540022944c0a8c1b4dd50018a9998351981ea492370726f706f73656420694173736574206f757470757420697320696e636f727265637400330084a0605460da6ea800c4cc0f524123636f6e73756d656420694173736574206f757470757420697320696e636f7272656374003333302d02700930243306f30433306f323232323232323232323232305c3307b307c00c3307b307c00b3307b307c00a3307b307c0093307b307c0083307b307c0073307b307c0063307b307c0053307b307c0043307b307c0033307b307c0023307b307c0013307b307c307d0013307b305c3307b375205697ae04bd70183e000983d800983d000983c800983c000983b800983b000983a800983a0009839800983900098369baa0034bd7025eb80c0b0c118c1b4dd5034a60103d87a800014a0294054cc1ad2411a537563682069617373657420616c7265616479206578697374730016306b37546606203c6eb8c140c1b0dd500118148008b183680098349baa001163042304130683754609260d06ea800458c1a8004ccc110dd6182518331baa04e303f306637540c4980103d879800014a0446666604e042006603c660d2607a660d26094660d26ea4064cc1a4c0f4cc1a405d2f5c0660d202a660d2026660d2022660d201e660d201a660d2016660d2012660d200e660d200a660d2008660d26660c8004980103d87a80004c0103d8798000330690014bd7025eb812f5c0604c608060ce6ea818d30103d87a8000303a33066304733066018330664c0103d87a80004bd7025eb80c198c19c008c194004c194008c18c004c18c008c184004c184008c17c004c17c008c174004c174008c16c004c16c008c164004c164008c15c004c15c008c154004c154008c14c004c14c008dd7182880098269baa0031533304a30420021323232323232323232323232323232323232323232323232325333067306a0021325333064305c3066375400226464a6660d460da004264a6660ce6607492011a694173736574206f757470757420697320696e636f7272656374003333302a02430403306c304d3306c01e3306c4c103d87a80004bd7025eb80c084cc1b0c100cc1b0c134cc1b0dd480e1983600d1983600c1983600b1983600a1983600919836008198360071983600619836005198360041983600398371837183718371837183718371837183718371837183718351baa0024bd7025eb80c0a4c10cc1a8dd5033260103d87a8000153330673303a4911b5370656e6420696e76616c696420694173736574206f7574707574003371e6eb8c138c1a8dd500100e0a9998339981d2491f43616e6e6f74206d6f6469667920612064656c697374656420694173736574005333067306430693754609660d46ea800854cc1a12411f43616e6e6f74206d6f6469667920612064656c697374656420694173736574001614a226607492011d4d6967726174696e67206e6f6e2d757067726164656420494173736574003375e609c60d46ea8c138c1a8dd5182598351baa00501e14a0294052818138008b183580098339baa001163040303f30663754608e60cc6ea800458c1a0004ccc10807cc0f4c190dd503026103d879800030663067002306500130650023063001306300230610013061002305f001305f002305d001305d002305b001305b00230590013059002305700130570023055001305500230530013053002375c60a2002609a6ea800c54ccc128c0f80084c8cc07924012176657273696f6e5265636f7264206f757470757420697320696e636f7272656374003333300e0083024330503031330503024330503021304e375409497ae0330504c103d87a80004bd7025eb80c014cc140c0c4cc140c144004cc140dd319198008009bab3052305300222533305100114bd6f7b6300998291919bb0305000130353051375460a200260a60026600400460a800297ae04bd701806980e98271baa04a4c0103d87a8000304d375460a0609a6ea800c54ccc128c0fc0085288a5130223304e3016304c375409097ae0304a3754002605660946ea81145280a50374a90020a5032323232302f3304e304f0043304e304f0033304e304f0023304e304f0013304e304f30500013304e37506644a66609666e2000400840044008cdc01bad3016304c375404800a66e092082d1cc044820225e92f5c0609e002609c002609a00260906ea8080c94ccc114c108c11cdd5000899805191980080099198008009bac302b304a3754609a60946ea800c894ccc13000452f5c026609a6e9cc8c8cc13cc140008cc13cc140004cc13cc140c1440052f5c060a000260966ea8c138004cc008008c13c004894ccc12c00452f5bded8c02664464666444a66609a6094002200a26666602e00a0066464004646600200200444a6660a8002293099299982a8008a4c26464a6660a660a060aa6ea8cc06cdd7182a982c8021bae3055002133005005330580020011533054491326b65797320696e206173736f63696174697665206c697374206172656e277420696e20617363656e64696e67206f72646572001630590023057001305700133052337606ea4008dd4000a5eb7bdb180888c94ccc144c068004530103d87a80001303733056374c00297ae03333301b001005004222325333054305100114c103d87a80001303a33059375000297ae03370000200403002a6eb8c14000cdd718280009bad3050305100130500023758609a00266004004609c002602660906ea8110520003011304737540846eb0c124c128c128008dd6182400098221baa02c23047304830483048304830483048304830483048304830483048304800125333040303d30423754002264646464646464646464646464646464646464646464646464646464a6660c060c6004264646464646464646464646493192999834183280089919299983718388010a4c2c6eb8c1bc004c1acdd50068a99983418300008a99983618359baa00d14985858c1a4dd5006182f807982f008182e808982e009182d809982d00a182c80a982c00b182b80b982c80c182980c8b1830800983080119299982f182e8008a99982d1829182e0008a511533305a3057305c00114a02c2c6ea8c17c004c17c008c174004c174008c16c004c16c008c164004c164008c15c004c15c008c154004c154008c14c004c14c008c144004c144008c13c004c13c008c134004c134008c12c004c12c008c124004c124008dd7182380098219baa0011623322533304130394800052f5bded8c0264646600200297adef6c60225333048001133049337606ea4014dd3001a5eb7bdb1804c8c8c8c94ccc120c050cc0400240084cc134cdd81ba9009374c00e00a2a66609066e3c0240084cc134cdd81ba9009374c00e00626609a66ec0dd48011ba600133006006003375660940066eb8c120008c130008c128004c8cc0040052f5bded8c044a66608e00226609066ec0dd4801a6010101004bd6f7b630099191919299982398099980780380109982619bb0375200e981010100005153330473371e00e00426609866ec0dd4803a6101010000313304c337606ea4008dd4000998030030019bad3049003375c608e004609600460920026eb8c098c108dd50009bae3023304237540024444464660020026604c00ca6660866080608a6ea80144c88cdd7981618241baa302c304837540020046092608c6ea80144c88cdd7981618241baa00100230493046375400a44a66609000229404c94ccc114c94ccc118cdd7981118249baa001007132533304b00114a22a666096609c0022646464a666094601c6eb8c14000c54ccc128c03800454ccc128c11cc130dd50048a99982519b89480000084cdc48012410137dc0429404cdc4a400000429405281bae304f3050002375a609c609e609e0026eb0c1340045281919800800998069bab302b304a3754004601c00e44a666098002297ae01323332223233001001003225333052001100313233054374e660a86ea4018cc150dd49bae30510013305437506eb4c1480052f5c06600600660ac00460a80026eb8c12c004dd5982600099801801982800118270008a50304b00214a226600600600260960026e3d2210022333022002375c604860806ea8004dd7181098201baa00122323330010010030022225333043002100113233300400430470033333300a002375c60840026eacc10c004888c94ccc110c0340045300103d87a80001302a33049374c00297ae032333001001003002222533304a0021001132333004004304e00333333012002375c60920026eb4c128004888c94ccc12cc1200045300103d87a80001303133050375000297ae03370000400201e6098004010608a0044646600200200444a666080002297adef6c6013233042337606ea4dd7181f8009ba632330010013756608200444a666086002297adef6c6013233045337606ea4dd718210009ba83370290001bad30430013300300330470023045001330030033044002304200122533303a33720004002298103d87980001533303a3371e0040022980103d87a800014c103d87b80002533303c00114a2294088888c8cc004004018894ccc1040044cc108cdd81ba9006374c00a97adef6c601323232325333041300d3300700a002133046337606ea4028dd30048028a99982099b8f00a0021325333042303f3044375400226608e66ec0dd4805982418229baa001004100433300800a009001133046337606ea4008dd3000998030030019bab3043003375c6082004608a004608600244444646600200200c44a66608000226608266ec0dd48031ba80054bd6f7b630099191919299982018061980380500109982299bb037520146ea002401454ccc100cdc78050010992999820981f18219baa001133046337606ea402cc11cc110dd5000802080219980400500480089982299bb037520046ea0004cc01801800cdd698210019bae304000230440023042001375e98103d879800014a046074607660766076607660760024607260746074607460746074607460746074607400229405280a5030010012253330360011480004c00ccc008008c0e4004dc02400429408c0d4c0d8c0d8c0d8c0d8004528112999817999817800a504a22a66060004200220024464a66605e605860626ea80044c0d4c0c8dd50008a9981824917436f756c64206e6f742066696e642072656465656d6572001632323300100100322533303500114c0103d87a8000132323253330343375e00c606c006260346607200297ae01330050050023036002303900230370013007330330024bd70192999816181218171baa0011337126eb4c0c8c0bcdd500099b80375a6006605e6ea80a8dd6980198179baa3010302f375400e2940c048c0b8dd5180798171baa3001302e375402c460626064606460646064606460646064002460606062606260620026466018024466ebcc044c0b4dd5180898169baa300e302d375400200460026605a605c605e605e605e605e605e605e605e605e60566ea809d2f5c06e95200253330263023302837540022646464646464646464646464a66606c60720042649318140048b1bad30370013037002375a606a002606a0046eb4c0cc004c0cc008dd698188009818801181780098178011bad302d001302937540022c6004600260506ea8c024c0a0dd5002118159816181600092999812180c98131baa0011302a302737540022a6604a921134e6f7420616e20696e6c696e6520646174756d0016300430243754604a004604600264a66604a002264a66604c0022a66046920130457870656374656420476f7620696e7075742065697468657220617320696e707574206f72207265662e20696e7075740016153330263029001133760605000266604494130103d87a80004c0103d8798000153302349130457870656374656420476f7620696e7075742065697468657220617320696e707574206f72207265662e20696e70757400163330023758600a60486ea8030c020c090dd501026103d8798000153330253028001133760604e00266604294530103d87a80004c0103d879800013253330260011533023490130457870656374656420476f7620696e7075742065697468657220617320696e707574206f72207265662e20696e7075740016153330263029001133760605000266604494130103d87a80004c0103d8798000153302349130457870656374656420476f7620696e7075742065697468657220617320696e707574206f72207265662e20696e70757400163330023758600a60486ea8030c020c090dd501026103d879800033300100930073023375403e980103d8798000222323300600423002300830273754002a666044603e60486ea800448c06cccc020dd5980398131baa001375c6014604c6ea800cdd7180398131baa0031230053330083756600e604c6ea8004dd7180518131baa003375c600e604c6ea800cdc42400044646600200200644a66604a002297ae01323253330233005002133028002330040040011330040040013029002302700123023302400122232533301f3017302137540022900009bad30253022375400264a66603e602e60426ea8004530103d87a8000132330010013756604c60466ea8008894ccc094004530103d87a8000132323253330243371e00e6eb8c09800c4c028cc0a4dd4000a5eb804cc014014008dd698130011814801181380099198008008021129998120008a6103d87a8000132323253330233371e00e6eb8c09400c4c024cc0a0dd3000a5eb804cc014014008dd59812801181400118130009ba5480008c080004dd5980f180f980f980f980f980f980f980f980f980f8011bac301d001301937540022c6036002602e6ea8004526136563253330133010301500115333017301600114985858dd5000a999808180698091baa00e13232323232323232323232325333020302300213232498c038008c03c02458c084004c084008dd6980f800980f8011bad301d001301d002375a60360026036004603200260320046eb4c05c004c04cdd50070b1192999808980700089919299980b980d00109924ca6660266020602a6ea80044c8c8c8c94ccc06cc0780084c8c92633013002253330193016301b37540022646464646464a666046604c0042930b1bad30240013024002375c604400260440046eb8c080004c070dd50008b299980b980a180c9baa003132323232533301f302200213232498c94ccc074c0680044c8c94ccc08cc0980084c926325333020301d0011323253330263029002132498c05000458c09c004c08cdd50010a999810180c0008991919191919299981518168010a4c2c6eb4c0ac004c0ac008dd6981480098148011bad3027001302337540042c60426ea800458c090004c080dd50018a99980e980a8008a99981098101baa00314985858c078dd500118068018b18100009810001180f000980d1baa00316163758603800260380046034002602c6ea80045858c060004c050dd50010a99980898048008a99980a980a1baa00214985858c048dd50009192999808180680089919299980b180c8010a4c2c6eb8c05c004c04cdd50010a999808180400089919299980b180c8010a4c2c6eb8c05c004c04cdd50010b18089baa001232533300f300c0011323232323232323232323232323232323232323232323232533302b302e00213232323232323232323232498c0a802cc0a4030c0a0034c09c038c09803cc094040c090044c08c048c08804cc090050c08405458c0b0004c0b0008c0a8004c0a8008c0a0004c0a0008c098004c098008c090004c090008c088004c088008c080004c080008c078004c078008c070004c070008c068004c068008c060004c060008dd7180b00098091baa0021533300f30070011323232323232323232323232323232323232323232323232533302b302e00213232323232323232323232498c0a802cc0a4030c0a0034c09c038c09803cc094040c090044c08c048c08804cc090050c07805458c0b0004c0b0008c0a8004c0a8008c0a0004c0a0008c098004c098008c090004c090008c088004c088008c080004c080008c078004c078008c070004c070008c068004c068008c060004c060008dd7180b00098091baa0021533300f30040011323253330153018002132498c01c00458c058004c048dd50010a999807980180089919299980a980c00109924ca666022601c60266ea80044c8c8c8c94ccc064c0700084c926330100012323253330183015301a375400226464a66603c60420042930b1bae301f001301b37540022c60340046eb8c06000458dd5980d000980d0011bad3018001301437540022c2c602c00260246ea800854ccc03ccdc3a401000226464a66602a60300042930b1bae3016001301237540042c60206ea8004dc3a400c6e1d20042533300b3008300d375400226464646464646464646464646464646464646464a666046604c00426493180c0058b1bad30240013024002375a604400260440046eb4c080004c080008dd6980f000980f0011bad301c001301c002301a001301a002375a603000260300046eb4c058004c058008dd6980a000980a0011bad3012001300e37540022c464a666016601000226464a66602260280042649318030008b180900098071baa0021533300b30030011323253330113014002132498c01c00458c048004c038dd50010b18061baa001370e900112999804180298051baa00113232533300e3011002149858dd6980780098059baa001162533300730043009375400226464a66601a60200042649318028008b180700098051baa0011622323300100100322533300d00114984c8cc00c00cc044008c00cc03c00494ccc014c008c01cdd5000899191919299980698080010a4c2c6eb8c038004c038008dd7180600098041baa00116370e90002b9a5738aae7555cf2ab9f5740ae855d101',
7
8
  };
9
+
10
+ export const mkVersionRegistryValidator = (): SpendingValidator => {
11
+ return {
12
+ type: versionRegistryValidatorData.type,
13
+ script: versionRegistryValidatorData.cborHex,
14
+ };
15
+ };
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  credentialToAddress,
3
+ Credential as LucidCredential,
3
4
  Data,
5
+ LucidEvolution,
4
6
  getAddressDetails,
5
- Credential,
6
- Network,
7
7
  } from '@lucid-evolution/lucid';
8
- import { match, P } from 'ts-pattern';
9
8
 
10
9
  export const AssetClassSchema = Data.Object({
11
10
  currencySymbol: Data.Bytes(),
@@ -15,104 +14,87 @@ export const AssetClassSchema = Data.Object({
15
14
  export type AssetClass = Data.Static<typeof AssetClassSchema>;
16
15
 
17
16
  export const OutputReferenceSchema = Data.Object({
18
- txHash: Data.Object({ hash: Data.Bytes() }),
17
+ txHash: Data.Object({ hash: Data.Bytes({ minLength: 32, maxLength: 32 }) }),
19
18
  outputIndex: Data.Integer(),
20
19
  });
21
20
  export type OutputReference = Data.Static<typeof OutputReferenceSchema>;
22
21
 
23
- export const VerificationKeyHashSchema = Data.Bytes();
22
+ export const VerificationKeyHashSchema = Data.Bytes({
23
+ minLength: 28,
24
+ maxLength: 28,
25
+ });
24
26
 
25
27
  export const CredentialSchema = Data.Enum([
26
28
  Data.Object({
27
29
  PublicKeyCredential: Data.Tuple([VerificationKeyHashSchema]),
28
30
  }),
29
31
  Data.Object({
30
- ScriptCredential: Data.Tuple([Data.Bytes()]),
31
- }),
32
- ]);
33
- export type CredentialD = Data.Static<typeof CredentialSchema>;
34
- export const CredentialD = CredentialSchema as unknown as CredentialD;
35
-
36
- export const StakeCredentialSchema = Data.Enum([
37
- Data.Object({ Inline: Data.Tuple([CredentialSchema]) }),
38
- Data.Object({
39
- Pointer: Data.Tuple([
40
- Data.Object({
41
- slotNumber: Data.Integer(),
42
- transactionIndex: Data.Integer(),
43
- certificateIndex: Data.Integer(),
44
- }),
32
+ ScriptCredential: Data.Tuple([
33
+ Data.Bytes({ minLength: 28, maxLength: 28 }),
45
34
  ]),
46
35
  }),
47
36
  ]);
37
+ export type Credential = Data.Static<typeof CredentialSchema>;
38
+ export const Credential = CredentialSchema as unknown as Credential;
48
39
 
49
40
  export const AddressSchema = Data.Object({
50
41
  paymentCredential: CredentialSchema,
51
- stakeCredential: Data.Nullable(StakeCredentialSchema),
42
+ stakeCredential: Data.Nullable(
43
+ Data.Enum([
44
+ Data.Object({ Inline: Data.Tuple([CredentialSchema]) }),
45
+ Data.Object({
46
+ Pointer: Data.Tuple([
47
+ Data.Object({
48
+ slotNumber: Data.Integer(),
49
+ transactionIndex: Data.Integer(),
50
+ certificateIndex: Data.Integer(),
51
+ }),
52
+ ]),
53
+ }),
54
+ ]),
55
+ ),
52
56
  });
53
- export type AddressD = Data.Static<typeof AddressSchema>;
54
- export const AddressD = AddressSchema as unknown as AddressD;
57
+ export type Address = Data.Static<typeof AddressSchema>;
58
+ export const Address = AddressSchema as unknown as Address;
55
59
 
56
- export function addressToBech32(address: AddressD, network: Network): string {
57
- const matchCred = (cred: CredentialD) =>
58
- match(cred)
59
- .returnType<Credential>()
60
- .with({ PublicKeyCredential: [P.select()] }, (pkh) => {
61
- return { type: 'Key', hash: pkh };
62
- })
63
- .with({ ScriptCredential: [P.select()] }, (scriptCred) => {
64
- return { type: 'Script', hash: scriptCred };
65
- })
66
- .exhaustive();
67
-
68
- const stakeCred: Credential | undefined = match(address.stakeCredential)
69
- .returnType<Credential | undefined>()
70
- .with(P.nullish, () => undefined)
71
- .with({ Inline: [P.select()] }, (cred) => matchCred(cred))
72
- .otherwise(() => {
73
- throw new Error('Unexpected stake credential format.');
74
- });
75
-
76
- const cred: Credential = matchCred(address.paymentCredential);
60
+ export function addressToBech32(
61
+ lucid: LucidEvolution,
62
+ address: Address,
63
+ ): string {
64
+ const paymentCredential: LucidCredential =
65
+ 'PublicKeyCredential' in address.paymentCredential
66
+ ? { type: 'Key', hash: address.paymentCredential.PublicKeyCredential[0] }
67
+ : { type: 'Script', hash: address.paymentCredential.ScriptCredential[0] };
68
+ const stakeCredential: LucidCredential | undefined =
69
+ address.stakeCredential && 'Inline' in address.stakeCredential
70
+ ? 'PublicKeyCredential' in address.stakeCredential.Inline[0]
71
+ ? {
72
+ type: 'Key',
73
+ hash: address.stakeCredential.Inline[0].PublicKeyCredential[0],
74
+ }
75
+ : {
76
+ type: 'Script',
77
+ hash: address.stakeCredential.Inline[0].ScriptCredential[0],
78
+ }
79
+ : undefined;
77
80
 
78
- return credentialToAddress(network, cred, stakeCred);
81
+ return credentialToAddress(
82
+ lucid.config().network,
83
+ paymentCredential,
84
+ stakeCredential,
85
+ );
79
86
  }
80
87
 
81
- export function addressFromBech32(address: string): AddressD {
88
+ export function addressFromBech32(address: string): Address {
82
89
  const details = getAddressDetails(address);
83
-
84
- const matchCred = (cred: Credential): CredentialD => {
85
- return match(cred)
86
- .returnType<CredentialD>()
87
- .with({ type: 'Key', hash: P.select() }, (pkh) => {
88
- return {
89
- PublicKeyCredential: [pkh],
90
- };
91
- })
92
- .with({ type: 'Script', hash: P.select() }, (scriptHash) => ({
93
- ScriptCredential: [scriptHash],
94
- }))
95
- .exhaustive();
90
+ return {
91
+ paymentCredential: {
92
+ PublicKeyCredential: [details.paymentCredential.hash],
93
+ },
94
+ stakeCredential: details.stakeCredential
95
+ ? { Inline: [{ PublicKeyCredential: [details.stakeCredential.hash] }] }
96
+ : undefined,
96
97
  };
97
-
98
- return match(details)
99
- .returnType<AddressD>()
100
- .with(
101
- { paymentCredential: P.nullish },
102
- { type: P.not(P.union('Base', 'Enterprise')) },
103
- (_) => {
104
- throw new Error('Invalid address provided');
105
- },
106
- )
107
- .narrow()
108
- .otherwise((details) => ({
109
- paymentCredential: matchCred(details.paymentCredential),
110
- stakeCredential: details.stakeCredential
111
- ? {
112
- Inline: [matchCred(details.stakeCredential)],
113
- }
114
- : null,
115
- }));
116
98
  }
117
99
 
118
100
  export interface CurrencySymbol {
@@ -1,5 +1,5 @@
1
- import { Data, Datum, Redeemer } from '@lucid-evolution/lucid';
2
- import { AssetClassSchema } from '../../types/generic';
1
+ import { Data, Datum } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
3
 
4
4
  const CDPCreatorParamsSchema = Data.Object({
5
5
  cdpCreatorNft: AssetClassSchema,
@@ -37,10 +37,8 @@ export type CDPCreatorRedeemer = Data.Static<typeof CDPCreatorRedeemerSchema>;
37
37
  export const CDPCreatorRedeemer =
38
38
  CDPCreatorRedeemerSchema as unknown as CDPCreatorRedeemer;
39
39
 
40
- export function serialiseCDPCreatorRedeemer(
41
- params: CDPCreatorRedeemer,
42
- ): Redeemer {
43
- return Data.to<CDPCreatorRedeemer>(params, CDPCreatorRedeemer);
40
+ export function castCDPCreatorRedeemer(params: CDPCreatorRedeemer): Data {
41
+ return Data.castTo(params, CDPCreatorRedeemer);
44
42
  }
45
43
 
46
44
  export function serialiseCDPCreatorDatum(): Datum {
@@ -0,0 +1,88 @@
1
+ import { Data, Datum } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
+ import { OnChainDecimalSchema } from '../on-chain-decimal';
4
+ import { OracleAssetNftSchema } from './price-oracle';
5
+ import { match, P } from 'ts-pattern';
6
+
7
+ export const CDPFeesSchema = Data.Enum([
8
+ Data.Object({
9
+ ActiveCDPInterestTracking: Data.Object({
10
+ lastSettled: Data.Integer(),
11
+ unitaryInterestSnapshot: Data.Integer(),
12
+ }),
13
+ }),
14
+ Data.Object({
15
+ FrozenCDPAccumulatedFees: Data.Object({
16
+ lovelacesTreasury: Data.Integer(),
17
+ lovelacesIndyStakers: Data.Integer(),
18
+ }),
19
+ }),
20
+ ]);
21
+
22
+ export const CDPContentSchema = Data.Object({
23
+ cdpOwner: Data.Nullable(Data.Bytes()),
24
+ iasset: Data.Bytes(),
25
+ mintedAmt: Data.Integer(),
26
+ cdpFees: CDPFeesSchema,
27
+ });
28
+
29
+ export const IAssetContentSchema = Data.Object({
30
+ /** Use the HEX encoding */
31
+ assetName: Data.Bytes(),
32
+ price: Data.Enum([
33
+ Data.Object({ Delisted: OnChainDecimalSchema }),
34
+ Data.Object({
35
+ Oracle: OracleAssetNftSchema,
36
+ }),
37
+ ]),
38
+ interestOracleNft: AssetClassSchema,
39
+ redemptionRatio: OnChainDecimalSchema,
40
+ maintenanceRatio: OnChainDecimalSchema,
41
+ liquidationRatio: OnChainDecimalSchema,
42
+ debtMintingFeePercentage: OnChainDecimalSchema,
43
+ liquidationProcessingFeePercentage: OnChainDecimalSchema,
44
+ stabilityPoolWithdrawalFeePercentage: OnChainDecimalSchema,
45
+ redemptionReimbursementPercentage: OnChainDecimalSchema,
46
+ redemptionProcessingFeePercentage: OnChainDecimalSchema,
47
+ interestCollectorPortionPercentage: OnChainDecimalSchema,
48
+ firstIAsset: Data.Boolean(),
49
+ nextIAsset: Data.Nullable(Data.Bytes()),
50
+ });
51
+
52
+ export const CDPDatumSchema = Data.Enum([
53
+ Data.Object({ CDP: Data.Object({ content: CDPContentSchema }) }),
54
+ Data.Object({ IAsset: Data.Object({ content: IAssetContentSchema }) }),
55
+ ]);
56
+
57
+ export type CDPFees = Data.Static<typeof CDPFeesSchema>;
58
+ export type CDPDatum = Data.Static<typeof CDPDatumSchema>;
59
+ const CDPDatum = CDPDatumSchema as unknown as CDPDatum;
60
+
61
+ export type CDPContent = Data.Static<typeof CDPContentSchema>;
62
+ const CDPContent = CDPContentSchema as unknown as CDPContent;
63
+ export type IAssetContent = Data.Static<typeof IAssetContentSchema>;
64
+ const IAssetContent = IAssetContentSchema as unknown as IAssetContent;
65
+
66
+ export function parseCDPDatum(datum: Datum): CDPContent {
67
+ return match(Data.from<CDPDatum>(datum, CDPDatum))
68
+ .with({ CDP: { content: P.select() } }, (res) => res)
69
+ .otherwise(() => {
70
+ throw new Error('Expected an CDP datum.');
71
+ });
72
+ }
73
+
74
+ export function serialiseCDPDatum(cdpDatum: CDPContent): Datum {
75
+ return Data.to<CDPDatum>({ CDP: { content: cdpDatum } }, CDPDatum);
76
+ }
77
+
78
+ export function parseIAssetDatum(datum: Datum): IAssetContent {
79
+ return match(Data.from<CDPDatum>(datum, CDPDatum))
80
+ .with({ IAsset: { content: P.select() } }, (res) => res)
81
+ .otherwise(() => {
82
+ throw new Error('Expected an IAsset datum.');
83
+ });
84
+ }
85
+
86
+ export function serialiseIAssetDatum(iassetDatum: IAssetContent): Datum {
87
+ return Data.to<CDPDatum>({ IAsset: { content: iassetDatum } }, CDPDatum);
88
+ }
@@ -0,0 +1,21 @@
1
+ import { Data } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
+
4
+ const ExecuteParamsSchema = Data.Object({
5
+ govNFT: AssetClassSchema,
6
+ upgradeToken: AssetClassSchema,
7
+ iAssetToken: AssetClassSchema,
8
+ stabilityPoolToken: AssetClassSchema,
9
+ versionRecordToken: AssetClassSchema,
10
+ cdpValHash: Data.Bytes(),
11
+ sPoolValHash: Data.Bytes(),
12
+ versionRegistryValHash: Data.Bytes(),
13
+ treasuryValHash: Data.Bytes(),
14
+ indyAsset: AssetClassSchema,
15
+ });
16
+ export type ExecuteParams = Data.Static<typeof ExecuteParamsSchema>;
17
+ export const ExecuteParams = ExecuteParamsSchema as unknown as ExecuteParams;
18
+
19
+ export function castExecuteParams(params: ExecuteParams): Data {
20
+ return Data.castTo(params, ExecuteParams);
21
+ }
@@ -0,0 +1,51 @@
1
+ import { Data, Datum } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
+ import { OnChainDecimalSchema } from '../on-chain-decimal';
4
+
5
+ const GovDatumSchema = Data.Object({
6
+ currentProposal: Data.Integer(),
7
+ protocolParams: Data.Object({
8
+ proposalDeposit: Data.Integer(),
9
+ votingPeriod: Data.Integer(),
10
+ effectiveDelay: Data.Integer(),
11
+ expirationPeriod: Data.Integer(),
12
+ collateralFeePercentage: OnChainDecimalSchema,
13
+ proposingPeriod: Data.Integer(),
14
+ totalShards: Data.Integer(),
15
+ minimumQuorum: Data.Integer(),
16
+ maxTreasuryLovelaceSpend: Data.Integer(),
17
+ maxTreasuryIndySpend: Data.Integer(),
18
+ }),
19
+ currentVersion: Data.Integer(),
20
+ iassetsCount: Data.Integer(),
21
+ activeProposals: Data.Integer(),
22
+ treasuryIndyWithdrawnAmt: Data.Integer(),
23
+ });
24
+ export type GovDatum = Data.Static<typeof GovDatumSchema>;
25
+ const GovDatum = GovDatumSchema as unknown as GovDatum;
26
+
27
+ export function parseGovDatum(datum: Datum): GovDatum {
28
+ return Data.from<GovDatum>(datum, GovDatum);
29
+ }
30
+
31
+ export function serialiseGovDatum(d: GovDatum): Datum {
32
+ return Data.to<GovDatum>(d, GovDatum);
33
+ }
34
+
35
+ const GovParamsSchema = Data.Object({
36
+ govNFT: AssetClassSchema,
37
+ pollToken: AssetClassSchema,
38
+ upgradeToken: AssetClassSchema,
39
+ indyAsset: AssetClassSchema,
40
+ versionRecordToken: AssetClassSchema,
41
+ pollManagerValHash: Data.Bytes(),
42
+ gBiasTime: Data.Integer(),
43
+ daoIdentityToken: AssetClassSchema,
44
+ iAssetAuthToken: AssetClassSchema,
45
+ });
46
+ export type GovParams = Data.Static<typeof GovParamsSchema>;
47
+ export const GovParams = GovParamsSchema as unknown as GovParams;
48
+
49
+ export function castGovParams(params: GovParams): Data {
50
+ return Data.castTo(params, GovParams);
51
+ }
@@ -1,5 +1,5 @@
1
1
  import { Data, Datum } from '@lucid-evolution/lucid';
2
- import { OnChainDecimalSchema } from '../../types/on-chain-decimal';
2
+ import { OnChainDecimalSchema } from '../on-chain-decimal';
3
3
 
4
4
  export const InterestOracleDatumSchema = Data.Object({
5
5
  unitaryInterest: Data.Integer(),
@@ -1,6 +1,6 @@
1
1
  import { Data, Datum, Redeemer } from '@lucid-evolution/lucid';
2
- import { AssetClassSchema, OutputReferenceSchema } from '../../types/generic';
3
- import { OnChainDecimalSchema } from '../../types/on-chain-decimal';
2
+ import { AssetClassSchema, OutputReferenceSchema } from '../generic';
3
+ import { OnChainDecimalSchema } from '../on-chain-decimal';
4
4
 
5
5
  export const LRPParamsSchema = Data.Object({
6
6
  versionRecordToken: AssetClassSchema,
@@ -0,0 +1,21 @@
1
+ import { Data } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
+
4
+ const PollManagerParamsSchema = Data.Object({
5
+ govNFT: AssetClassSchema,
6
+ pollToken: AssetClassSchema,
7
+ upgradeToken: AssetClassSchema,
8
+ indyAsset: AssetClassSchema,
9
+ govExecuteValHash: Data.Bytes(),
10
+ pBiasTime: Data.Integer(),
11
+ shardValHash: Data.Bytes(),
12
+ treasuryValHash: Data.Bytes(),
13
+ initialIndyDistribution: Data.Integer(),
14
+ });
15
+ export type PollManagerParams = Data.Static<typeof PollManagerParamsSchema>;
16
+ export const PollManagerParams =
17
+ PollManagerParamsSchema as unknown as PollManagerParams;
18
+
19
+ export function castPollManagerParams(params: PollManagerParams): Data {
20
+ return Data.castTo(params, PollManagerParams);
21
+ }
@@ -0,0 +1,16 @@
1
+ import { Data } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
+
4
+ const PollShardParamsSchema = Data.Object({
5
+ pollToken: AssetClassSchema,
6
+ stakingToken: AssetClassSchema,
7
+ indyAsset: AssetClassSchema,
8
+ stakingValHash: Data.Bytes(),
9
+ });
10
+ export type PollShardParams = Data.Static<typeof PollShardParamsSchema>;
11
+ export const PollShardParams =
12
+ PollShardParamsSchema as unknown as PollShardParams;
13
+
14
+ export function castPollShardParams(params: PollShardParams): Data {
15
+ return Data.castTo(params, PollShardParams);
16
+ }
@@ -1,9 +1,9 @@
1
- import { Data, Datum, Redeemer } from '@lucid-evolution/lucid';
2
- import { AssetClassSchema } from '../../types/generic';
3
- import { OnChainDecimalSchema } from '../../types/on-chain-decimal';
1
+ import { Data, Datum } from '@lucid-evolution/lucid';
2
+ import { AssetClassSchema } from '../generic';
3
+ import { OnChainDecimalSchema } from '../on-chain-decimal';
4
4
 
5
5
  export const OracleAssetNftSchema = Data.Object({
6
- oracleNft: AssetClassSchema,
6
+ oracleNft: Data.Object({ asset: AssetClassSchema }),
7
7
  });
8
8
  export type OracleAssetNft = Data.Static<typeof OracleAssetNftSchema>;
9
9
 
@@ -25,18 +25,6 @@ export const PriceOracleDatumSchema = Data.Object({
25
25
  export type PriceOracleDatum = Data.Static<typeof PriceOracleDatumSchema>;
26
26
  const PriceOracleDatum = PriceOracleDatumSchema as unknown as PriceOracleDatum;
27
27
 
28
- const PriceOracleRedeemerSchema = Data.Object({
29
- currentTime: Data.Integer(),
30
- newPrice: OnChainDecimalSchema,
31
- });
32
- export type PriceOracleRedeemer = Data.Static<typeof PriceOracleRedeemerSchema>;
33
- const PriceOracleRedeemer =
34
- PriceOracleRedeemerSchema as unknown as PriceOracleRedeemer;
35
-
36
- export function serialisePriceOracleRedeemer(r: PriceOracleRedeemer): Redeemer {
37
- return Data.to<PriceOracleRedeemer>(r, PriceOracleRedeemer);
38
- }
39
-
40
28
  export function parsePriceOracleDatum(datum: Datum): PriceOracleDatum {
41
29
  return Data.from<PriceOracleDatum>(datum, PriceOracleDatum);
42
30
  }