diff --git a/blueprint.ts b/blueprint.ts deleted file mode 100644 index 57b7d61..0000000 --- a/blueprint.ts +++ /dev/null @@ -1,247 +0,0 @@ -type ParseBlueprint = { - preamble: { - title: string; - description: string; - version: string; - plutusVersion: string; - license: string; - }; - validators: { - title: string; - datum?: { - title: string; - schema: { - $ref: string; - }; - }; - redeemer: { - title: string; - schema: { - $ref: string; - }; - }; - parameters?: { - title: string; - schema: { - $ref: string; - }; - }[]; - plutarchCode?: boolean, - compiledCode: string; - hash: string; - }[]; - definitions: Record; -}; - -const plutusJson: ParseBlueprint = JSON.parse( - await Deno.readTextFile('plutus.json'), -); - -const plutusVersion = `Plutus${ - plutusJson.preamble.plutusVersion.toUpperCase()}`; - -const { definitions } = plutusJson; - -const imports = `// deno-lint-ignore-file -import { applyParamsToScript, Data, Validator, applyDoubleCborEncoding } from "${ - 'npm:@lucid-evolution/lucid' -}"`; - -const validators = plutusJson.validators.map((validator) => { - const { title } = validator; - const name = (() => { - const dirs = title.split('/') - const [a, b] = dirs[dirs.length - 1].split('.'); - console.log([a, b]) - return upperFirst(snakeToCamel(a)) + upperFirst(snakeToCamel(b)); - })(); - const { datum } = validator; - const datumTitle = datum ? snakeToCamel(datum.title) : null; - const datumSchema = datum ? resolveSchema(datum.schema, definitions) : null; - - const { redeemer } = validator; - const redeemerTitle = snakeToCamel(redeemer.title); - const redeemerSchema = resolveSchema(redeemer.schema, definitions); - - const params = validator.parameters || []; - const plutarchScript = validator.plutarchCode ? true : false; - const paramsSchema = { - dataType: 'list', - items: params.map((param) => resolveSchema(param.schema, definitions)), - }; - const paramsArgs = params.map(( - param, - index, - ) => [snakeToCamel(param.title), schemaToType(paramsSchema.items[index])]); - - const script = validator.compiledCode; - - return `export interface I${name} { - new (${paramsArgs.map((param) => param.join(':')).join(',')}): Validator;${ - datum ? `\n${datumTitle}: ${schemaToType(datumSchema)};` : '' -} - ${redeemerTitle}: ${schemaToType(redeemerSchema)}; - }; - - export const ${name} = Object.assign( - function (${paramsArgs.map((param) => param.join(':')).join(',')}) {${ - (paramsArgs.length > 0 && !plutarchScript) - ? `return { type: "${plutusVersion}", script: applyParamsToScript(applyDoubleCborEncoding("${script}"), [${ - paramsArgs.map((param) => param[0]).join(',') - }], ${JSON.stringify(paramsSchema)}) };` - : `return {type: "${plutusVersion}", script: "${script}"};` -}}, - ${datum ? `{${datumTitle}: ${JSON.stringify(datumSchema)}},` : ''} - {${redeemerTitle}: ${JSON.stringify(redeemerSchema)}}, - ) as unknown as I${name};`; -}); - -const plutus = `${imports}\n\n${validators.join('\n\n')}`; - -await Deno.writeTextFile('plutus.ts', plutus); -await new Deno.Command(Deno.execPath(), { - args: ['fmt', 'plutus.ts'], - stderr: 'piped', -}).output(); -console.log( - '%cGenerated %cplutus.ts', - 'color: green; font-weight: bold', - 'font-weight: bold', -); - -function resolveSchema(schema: any, definitions: any): any { - if (schema.items) { - if (schema.items instanceof Array) { - return { - ...schema, - items: schema.items.map((item: any) => resolveSchema(item, definitions)), - }; - } - return { - ...schema, - items: resolveSchema(schema.items, definitions), - }; - } if (schema.anyOf) { - return { - ...schema, - anyOf: schema.anyOf.map((a: any) => ({ - ...a, - fields: a.fields.map((field: any) => ({ - ...resolveSchema(field, definitions), - title: field.title ? snakeToCamel(field.title) : undefined, - })), - })), - }; - } if (schema.keys && schema.values) { - return { - ...schema, - keys: resolveSchema(schema.keys, definitions), - values: resolveSchema(schema.values, definitions), - }; - } - if (schema.$ref) { - const refKey = schema.$ref.replaceAll('~1', '/').split('#/definitions/')[1]; - return resolveSchema(definitions[refKey], definitions); - } - return schema; -} - -function schemaToType(schema: any): string { - if (!schema) throw new Error('Could not generate type.'); - const shapeType = (schema.anyOf ? 'enum' : '') || schema.dataType; - - switch (shapeType) { - case 'integer': { - return 'bigint'; - } - case 'bytes': { - return 'string'; - } - case 'constructor': { - if (isVoid(schema)) { - return 'undefined'; - } - return `{${ - schema.fields.map((field: any) => `${field.title || 'wrapper'}:${schemaToType(field)}`).join(';') - }}`; - } - case 'enum': { - // When enum has only one entry it's a single constructor/record object - if (schema.anyOf.length === 1) { - return schemaToType(schema.anyOf[0]); - } - if (isBoolean(schema)) { - return 'boolean'; - } - if (isNullable(schema)) { - return `${schemaToType(schema.anyOf[0].fields[0])} | null`; - } - return schema.anyOf.map((entry: any) => (entry.fields.length === 0 - ? `"${entry.title}"` - : `{${entry.title}: ${ - entry.fields[0].title - ? `{${ - entry.fields.map((field: any) => [field.title, schemaToType(field)].join(':')).join(',') - }}}` - : `[${ - entry.fields.map((field: any) => schemaToType(field)).join(',') - }]}` - }`)).join(' | '); - } - case 'list': { - if (schema.items instanceof Array) { - return `[${ - schema.items.map((item: any) => schemaToType(item)).join(',') - }]`; - } - return `Array<${schemaToType(schema.items)}>`; - } - case 'map': { - return `Map<${schemaToType(schema.keys)}, ${ - schemaToType(schema.values) - }>`; - } - case undefined: { - return 'Data'; - } - } - throw new Error('Could not type cast data.'); -} - -function isBoolean(shape: any): boolean { - return shape.anyOf && shape.anyOf[0]?.title === 'False' - && shape.anyOf[1]?.title === 'True'; -} - -function isVoid(shape: any): boolean { - return shape.index === 0 && shape.fields.length === 0; -} - -function isNullable(shape: any): boolean { - return shape.anyOf && shape.anyOf[0]?.title === 'Some' - && shape.anyOf[1]?.title === 'None'; -} - -function snakeToCamel(s: string): string { - const withUnderscore = s.charAt(0) === '_' ? s.charAt(0) : ''; - return withUnderscore - + (withUnderscore ? s.slice(1) : s).toLowerCase().replace( - /([-_][a-z])/g, - (group) => group - .toUpperCase() - .replace('-', '') - .replace('_', ''), - ); -} - -function upperFirst(s: string): string { - const withUnderscore = s.charAt(0) === '_' ? s.charAt(0) : ''; - return withUnderscore - + s.charAt(withUnderscore ? 1 : 0).toUpperCase() - + s.slice((withUnderscore ? 1 : 0) + 1); -} diff --git a/flake.lock b/flake.lock index 3b0d476..3959bba 100644 --- a/flake.lock +++ b/flake.lock @@ -2956,7 +2956,7 @@ }, "locked": { "lastModified": 1656595231, - "narHash": "sha256-3EBhSroECMOSP02qZGT0Zb3QHWibI/tYjdcaT5/YotY=", + "narHash": "sha256-/UzVhInSfS8QTNvuLCzXtrRxhC0sCPB9G8ieu2rIgQA=", "owner": "input-output-hk", "repo": "plutus", "rev": "b39a526e983cb931d0cc49b7d073d6d43abd22b5", @@ -3016,7 +3016,7 @@ }, "locked": { "lastModified": 1656595231, - "narHash": "sha256-3EBhSroECMOSP02qZGT0Zb3QHWibI/tYjdcaT5/YotY=", + "narHash": "sha256-/UzVhInSfS8QTNvuLCzXtrRxhC0sCPB9G8ieu2rIgQA=", "owner": "input-output-hk", "repo": "plutus", "rev": "b39a526e983cb931d0cc49b7d073d6d43abd22b5", @@ -3032,7 +3032,7 @@ "flake": false, "locked": { "lastModified": 1656595231, - "narHash": "sha256-3EBhSroECMOSP02qZGT0Zb3QHWibI/tYjdcaT5/YotY=", + "narHash": "sha256-/UzVhInSfS8QTNvuLCzXtrRxhC0sCPB9G8ieu2rIgQA=", "owner": "input-output-hk", "repo": "plutus", "rev": "b39a526e983cb931d0cc49b7d073d6d43abd22b5", @@ -3140,7 +3140,7 @@ "flake": false, "locked": { "lastModified": 1647139352, - "narHash": "sha256-JyHAQfTTUswP8MeGEZibx/2/v01Q7cU5mNpnmDazh24=", + "narHash": "sha256-NDVzTC/eDhVeulbIg6h/I1z9Nt9G31EqkiM9IBjfhT0=", "owner": "protolude", "repo": "protolude", "rev": "3e249724fd0ead27370c8c297b1ecd38f92cbd5b", @@ -3156,7 +3156,7 @@ "flake": false, "locked": { "lastModified": 1647139352, - "narHash": "sha256-JyHAQfTTUswP8MeGEZibx/2/v01Q7cU5mNpnmDazh24=", + "narHash": "sha256-NDVzTC/eDhVeulbIg6h/I1z9Nt9G31EqkiM9IBjfhT0=", "owner": "protolude", "repo": "protolude", "rev": "3e249724fd0ead27370c8c297b1ecd38f92cbd5b", diff --git a/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyPool.hs b/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyPool.hs index f63bcc6..6c8497f 100644 --- a/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyPool.hs +++ b/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyPool.hs @@ -51,7 +51,7 @@ import qualified Data.ByteString.Base16 as Hex import qualified Data.Text.Encoding as E royaltyWithdrawPoolScriptHash :: BuiltinByteString -royaltyWithdrawPoolScriptHash = BuiltinByteString $ mkByteString . T.pack $ "d80ff7c295e018708f9daf709ab1ce50634959d13247a5f708e8bded" +royaltyWithdrawPoolScriptHash = BuiltinByteString $ mkByteString . T.pack $ "a062da72f9f3280fbed90b3e95ea943aabd7eff9c82343324a9726ad" royaltyStakeCred :: Term s PStakingCredential royaltyStakeCred = pconstant (StakingHash . ScriptCredential . ValidatorHash $ royaltyWithdrawPoolScriptHash) diff --git a/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyWithdrawPool.hs b/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyWithdrawPool.hs deleted file mode 100644 index 141f383..0000000 --- a/plutarch-validators/WhalePoolsDex/PContracts/PDoubleRoyaltyWithdrawPool.hs +++ /dev/null @@ -1,354 +0,0 @@ -module WhalePoolsDex.PContracts.PDoubleRoyaltyWithdrawPool ( - doubleRoyaltyWithdrawPoolValidatorT, -) where - -import qualified GHC.Generics as GHC - -import Plutarch -import Plutarch.Builtin -import Plutarch.Api.V2 -import Plutarch.DataRepr -import Plutarch.Prelude -import Plutarch.Extra.TermCont -import Plutarch.Crypto (pverifyEd25519Signature, pblake2b_256) -import Plutarch.Unsafe (punsafeCoerce) - -import PExtra.API -import PExtra.Monadic (tlet, tletField, tmatch, tcon) -import PExtra.Ada - -import WhalePoolsDex.PContracts.PDoubleRoyaltyWithdrawOrder -import WhalePoolsDex.PContracts.PRoyaltyWithdrawOrder (extractRoyaltyWithdrawConfigFromDatum) -import WhalePoolsDex.PContracts.PDoubleRoyaltyPool (DoubleRoyaltyPoolConfig(..), findPoolOutput) -import Plutarch.Api.V1.Scripts -import Plutarch.Api.V1.Address -import Data.Text as T -import qualified Data.ByteString as BS -import qualified Data.ByteString.Base16 as Hex -import qualified Data.Text.Encoding as E -import Plutarch.Trace - -mkByteString :: T.Text -> BS.ByteString -mkByteString input = unsafeFromEither (Hex.decode . E.encodeUtf8 $ input) - -unsafeFromEither :: (Show b) => Either b a -> a -unsafeFromEither (Left err) = Prelude.error ("Err:" ++ show err) -unsafeFromEither (Right value) = value - -royaltyWithdrawRequestScriptHash :: String -royaltyWithdrawRequestScriptHash = "6710f3002759d028a90a08e1538b25d4eaf48c72d88157f71d68dcc0" - -royaltyWithdrawRequestScriptHashP :: Term s PValidatorHash -royaltyWithdrawRequestScriptHashP = pcon $ PValidatorHash $ phexByteStr royaltyWithdrawRequestScriptHash - -newtype DoubleRoyaltyWithdrawRedeemer (s :: S) - = DoubleRoyaltyWithdrawRedeemer - ( Term - s - ( PDataRecord - '[ "poolInIx" ':= PInteger - , "orderInIx" ':= PInteger - , "signer" ':= PInteger - ] - ) - ) - deriving stock (GHC.Generic) - deriving - (PIsData, PDataFields, PlutusType) - -instance DerivePlutusType DoubleRoyaltyWithdrawRedeemer where type DPTStrat _ = PlutusTypeData - -{-| - Pool Royalty Withdrawal Contract (v2) - - The purpose of the Pool Royalty Withdrawal Contract is to securely manage and validate - royalty withdrawal requests from a liquidity pool that maintains two separate royalty slots. - This contract is triggered by the PRewarding action when a royalty withdrawal is initiated. - It ensures that only legitimate requests are processed, and protects against unauthorized - changes to the pool's state. - - The contract achieves this by enforcing the following rules: - - 1. Restricted Field Modifications: - - Only the fields `firstRoyaltyX`, `firstRoyaltyY`, `secondRoyaltyX`, `secondRoyaltyY`, and `nonce` can be modified. - - The royalty slot being withdrawn from must have its `X` and `Y` values reduced by the corresponding withdrawal amounts. - - The royalty slot not being withdrawn from must remain unchanged. - - The `nonce` must be incremented, ensuring each withdrawal is unique. - - 2. Dual Royalty Slots: - - The pool maintains two separate royalty slots (first and second), each holding `X` and `Y` token values. - - The signer determines which royalty slot they are allowed to withdraw from: - - Signer `0` can withdraw only from the first royalty slot. - - Other signers can withdraw only from the second royalty slot. - - 3. Withdrawal Limits: - - The requested withdrawal amounts for tokens `X` and `Y` must not exceed the current values - of the selected royalty slot (`firstRoyaltyX/Y` or `secondRoyaltyX/Y`). - - The overall `X` and `Y` values in the pool must be reduced accordingly. - - 4. Input Validation: - - A UTXO associated with the User Royalty Withdrawal Contract must be present in the transaction inputs, - ensuring that the request is linked to a legitimate withdrawal process. - - This protects against attempts to redirect royalties to unauthorized addresses by copying the original request. - - 5. Consistency Checks: - - The differences in token values before and after the transaction must match the requested withdrawal amounts. - - The pool's total liquidity (`LQ`) value must remain unchanged. - - The Lovelace amount used in token-to-token pools must remain unchanged. - - 6. Address Integrity: - - The pool address must remain unchanged throughout the process, ensuring that the withdrawal does not - inadvertently or maliciously alter the pool destination. - - 7. Signature Verification: - - The withdrawal request must be signed using the appropriate public key for the selected royalty slot: - - `firstRoyaltyPubKey` for signer `0`. - - `secondRoyaltyPubKey` for other signers. - - The signature must validate over the serialized withdrawal data and current pool nonce. - - 8. Operation Data Representation: - - The `operationRelatedData` is represented by the `WithdrawRoyaltyDataToSign` structure, - which contains the necessary information for validating the transaction. --} - -doubleRoyaltyWithdrawPoolValidatorT :: ClosedTerm (DoubleRoyaltyWithdrawRedeemer :--> PScriptContext :--> PBool) -doubleRoyaltyWithdrawPoolValidatorT = plam $ \redeemer' ctx' -> unTermCont $ do - ctx <- pletFieldsC @'["txInfo", "purpose"] ctx' - redeemer <- pletFieldsC @'["orderInIx", "poolInIx", "signer"] redeemer' - - PRewarding _ <- tmatch (pfromData $ getField @"purpose" ctx) - - txInfo <- pletFieldsC @'["inputs", "outputs"] $ getField @"txInfo" ctx - inputs <- tletUnwrap $ getField @"inputs" txInfo - outputs <- tletUnwrap $ getField @"outputs" txInfo - let - orderInIx = getField @"orderInIx" redeemer - poolInIx = getField @"poolInIx" redeemer - signer = pfromData $ getField @"signer" redeemer - - -- Extract withdraw request utxo - orderIn' <- tlet $ pelemAt # orderInIx # inputs - orderIn <- pletFieldsC @'["outRef", "resolved"] orderIn' - let - orderInput = getField @"resolved" orderIn - inputsQtyIsCorrect = (plength # inputs) #== 2 - - parsedOrderInput <- pletFieldsC @'["datum", "address"] orderInput - - -- Validate royalty withdraw request address - let - royaltyRequestAddr = getField @"address" parsedOrderInput - cred <- tletField @"credential" royaltyRequestAddr - correctOrderInputAddress <- tletUnwrap $ - pmatch cred $ \case - PScriptCredential pcred -> - let skh = pfield @"_0" # pcred - in pif (skh #== royaltyWithdrawRequestScriptHashP) (pdata inputsQtyIsCorrect) perror - _ -> perror - - conf' <- tlet $ extractRoyaltyWithdrawConfigFromDatum parsedOrderInput - conf <- pletFieldsC @'["withdrawData", "signature", "additionalBytes"] conf' - let - signature = getField @"signature" conf - withdrawDataRaw = getField @"withdrawData" conf - additionalBytes = getField @"additionalBytes" conf - withdrawData' = pfromData withdrawDataRaw - - withdrawData <- pletFieldsC @'["poolNft", "withdrawRoyaltyX", "withdrawRoyaltyY", "exFee"] withdrawData' - let - poolNft = getField @"poolNft" withdrawData - withdrawRoyaltyX = getField @"withdrawRoyaltyX" withdrawData - withdrawRoyaltyY = getField @"withdrawRoyaltyY" withdrawData - - -- Extract input pool - poolIn' <- tlet $ pelemAt # poolInIx # inputs - poolIn <- pletFieldsC @'["outRef", "resolved"] poolIn' - let - poolInput = getField @"resolved" poolIn - - parsedPoolInput <- pletFieldsC @'["datum", "address", "value"] poolInput - inputDatum <- tlet $ extractDoubleRoyaltyPoolConfigFromDatum parsedPoolInput - prevConfig <- pletFieldsC @'["poolNft", "poolX", "poolY", "poolLq", "feeNum", "treasuryFee", "firstRoyaltyFee", "secondRoyaltyFee", "treasuryX", "treasuryY", "firstRoyaltyX", "firstRoyaltyY", "secondRoyaltyX", "secondRoyaltyY", "DAOPolicy", "treasuryAddress", "firstRoyaltyPubKey", "secondRoyaltyPubKey", "nonce"] inputDatum - let - {-| - -- To ensure the immutability of the pool datum, all fields should be extracted from the input pool datum, - -- except for the fields related to royalties and the nonce, which are allowed to change. - -- The `firstRoyaltyX`, `firstRoyaltyY`, `secondRoyaltyX`, and `secondRoyaltyY` fields will be utilized - -- to verify the correctness of the withdrawal process. - -} - prevPoolNft = getField @"poolNft" prevConfig - prevPoolX = getField @"poolX" prevConfig - prevPoolY = getField @"poolY" prevConfig - prevPoolLq = getField @"poolLq" prevConfig - prevFeeNum = getField @"feeNum" prevConfig - prevTreasuryFeeNum = getField @"treasuryFee" prevConfig - prevFirstRoyaltyFeeNum = getField @"firstRoyaltyFee" prevConfig - prevSecondRoyaltyFeeNum = getField @"secondRoyaltyFee" prevConfig - prevTreasuryX = getField @"treasuryX" prevConfig - prevTreasuryY = getField @"treasuryY" prevConfig - prevFirstRoyaltyX = getField @"firstRoyaltyX" prevConfig - prevFirstRoyaltyY = getField @"firstRoyaltyY" prevConfig - prevSecondRoyaltyX = getField @"secondRoyaltyX" prevConfig - prevSecondRoyaltyY = getField @"secondRoyaltyY" prevConfig - prevDAOPolicy = getField @"DAOPolicy" prevConfig - prevTreasuryAddress = getField @"treasuryAddress" prevConfig - prevFirstRoyaltyPubKey = getField @"firstRoyaltyPubKey" prevConfig - prevSecondRoyaltyPubKey = getField @"secondRoyaltyPubKey" prevConfig - prevNonce = getField @"nonce" prevConfig - - -- Input value related fields - prevPoolValue = getField @"value" parsedPoolInput - prevXValue = assetClassValueOf # prevPoolValue # prevPoolX - prevYValue = assetClassValueOf # prevPoolValue # prevPoolY - prevLqValue = assetClassValueOf # prevPoolValue # prevPoolLq - - prevLovelaceToken2Token = - pif - ((prevPoolX #== pAdaAssetClass) #|| (prevPoolY #== pAdaAssetClass)) - (pconstant 0) - (assetClassValueOf # prevPoolValue # pAdaAssetClass) - - prevPoolValueLength = pValueLength # prevPoolValue - - -- Input pool address - prevPoolAddr = getField @"address" parsedPoolInput - - -- Pool nft in request equals to pool nft - correctPool = poolNft #== prevPoolNft - - -- Extract info about output pool - poolOutput <- tlet $ findPoolOutput # poolNft # outputs - parsedPoolOutput <- pletFieldsC @'["datum", "address", "value"] poolOutput - outputPoolDatum <- tlet $ extractDoubleRoyaltyPoolConfigFromDatum parsedPoolOutput - newPoolConfig <- pletFieldsC @'["firstRoyaltyX", "firstRoyaltyY", "secondRoyaltyX", "secondRoyaltyY"] outputPoolDatum - let - outputPoolValue = getField @"value" parsedPoolOutput - - {-| - -- In the new pool datum, only the updated values of `royaltyX` and `royaltyY` should be verified. - -- All other fields must remain unchanged from the previous pool datum. - -} - newFirstRoyaltyX = getField @"firstRoyaltyX" newPoolConfig - newFirstRoyaltyY = getField @"firstRoyaltyY" newPoolConfig - newSecondRoyaltyX = getField @"secondRoyaltyX" newPoolConfig - newSecondRoyaltyY = getField @"secondRoyaltyY" newPoolConfig - - -- Output pool value - newPoolValue = getField @"value" parsedPoolOutput - newXValue = assetClassValueOf # newPoolValue # prevPoolX - newYValue = assetClassValueOf # newPoolValue # prevPoolY - newLqValue = assetClassValueOf # newPoolValue # prevPoolLq - - newLovelaceToken2Token = - pif - ((prevPoolX #== pAdaAssetClass) #|| (prevPoolY #== pAdaAssetClass)) - (pconstant 0) - (assetClassValueOf # newPoolValue # pAdaAssetClass) - - newPoolValueLength = pValueLength # newPoolValue - - -- Output pool address - newPoolAddr = getField @"address" parsedPoolOutput - - -- Verifications: - let - -- Pool address is the same - correctFinalPoolAddress = prevPoolAddr #== newPoolAddr - - -- Pool value length (tokens qty) is the same - correctTokensQtyInPool = prevPoolValueLength #== newPoolValueLength - - -- Pool output should contains poolNft - poolIdentity = (assetClassValueOf # outputPoolValue # prevPoolNft) #== 1 - - {-| - The withdrawal must be validated according to the following rules: - - * There are two separate royalty slots (first and second), each with `X` and `Y` token values. - * The signer determines which royalty slot they are allowed to withdraw from: - - Signer `0` can withdraw only from the first royalty slot. - - Other signers can withdraw only from the second royalty slot. - * The withdrawal amount (`withdrawRoyaltyX`, `withdrawRoyaltyY`) must be less than or equal to the corresponding royalty slot value. - * The royalty slot being withdrawn from must be reduced by the withdrawal amount. - * The royalty slot not being withdrawn from must remain unchanged. - * The total liquidity (LQ) value must remain unchanged. - * The overall `X` and `Y` values must be reduced by the corresponding withdrawal amounts. - -} - royaltyWithdrawIsCorrect = - ( pif - (signer #== 0) - ( withdrawRoyaltyX #<= prevFirstRoyaltyX - #&& withdrawRoyaltyY #<= prevFirstRoyaltyY - #&& newFirstRoyaltyX #== (prevFirstRoyaltyX - withdrawRoyaltyX) - #&& newFirstRoyaltyY #== (prevFirstRoyaltyY - withdrawRoyaltyY) - #&& prevSecondRoyaltyX #== newSecondRoyaltyX - #&& prevSecondRoyaltyY #== newSecondRoyaltyY - ) - ( withdrawRoyaltyX #<= prevSecondRoyaltyX - #&& withdrawRoyaltyY #<= prevSecondRoyaltyY - #&& newSecondRoyaltyX #== (prevSecondRoyaltyX - withdrawRoyaltyX) - #&& newSecondRoyaltyY #== (prevSecondRoyaltyY - withdrawRoyaltyY) - #&& prevFirstRoyaltyX #== newFirstRoyaltyX - #&& prevFirstRoyaltyY #== newFirstRoyaltyY - ) - ) #&& prevLqValue #== newLqValue #&& (prevXValue - withdrawRoyaltyX) #== newXValue #&& (prevYValue - withdrawRoyaltyY) #== newYValue - - correctLovelaceToken2Token = prevLovelaceToken2Token #== newLovelaceToken2Token - - -- Signature verification - dataToSign <- - tcon $ (WithdrawRoyaltyDataToSign $ - pdcons @"withdrawData" @WithdrawData # pdata withdrawData' - #$ pdcons @"poolNonce" @PInteger # pdata prevNonce - # pdnil) - - let - dataToSignRaw = (additionalBytes <> pserialiseData # (punsafeCoerce dataToSign)) - - keyToVerify = pif (signer #== 0) prevFirstRoyaltyPubKey prevSecondRoyaltyPubKey - - signatureIsCorrect = pverifyEd25519Signature # keyToVerify # dataToSignRaw # signature - - -- Tx should contains only two inputs: pool, withdraw request - strictInputs = (plength # inputs) #== 2 - - -- New pool config should be the same, except of royalty fields and nonce - expectedConfig <- - tcon $ (DoubleRoyaltyPoolConfig $ - pdcons @"poolNft" @PAssetClass # pdata prevPoolNft - #$ pdcons @"poolX" @PAssetClass # pdata prevPoolX - #$ pdcons @"poolY" @PAssetClass # pdata prevPoolY - #$ pdcons @"poolLq" @PAssetClass # pdata prevPoolLq - #$ pdcons @"feeNum" @PInteger # pdata prevFeeNum - #$ pdcons @"treasuryFee" @PInteger # pdata prevTreasuryFeeNum - #$ pdcons @"firstRoyaltyFee" @PInteger # pdata prevFirstRoyaltyFeeNum - #$ pdcons @"secondRoyaltyFee" @PInteger # pdata prevSecondRoyaltyFeeNum - #$ pdcons @"treasuryX" @PInteger # pdata prevTreasuryX - #$ pdcons @"treasuryY" @PInteger # pdata prevTreasuryY - #$ pdcons @"firstRoyaltyX" @PInteger # pdata newFirstRoyaltyX - #$ pdcons @"firstRoyaltyY" @PInteger # pdata newFirstRoyaltyY - #$ pdcons @"secondRoyaltyX" @PInteger # pdata newSecondRoyaltyX - #$ pdcons @"secondRoyaltyY" @PInteger # pdata newSecondRoyaltyY - #$ pdcons @"DAOPolicy" @(PBuiltinList (PAsData PStakingCredential)) # pdata prevDAOPolicy - #$ pdcons @"treasuryAddress" @PValidatorHash # pdata prevTreasuryAddress - #$ pdcons @"firstRoyaltyPubKey" @PByteString # pdata prevFirstRoyaltyPubKey - #$ pdcons @"secondRoyaltyPubKey" @PByteString # pdata prevSecondRoyaltyPubKey - #$ pdcons @"nonce" @PInteger # pdata (prevNonce + 1) - # pdnil) - - let - finalPoolConfigIsCorrect = expectedConfig #== outputPoolDatum - - withdrawIsCorrect = - correctOrderInputAddress #&& - correctFinalPoolAddress #&& - correctTokensQtyInPool #&& - poolIdentity #&& - royaltyWithdrawIsCorrect #&& - signatureIsCorrect #&& - strictInputs #&& - finalPoolConfigIsCorrect #&& - correctPool #&& - correctLovelaceToken2Token - - pure withdrawIsCorrect diff --git a/plutarch-validators/WhalePoolsDex/PContracts/PRoyaltyPool.hs b/plutarch-validators/WhalePoolsDex/PContracts/PRoyaltyPool.hs index 77cac86..e866616 100644 --- a/plutarch-validators/WhalePoolsDex/PContracts/PRoyaltyPool.hs +++ b/plutarch-validators/WhalePoolsDex/PContracts/PRoyaltyPool.hs @@ -51,7 +51,7 @@ import qualified Data.ByteString.Base16 as Hex import qualified Data.Text.Encoding as E royaltyWithdrawPoolScriptHash :: BuiltinByteString -royaltyWithdrawPoolScriptHash = BuiltinByteString $ mkByteString . T.pack $ "b7f10508f0bca230b30172c17ae98fc11846ff573b4b91b4ea41ffc6" +royaltyWithdrawPoolScriptHash = BuiltinByteString $ mkByteString . T.pack $ "b06af42921ec84197df52d049736ae4e38dc4d568772455c088d7e49" royaltyStakeCred :: Term s PStakingCredential royaltyStakeCred = pconstant (StakingHash . ScriptCredential . ValidatorHash $ royaltyWithdrawPoolScriptHash) diff --git a/plutarch-validators/WhalePoolsDex/PMintingValidators.hs b/plutarch-validators/WhalePoolsDex/PMintingValidators.hs index 105b6cc..efc68c7 100644 --- a/plutarch-validators/WhalePoolsDex/PMintingValidators.hs +++ b/plutarch-validators/WhalePoolsDex/PMintingValidators.hs @@ -8,8 +8,7 @@ module WhalePoolsDex.PMintingValidators ( daoBalanceMintPolicyValidator, royaltyPoolDAOV1Validator, royaltyWithdrawPoolValidator, - doubleRoyaltyPoolDAOV1Validator, - doubleRoyaltyWithdrawPoolValidator + doubleRoyaltyPoolDAOV1Validator ) where import Plutarch @@ -29,7 +28,6 @@ import qualified WhalePoolsDex.PContracts.PFeeSwitchBalancePool as BDao import qualified WhalePoolsDex.PContracts.PRoyaltyDAOV1 as PRDAOV1 import qualified WhalePoolsDex.PContracts.PDoubleRoyaltyDAOV1 as PDRDAOV1 import qualified WhalePoolsDex.PContracts.PRoyaltyWithdrawPool as PRWP -import qualified WhalePoolsDex.PContracts.PDoubleRoyaltyWithdrawPool as PRDWP import Data.ByteString (ByteString) cfgForMintingValidator :: Config @@ -85,10 +83,3 @@ royaltyWithdrawPoolValidator = mkMintingPolicy cfgForMintingValidator $ wrapMintingValidator $ PRWP.royaltyWithdrawPoolValidatorT - -doubleRoyaltyWithdrawPoolValidator :: MintingPolicy -doubleRoyaltyWithdrawPoolValidator = - mkMintingPolicy cfgForMintingValidator $ - wrapMintingValidator $ - PRDWP.doubleRoyaltyWithdrawPoolValidatorT - diff --git a/plutarch-validators/plutarch-validators.cabal b/plutarch-validators/plutarch-validators.cabal index 6cdfb77..8f14e5e 100644 --- a/plutarch-validators/plutarch-validators.cabal +++ b/plutarch-validators/plutarch-validators.cabal @@ -115,7 +115,6 @@ library WhalePoolsDex.PContracts.PDoubleRoyaltyDeposit WhalePoolsDex.PContracts.PDoubleRoyaltyRedeem WhalePoolsDex.PContracts.PDoubleRoyaltyDAOV1 - WhalePoolsDex.PContracts.PDoubleRoyaltyWithdrawPool WhalePoolsDex.PContracts.PDoubleRoyaltyWithdrawOrder WhalePoolsDex.PContracts.PPoolBFee WhalePoolsDex.PContracts.PRedeem diff --git a/plutarch-validators/test/Spec.hs b/plutarch-validators/test/Spec.hs index 43e1a1c..3f2b0d5 100644 --- a/plutarch-validators/test/Spec.hs +++ b/plutarch-validators/test/Spec.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE BlockArguments #-} + module Main(main) where import WhalePoolsDex.PMintingValidators @@ -12,6 +14,7 @@ import Tests.Api import Tests.FeeSwitch import Tests.FeeSwitchBFee import Tests.BalancePool +-- import Tests.RoyaltyWithdraw import Test.Tasty import Test.Tasty.HUnit @@ -22,10 +25,86 @@ import Plutarch.Api.V2 import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as LBS import Codec.Serialise (serialise, deserialise) +import qualified Data.ByteString.Base16 as Hex +import qualified Data.Text.Encoding as E +import qualified Data.ByteString.Short as SBS +import qualified PlutusLedgerApi.V2 as PlutusV2 +import qualified Data.Text as T +import PlutusTx.Builtins.Internal (BuiltinByteString(..)) +import PlutusLedgerApi.V1.Value import Debug.Trace +mkPubKeyHash :: String -> PubKeyHash +mkPubKeyHash str = PubKeyHash $ BuiltinByteString $ mkByteString . T.pack $ str + +mkByteString :: T.Text -> BS.ByteString +mkByteString input = unsafeFromEither (Hex.decode . E.encodeUtf8 $ input) + +unsafeFromEither :: (Show b) => Either b a -> a +unsafeFromEither (Left err) = Prelude.error ("Err:" ++ show err) +unsafeFromEither (Right value) = value + +mintingPolicyHash :: MintingPolicy -> MintingPolicyHash +mintingPolicyHash = + MintingPolicyHash + . getScriptHash + . scriptHash + . PlutusV2.getMintingPolicy + main :: IO () -main = defaultMain tests +main = do + -- defaultMain test123 + let + -- nftCS = "e07f13716ab4dfffb388ad7c67a6ed6642dc9f1145f5c3077ecd33e8" + -- nftTN = "6e6674" + + -- cs = CurrencySymbol $ BuiltinByteString $ mkByteString $ T.pack nftCS + -- tn = TokenName $ BuiltinByteString $ mkByteString $ T.pack nftTN + -- ac = AssetClass (cs, tn) + + pk1 = (mkByteString . T.pack $ "0bb1d2db22f9b641f0afe8d8a398279cb778d8f86167500f7e63ebbdc35b4d69") + pk2 = (mkByteString . T.pack $ "4e8221615500dbf6737b02992610ffeed82da6826dc3d9729febf1d32d766615") + pk3 = (mkByteString . T.pack $ "ae536160ccec4f078982396125773d509072397e35ed6fab7af2a762ca147318") + pk4 = (mkByteString . T.pack $ "04e3a257bcb0306c27e796bc16d1b7bde8f2306dc1d6aa344f6043ef48bd7fd8") + pk5 = (mkByteString . T.pack $ "83d3aa4ccd1c72ff7a27c032394f44b699778b6050290e37fd82bc295f5caf18") + pk6 = (mkByteString . T.pack $ "a7d30e99673c57638bdb65b5a0554ddee3135131940a41bbd3534b0d4c709506") + -- hash = validatorHash + + doubelRoyaltyDaoValidator = doubleRoyaltyPoolDAOV1Validator [pk1, pk2, pk3, pk4, pk5, pk6] 4 True + + doubleRoyaltyPoolHash = validatorHash doubleRoyaltyPoolValidator + royaltyPoolHash = validatorHash royaltyPoolValidator + daoV1ValidatorHash = mintingPolicyHash doubelRoyaltyDaoValidator + royaltyDoubleDepositHash = validatorHash doubleRoyaltyDepositValidator + royaltyDoubleRedeemHash = validatorHash doubleRoyaltyRedeemValidator + daoV1OrderValidatorHash = validatorHash royaltyPooldaoV1ActionOrderValidator + royaltyWithdrawOrderValidatorHash = validatorHash royaltyWithdrawOrderValidator + + royaltyWithdrawOrder = LBS.toStrict $ serialise (unValidatorScript royaltyWithdrawOrderValidator) + doubleRoyaltyPool = LBS.toStrict $ serialise (unValidatorScript doubleRoyaltyPoolValidator) + royaltyPool = LBS.toStrict $ serialise (unValidatorScript royaltyPoolValidator) + doubleRoyaltyPoolDeposit = LBS.toStrict $ serialise (unValidatorScript doubleRoyaltyDepositValidator) + doubleRoyaltyPoolRedeem = LBS.toStrict $ serialise (unValidatorScript doubleRoyaltyRedeemValidator) + daoV1Validator = LBS.toStrict $ serialise (unMintingPolicyScript doubelRoyaltyDaoValidator) + -- daoV1OrderValidator = LBS.toStrict $ serialise (unValidatorScript royaltyPooldaoV1ActionOrderValidator) + + -- traceM $ "royaltyWithdraw doueble pool hash: " ++ show doubleRoyaltyWithdrawPoolHash + traceM $ "roaylty double pool hash: " ++ show doubleRoyaltyPoolHash + traceM $ "roaylty pool hash: " ++ show royaltyPoolHash + -- traceM $ "roaylty double pool deposit: " ++ show royaltyDoubleDepositHash + -- traceM $ "roaylty double pool redeem: " ++ show royaltyDoubleRedeemHash + -- traceM $ "roaylty dao v1 order hash: " ++ show daoV1OrderValidatorHash + traceM $ "double roaylty withdraw v1 order : " ++ show royaltyWithdrawOrderValidatorHash + BS.writeFile ("/home/bromel/projects/whalepools-core/plutarch-validators/royaltyPool.uplc") royaltyPool + BS.writeFile ("/home/bromel/projects/whalepools-core/plutarch-validators/doubleRoyaltyPool.uplc") doubleRoyaltyPool + -- BS.writeFile ("/home/bromel/projects/whalepools-core/plutarch-validators/doubleRoyaltyDeposit.uplc") doubleRoyaltyPoolDeposit + -- BS.writeFile ("/home/bromel/projects/whalepools-core/plutarch-validators/doubleRoyaltyRedeem.uplc") doubleRoyaltyPoolRedeem + -- BS.writeFile ("/home/bromel/projects/whalepools-core/plutarch-validators/doubleRoyaltyDAOV1.uplc") daoV1Validator + --BS.writeFile ("/home/bromel/projects/whalepools-core/plutarch-validators/royaltyDAOV1Order.uplc") daoV1OrderValidator + pure () + +-- test123 = testGroup "TestGroup" +-- [ royaltyWithdraw ] tests = testGroup "Contracts" [ feeSwitch diff --git a/aiken.lock b/validators_v2/aiken.lock similarity index 100% rename from aiken.lock rename to validators_v2/aiken.lock diff --git a/aiken.toml b/validators_v2/aiken.toml similarity index 100% rename from aiken.toml rename to validators_v2/aiken.toml diff --git a/lib/splash/orders/spot.ak b/validators_v2/lib/splash/orders/spot.ak similarity index 100% rename from lib/splash/orders/spot.ak rename to validators_v2/lib/splash/orders/spot.ak diff --git a/lib/splash/orders/types.ak b/validators_v2/lib/splash/orders/types.ak similarity index 100% rename from lib/splash/orders/types.ak rename to validators_v2/lib/splash/orders/types.ak diff --git a/lib/splash/plutus.ak b/validators_v2/lib/splash/plutus.ak similarity index 100% rename from lib/splash/plutus.ak rename to validators_v2/lib/splash/plutus.ak diff --git a/lib/splash/rational.ak b/validators_v2/lib/splash/rational.ak similarity index 100% rename from lib/splash/rational.ak rename to validators_v2/lib/splash/rational.ak diff --git a/lib/splash/stableswap/test_utils.ak b/validators_v2/lib/splash/stableswap/test_utils.ak similarity index 100% rename from lib/splash/stableswap/test_utils.ak rename to validators_v2/lib/splash/stableswap/test_utils.ak diff --git a/lib/splash/stableswap/types.ak b/validators_v2/lib/splash/stableswap/types.ak similarity index 100% rename from lib/splash/stableswap/types.ak rename to validators_v2/lib/splash/stableswap/types.ak diff --git a/lib/splash/stableswap/utils.ak b/validators_v2/lib/splash/stableswap/utils.ak similarity index 100% rename from lib/splash/stableswap/utils.ak rename to validators_v2/lib/splash/stableswap/utils.ak diff --git a/lib/splash/value_ext.ak b/validators_v2/lib/splash/value_ext.ak similarity index 100% rename from lib/splash/value_ext.ak rename to validators_v2/lib/splash/value_ext.ak diff --git a/validators_v2/plutus.json b/validators_v2/plutus.json new file mode 100644 index 0000000..c422bbd --- /dev/null +++ b/validators_v2/plutus.json @@ -0,0 +1,1089 @@ +{ + "preamble": { + "title": "spectrum/splash", + "description": "Aiken contracts for project 'spectrum/splash'", + "version": "0.0.0", + "plutusVersion": "v2", + "compiler": { + "name": "Aiken", + "version": "v1.0.26-alpha+075668b" + }, + "license": "Apache-2.0" + }, + "validators": [ + { + "title": "beacon.beacon", + "redeemer": { + "title": "_", + "schema": { + "$ref": "#/definitions/Data" + } + }, + "parameters": [ + { + "title": "ref", + "schema": { + "$ref": "#/definitions/aiken~1transaction~1OutputReference" + } + } + ], + "compiledCode": "5901e301000032323232323232222533300432533233006300130073754004264a6646601066e212000332232533300b3370e900118061baa0011480004dd6980818069baa00132533300b3370e900118061baa00114c103d87a80001323300100137566022601c6ea8008894ccc040004530103d87a8000132323253330103371e911010100375c602200626012660286ea00052f5c026600a00a0046eb4c044008c050008c048004c8cc00400400c894ccc03c0045300103d87a80001323232533300f3371e00c6eb8c04000c4c020cc04cdd3000a5eb804cc014014008dd598080011809801180880099198008009bab300e300f300f300f300f300b3754600660166ea8018894ccc03400452f5bded8c0264646464a66601c66e3d2201000021003133012337606ea4008dd3000998030030019bab300f003375c601a0046022004601e0026eb8c034c028dd50020992999804980218051baa00113375e600660166ea8c038c02cdd50008040b1999180080091129998070010a6103d87a800013232533300d300800313006330110024bd70099980280280099b8000348004c04800cc040008dd6180118051baa3002300a375400a90001ba548000528918060009b874800058c024c028c018dd50008a4c26cacae6955ceaab9e5573eae815d0aba201", + "hash": "95c393d81a8c0bf94ea6226b2da4193a08bf71c1c6afb3c14e01ae58" + }, + { + "title": "liquidity_locker.liquidity_locker", + "datum": { + "title": "conf", + "schema": { + "$ref": "#/definitions/liquidity_locker~1Config" + } + }, + "redeemer": { + "title": "successor_ix", + "schema": { + "$ref": "#/definitions/Int" + } + }, + "compiledCode": "5904040100003232323232323223232322322533300832323253323300c3001300d37540042646464a66601e601a60206ea80044c8c8c8c94ccc04cc044c050dd500089919299980a9991191980080080191299980e0008a50132533301a3371e6eb8c07c008010528899801801800980f8009bac301a301b301b301b301b301b301b301b301b301737546012602e6ea8038dd71803180b9baa014100114a0a66602866ebcc020c058dd50021804180b1baa00113253330153370e9002180b1baa00113232323253330193233001001323300100137566018603a6ea802c894ccc07c00452f5c0264666444646600200200644a66604a00220062646604e6e9ccc09cdd4803198139ba9375c60480026604e6ea0dd69812800a5eb80cc00c00cc0a4008c09c004dd7180f0009bab301f001330030033023002302100122533301e00114a2264a666038646466e24dd6981198120009991192999810980b18111baa0011480004dd6981318119baa0013253330213016302237540022980103d87a8000132330010013756604e60486ea8008894ccc098004530103d87a8000132323253330263371e00e6eb8c09c00c4c064cc0a8dd4000a5eb804cc014014008dd698138011815001181400099198008008051129998128008a6103d87a8000132323253330253371e00e6eb8c09800c4c060cc0a4dd3000a5eb804cc014014008dd59813001181480118138009bae3023002375c604600260460026eb0c0840084cc00c00c004528181080088008a50337126eb4c030c068dd500b9bad300c301a37540066eacc020c064dd50021809800980d180b9baa001163003301637540022664464a66602e601860306ea80044c94ccc060c94ccc070c06c00454ccc064c038c0680045288a99980c980b980d0008a5016163754601260346ea8c030c068dd5002099b880030011337120060026eb4c070c064dd50008a50300a30183754601460306ea8008c064c068c068c068c068c068c068c068c058dd50059bad3008301637540266030602a6ea800458ccc8c0040048894ccc0600085300103d87a800013232533301730150031300a3301b0024bd70099980280280099b8000348004c07000cc068008dd61800980a1baa00900c2301730183018001300130123754602a60246ea80088c054c05800458cc88c8cc00400400c894ccc054004530103d87a80001323253330143375e6010602c6ea80080144c01ccc0600092f5c02660080080026032004602e0026eb0c008c040dd5002980998081baa004374a9000118090009b874800858c03cc040008c038004c028dd50008a4c26cac6eb4004c00400c94ccc010c008c014dd5000899191919299980598070010a4c2c6eb8c030004c030008dd6980500098031baa00116370e90002b9a5573aaae7955cfaba05742ae89", + "hash": "9e310043d0abbd80b17a54a05ae409fc7efefecb4bba55f594bf763d" + }, + { + "title": "orders/auction.auction", + "datum": { + "title": "conf", + "schema": { + "$ref": "#/definitions/orders~1auction~1Config" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/orders~1auction~1Action" + } + }, + "compiledCode": "590717010000323232323232322323223232253330083232533300a3008300b375400c2646464646464a666020601660226ea80044c8c94ccc048c040c04cdd5000899191919191919191919299980e180d180e9baa001132323232323232323232323232323232323232533302f0171533302f0011533302f0051533302f002100614a029405280a5032533302f302d303037540022a66605e66e3cdd7181398189baa02e375c606860626ea80044c0b4034528099baf30263031375402c604c60626ea804cc094c0c0dd5181298181baa0123370e66e08018ccc004008dd6980b18179baa3013302f37540584466e0800920d00f33704a66605a010266e04cdc0806805802899b8100d00b333001002375a6048605e6ea8c04cc0bcdd50161119b82002375a6068606a606a606a606a606a606a60626ea80b8888c8ccc00400401000c8894ccc0d400840044ccc00c00cc0e0008cc010004dd6981b8011919800800a400044a66605a66e2008800452f5c02660626ea0004cc008008cdc0000a400466e2120000035333029533302900514a2200829444cdc49919b8130013756602660586ea8044c004dd5980998161baa00e233300b0014881004881000013370666e08004dd6980f98151baa002375a602260546ea80094ccc09c00c4cdc199b823370200800c6eb4c040c0a4dd500099b80375a602060526ea8004dd6980f18149baa00113370200800c602260506ea8094cdc78042441003371e00c91010033300437566018604a6ea801c014dd7180618129baa300c302537540446660066eacc02cc090dd50030029bae300b30243754603260486ea8084ccc008dd5980518119baa008003375c601460466ea8c028c08cdd50101998009bab30093022375400e0066eb8c024c088dd5180b98111baa01f222325333023301e302437540022900009bad30283025375400264a666046603c60486ea80045300103d87a80001323300100137566052604c6ea8008894ccc0a0004530103d87a8000132323253330283371e00e6eb8c0a400c4c060cc0b0dd4000a5eb804cc014014008dd698148011816001181500099198008008021129998138008a6103d87a8000132323253330273371e00e6eb8c0a000c4c05ccc0acdd3000a5eb804cc014014008dd59814001181580118148009bae301530203754600e60406ea8074dd7180a180f9baa3014301f37540386042603c6ea800458ccc8c0040048894ccc0840085300103d87a8000132325333020301e00313010330240024bd70099980280280099b8000348004c09400cc08c008dd61800980e9baa00d00f23020302130210013002301b3754603c60366ea80214ccc060cdc40069bad301d301e301e301e301e301e301a375402e2a66603064a666032602860346ea80044c94ccc068c94ccc078c07400454ccc06cc058c0700045288a99980d980c980e0008a5016163754600660386ea8c044c070dd5002099b8800700113371200e0026eb4c078c06cdd50008a50300f301a3754601e60346ea80084c94ccc064c050c068dd5000899299980d19299980f180e8008a99980d980b180e0008a511533301b3019301c00114a02c2c6ea8c00cc070dd51801980e1baa00413371000200c266e24004018dd6980f180d9baa00114a0601e60346ea8c004c068dd50010a5014a04603a603c002600260306ea80208c06cc070c070c070c070c070c070c070004cdc000080119b80375a6030603260326032602a6ea8048cdc10008041bad30173018301830183018301437540222c6644646600200200644a6660300022980103d87a80001323253330173375e601c60326ea80080144c01ccc06c0092f5c0266008008002603800460340026eb0c020c04cdd5001980b18099baa002374a90000b180a180a801180980098079baa006375a602260240046eb4c040004c030dd50030999119198008008019129998088008a50132533300f3371e6eb8c050008010528899801801800980a0009bac3002300c3754600260186ea800cdd7180118061baa0092300f0012300e300f300f300f300f300f300f300f300f00114984d958c94ccc01cc0140044c8c8c8c94ccc038c04400852616375a601e002601e0046eb4c034004c024dd50018a99980398010008a99980518049baa00314985858c01cdd50011b8748008c8c94ccc014c00cc018dd50020991919191919191919191919191919191919299980d180e80109919191924c602c00c602a01e602a02060280222c6eb8c06c004c06c008c064004c064008dd6980b800980b8011bad30150013015002375a602600260260046eb4c044004c044008c03c004c03c008c034004c034008c02c004c01cdd50020b12999802980198031baa001132323232533300c300f002149858dd6980680098068011bad300b001300737540022c4a6660086004600a6ea80044c8c8c8c94ccc02cc03800852616375c601800260180046eb8c028004c018dd50008b1b87480015cd2ab9d5573caae7d5d02ba157441", + "hash": "fbc59e20bd55b1b521db154643fb359020bdfc8da40120946c89c08a" + }, + { + "title": "orders/grid.grid_native", + "datum": { + "title": "state", + "schema": { + "$ref": "#/definitions/orders~1grid~1GridStateNative" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/orders~1grid~1Action" + } + }, + "compiledCode": "5908350100003232323232323223232322322533300832323232323232533300f300c3010375400a264646464a666026602260286ea80384c8c94ccc054c04cc058dd500089919299980b980a980c1baa0011323232323232323232323232323232323232323232323232323232323232323232323232533303b3370e9002181e1baa00113232533303d006100114a064a646466607e02e26464646464a66608866e2002d20001533304400415333044003100114a0294052819baf0083032330473038304537540846608e04e6608e04a6608e0466608e6ea0084cc11cdd419b8001f00a3304753330430011330073006375a6070608a6ea8094c014dd6981998229baa025101d330473330433330430014a094530103d87a80004c0103d87980003304737500326608e6ea005ccc11cdd400a99823809998239ba90124bd7019b89375a608e6090609060906090609060886ea810400ccdc49801801180200499b89012008337029000003099191919299982199b8800b4800054ccc10c01054ccc10c00c40045280a5014a066ebc01cc0c4cc118c0dcc110dd5020998230131982301219823011198231ba80203304637500406608ca66608400226600c600a6eb4c0dcc110dd501118021bad30323044375404420386608c66608400298103d87a80004c0103d87980003304637500306608c6ea0058cc118dd400a19823009198231ba90114bd70181f80599b893370466e052000008375a606a60846ea8068cdc10039bad30303042375403466e2404c018dc11bad302e304037540306e08dd69819181f9baa01722302d330423750004660846ea00052f5c06080607a6ea800458c0b4c0f0dd501199b80337026eb4c0ecc0f8dd5981d981f0109bad303b303e37566076607c04801e66e04008cccc00cc0f808c01401120063034333300201e375c607803a91010048018cccc00407400c0092006222232333001001005002222533303c3371090000008a99981f8010a40002646464a66607e66e3cdd718200018048991919299982119b8f375c608600601620022a66608a004290000a999822982400109919299982219b8f375c608a00401a2002290001bad3045001304700216375a6086004608c0046088002266600c00c00466e00011200137566080004608600660820042c6eb8c0e4c0e8008dd7181c000981a1baa3022303437540626eb8c0d8c0dc008c0d4004c0d4008dd6981980098198011bad30310013031002375a605e002605e00466e21200030293754605a002605a004605600260560046eb4c0a4004c0a4008dd698138009813801181280098128011811800981180118108009810800980e1baa019301f0013756601060346ea8004c070c064dd50008b19991800800911299980e0010a60103d87a800013232533301b30190031300a3301f0024bd70099980280280099b8000348004c08000cc07800802000cdd59802980b9baa3005301737546034602e6ea800458cc008020014dd6980c180a9baa00e132325333015301230163754002264a66602c6028602e6ea80044c8c8c94ccc06401854ccc06400840045280a503375e601a60346ea8008c074c078c078c078c078c078c078c078c078c078c078c078c068dd500b99baf300730193754600e60326ea8c070c064dd50011803980c9baa001301b0081633003009301a301737540022c6008602c6ea8034cc88c8cc00400400c894ccc068004528099299980c19b8f375c603a00400829444cc00c00c004c074004dd6180c180c980c980c980c980c980c980c980c980a9baa00a375c6030603260326032603260326032603260326032603260326032602a6ea804888c8cc00400400c894ccc064004530103d87a80001323253330183375e601a60346ea80080144c01ccc0700092f5c0266008008002603a00460360026e95200023016301700130143011375400a2c6eb0c004c040dd500291809980a180a0009bac3001300e375400646022002601e6020004601c00260146ea800452613656325333007300500113232533300c300f002149858dd6980680098049baa0021533300730040011533300a300937540042930b0b18039baa0013232533300630043007375400a26464646464646464646464646464646464646464646464646464a666046604c00426464646464932999812181118129baa007132323232533302b302e00213232498c94ccc0a8c0a00044c8c94ccc0bcc0c80084c92632533302d302b0011323253330323035002132498c0ac00458c0cc004c0bcdd50010a99981698150008991919191919299981b181c8010a4c2c6eb4c0dc004c0dc008dd6981a800981a8011bad3033001302f37540042c605a6ea800458c0c0004c0b0dd50018a99981518138008a99981698161baa00314985858c0a8dd500118120018b18160009816001181500098131baa00716301e010301d015301c0165333020301e3021375402e264646464a66604e60540042930b1bae30280013028002375c604c00260446ea805c5858dd718120009812001181100098110011bad30200013020002375a603c002603c0046eb4c070004c070008c94ccc064c06000454ccc058c04cc05c0045288a99980b180a180b8008a501616375460340026034004603000260300046eb4c058004c058008dd6980a000980a0011809000980900118080009808001180700098070011bae300c0013008375400a2c4a66600c6008600e6ea80044c8c8c8c94ccc034c04000852616375a601c002601c0046eb4c030004c020dd50008b1192999803180200089919299980598070010a4c2c6eb8c030004c020dd50010a999803180180089919299980598070010a4c2c6eb8c030004c020dd50010b18031baa001370e90011b87480015cd2ab9d5573caae7d5d02ba157441", + "hash": "6eff899ca605c05c115f0d7b0d0397e2dd886cd366d77bcb4ac65922" + }, + { + "title": "orders/instant_order.batch_witness", + "redeemer": { + "title": "_", + "schema": { + "$ref": "#/definitions/Data" + } + }, + "compiledCode": "5906cf01000032323232323232225333003325332330053001300637546004600e6ea800c4c8c8c8c8cccc8888c8cccc004004014011289111299980a001880089919299980b0020a501323333007007002301a0055333014004133300800300100914a060300086030008602c0066eb0c010c02cdd50019bac3001300b37540066eb0c008c02cdd500199191919191919191111919299980b1809180b9baa00113253330173375e60386eb0c064c8cdd81ba83019001374e60340026ea8005301024101001323232323232323232323232323232323232323232323232533302f5323330303375e006605a60646ea80684c8c94ccc0c8cdc499b82009375a605a60686ea801ccdc12999819009899b80300200c00a100c375a605e60686ea801c400452829998188098980119b803001008009153330310121300200815333031300200813371266e05200000a300100914a06e000184c94ccc0c4c0b4c0c8dd500089919191919191919191919299981e19b89337040106eb4c0dcc0f8dd500899b82533303c01d133700600802c028202c6eb4c0e4c0f8dd50088a99981e0028a99981e0018a99981e00108008a5014a0294052819baf00a3232323232323374a9000198229823003198229823002998229823002198229ba800e330453046003330453046002330453046001330453750018608e608e002608c002608a0026088608800260860026084002607a6ea8094cdd7807006a99981c80d8980519b8030010050111533303901a1300a00515333039300a00513371266e052000012300101114a06e00008cdc480099b833370400601a01c66e04030004dd69812981b9baa004337020160026eb4c090c0d4dd50011812800981b18199baa0011630283032375403c6e24cdc0a99981780888068999981080700a80a2400ca66605e02220142666604201602a028900308008a503371e6eb8c09cc0c0dd500c1bae303301b3028302f3754036604e605c6ea8060c0c0c0c4c0c4c0c4c0c4c0c4c0c4c0b4dd500a9bad301a302c37540286eb4c068c0acdd50099bad302d302e302e302e302e302a375402466e04008014cdc0a99981300388008999980c001005004a400ca66604c00e20082666603000a01401290031bad3027302a3756604e605400460540026eacc080c094dd50089bad3024302737566048604e004604e0026eacc074c088dd500619b8f003489003371e008910100375c6034603e6ea8010dd7180b980f1baa003375c6030603a6ea800cdd7180a980e1baa002301e301f301f301f301f301f301b3754006602060346ea8008c028004528980d980c1baa00114a2601a602e6ea8004c044c058dd50019180b180b980b980b980b980b980b980b8009180a980b180b180b000911119199800800802801111299980a99b884800000454ccc06000852000132323253330183371e6eb8c06400c0244c8c8c94ccc06ccdc79bae301c00300b10011533301e00214800054ccc078c0840084c8c94ccc074cdc79bae301e00200d1001148000dd6980f00098100010b1bad301c002301f002301d00113330060060023370000890009bab3019002301c003301a002162533300e3005300f37540022646464646464646464646464646464646464646464646464a6660526058004264646464932999814981018151baa00e13232323253330303033002149858dd6981880098188011bad302f001302b375401c2c603801e6036028a66604c603a604e6ea80544c8c8c8c94ccc0b4c0c00084c8c92632533302c30230011323253330313034002132498c94ccc0bcc0980044c8c94ccc0d0c0dc0084c9263026001163035001303137540042a66605e604a0022646464646464a66607060760042930b1bad30390013039002375a606e002606e0046eb4c0d4004c0c4dd50010b18179baa001163032001302e37540062a66605860440022a66605e605c6ea800c5261616302c3754004603e0062c605c002605c004605800260506ea80545858dd7181500098150011bae30280013028002375a604c002604c0046eb8c090004c090008dd69811000981100118100009810001180f000980f0011bad301c001301c002375a6034002603400460300026030004602c002602c0046eb8c050004c040dd50008b12999806980218071baa00113232323253330143017002149858dd7180a800980a8011bae3013001300f37540022c464a66601a600800226464a666024602a0042930b1bae3013001300f37540042a66601a600600226464a666024602a0042930b1bae3013001300f37540042c601a6ea8004dc3a40046e1d20002300e300f300f0012300d300e300e300e300e300e300e300e300e001300130083754008460160026e1d20041623009300a00114984d9595cd2ab9d5573caae7d5d02ba15745", + "hash": "152e7a364d285842494bb356ddd54ab46eb8360c9fecf5e792525298" + }, + { + "title": "orders/instant_order.instant_order", + "datum": { + "title": "conf", + "schema": { + "$ref": "#/definitions/orders~1instant_order~1InstantOrderConfig" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/Bool" + } + }, + "parameters": [ + { + "title": "witness", + "schema": { + "$ref": "#/definitions/aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential" + } + } + ], + "compiledCode": "59042c0100003232323232323222323232232253330093232533300b00413375e601860206eacc040c044c044c044c044c044c044c034dd500080509919192999807180518079baa001132533300f300c30103754002264646464a6660260102a6660260062a666026004200229405280a50337126eb4c05cc060c060c060c060c060c060c060c060c060c050dd5008191919299980a9808980b1baa0021325333016002100116375a6034602e6ea800858cdc424000602a6ea8c064c068008c060004c050dd51804980a1baa301730183018301830183018301830183014375401066ebcc020c04cdd5001180298099baa00f3375e600860246ea8c010c048dd5180a98091baa00230043012375400260286eb0c050c054c054c044dd50028b1991191980080080191299980a8008a60103d87a80001323253330143375e6016602c6ea80080144cdd2a40006603000497ae0133004004001301900230170013758600a60206ea8010c04cc040dd50008b180098079baa0052301230130013322323300100100322533301200114a0264a66602066e3cdd7180a8010020a5113300300300130150013758602060226022602260226022602260226022601a6ea8004dd71808180898089808980898089808980898089808980898069baa0093001300c37540044601e00229309b2b19299980598050008a999804180218048008a51153330083005300900114a02c2c6ea8004c8c94ccc01cc010c020dd500289919191919191919191919191919191919191919191919192999811181280109919191924ca666044603e60466ea80384c8c8c8c94ccc0a4c0b000852616375a605400260540046eb4c0a0004c090dd50070b180d807980d00a299980f980e18101baa0151323232325333026302900213232498c94ccc094c0880044c8c94ccc0a8c0b40084c926325333028302500113232533302d3030002132498c09400458c0b8004c0a8dd50010a999814181200089919191919192999818981a0010a4c2c6eb4c0c8004c0c8008dd6981800098180011bad302e001302a37540042c60506ea800458c0ac004c09cdd50018a99981298108008a99981418139baa00314985858c094dd5001180f0018b18138009813801181280098109baa0151616375c604600260460046eb8c084004c084008dd6980f800980f8011bae301d001301d002375a6036002603600460320026032004602e002602e0046eb4c054004c054008dd69809800980980118088009808801180780098078011bae300d0013009375400a2c4a66600e600860106ea80044c8c8c8c94ccc038c04400852616375c601e002601e0046eb8c034004c024dd50008b1192999803980200089919299980618078010a4c2c6eb8c034004c024dd50010a999803980180089919299980618078010a4c2c6eb8c034004c024dd50010b18039baa001370e90011b87480015cd2ab9d5573caae7d5d02ba157441", + "hash": "e866e04ba3d50a61e9185cb79e5e85481ac927187c2683186530ef35" + }, + { + "title": "orders/limit_order.batch_witness", + "redeemer": { + "title": "_", + "schema": { + "$ref": "#/definitions/Data" + } + }, + "compiledCode": "59075801000032323232323232225333003325332330053001300637546004600e6ea800c4c8c8c8c8cccc8888c8cccc004004014011289111299980a001880089919299980b0020a501323333007007002301a0055333014004133300800300100914a060300086030008602c0066eb0c010c02cdd50019bac3001300b37540066eb0c008c02cdd5001991919191919191111919299980a9808980b1baa00113253330163375e60366eb0c060c8cdd81ba83018001374e60320026ea800530102410000132323232323232323232323232323232323232323232323232533302f53233303000313253330313371266e08024dd6981618199baa00733704a666062026266e00cdc000600400508061bad302e3033375400e200229414ccc0c004c4c004cdc019b80008007009153330300121300100815333030300100813371266e05200000a3370000e01229404c94ccc0c4c0b4c0c8dd50008991919191919191919191919299981e99b89337040126eb4c0e0c0fcdd500999b82006375a6074607e6ea804c54ccc0f401454ccc0f401054ccc0f400c54ccc0f400840045280a5014a0294052819baf00b323232323232323374a9000198239824003998239824003198239824002998239ba801033047304800433047304800333047304800233047304800133047375001c609260920026090002608e002608c002608a608a00260880026086002607c6ea809ccdd7808007a99981d19b89375a607e6080608060806080608060786ea809400c5288806a99981c80e0980519b803370000a0060242a6660720362601400a2a666072601400a266e24cdc0a400002666e0000c04852819b890023370666e0801003c0414ccc0dc0644cdc019b8001200101010123370201a0026eb4c0b8c0dcdd500219b8100c001375a6048606a6ea8008c094004c0d8c0ccdd50008b181418191baa01f371266e054ccc0bc04840384cccc08403c0580552006533302f012100b1333302100c0160154801840045281929998190008a51132323300100100322533303500114a0264a66606666e3cdd7181c0010020a511330030030013038001375c606803a6eb0c0ccc0d0c0d0c0d0c0d0c0d0c0d0c0d0c0d0c0d0c0c0dd500c99baf001302a302f3754030604e605c6ea806cc098c0b4dd500c1817981818181818181818181818181818161baa015375a604460566ea8050dd6980c98151baa013375a6058605a605a605a605a60526ea8048cdc080100299b81533302500710011333301700200a009480194ccc09401c40104cccc05c0140280252006375a604c60526eacc098c0a4008c0a4004dd5980f98121baa011375a6046604c6eacc08cc098008c098004dd5980e18109baa00c3371e006911003371e008910100375c6032603c6ea8010dd7180b180e9baa003375c602e60386ea800cdd7180a180d9baa002301d301e301e301e301e301e301e301a3754006601e60326ea8008c024004528980d180b9baa00114a26018602c6ea8004c040c054dd50019180a980b180b180b000911119199800800802801111299980a99b884800000454ccc06000852000132323253330183371e6eb8c06400c0244c8c8c94ccc06ccdc79bae301c00300b10011533301e00214800054ccc078c0840084c8c94ccc074cdc79bae301e00200d1001148000dd6980f00098100010b1bad301c002301f002301d00113330060060023370000890009bab3019002301c003301a002162533300e3005300f37540022646464646464646464646464646464646464646464646464a6660526058004264646464649319198008008051129998178008a4c2646600600660660046eb8c0c40054ccc0a4c080c0a8dd5006099191919299981818198010a4c2c6eb4c0c4004c0c4008dd6981780098159baa00c16301c00d301b0145333026301d3027375402a264646464a66605a606000426464931929998161811800899192999818981a00109924c64a66605e604c00226464a666068606e0042649318130008b181a80098189baa0021533302f302500113232323232325333038303b002149858dd6981c800981c8011bad30370013037002375a606a00260626ea800858c0bcdd50008b181900098171baa0031533302c30220011533302f302e37540062930b0b18161baa002301f00316302e001302e002302c0013028375402a2c2c6eb8c0a8004c0a8008dd7181400098140011bac30260013026002375a6048002604800460440026044004604000260400046eb4c078004c078008dd6980e000980e0011bad301a001301a0023018001301800230160013016002375c602800260206ea80045894ccc034c010c038dd5000899191919299980a180b8010a4c2c6eb8c054004c054008dd7180980098079baa00116232533300d30040011323253330123015002149858dd7180980098079baa0021533300d30030011323253330123015002149858dd7180980098079baa00216300d37540026e1d2002370e900011807180798078009180698071807180718071807180718071807000980098041baa0042300b001370e90020b1180498050008a4c26cacae6955ceaab9e5573eae815d0aba21", + "hash": "3e3bd340e5ce42aec805aca4d37c02099982b3909b6e6f08d33d8a46" + }, + { + "title": "orders/limit_order.limit_order", + "datum": { + "title": "conf", + "schema": { + "$ref": "#/definitions/orders~1limit_order~1LimitOrderConfig" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/Bool" + } + }, + "parameters": [ + { + "title": "witness", + "schema": { + "$ref": "#/definitions/aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential" + } + } + ], + "compiledCode": "5903f00100003232323232323222323232232253330093232533300b0041323300100137566022602460246024602460246024601c6ea8008894ccc040004528099299980719baf00d300f301300214a226600600600260260022646464a66601c6014601e6ea80044c94ccc03cc030c040dd5000899191929998090038a99980900108008a5014a066ebcc020c04cdd5001180298099baa00f3375e600860246ea8c010c048dd5180a98091baa00230043012375400260286eb0c050c054c054c044dd50028b1991191980080080191299980a8008a6103d87a80001323253330143375e6016602c6ea80080144cdd2a40006603000497ae0133004004001301900230170013758600a60206ea8010c04cc040dd50008b180098079baa0052301230130013322323300100100322533301200114a0264a66602066e3cdd7180a8010020a5113300300300130150013758602060226022602260226022602260226022601a6ea8004dd71808180898089808980898089808980898089808980898069baa0093001300c37540044601e00229309b2b19299980598050008a999804180218048008a51153330083005300900114a02c2c6ea8004c8c94ccc01cc010c020dd50028991919191919191919191919191919191919191919191919299981118128010991919191924c646600200201444a6660500022930991980180198160011bae302a0015333022301f30233754018264646464a66605260580042930b1bad302a001302a002375a605000260486ea803058c06c034c0680514ccc07cc070c080dd500a899191919299981318148010991924c64a66604a604400226464a666054605a004264931929998141812800899192999816981800109924c604a0022c605c00260546ea800854ccc0a0c0900044c8c8c8c8c8c94ccc0c4c0d000852616375a606400260640046eb4c0c0004c0c0008dd6981700098151baa00216302837540022c6056002604e6ea800c54ccc094c08400454ccc0a0c09cdd50018a4c2c2c604a6ea8008c07800c58c09c004c09c008c094004c084dd500a8b0b1bae30230013023002375c604200260420046eb0c07c004c07c008dd6980e800980e801180d800980d801180c800980c8011bad30170013017002375a602a002602a0046eb4c04c004c04c008c044004c044008c03c004c03c008dd7180680098049baa0051625333007300430083754002264646464a66601c60220042930b1bae300f001300f002375c601a00260126ea8004588c94ccc01cc0100044c8c94ccc030c03c00852616375c601a00260126ea800854ccc01cc00c0044c8c94ccc030c03c00852616375c601a00260126ea800858c01cdd50009b8748008dc3a4000ae6955ceaab9e5573eae815d0aba201", + "hash": "ba7d2c5a39720d3e42e45cef60f0aea321bea0ead46f72d38552b67d" + }, + { + "title": "stable_pool/deposit.deposit", + "datum": { + "title": "datum", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1DepositData" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1OrderAction" + } + }, + "compiledCode": "5904bc0100003232323232323223232322323225333009323232533300c300a300d375400e26464646464646464646464a66602e602a60306ea80044c8c8c8c8c8c8c94ccc078c070c07cdd5000899191919299981119b8748010c08cdd50008992999811981098121baa00113232323232323232323232323232323232323232323232323232533304030430021323232323232323232323253330483046304937540022646464646464a66609c609066600605c0660642a66609c0042002294052819192999827982698281baa00113371e0886eb8c150c144dd5000899baf300230513754606260a26ea80e0014c004c140dd5180098281baa00623053001337120666660026eacc144c14800c01c018888c94ccc13cc124c140dd50008a400026eb4c150c144dd5000992999827982498281baa00114c103d87a800013233001001375660aa60a46ea8008894ccc150004530103d87a8000132323253330543371e00e6eb8c15400c4c104cc160dd4000a5eb804cc014014008dd6982a801182c001182b00099198008008021129998298008a6103d87a8000132323253330533371e00e6eb8c15000c4c100cc15cdd3000a5eb804cc014014008dd5982a001182b801182a800982780098259baa001304d304a37540022c6606406a0726eb8c12cc130008dd7182500098231baa018330050092375a0026600801846eb8004c0f8054cc0080588dd68009980080b9181e8009119198008008019129998228008a4c2646600600660920046006608e00260740322c6eb4c104004c104008dd6181f800981f8011bae303d001303d0023758607600260760046eb4c0e4004c0e4008dd6981b800981b8011bad3035001303500232533303230310011533302f3029303000114a22a66605e605a606000229405858dd518198009819801181880098188011bac302f001302f0023758605a002605a0046eb4c0ac004c0ac008c0a4004c094dd50008b181398121baa00116302630270023756604a002604a60426ea8c004c084dd5181218109baa002230243025001163300800c00e375c604260440046eb8c080004c070dd5180f8011bad301e301f301f001301a375402e603860326ea800458cc004014dd6980d8051800800911299980d0010a60103d87a80001323253330193017003130063301d0024bd70099980280280099b8000348004c07800cc070008dd2a40006eb0c05cc060c060008dd6180b00098091baa007375a6028602a0046eb4c04c004c04c004c038dd5003899198008008019129998088008a50132533300f3371e6eb8c050008010528899801801800980a0009bae30103011300d37540146eb0c03cc040c040c040c040c040c040c040c040c030dd5000980718059baa00114984d958c94ccc020c0180044c8c8c8c8c8c94ccc044c05000852616375a602400260240046eb4c040004c040008dd6980700098051baa0031533300830020011533300b300a37540062930b0b18041baa002370e90012999802180118029baa0031323232323232533300d3010002132498c01c01458dd6980700098070011bae300c001300c002300a001300637540062c4a6660086004600a6ea80044c8c8c8c94ccc02cc03800852616375c601800260180046eb8c028004c018dd50008b1b87480015cd2ab9d5573caae7d5d02ba15745", + "hash": "17d0a951dac4f55f62c4ded49e62c51f60e08db602dfd89e5b46d75b" + }, + { + "title": "stable_pool/pool.validate_pool", + "datum": { + "title": "input_datum", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1PoolData" + } + }, + "redeemer": { + "title": "redeemer", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1PoolRedeemer" + } + }, + "parameters": [ + { + "title": "dao_voting_witness", + "schema": { + "$ref": "#/definitions/ByteArray" + } + } + ], + "compiledCode": "590e600100003232323232323223223232323232322322533300d3232323232325333013300c30143754008264646464646464646464a66603a6032603c6ea80044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc0d0c0c0c0d4dd500089919191919299981c99b8748010c0e8dd5001099191919191919191919191919191919191919299982619baf03902e1533304c0071533304c0041533304c0031533304c002100114a029405280a5014a0a666096608e60986ea80d04c8ccc8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c888c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc234054ccc23404cdc38111bad3092010151533308d013370e0400262a66611a0266ebcdd380f1ba701113371e03801e29405280a50100114a0a66611802666118026110020129412889919191919191919299984a009999981d8048188058050098a99984a008038a99984a008018a99984a0080108008a5014a0294052819b8733702900000819b833370466e040c807ccdc0a41fdfffffffffffffffffffffffffffffffffe0e02203e666660726607464666600200200e0066607200a466e0ccdc119b82031029001005222253330990100314bd7009919299984d808020a5eb804c8c94ccc2740401452f5c026613c026ea0cdc099b81004002375a613e0200a666601001000600261400200a613e0200a6eb4c27404010c27404010dd6984d8080181581780480401899baf374e0126e9c004cc0d80088cdc199b823370405c04800200466e08cdc12401060ec05890604d0619981e0011981a004119b833370400205e03644a6661200266e200040084cdc0801000899b81001002333330343303500102602a00400302d330350070191323232533308f01308b01309001375400226464a66612202611a026124026ea80044c8c94ccc24c04c23c04c25004dd500089919299984a80984880984b009baa00113232533309701309301309801375400226464a66613202612a026134026ea80044c8c8c8c8c8c8c8c8c8c94ccc28c04cdc4982319b803370401c012600e06c66e092004009153330a301008153330a301006153330a301005153330a301004153330a301002100114a029405280a5014a02940ccccccc10cc8ccc004005200001822253330a80100114bd70099854809ba83253330a6013370e00608a2600c66e0ccdc019b823370600201a018601407601820026eb4c2a804004ccc00c00cc154008c2ac040040b80fc064060c0080fc104ccccccc1080580800f806005cc0040f8100dc100399b8700833700018014a66613c0266e1ccc1000488c26c04004cdc001da4006266e1c03c03452819b8930403370266e0802800cc004cdc0a4181341806466e092004003370400a66e1ccc0f404c8c26004004c208040e0cdc099b814830268300bc0b4dd6984f00984d809baa001163303c031037375a6138026132026ea800458cc0e80240d4dd6984d00984b809baa001163303800c033375a613002612a026ea800458cc0d80180c4dd6984b009849809baa0011633034003030375a6128026122026ea800458cc0c80080b8cc0d8020024cc0d4014018cc0cc010090cdc11bad308f010210013303b02602633031008015330300020073302f0020133302f02004f3302e01f0643370266607809a01a0180026660760c40180166eb4c21804c21c04008dd61842808009842808011bae30830100130830100237586102020026102020046eb4c1fc004c1fc004c1f8c1f8c1f8c1f8c1f8c1f8c1f8c1e8dd501f9bae307c307d002375c60f600260ee6ea8c1e8034dd6983c983d0011bac30780013078002375c60ec00260ec0046eb0c1d0004c1d0008dd6983900098390011bad30700013070001306f306f001306e002375860d800260d80046eb0c1a8004c1a8008dd69834000983418321baa05f22222223232323232323232533306e306a306f3754002264646464a6660e466e20020ccccc07c03c048028dd6983980119b8100b0061337100100022940ccccc078038044024dd6983980099b8000a005337606ea0cdc1180380099b81002005375066e08c01c004cdc000100299b83009001375a60e660e06ea800458cc044038020cdc100080499b8200a0073333301700700a0023001004003370400e66034010603000e66e08010c048020c04801c88ccc050009200022533306230030021301200110012533305e337100029000099b81480000044004c0040048894ccc1840085300103d87a8000132325333060305c0031304833064375000497ae0133300500500130470033065003375a60c600444646600200200644a6660c2002297ae0133062375060066eb4c18c004cc008008c19000488888c8c8c8c94ccc188cdc4001199998088040031824802802001899b8800200114a06666602000e00a60220080060046666601e00c00800600400266e0800cc028018cdc10019805002911998040010009119b8200200122333007002001223370200400244646600200200644a6660ba002297ae013305e3750646660280086eb8c180004dd718301830800982e1baa305f00133002002306000123330070014800088cdc00010009199803191980080080111299982d0008a5eb804c8c94ccc164c148c168dd500089980200200109982e982f182d9baa0013300400400232533305933305930550014a09444c104cc174dd4000a5eb80530103d87a8000375a60ba00460ba00290011119b82002001222223232533305a33710002004266e040080044cdc080080119b800020053370066e08014010cdc180180111119199800800802001911299982d8010a5eb804c8c94ccc17400c52f5c02660bc6ea0cc018008dd6982f8019998028028009830001982f8019bad305d002222223232533305833710002004266e040080044cdc080080119b800020043370066e0801000ccdc19980400198030028011b8048008888ccc01800c00888cc00c004008c0040048894ccc140cdc4000a4000290000a99982818260008a40042a646660a2609a66e1800920041333004004300100333706004900209800999802002180080199b83303800248010dc100111119199800800802001911299982a80108008999801801982c001198021bad3057002001375a60a20026eb4c144c148004c134dd501a0992999826182418269baa0011323232533304f330023756600660a26ea8104dd7182a18289baa004100114a0660026eacc008c140dd50200261119191980080080211299982a8008a5013253330533375e00860a860b000429444cc00c00c004c160004c0dccc14ccdd2a4004660a66ea40052f5c097ae0230523053305330533053305330530011633323001001222533305100214c0103d87a8000132325333050304c0031303833054375200497ae0133300500500130370033055003375c60a600403a900019baf374e0306e9cc0640514ccc124cdd781318270070a99982499b8702400c153330493375e6e9c088dd38050a99982499baf374e0406e9c02054ccc124cdd780f0030a99982480e08028999824802a504a229405280a5014a02940c104ccc004048dd718268011bae304d304e00222232533304b3044304c37540022900009bad3050304d375400264a666096608860986ea8004530103d87a800013233001001375660a2609c6ea8008894ccc140004530103d87a8000132323253330503371e00e6eb8c14400c4c0e0cc150dd4000a5eb804cc014014008dd69828801182a001182900099198008008021129998278008a6103d87a80001323232533304f3371e00e6eb8c14000c4c0dccc14cdd3000a5eb804cc014014008dd598280011829801182880098241baa0233375e04801a66e2120003045375460926094004609000260900046eb0c118004c118008dd6182200098220011bad30420013042001303d37540046064002607c60766ea800858c0f4c0e8dd5181e802181e181e8011bab303b001303b001303637546072606c6ea800458cc060084074c0040488c008004c004004894ccc0d000452f5c026606a6064606c00266004004606e0026eb0c0ccc0d0c0d0c0d0c0d0008cdc424000605c6ea8c0c8004c0c8008c0c0004c0c0008dd6181700098170011bac302c001302c002375a60540026054004605000260486ea807cc098c08cdd518130011bab30253026001302137546048604a0046046002603e6ea8c088c07cdd50008b198008059bad30210083001001222533302000214c0103d87a800013232533301f301b00313007330230024bd7009998028028009803001981200198110011b8048004dd2a40006038603a0046eb4c06c004c06c004c058dd5005180c180a9baa004163758602e603060300046eb0c058004c048dd5001180a180a801180980098079baa00114984d9594ccc02cc01cc030dd50008991919191919299980a180b80109924c64a666024601c002264646464a66603260380042930b1bad301a001301a002375a603000260286ea800854ccc048c02c00454ccc054c050dd50010a4c2c2c60246ea800458c054004c054008dd6980980098098011bad3011001300d37540022c600200c4a666012600a60146ea80044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc098c0a40084c8c8c8c8c8c926330220082375a0026604201646eb8004c084050cc07c0548dd68009980f00b11810000980f00c8b1bad302700130270023758604a002604a0046eb8c08c004c08c008dd6181080098108011bad301f001301f002375a603a002603a0046eb4c06c004c06c008c94ccc060c05c00454ccc054c038c0580045288a99980a9808980b0008a501616375460320026032004602e002602e0046eb0c054004c054008dd6180980098098011bad30110013011002300f001300b37540022c6e1d200222323300100100322533300d00114984c8cc00c00cc044008c00cc03c00494ccc018c008c01cdd5000899191919299980698080010a4c2c6eb8c038004c038008dd7180600098041baa00116370e90001bae0015734aae7555cf2ab9f5740ae855d11", + "hash": "eb216127f690a1df987d90d222551c0384ea3a9ec37d1dfe7c6454ce" + }, + { + "title": "stable_pool/proxy_dao.stable_pool_dao", + "datum": { + "title": "datum", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1DAOData" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1DAOAction" + } + }, + "compiledCode": "5908a3010000323232323232322323232322322533300932323253323300d3001300e3754004264646464646464646464646464646464a66603a6036603c6ea80044c8c8c8c8c8c94cc8cc090c004c094dd5001099192999813181218139baa00113232323232533302b3029302c375400226464646464a666060605c60626ea80044c8c8c8c8c94ccc0d4c048c0d8dd500089919299981b981a981c1baa0011323232533303a3038303b375400226464646464a66607e603860806ea80044c8c8c8c8c8c94ccc114cdd781c182518239baa01a153330450041533304500315333045002100114a029405280a50323232323232323232323232323232323232323232323232323232323253330613370e6eb4c198c19c044dd6983318338020a99983080108008a5014a0a64646464646464646660d060cc0a026464a6660d40422a6660d40042002294052829998348038a9998348030a9998348040a9998348028a9998348020a99983480108018a5014a029405280a5014a0a6660d06010020266e2404120c0b80214a02a646660d260ba0a2264a6660d4a6660d46014020266e2404120be9a0c14a0200229414ccc1a401c54ccc1a401854ccc1a402054ccc1a401454ccc1a400454ccc1a400c40085280a5014a029405280a50153330693046051153330690071533306900615333069008153330690051533306900115333069004100214a029405280a5014a0294054ccc1a4cdc3828a400c26464a6660d6a6660d60142a6660d600e2a6660d60062a6660d600c2a6660d600a200829405280a5014a02940400452819baf374e660486604a00206e6604a0020926e9ccc090030064dd618371837983798359baa045153330693370e0a290040a9998348038a9998348030a9998348040a9998348028a9998348008a99983480208018a5014a029405280a5014a02a6660d266e1c145200a132533306a533306a300a01413371202890504e008a50100114a0a6660d200e2a6660d200c2a6660d20102a6660d20022a6660d20082a6660d2006200429405280a5014a029405280a99983499b870514803054ccc1a401c54ccc1a401854ccc1a401454ccc1a400454ccc1a401054ccc1a400c40085280a5014a029405280a5014a066e1c040070cdd79ba7375860d80186e9cdd6183600c99b8f375c60d60146eb8c1ac05ccdc38059bad306a0183370e6eb4c1a4068038cdd79ba6042374c06066ebcdd38089ba70043375e0760546e2520023370e66603607c0180166660360580180166eb0c18c004c18c004c188004c184008dd6982f800982f8011bad305d001305d002375a60b600260b660b660b660b660b660b660ae6ea8080dd7182c982d0011bae30580013054375460ae0166eb0c158004c158004c154004c150004c14c008dd698288009828800982800119b8848000c128dd518270009827000982698269826982698249baa0232232333001001003002222533304e00214bd700991929998280018a5eb804cc144dd419b81002375a60a400666600a00a00260a600660a40066eb4c14000888c8cc00400400c894ccc13000452f5c026609a6ea0c8ccc018010dd718278009bae304f3050001304b3754609c00266004004609e00244464a666090607860926ea8004520001375a609a60946ea8004c94ccc120c0f0c124dd50008a6103d87a8000132330010013756609c60966ea8008894ccc134004530103d87a80001323232533304d3371e00e6eb8c13800c4c0d0cc144dd4000a5eb804cc014014008dd698270011828801182780099198008008021129998260008a6103d87a80001323232533304c3371e00e6eb8c13400c4c0cccc140dd3000a5eb804cc014014008dd598268011828001182700099baf374c02a6e98018cdd782080199baf014006303c0013044304137540022c608660880046eacc108004c108008c100004c0f0dd5181f981e1baa001163301e0290223010003303c303937540022c603260706ea8014c0e8c0dcdd50008b181c981d0011bab30380013038002303600130323754606a60646ea800458cc05007c070dd59819981a001181900098171baa300f302e37540026060605a6ea800458cc03c06c054c00401494ccc0a4c09cc0a8dd50008991919191919191919191919191919191919191919191919191929998231824801099191919191924c6604201046eb4004cc08002c8dd7000982180a1980f00a91bad0013301d01623042001304001916375a608e002608e0046eb0c114004c114008dd7182180098218011bac30410013041002375a607e002607e0046eb4c0f4004c0f4008dd6981d800981d80119299981c181b8008a99981a9814981b0008a51153330353033303600114a02c2c6ea8c0e4004c0e4008c0dc004c0dc008dd6181a800981a8011bac30330013033002375a60620026062004605e00260566ea80045888c8cc00400400c894ccc0b800452613233003003303200230033030001302b302837540022c6010604e6ea8018c0a4c098dd50011b874801058c09cc0a0008dd598130009813001181200098101baa300130203754604660406ea80088c08cc09000458cc004034dd69810805980080091129998100010a60103d87a800013232533301f301d00313006330230024bd70099980280280099b8000348004c09000cc088008dd2a40006eb4c074c078008dd6980e000980e0011bad301a001301a002375a6030002603000260266ea802cdd6180a980b180b0011bac3014001301037540086024601e6ea8008dc3a40042c60206022004601e00260166ea8004526136565333007300530083754002264646464646464646464a666028602e0042930b1bad30150013015002375a602600260260046eb4c044004c044008dd6980780098078011bad300d001300937540022c60020084a66600a6006600c6ea80044c8c94ccc028c0340084c926300400116300b001300737540022c4a6660086004600a6ea80044c8c8c8c94ccc02cc03800852616375c601800260180046eb8c028004c018dd50008b1b87480015cd2ab9d5573caae7d5d02ba15745", + "hash": "5fcc4c021b87aab25f97bedd018c2fcd691cd85cc4ef04f632e6464a" + }, + { + "title": "stable_pool/redeem.redeem", + "datum": { + "title": "datum", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1RedeemData" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1OrderAction" + } + }, + "compiledCode": "5905b401000032323232323232232323232232322533300a323232533300d300b300e375400e26464646464646464646464a666030602c60326ea80044c8c8c8c8c8c8c8c8c8c8c94ccc08cc084c090dd5000899191919299981399b8748010c0a0dd50008992999814181318149baa0011323232323232323232323232323232323232323232323232323253330453048002132323232323232323232533304c304a304d3754002264646464646464a6660a6609866600805c0660642a6660a60062a6660a6004200229405280a5032325333054305230553754002266e3c120dd7182c982b1baa00113375e600460ac6ea8c0c4c158dd501e0039800982a9baa006230580013370e66600400601000e066646600200264666002002646600200207044a6660ae002297ae013305837506466600c00e6eb8c168004dd7182d182d800982b1baa305900133002002305a001035222533305700214bd7009919299982c8018a5eb804cc168ccc158cdc49bad305b0030024c0103d87a80004c0103d8798000333005005001305c003305b003375a60b200444a6660aa00229444c94ccc14d4ccc14ccdc42400060a86ea8c1600085288999829a514a09444cc00c00c004528182c0009111929998299826182a1baa0011480004dd6982c182a9baa001325333053304c305437540022980103d87a800013233001001375660b260ac6ea8008894ccc160004530103d87a8000132323253330583371e00e6eb8c16400c4c110cc170dd4000a5eb804cc014014008dd6982c801182e001182d000991980080080211299982b8008a6103d87a8000132323253330573371e00e6eb8c16000c4c10ccc16cdd3000a5eb804cc014014008dd5982c001182d801182c8009bab305330540023052001304e375460a2609c6ea800458cc0d40e00f0dd7182798280011bae304e001304a375402e6608601046eb4004cc10802c8dd7000982100a1982000a91bad0013303f01623041001303f01916375a608c002608c0046eb0c110004c110008dd7182100098210011bac30400013040002375a607c002607c0046eb4c0f0004c0f0008dd6981d000981d00119299981b981b0008a99981a1816981a8008a51153330343032303500114a02c2c6ea8c0e0004c0e0008c0d8004c0d8008dd6181a000981a0011bac30320013032002375a60600026060004605c00260546ea800458c0b0c0a4dd50008b181598160011bab302a001302a302637546002604c6ea8c0a4c098dd50011181498150008b198060080091bae30263027002375c604a00260426ea8c090018dd6981198120011bac30220013022002375860400026040604000260366ea8060c074c068dd50008b198008029bad301c00a3001001222533301b00214c0103d87a800013232533301a3018003130063301e0024bd70099980280280099b8000348004c07c00cc074008dd2a40006eb0c060c064c064008dd6180b80098099baa007375a602a602c0046eb4c050004c050004c03cdd5003899198008008019129998090008a5013253330103371e6eb8c054008010528899801801800980a8009bae30113012300e37540166eb0c040c044c044c044c044c044c044c044c044c034dd5000980798061baa00114984d958c94ccc024c01c0044c8c8c8c8c8c94ccc048c05400852616375a602600260260046eb4c044004c044008dd6980780098059baa0031533300930020011533300c300b37540062930b0b18049baa002370e90012999802980198031baa004132323232323232323232533301230150021323232498cc0340148dd6800998060031180700098060048b1bad301300130130023758602200260220046eb0c03c004c03c008dd718068009806801180580098039baa0041622323300100100322533300b00114984c8cc00c00cc03c008c00cc03400494ccc010c008c014dd5000899191919299980598070010a4c2c6eb8c030004c030008dd7180500098031baa00116370e90002b9a5573aaae7955cfaba05742ae881", + "hash": "cc2fb74a582dc494baf12e52aeb883c4ee3b6404b0efba4dc97e5e60" + }, + { + "title": "stable_pool/redeem_uniform.redeem_uniform", + "datum": { + "title": "datum", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1RedeemUniformData" + } + }, + "redeemer": { + "title": "action", + "schema": { + "$ref": "#/definitions/splash~1stableswap~1types~1OrderAction" + } + }, + "compiledCode": "59056601000032323232323232232323232232322533300a323232533300d300b300e375400e26464646464646464646464a666030602c60326ea80044c8c8c8c8c8c8c94ccc07cc074c080dd5000899191919299981199b8748010c090dd50008992999812181118129baa001132323232323232323232323232323232323232323232323232325333041304400213232323232323253330453043304637540022646464646464a666096608866600605405e05c2a6660960042002294052819192999826182518269baa00113371e6eb8c0b4c138dd50259bae3051304e3754002266ebcc008c138dd5181698271baa0340053001304d37546002609a6ea80188c140004c8cc004004c8ccc004004c8c8cc004004090894ccc14400452f5c02660a46ea0c8ccc01c010dd7182a0009bae305430550013050375460a60026600400460a80026eacc140c1440140c48894ccc14000852f5c026464a6660a4006297ae013305333304f337126eb4c15000c00930103d87a80004c0103d879800033300500500130550033054003375a60a400444a66609c00229444c94ccc1314ccc130cdc424000609a6ea8c14400852889998262514a09444cc00c00c0045281828800911192999826182298269baa0011480004dd6982898271baa00132533304c3045304d37540022980103d87a800013233001001375660a4609e6ea8008894ccc144004530103d87a8000132323253330513371e00e6eb8c14800c4c0f4cc154dd4000a5eb804cc014014008dd69829001182a801182980099198008008021129998280008a6103d87a8000132323253330503371e00e6eb8c14400c4c0f0cc150dd3000a5eb804cc014014008dd59828801182a0011829000982600098241baa001304a304737540022c6605c06206a6607e01046eb4004cc0f802c8dd7000981f00a1981e00a91bad0013303b0162303d001303b01916375a608400260840046eb0c100004c100008dd7181f000981f0011bac303c001303c002375a607400260740046eb4c0e0004c0e0008dd6981b000981b00119299981998190008a999818181498188008a5115333030302e303100114a02c2c6ea8c0d0004c0d0008c0c8004c0c8008dd6181800098180011bac302e001302e002375a605800260580046054002604c6ea800458c0a0c094dd50008b181398140011bab3026001302630223754600260446ea8c094c088dd50011181298130008b198040060071bae30223023002375c6042002603a6ea8c080008dd6180f98101810000980d9baa018301d301a37540022c6600200a6eb4c070028c0040048894ccc06c008530103d87a800013232533301a3018003130063301e0024bd70099980280280099b8000348004c07c00cc074008dd2a40006eb0c060c064c064008dd6180b80098099baa007375a602a602c0046eb4c050004c050004c03cdd5003899198008008019129998090008a5013253330103371e6eb8c054008010528899801801800980a8009bae30113012300e37540166eb0c040c044c044c044c044c044c044c044c044c034dd5000980798061baa00114984d958c94ccc024c01c0044c8c8c8c8c8c94ccc048c05400852616375a602600260260046eb4c044004c044008dd6980780098059baa0031533300930020011533300c300b37540062930b0b18049baa002370e90012999802980198031baa0041323232323232533300e301100213232498cc0200088dd680098040028b1bac300f001300f002375c601a002601a0046016002600e6ea80105888c8cc00400400c894ccc02c00452613233003003300f0023003300d00125333004300230053754002264646464a666016601c0042930b1bae300c001300c002375c6014002600c6ea800458dc3a4000ae6955ceaab9e5573eae815d0aba21", + "hash": "c6923c633646640162a27763b9d68a269ba95fa093ae075b0c68f437" + } + ], + "definitions": { + "Bool": { + "title": "Bool", + "anyOf": [ + { + "title": "False", + "dataType": "constructor", + "index": 0, + "fields": [] + }, + { + "title": "True", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "ByteArray": { + "dataType": "bytes" + }, + "Data": { + "title": "Data", + "description": "Any Plutus data." + }, + "Int": { + "dataType": "integer" + }, + "List$ByteArray": { + "dataType": "list", + "items": { + "$ref": "#/definitions/ByteArray" + } + }, + "List$Int": { + "dataType": "list", + "items": { + "$ref": "#/definitions/Int" + } + }, + "List$splash/plutus/Asset": { + "dataType": "list", + "items": { + "$ref": "#/definitions/splash~1plutus~1Asset" + } + }, + "Option$aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": { + "title": "Optional", + "anyOf": [ + { + "title": "Some", + "description": "An optional value.", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "$ref": "#/definitions/aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential" + } + ] + }, + { + "title": "None", + "description": "Nothing.", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "aiken/transaction/OutputReference": { + "title": "OutputReference", + "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", + "anyOf": [ + { + "title": "OutputReference", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "transaction_id", + "$ref": "#/definitions/aiken~1transaction~1TransactionId" + }, + { + "title": "output_index", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "aiken/transaction/TransactionId": { + "title": "TransactionId", + "description": "A unique transaction identifier, as the hash of a transaction body. Note that the transaction id\n isn't a direct hash of the `Transaction` as visible on-chain. Rather, they correspond to hash\n digests of transaction body as they are serialized on the network.", + "anyOf": [ + { + "title": "TransactionId", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "hash", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "aiken/transaction/credential/Address": { + "title": "Address", + "description": "A Cardano `Address` typically holding one or two credential references.\n\n Note that legacy bootstrap addresses (a.k.a. 'Byron addresses') are\n completely excluded from Plutus contexts. Thus, from an on-chain\n perspective only exists addresses of type 00, 01, ..., 07 as detailed\n in [CIP-0019 :: Shelley Addresses](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0019/#shelley-addresses).", + "anyOf": [ + { + "title": "Address", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "payment_credential", + "$ref": "#/definitions/aiken~1transaction~1credential~1Credential" + }, + { + "title": "stake_credential", + "$ref": "#/definitions/Option$aiken~1transaction~1credential~1Referenced$aiken~1transaction~1credential~1Credential" + } + ] + } + ] + }, + "aiken/transaction/credential/Credential": { + "title": "Credential", + "description": "A general structure for representing an on-chain `Credential`.\n\n Credentials are always one of two kinds: a direct public/private key\n pair, or a script (native or Plutus).", + "anyOf": [ + { + "title": "VerificationKeyCredential", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "$ref": "#/definitions/ByteArray" + } + ] + }, + { + "title": "ScriptCredential", + "dataType": "constructor", + "index": 1, + "fields": [ + { + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "aiken/transaction/credential/Referenced$aiken/transaction/credential/Credential": { + "title": "Referenced", + "description": "Represent a type of object that can be represented either inline (by hash)\n or via a reference (i.e. a pointer to an on-chain location).\n\n This is mainly use for capturing pointers to a stake credential\n registration certificate in the case of so-called pointer addresses.", + "anyOf": [ + { + "title": "Inline", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "$ref": "#/definitions/aiken~1transaction~1credential~1Credential" + } + ] + }, + { + "title": "Pointer", + "dataType": "constructor", + "index": 1, + "fields": [ + { + "title": "slot_number", + "$ref": "#/definitions/Int" + }, + { + "title": "transaction_index", + "$ref": "#/definitions/Int" + }, + { + "title": "certificate_index", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "liquidity_locker/Config": { + "title": "Config", + "anyOf": [ + { + "title": "Config", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "locked_until", + "description": "Redeem of locked assets is possible after this timestamp.", + "$ref": "#/definitions/Int" + }, + { + "title": "redeemer", + "description": "Who is authorized to redeem assets.", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "orders/auction/Action": { + "title": "Action", + "anyOf": [ + { + "title": "Exec", + "description": "Execute order", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "span_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "successor_ix", + "$ref": "#/definitions/Int" + } + ] + }, + { + "title": "Cancel", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "orders/auction/Config": { + "title": "Config", + "anyOf": [ + { + "title": "Config", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "base", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "quote", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "price_start", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "start_time", + "$ref": "#/definitions/Int" + }, + { + "title": "step_len", + "$ref": "#/definitions/Int" + }, + { + "title": "steps", + "$ref": "#/definitions/Int" + }, + { + "title": "price_dacay_num", + "$ref": "#/definitions/Int" + }, + { + "title": "fee_per_quote", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "redeemer", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "orders/grid/Action": { + "title": "Action", + "anyOf": [ + { + "title": "Execute", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "successor_out_index", + "$ref": "#/definitions/Int" + } + ] + }, + { + "title": "Close", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "orders/grid/GridStateNative": { + "title": "GridStateNative", + "anyOf": [ + { + "title": "GridStateNative", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "beacon", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "token", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "buy_shift_factor", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "sell_shift_factor", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "max_lovelace_offer", + "$ref": "#/definitions/Int" + }, + { + "title": "lovelace_offer", + "description": "Remaining lovelace for sale (Mutable)", + "$ref": "#/definitions/Int" + }, + { + "title": "price", + "description": "Current price (Output/Input) (Mutable)", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "side", + "description": "True = Bid, False = Ask (Mutable)", + "$ref": "#/definitions/Bool" + }, + { + "title": "budget_per_transaction", + "description": "Lovelace allowed to be utilized to cover TX fee.", + "$ref": "#/definitions/Int" + }, + { + "title": "min_marginal_output_lovelace", + "$ref": "#/definitions/Int" + }, + { + "title": "min_marginal_output_token", + "$ref": "#/definitions/Int" + }, + { + "title": "redeemer_address", + "description": "Where the output from the order must go.", + "$ref": "#/definitions/aiken~1transaction~1credential~1Address" + }, + { + "title": "cancellation_pkh", + "description": "PKH authorized to cancel order.", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "orders/instant_order/InstantOrderConfig": { + "title": "InstantOrderConfig", + "anyOf": [ + { + "title": "InstantOrderConfig", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "tag", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "redeemer_address", + "description": "Where the output from the order must go.", + "$ref": "#/definitions/aiken~1transaction~1credential~1Address" + }, + { + "title": "input", + "description": "What we receive.", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "tradable_input", + "description": "Tradable amount of Lovelace.", + "$ref": "#/definitions/Int" + }, + { + "title": "cost_per_ex_step", + "description": "Assumed cost (in Lovelace) of one step of execution.", + "$ref": "#/definitions/Int" + }, + { + "title": "output", + "description": "What we receive.", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "base_price", + "description": "Worst acceptable price (Output/Input).", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "fee", + "description": "How much fee we pay to executor for whole swap.", + "$ref": "#/definitions/Int" + }, + { + "title": "permitted_executors", + "description": "Executors permitted to execute this order.", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "cancellation_after", + "description": "When this order can be cancelled.", + "$ref": "#/definitions/Int" + }, + { + "title": "cancellation_pkh", + "description": "PKH authorized to cancel order.", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "beacon", + "description": "Beacon used to track progress.", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "orders/limit_order/LimitOrderConfig": { + "title": "LimitOrderConfig", + "anyOf": [ + { + "title": "LimitOrderConfig", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "tag", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "redeemer_address", + "description": "Where the output from the order must go.", + "$ref": "#/definitions/aiken~1transaction~1credential~1Address" + }, + { + "title": "input", + "description": "What we receive.", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "tradable_input", + "description": "Tradable amount of Lovelace.", + "$ref": "#/definitions/Int" + }, + { + "title": "cost_per_ex_step", + "description": "Assumed cost (in Lovelace) of one step of execution.", + "$ref": "#/definitions/Int" + }, + { + "title": "min_marginal_output", + "description": "Minimal marginal output allowed per execution step.", + "$ref": "#/definitions/Int" + }, + { + "title": "output", + "description": "What we receive.", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "base_price", + "description": "Worst acceptable price (Output/Input).", + "$ref": "#/definitions/splash~1rational~1Rational" + }, + { + "title": "fee", + "description": "How much fee we pay to executor for whole swap.", + "$ref": "#/definitions/Int" + }, + { + "title": "permitted_executors", + "description": "Executors permitted to execute this order.", + "$ref": "#/definitions/List$ByteArray" + }, + { + "title": "cancellation_pkh", + "description": "PKH authorized to cancel order.", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "beacon", + "description": "Beacon used to track progress.", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "splash/plutus/Asset": { + "title": "Asset", + "anyOf": [ + { + "title": "Asset", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "policy", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "name", + "$ref": "#/definitions/ByteArray" + } + ] + } + ] + }, + "splash/rational/Rational": { + "title": "Rational", + "anyOf": [ + { + "title": "Rational", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "num", + "$ref": "#/definitions/Int" + }, + { + "title": "denom", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "splash/stableswap/types/DAOAction": { + "title": "DAOAction", + "description": "DAO action types:", + "anyOf": [ + { + "title": "DAOAction", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "pool_out_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "dao_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "dao_out_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "dao_action_ix", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "splash/stableswap/types/DAOData": { + "title": "DAOData", + "description": "DAO contract config (congig is immutable).", + "anyOf": [ + { + "title": "DAOData", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_nft", + "$ref": "#/definitions/splash~1plutus~1Asset" + } + ] + } + ] + }, + "splash/stableswap/types/DepositData": { + "title": "DepositData", + "description": "AMM-orders data.", + "anyOf": [ + { + "title": "DepositData", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_nft", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "redeemer", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "min_expected_lp_amount", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "splash/stableswap/types/OrderAction": { + "title": "OrderAction", + "description": "Order action types.", + "anyOf": [ + { + "title": "ApplyOrder", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "redeemer_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "redeemer_out_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "pool_in_ix", + "$ref": "#/definitions/Int" + } + ] + }, + { + "title": "CancelOrder", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "splash/stableswap/types/PoolAction": { + "title": "PoolAction", + "description": "Pool action types.", + "anyOf": [ + { + "title": "AMMAction", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "option_int0", + "$ref": "#/definitions/Int" + }, + { + "title": "option_int1", + "$ref": "#/definitions/Int" + } + ] + }, + { + "title": "PDAOAction", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "splash/stableswap/types/PoolData": { + "title": "PoolData", + "description": "Pool data.", + "anyOf": [ + { + "title": "PoolData", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_nft", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "n", + "$ref": "#/definitions/Int" + }, + { + "title": "tradable_assets", + "$ref": "#/definitions/List$splash~1plutus~1Asset" + }, + { + "title": "tradable_tokens_multipliers", + "$ref": "#/definitions/List$Int" + }, + { + "title": "lp_token", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "lp_fee_is_editable", + "$ref": "#/definitions/Bool" + }, + { + "title": "ampl_coeff", + "$ref": "#/definitions/Int" + }, + { + "title": "lp_fee_num", + "$ref": "#/definitions/Int" + }, + { + "title": "protocol_fee_num", + "$ref": "#/definitions/Int" + }, + { + "title": "dao_stabe_proxy_witness", + "$ref": "#/definitions/List$ByteArray" + }, + { + "title": "treasury_address", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "protocol_fees", + "$ref": "#/definitions/List$Int" + }, + { + "title": "inv", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "splash/stableswap/types/PoolRedeemer": { + "title": "PoolRedeemer", + "anyOf": [ + { + "title": "PoolRedeemer", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "pool_out_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "action", + "$ref": "#/definitions/splash~1stableswap~1types~1PoolAction" + } + ] + } + ] + }, + "splash/stableswap/types/RedeemData": { + "title": "RedeemData", + "anyOf": [ + { + "title": "RedeemData", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_nft", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "redeemer", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "expected_assets", + "$ref": "#/definitions/List$splash~1plutus~1Asset" + }, + { + "title": "min_expected_received_assets_balances", + "$ref": "#/definitions/List$Int" + }, + { + "title": "min_expected_lp_change", + "$ref": "#/definitions/Int" + } + ] + } + ] + }, + "splash/stableswap/types/RedeemUniformData": { + "title": "RedeemUniformData", + "anyOf": [ + { + "title": "RedeemUniformData", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_nft", + "$ref": "#/definitions/splash~1plutus~1Asset" + }, + { + "title": "redeemer", + "$ref": "#/definitions/ByteArray" + }, + { + "title": "min_expected_received_assets_balances", + "$ref": "#/definitions/List$Int" + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/validators/beacon.ak b/validators_v2/validators/beacon.ak similarity index 100% rename from validators/beacon.ak rename to validators_v2/validators/beacon.ak diff --git a/validators/liquidity_locker.ak b/validators_v2/validators/liquidity_locker.ak similarity index 100% rename from validators/liquidity_locker.ak rename to validators_v2/validators/liquidity_locker.ak diff --git a/validators/orders/auction.ak b/validators_v2/validators/orders/auction.ak similarity index 100% rename from validators/orders/auction.ak rename to validators_v2/validators/orders/auction.ak diff --git a/validators/orders/grid.ak b/validators_v2/validators/orders/grid.ak similarity index 100% rename from validators/orders/grid.ak rename to validators_v2/validators/orders/grid.ak diff --git a/validators/orders/instant_order.ak b/validators_v2/validators/orders/instant_order.ak similarity index 100% rename from validators/orders/instant_order.ak rename to validators_v2/validators/orders/instant_order.ak diff --git a/validators/orders/limit_order.ak b/validators_v2/validators/orders/limit_order.ak similarity index 100% rename from validators/orders/limit_order.ak rename to validators_v2/validators/orders/limit_order.ak diff --git a/validators/stable_pool/deposit.ak b/validators_v2/validators/stable_pool/deposit.ak similarity index 100% rename from validators/stable_pool/deposit.ak rename to validators_v2/validators/stable_pool/deposit.ak diff --git a/validators/stable_pool/pool.ak b/validators_v2/validators/stable_pool/pool.ak similarity index 100% rename from validators/stable_pool/pool.ak rename to validators_v2/validators/stable_pool/pool.ak diff --git a/validators/stable_pool/proxy_dao.ak b/validators_v2/validators/stable_pool/proxy_dao.ak similarity index 100% rename from validators/stable_pool/proxy_dao.ak rename to validators_v2/validators/stable_pool/proxy_dao.ak diff --git a/validators/stable_pool/redeem.ak b/validators_v2/validators/stable_pool/redeem.ak similarity index 100% rename from validators/stable_pool/redeem.ak rename to validators_v2/validators/stable_pool/redeem.ak diff --git a/validators/stable_pool/redeem_uniform.ak b/validators_v2/validators/stable_pool/redeem_uniform.ak similarity index 100% rename from validators/stable_pool/redeem_uniform.ak rename to validators_v2/validators/stable_pool/redeem_uniform.ak diff --git a/validators_v3/aiken.lock b/validators_v3/aiken.lock new file mode 100644 index 0000000..21e7fb4 --- /dev/null +++ b/validators_v3/aiken.lock @@ -0,0 +1,15 @@ +# This file was generated by Aiken +# You typically do not need to edit this file + +[[requirements]] +name = "aiken-lang/stdlib" +version = "v2.1.0" +source = "github" + +[[packages]] +name = "aiken-lang/stdlib" +version = "v2.1.0" +requirements = [] +source = "github" + +[etags] diff --git a/validators_v3/aiken.toml b/validators_v3/aiken.toml new file mode 100644 index 0000000..6658d85 --- /dev/null +++ b/validators_v3/aiken.toml @@ -0,0 +1,18 @@ +name = "spectrum/splash" +version = "0.0.0" +compiler = "v1.1.19" +plutus = "v3" +license = "Apache-2.0" +description = "Aiken contracts for project 'spectrum/splash'" + +[repository] +user = "spectrum" +project = "splash" +platform = "github" + +[[dependencies]] +name = "aiken-lang/stdlib" +version = "v2.1.0" +source = "github" + +[config] diff --git a/validators_v3/lib/splash/orders/royalty_withdraw.ak b/validators_v3/lib/splash/orders/royalty_withdraw.ak new file mode 100644 index 0000000..0196b1f --- /dev/null +++ b/validators_v3/lib/splash/orders/royalty_withdraw.ak @@ -0,0 +1,33 @@ +use splash/plutus.{Asset} + +pub type RoyaltyWithdrawConfig { + withdraw_data: WithdrawData, + signature: ByteArray, + additional_bytes: ByteArray, +} + +pub type WithdrawData { + pool_nft: Asset, + withdraw_royalty_x: Int, + withdraw_royalty_y: Int, + ex_fee: Int, +} + +// Used to build message for signature verification +pub type WithdrawRoyaltyDataToSign { + withdraw_data: WithdrawData, + pool_nonce: Int, +} + +pub type DoubleRoyaltyWithdrawRedeemer { + pool_in_ix: Int, + order_in_ix: Int, + signer: Int, + hash: Bool, +} + +pub type RoyaltyWithdrawRedeemer { + pool_in_ix: Int, + order_in_ix: Int, + hash: Bool, +} diff --git a/validators_v3/lib/splash/plutus.ak b/validators_v3/lib/splash/plutus.ak new file mode 100644 index 0000000..44fde75 --- /dev/null +++ b/validators_v3/lib/splash/plutus.ak @@ -0,0 +1,15 @@ +use aiken/collection/dict.{Dict} +use aiken/crypto.{Blake2b_256, Hash} +use cardano/assets.{AssetName, PolicyId} + +pub type Asset { + policy: PolicyId, + name: AssetName, +} + +pub type DatumHashMap = + Dict, Data> + +pub fn mk_asset(policy: PolicyId, name: AssetName) -> Asset { + Asset { policy, name } +} diff --git a/validators_v3/lib/splash/rational.ak b/validators_v3/lib/splash/rational.ak new file mode 100644 index 0000000..92e3a27 --- /dev/null +++ b/validators_v3/lib/splash/rational.ak @@ -0,0 +1,8 @@ +pub type Rational { + num: Int, + denom: Int, +} + +pub fn rational(num: Int, denom: Int) -> Rational { + Rational { num, denom } +} diff --git a/validators_v3/lib/splash/royalty_pool/double_royalty_pool.ak b/validators_v3/lib/splash/royalty_pool/double_royalty_pool.ak new file mode 100644 index 0000000..872dd79 --- /dev/null +++ b/validators_v3/lib/splash/royalty_pool/double_royalty_pool.ak @@ -0,0 +1,24 @@ +use cardano/address.{StakeCredential} +use splash/plutus.{Asset} + +pub type DoubleRoyaltyPoolConfig { + pool_nft: Asset, + pool_x: Asset, + pool_y: Asset, + pool_lq: Asset, + fee_num: Int, + treasury_fee: Int, + first_royalty_fee: Int, + second_royalty_fee: Int, + treasury_x: Int, + treasury_y: Int, + first_royalty_x: Int, + first_royalty_y: Int, + second_royalty_x: Int, + second_royalty_y: Int, + dao_policy: List, + treasury_address: ByteArray, + first_royalty_pub_key: ByteArray, + second_royalty_pub_key: ByteArray, + nonce: Int, +} diff --git a/validators_v3/lib/splash/royalty_pool/single_royalty_pool.ak b/validators_v3/lib/splash/royalty_pool/single_royalty_pool.ak new file mode 100644 index 0000000..4d48c51 --- /dev/null +++ b/validators_v3/lib/splash/royalty_pool/single_royalty_pool.ak @@ -0,0 +1,20 @@ +use cardano/address.{StakeCredential} +use splash/plutus.{Asset} + +pub type SingleRoyaltyPoolConfig { + pool_nft: Asset, + pool_x: Asset, + pool_y: Asset, + pool_lq: Asset, + fee_num: Int, + treasury_fee: Int, + royalty_fee: Int, + treasury_x: Int, + treasury_y: Int, + royalty_x: Int, + royalty_y: Int, + dao_policy: List, + treasury_address: ByteArray, + royalty_pub_key: ByteArray, + nonce: Int, +} diff --git a/validators_v3/lib/splash/value_ext.ak b/validators_v3/lib/splash/value_ext.ak new file mode 100644 index 0000000..0ba2504 --- /dev/null +++ b/validators_v3/lib/splash/value_ext.ak @@ -0,0 +1,12 @@ +use aiken/collection/list +use cardano/assets.{Value} +use splash/plutus.{Asset} + +pub fn asset_quantity_of(value: Value, asset: Asset) -> Int { + let Asset { policy, name: token_name } = asset + assets.quantity_of(value, policy, token_name) +} + +pub fn v_len(v: Value) -> Int { + v |> assets.flatten |> list.length +} diff --git a/validators_v3/plutus.json b/validators_v3/plutus.json new file mode 100644 index 0000000..8d82ca1 --- /dev/null +++ b/validators_v3/plutus.json @@ -0,0 +1,127 @@ +{ + "preamble": { + "title": "spectrum/splash", + "description": "Aiken contracts for project 'spectrum/splash'", + "version": "0.0.0", + "plutusVersion": "v3", + "compiler": { + "name": "Aiken", + "version": "v1.1.19+e525483" + }, + "license": "Apache-2.0" + }, + "validators": [ + { + "title": "royalty_pool/double_royalty_withdraw_pool.double_royalty_withdraw_pool.withdraw", + "redeemer": { + "title": "redeemer", + "schema": { + "$ref": "#/definitions/splash~1orders~1royalty_withdraw~1DoubleRoyaltyWithdrawRedeemer" + } + }, + "compiledCode": "590ab701010029800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cdc3a400930080024888966002600460106ea800e26644b30013001300a375400d132323233229800992cc004c0440062b30013371290021808000c5a260046020002807a2c8090dd518098014dd69809802cdd698098024dd69809801a4444b300130180068cc004dd6180b980a1baa00c9180c180c980c800c8c060c064006600a60266ea8c05cc060c060c060c050dd5007cdd2a40009111119194c004cc00401cdd69802980d9baa0169bad3006301b375402d3758600c60366ea804d22259800980a180e9baa003899192cc004c064c07cdd5000c4c8c8ca600264b300130153023375400315980099b8f375c604e60486ea800522011c6710f3002759d028a90a08e1538b25d4eaf48c72d88157f71d68dcc0008980e9801008452820448a504088604c60466ea8c09801644b3001301b30243754005132323322598009816801c0162c8150dd718150009bae302a002302a0013025375400516408d3026302337540089112cc004c070c094dd5000c4c8c8c8cc8966002605e00713259800981118159baa0018991919194c004dd69819800cdd69819801cdd698198012444b30013037004899807981b003899199119194c004dd6981d800cdd6981d981e000ccc078090dd6981d981c1baa0339bae303b303c0049bae303b004981d8012444444b30013034303d37540091323298009bab304300198219822000cc10c00922259800981e18211baa00289991198008010cc004c114dd50014888c966002607460906ea80062900044dd6982618249baa001411c64b3001303a3048375400314c0103d87a8000899198008009bab304d304a375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062606a6609e609a00497ae08a60103d87a8000412d1330040043051003412c6eb8c12c004c13800504c208e32330010010042259800800c5300103d87a8000899192cc004cdc8803000c56600266e3c018006260686609c609800497ae08a60103d87a80004129133004004305000341286eb8c128004c13400504b4dc7a4500912cc0040062900044c09ccc008008c12c005048244453001304d0049826002488ca6002007375c609e003375c609e60a00028030c12cdd5000ca6002003488100a441004011300100148888a600260a400b3051005918011919800800801112cc004006297ae08991991199119801001000912cc004006200713233059374e660b26ea4014cc164c158004cc164c15c0052f5c06600600660b600460b200282b8dd5982a0019bae3051001330030033056002305400141493375e00802332330010010322259800800c530103d87a80008992cc004c108cc018dd5981d98289baa0010078981c99829800a5eb8226600600660aa0048278c14c00505124444530013057005982b002ccc02004c012600602691114c004c16c01260b40093300c017003acc0056600260206eb8c168c15cdd50044528c4c040dd7182d182b9baa00341551480022601602e82a922223232323232323232323232323298009bae306b0019bad306b306c0019980e8140084dd69835808cdd69835806cdd698358064dd69835805cdd698358054dd69835804cdd698358044dd69835803cdd698358034dd69835802cdd618358024dd71835801cdd7183580124444444444444444b3001306e3077375404d1323298009bab307d001983e983f000cc1f400922259800983b183e1baa0028991981d00089919194c004dd6984200800cdd6984200984280800cdd99834998418082619841809ba80184bd704dd6984200801cdd6984200801244444b30010638acc004cdd7822005456600266e1c0c0c0d80322b300130773303b00c03c8acc0056600260f80d515980099b8904e0158acc004cdc482680a456600266e1c008cdc080a827456600266e1c004cdc080a026c56600266e1c04c016266e1c04801229410840145282108028a5042100514a084200a294108401456600266e2413804e2b30013371209a02515980099b870053370202609d15980099b870043370202409b15980099b87015002899b870140018a5042100514a084200a29410840145282108028a5042100484200a2b30015980099b8701c3303b00c02e8acc004cdc399b8103104e3303b00c037899b873370205a09a6607601806514a084200a2941084014566003300159800983e0354403e203c84200a66e2812d660020df13790007100342100504a5caa2b30013375e60dc6611002078661100206e6611002064661100205c66110026ea006ccc22004dd400d19844009ba80193308801375003066110026ea005ccc22004dd400b19844009ba80023308801375000266110026ea0014cc22004dd400219844009ba70113308801375202066110026ea403ccc22004dd480f19844009ba8306601d4bd70004c56600206b15980099b8702c59800acc004c0fcdd71844809843009baa0378a518981f9bae308901308601375406484200a2900044c0e80310840144c1fcc1901ca29410840145282108028a5042100514a084200a29410840145282108028a5042100514a084200a2941084014528210802184200800984180800984100984100984100984100984100984100984100984100984100984100983f1baa001308001307d37540051641ec307d0013078375460f660f06ea809a2c83b060d600260d400260d200260d000260ce00260cc00260ca00260c800260c600260c400260c200260c000260be008030463043375400444b3001303b3044375400513232323232323232323232323232323232323298009bad305b001982d8094c16c04660b6021375a60b601f375a60b601d375a60b601b375a60b6019375a60b6017375a60b6015375a60b6013375a60b6011375a60b600f375a60b600d375860b600b375c60b6009375c60b6007375c60b60049111111111111111112cc004c1b804e26608c60da04a26608c02226608c02026608c01e2646600200200a4464b3001002814c4c8cc896600260cc00513259800983a800c4c8c96600260d20031323259800983c801401a2c83b0dd7183b80098399baa0028acc004c19000626464b300130790028034590761bae3077001307337540051641c48388c1c4dd5000983a000c5907218381baa0038acc004c18400a26464653001375a60ec003375a60ec007375a60ec0049112cc004c1e801200f1641dc30760013075001307037540071641b88370c1b4dd5000898011839001983800120dc30020028b20d6182d800982d000982c800982c000982b800982b000982a800982a000982980098290009828800982800098278009827000982680098260009825800982500098229baa0028b20868b20821821800981f1baa30413042303e37546082607c6ea80122c81e06076002606c6ea8004c0e0004c0dc004c0ccdd50074590340c0cc004c0c8004c0c4004c0b0dd5000c5902a1817002c5902c1bae302c001375c605800460580026056002604c6ea80062c8120600200244b30010018a40011300333002002302700140906e0120028b203c302230233023001301e375460426044603c6ea8c084c078dd5001c5901c0c0040048896600200514c103d87a80008acc004c048006260086603c603e00497ae08cc00400e6040005337000029000a006406880e91640543012001370e90011808800980800098059baa0068b2012300c300937540066e1d20008b200e180400098019baa0088a4d13656400401", + "hash": "7bd23810f77f08468af0a0ecec3fa3be1f3410a74e36c65193a96cb5" + }, + { + "title": "royalty_pool/double_royalty_withdraw_pool.double_royalty_withdraw_pool.else", + "redeemer": { + "schema": {} + }, + "compiledCode": "590ab701010029800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cdc3a400930080024888966002600460106ea800e26644b30013001300a375400d132323233229800992cc004c0440062b30013371290021808000c5a260046020002807a2c8090dd518098014dd69809802cdd698098024dd69809801a4444b300130180068cc004dd6180b980a1baa00c9180c180c980c800c8c060c064006600a60266ea8c05cc060c060c060c050dd5007cdd2a40009111119194c004cc00401cdd69802980d9baa0169bad3006301b375402d3758600c60366ea804d22259800980a180e9baa003899192cc004c064c07cdd5000c4c8c8ca600264b300130153023375400315980099b8f375c604e60486ea800522011c6710f3002759d028a90a08e1538b25d4eaf48c72d88157f71d68dcc0008980e9801008452820448a504088604c60466ea8c09801644b3001301b30243754005132323322598009816801c0162c8150dd718150009bae302a002302a0013025375400516408d3026302337540089112cc004c070c094dd5000c4c8c8c8cc8966002605e00713259800981118159baa0018991919194c004dd69819800cdd69819801cdd698198012444b30013037004899807981b003899199119194c004dd6981d800cdd6981d981e000ccc078090dd6981d981c1baa0339bae303b303c0049bae303b004981d8012444444b30013034303d37540091323298009bab304300198219822000cc10c00922259800981e18211baa00289991198008010cc004c114dd50014888c966002607460906ea80062900044dd6982618249baa001411c64b3001303a3048375400314c0103d87a8000899198008009bab304d304a375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062606a6609e609a00497ae08a60103d87a8000412d1330040043051003412c6eb8c12c004c13800504c208e32330010010042259800800c5300103d87a8000899192cc004cdc8803000c56600266e3c018006260686609c609800497ae08a60103d87a80004129133004004305000341286eb8c128004c13400504b4dc7a4500912cc0040062900044c09ccc008008c12c005048244453001304d0049826002488ca6002007375c609e003375c609e60a00028030c12cdd5000ca6002003488100a441004011300100148888a600260a400b3051005918011919800800801112cc004006297ae08991991199119801001000912cc004006200713233059374e660b26ea4014cc164c158004cc164c15c0052f5c06600600660b600460b200282b8dd5982a0019bae3051001330030033056002305400141493375e00802332330010010322259800800c530103d87a80008992cc004c108cc018dd5981d98289baa0010078981c99829800a5eb8226600600660aa0048278c14c00505124444530013057005982b002ccc02004c012600602691114c004c16c01260b40093300c017003acc0056600260206eb8c168c15cdd50044528c4c040dd7182d182b9baa00341551480022601602e82a922223232323232323232323232323298009bae306b0019bad306b306c0019980e8140084dd69835808cdd69835806cdd698358064dd69835805cdd698358054dd69835804cdd698358044dd69835803cdd698358034dd69835802cdd618358024dd71835801cdd7183580124444444444444444b3001306e3077375404d1323298009bab307d001983e983f000cc1f400922259800983b183e1baa0028991981d00089919194c004dd6984200800cdd6984200984280800cdd99834998418082619841809ba80184bd704dd6984200801cdd6984200801244444b30010638acc004cdd7822005456600266e1c0c0c0d80322b300130773303b00c03c8acc0056600260f80d515980099b8904e0158acc004cdc482680a456600266e1c008cdc080a827456600266e1c004cdc080a026c56600266e1c04c016266e1c04801229410840145282108028a5042100514a084200a294108401456600266e2413804e2b30013371209a02515980099b870053370202609d15980099b870043370202409b15980099b87015002899b870140018a5042100514a084200a29410840145282108028a5042100484200a2b30015980099b8701c3303b00c02e8acc004cdc399b8103104e3303b00c037899b873370205a09a6607601806514a084200a2941084014566003300159800983e0354403e203c84200a66e2812d660020df13790007100342100504a5caa2b30013375e60dc6611002078661100206e6611002064661100205c66110026ea006ccc22004dd400d19844009ba80193308801375003066110026ea005ccc22004dd400b19844009ba80023308801375000266110026ea0014cc22004dd400219844009ba70113308801375202066110026ea403ccc22004dd480f19844009ba8306601d4bd70004c56600206b15980099b8702c59800acc004c0fcdd71844809843009baa0378a518981f9bae308901308601375406484200a2900044c0e80310840144c1fcc1901ca29410840145282108028a5042100514a084200a29410840145282108028a5042100514a084200a2941084014528210802184200800984180800984100984100984100984100984100984100984100984100984100984100983f1baa001308001307d37540051641ec307d0013078375460f660f06ea809a2c83b060d600260d400260d200260d000260ce00260cc00260ca00260c800260c600260c400260c200260c000260be008030463043375400444b3001303b3044375400513232323232323232323232323232323232323298009bad305b001982d8094c16c04660b6021375a60b601f375a60b601d375a60b601b375a60b6019375a60b6017375a60b6015375a60b6013375a60b6011375a60b600f375a60b600d375860b600b375c60b6009375c60b6007375c60b60049111111111111111112cc004c1b804e26608c60da04a26608c02226608c02026608c01e2646600200200a4464b3001002814c4c8cc896600260cc00513259800983a800c4c8c96600260d20031323259800983c801401a2c83b0dd7183b80098399baa0028acc004c19000626464b300130790028034590761bae3077001307337540051641c48388c1c4dd5000983a000c5907218381baa0038acc004c18400a26464653001375a60ec003375a60ec007375a60ec0049112cc004c1e801200f1641dc30760013075001307037540071641b88370c1b4dd5000898011839001983800120dc30020028b20d6182d800982d000982c800982c000982b800982b000982a800982a000982980098290009828800982800098278009827000982680098260009825800982500098229baa0028b20868b20821821800981f1baa30413042303e37546082607c6ea80122c81e06076002606c6ea8004c0e0004c0dc004c0ccdd50074590340c0cc004c0c8004c0c4004c0b0dd5000c5902a1817002c5902c1bae302c001375c605800460580026056002604c6ea80062c8120600200244b30010018a40011300333002002302700140906e0120028b203c302230233023001301e375460426044603c6ea8c084c078dd5001c5901c0c0040048896600200514c103d87a80008acc004c048006260086603c603e00497ae08cc00400e6040005337000029000a006406880e91640543012001370e90011808800980800098059baa0068b2012300c300937540066e1d20008b200e180400098019baa0088a4d13656400401", + "hash": "7bd23810f77f08468af0a0ecec3fa3be1f3410a74e36c65193a96cb5" + }, + { + "title": "royalty_pool/single_royalty_withdraw_pool.royalty_withdraw_pool.withdraw", + "redeemer": { + "title": "redeemer", + "schema": { + "$ref": "#/definitions/splash~1orders~1royalty_withdraw~1RoyaltyWithdrawRedeemer" + } + }, + "compiledCode": "59095b01010029800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cdc3a400930080024888966002600460106ea800e26644b30013001300a375400d1323233229800992cc004c0400062b30013371290021807800c5a26004601e00280722c8088dd518090014dd698090024dd69809001a444b300130160058cc004dd6180a98091baa00a9180b180b980b800c8c058c05c0066e95200048888c8ca60026600200c6eb4c010c060dd5009cc028c05cdd51802980c1baa0139bac3005301837540209112cc004c044c068dd5001c4c8c966002602c60386ea8006264646530013259800980998101baa0018acc004cdc79bae30243021375400291011c92c094b90cf3637a96a13e9bc9a04ce8bb7e48c7ed0b5d1cc5ca7332008980d1801007c528203e8a50407c604660406ea8c08c01644b3001301830213754005132323322598009815001c0162c8138dd718138009bae30270023027001302237540051640813023302037540089112cc004c064c088dd5000c4c8c8c8cc8966002605800713259800980f98141baa0018991919194c004dd69818000cdd69818001cdd698180012444b300130340048998079819803899199119194c004dd6981c000cdd6981c181c800ccc07808cdd6981c181a9baa0309bae303830390049bae3038004981c0012444444b30013031303a37540091323298009bab304000198201820800cc10000922259800981c981f9baa00289991198008010cc004c108dd50014888c9660026070608a6ea80062900044dd6982498231baa001411064b300130383045375400314c0103d87a8000899198008009bab304a3047375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062606a66098609400497ae08a60103d87a80004121133004004304e00341206eb8c120004c12c005049208832330010010042259800800c5300103d87a8000899192cc004cdc8803000c56600266e3c0180062606866096609200497ae08a60103d87a8000411d133004004304d003411c6eb8c11c004c1280050484dc7a4500912cc0040062900044c09ccc008008c120005045244453001304a0049824802488ca6002007375c6098003375c6098609a0028030c120dd5000ca6002003488100a441004011300100148888a6002609e00b304e005918011919800800801112cc004006297ae08991991199119801001000912cc004006200713233056374e660ac6ea4014cc158c14c004cc158c1500052f5c06600600660b000460ac00282a0dd598288019bae304e0013300300330530023051001413d3375e00802332330010010322259800800c530103d87a80008992cc004c100cc018dd5981d18271baa0010078981c99828000a5eb8226600600660a40048260c14000504e244445300130540059829802ccc02004c012600602691114c004c16001260ae0093300c017003acc0056600260206eb8c15cc150dd50044528c4c040dd7182b982a1baa00341491480022601602e8291222232323232323232323298009bae30640019bad306430650019980c8120064dd69832006cdd69832004cdd698320044dd69832003cdd698320034dd69832002cdd698320024dd61832001cdd718320012444444444444b30013063306c375403d1323298009bab307200198391839800cc1c800922259800983598389baa002899198190008994c004dd6983b800cdd6983b983c000cdd9982f9983b0211983b1ba80124bd702444b30010578acc004cdd781c003456600266e1c090c0a80222b300130693302f0080308acc0056600266e2410803a2b30013371208201b15980099b870033370201c08515980099b870023370201a08315980099b870143302f0080228acc004cdc399b810250423302f00802b899b87337020420826605e01004d14a083aa2941075452820ea8a5041d514a083aa29410754566003300101699b8a03f5980082f44de4000c400507540f972a8acc004c1c0c1601962b30013375e60c4660f2060660f2056660f204c660f2044660f26ea004ccc1e4dd40091983c9ba8011330793750020660f26ea003ccc1e4dd40019983c9ba800233079374e018660f26ea402ccc1e4dd480b1983c9ba8305a0154bd70002c56600205313370e040b30015980098199bae307a3077375405714a313033375c60f460ee6ea80990754520008981700420ea8a5041d514a083aa2941075452820ea8a5041d514a083aa2941075452820ea8a5041d43077307730773077307730773077307730773073375400260ea60e46ea800a2c838060e400260da6ea8c1c0c1b4dd500f45906b0c190004c18c004c188004c184004c180004c17c004c178004c174004c1700100608660806ea80088966002607060826ea800a26464646464646464646464646464653001375a60a8003305400e982a006cc1500326eb4c15002e6eb4c15002a6eb4c1500266eb4c1500226eb4c15001e6eb4c15001a6eb4c1500166eb0c1500126eb8c15000e6eb8c15000922222222222222598009831807c4cc0f8c1880744cc0f80344cc0f80304cc0f802c4c8cc00400401088c96600200502189919912cc004c16c00a264b3001306a001899192cc004c17800626464b3001306e00280345906b1bae306c00130683754005159800982d000c4c8c96600260dc0050068b20d6375c60d800260d06ea800a2c833106618331baa00130690018b20ce30653754007159800982b80144c8c8ca60026eb4c1ac0066eb4c1ac00e6eb4c1ac009222598009837802401e2c836060d600260d400260ca6ea800e2c831906318311baa0011300230670033065002418c600400516418030540013053001305200130510013050001304f001304e001304d001304c001304b001304a001304900130480013047001304237540051641011640f83040001303b3754607c607e60766ea8c0f8c0ecdd50024590390c0e0004c0ccdd5000981a800981a00098181baa00e8b206218180009817800981700098149baa0018b204e302b0058b2052375c60520026eb8c0a4008c0a4004c0a0004c08cdd5000c590210c0040048966002003148002260066600400460480028108dc02400516406c603e6040604000260366ea8c078c07cc06cdd5180f180d9baa0038b203218008009112cc00400a298103d87a80008acc004c03c0062600866036603800497ae08cc00400e603a005337000029000a006405c80d116404c3011001370e9001180800098059baa0068b2012300c300937540066e1d20008b200e180400098019baa0088a4d1365640041", + "hash": "a75ab76ed618daa4fa6c4d4690f4da9d5e67fc0095eb94690e0f4417" + }, + { + "title": "royalty_pool/single_royalty_withdraw_pool.royalty_withdraw_pool.else", + "redeemer": { + "schema": {} + }, + "compiledCode": "59095b01010029800aba2aba1aba0aab9faab9eaab9dab9a488888896600264653001300800198041804800cdc3a400930080024888966002600460106ea800e26644b30013001300a375400d1323233229800992cc004c0400062b30013371290021807800c5a26004601e00280722c8088dd518090014dd698090024dd69809001a444b300130160058cc004dd6180a98091baa00a9180b180b980b800c8c058c05c0066e95200048888c8ca60026600200c6eb4c010c060dd5009cc028c05cdd51802980c1baa0139bac3005301837540209112cc004c044c068dd5001c4c8c966002602c60386ea8006264646530013259800980998101baa0018acc004cdc79bae30243021375400291011c92c094b90cf3637a96a13e9bc9a04ce8bb7e48c7ed0b5d1cc5ca7332008980d1801007c528203e8a50407c604660406ea8c08c01644b3001301830213754005132323322598009815001c0162c8138dd718138009bae30270023027001302237540051640813023302037540089112cc004c064c088dd5000c4c8c8c8cc8966002605800713259800980f98141baa0018991919194c004dd69818000cdd69818001cdd698180012444b300130340048998079819803899199119194c004dd6981c000cdd6981c181c800ccc07808cdd6981c181a9baa0309bae303830390049bae3038004981c0012444444b30013031303a37540091323298009bab304000198201820800cc10000922259800981c981f9baa00289991198008010cc004c108dd50014888c9660026070608a6ea80062900044dd6982498231baa001411064b300130383045375400314c0103d87a8000899198008009bab304a3047375400444b30010018a6103d87a8000899192cc004cdc8803000c56600266e3c0180062606a66098609400497ae08a60103d87a80004121133004004304e00341206eb8c120004c12c005049208832330010010042259800800c5300103d87a8000899192cc004cdc8803000c56600266e3c0180062606866096609200497ae08a60103d87a8000411d133004004304d003411c6eb8c11c004c1280050484dc7a4500912cc0040062900044c09ccc008008c120005045244453001304a0049824802488ca6002007375c6098003375c6098609a0028030c120dd5000ca6002003488100a441004011300100148888a6002609e00b304e005918011919800800801112cc004006297ae08991991199119801001000912cc004006200713233056374e660ac6ea4014cc158c14c004cc158c1500052f5c06600600660b000460ac00282a0dd598288019bae304e0013300300330530023051001413d3375e00802332330010010322259800800c530103d87a80008992cc004c100cc018dd5981d18271baa0010078981c99828000a5eb8226600600660a40048260c14000504e244445300130540059829802ccc02004c012600602691114c004c16001260ae0093300c017003acc0056600260206eb8c15cc150dd50044528c4c040dd7182b982a1baa00341491480022601602e8291222232323232323232323298009bae30640019bad306430650019980c8120064dd69832006cdd69832004cdd698320044dd69832003cdd698320034dd69832002cdd698320024dd61832001cdd718320012444444444444b30013063306c375403d1323298009bab307200198391839800cc1c800922259800983598389baa002899198190008994c004dd6983b800cdd6983b983c000cdd9982f9983b0211983b1ba80124bd702444b30010578acc004cdd781c003456600266e1c090c0a80222b300130693302f0080308acc0056600266e2410803a2b30013371208201b15980099b870033370201c08515980099b870023370201a08315980099b870143302f0080228acc004cdc399b810250423302f00802b899b87337020420826605e01004d14a083aa2941075452820ea8a5041d514a083aa29410754566003300101699b8a03f5980082f44de4000c400507540f972a8acc004c1c0c1601962b30013375e60c4660f2060660f2056660f204c660f2044660f26ea004ccc1e4dd40091983c9ba8011330793750020660f26ea003ccc1e4dd40019983c9ba800233079374e018660f26ea402ccc1e4dd480b1983c9ba8305a0154bd70002c56600205313370e040b30015980098199bae307a3077375405714a313033375c60f460ee6ea80990754520008981700420ea8a5041d514a083aa2941075452820ea8a5041d514a083aa2941075452820ea8a5041d43077307730773077307730773077307730773073375400260ea60e46ea800a2c838060e400260da6ea8c1c0c1b4dd500f45906b0c190004c18c004c188004c184004c180004c17c004c178004c174004c1700100608660806ea80088966002607060826ea800a26464646464646464646464646464653001375a60a8003305400e982a006cc1500326eb4c15002e6eb4c15002a6eb4c1500266eb4c1500226eb4c15001e6eb4c15001a6eb4c1500166eb0c1500126eb8c15000e6eb8c15000922222222222222598009831807c4cc0f8c1880744cc0f80344cc0f80304cc0f802c4c8cc00400401088c96600200502189919912cc004c16c00a264b3001306a001899192cc004c17800626464b3001306e00280345906b1bae306c00130683754005159800982d000c4c8c96600260dc0050068b20d6375c60d800260d06ea800a2c833106618331baa00130690018b20ce30653754007159800982b80144c8c8ca60026eb4c1ac0066eb4c1ac00e6eb4c1ac009222598009837802401e2c836060d600260d400260ca6ea800e2c831906318311baa0011300230670033065002418c600400516418030540013053001305200130510013050001304f001304e001304d001304c001304b001304a001304900130480013047001304237540051641011640f83040001303b3754607c607e60766ea8c0f8c0ecdd50024590390c0e0004c0ccdd5000981a800981a00098181baa00e8b206218180009817800981700098149baa0018b204e302b0058b2052375c60520026eb8c0a4008c0a4004c0a0004c08cdd5000c590210c0040048966002003148002260066600400460480028108dc02400516406c603e6040604000260366ea8c078c07cc06cdd5180f180d9baa0038b203218008009112cc00400a298103d87a80008acc004c03c0062600866036603800497ae08cc00400e603a005337000029000a006405c80d116404c3011001370e9001180800098059baa0068b2012300c300937540066e1d20008b200e180400098019baa0088a4d1365640041", + "hash": "a75ab76ed618daa4fa6c4d4690f4da9d5e67fc0095eb94690e0f4417" + } + ], + "definitions": { + "Bool": { + "title": "Bool", + "anyOf": [ + { + "title": "False", + "dataType": "constructor", + "index": 0, + "fields": [] + }, + { + "title": "True", + "dataType": "constructor", + "index": 1, + "fields": [] + } + ] + }, + "Int": { + "dataType": "integer" + }, + "splash/orders/royalty_withdraw/DoubleRoyaltyWithdrawRedeemer": { + "title": "DoubleRoyaltyWithdrawRedeemer", + "anyOf": [ + { + "title": "DoubleRoyaltyWithdrawRedeemer", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "order_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "signer", + "$ref": "#/definitions/Int" + }, + { + "title": "hash", + "$ref": "#/definitions/Bool" + } + ] + } + ] + }, + "splash/orders/royalty_withdraw/RoyaltyWithdrawRedeemer": { + "title": "RoyaltyWithdrawRedeemer", + "anyOf": [ + { + "title": "RoyaltyWithdrawRedeemer", + "dataType": "constructor", + "index": 0, + "fields": [ + { + "title": "pool_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "order_in_ix", + "$ref": "#/definitions/Int" + }, + { + "title": "hash", + "$ref": "#/definitions/Bool" + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/validators_v3/validators/royalty_pool/double_royalty_withdraw_pool.ak b/validators_v3/validators/royalty_pool/double_royalty_withdraw_pool.ak new file mode 100644 index 0000000..42b4fe8 --- /dev/null +++ b/validators_v3/validators/royalty_pool/double_royalty_withdraw_pool.ak @@ -0,0 +1,275 @@ +use aiken/builtin +use aiken/collection/list +use aiken/crypto.{blake2b_224} +use aiken/primitive/bytearray +use cardano/address.{Address, Credential, Script} +use cardano/assets.{ada_policy_id} +use cardano/transaction.{InlineDatum, Input, Output, Transaction} +use splash/orders/royalty_withdraw.{ + DoubleRoyaltyWithdrawRedeemer, RoyaltyWithdrawConfig, WithdrawData, + WithdrawRoyaltyDataToSign, +} +use splash/plutus.{Asset} +use splash/royalty_pool/double_royalty_pool.{DoubleRoyaltyPoolConfig} +use splash/value_ext.{asset_quantity_of, v_len} + +// Double Royalty Withdrawal Contract +// +// Purpose +// - Securely process withdrawals from a pool that maintains two royalty slots +// (first/second). Enforces selection by signer, correct value deltas, +// and datum immutability. +// +// Enforced rules +// 1) Restricted Field Modifications +// - Only these fields may change: +// • first_royalty_x / first_royalty_y (when signer == 0) +// • second_royalty_x / second_royalty_y (when signer != 0) +// • nonce (must increase by exactly +1) +// - All other fields (pool_x, pool_y, pool_lq, fees, dao_policy, +// treasury_address, *_pub_key, etc.) must be unchanged. +// +// 2) Signer delection +// - signer == 0 → withdraw from the first slot: +// new.first_royalty_x = old.first_royalty_x - withdraw_x +// new.first_royalty_y = old.first_royalty_y - withdraw_y +// new.second_* == old.second_* +// - signer != 0 → withdraw from the second slot: +// new.second_royalty_x = old.second_royalty_x - withdraw_x +// new.second_royalty_y = old.second_royalty_y - withdraw_y +// new.first_* == old.first_* +// - Bounds: withdraw_x ≤ slot_x and withdraw_y ≤ slot_y. +// +// 3) Value deltas (outputs vs inputs) +// - pool_x and pool_y in the pool output value must be reduced exactly by +// withdraw_x / withdraw_y. +// - pool_lq must be unchanged. +// +// 4) ADA invariant for token-to-token pools +// - If both pool_x and pool_y are non-ADA (policy != ada_policy_id), then +// the lovelace amount in the pool output must equal the input’s. +// +// 5) Pool identity, address & shape +// - Pool output is located by pool_nft quantity == 1. +// - The pool address (input → output) must remain the same. +// - The “shape” of the value (token entry count) must remain unchanged. +// +// 6) Input structure +// - Exactly two inputs: the withdraw-request UTxO and the pool UTxO. +// - The withdraw-request input must be locked by royalty_withdraw_request_vh +// (script-hash check) to prevent spoofed requests. +// +// 7) Signature verification +// - Message = additional_bytes || payload_to_sign +// - payload_to_sign is the CBOR of: +// WithdrawRoyaltyDataToSign { withdraw_data, pool_nonce = old.nonce } +// (or its blake2b_224 hash when the redeemer’s flag requests hashing). +// - Public key selection: +// signer == 0 → first_royalty_pub_key +// otherwise → second_royalty_pub_key +// +// 8) Final datum check +// - The new DoubleRoyaltyPoolConfig must equal the previous one except for: +// • the modified royalty slot fields (per signer rule), and +// • nonce = old.nonce + 1. + + +const royalty_withdraw_request_vh = + #"6710f3002759d028a90a08e1538b25d4eaf48c72d88157f71d68dcc0" + +validator double_royalty_withdraw_pool { + withdraw( + redeemer: DoubleRoyaltyWithdrawRedeemer, + _account: Credential, + self: Transaction, + ) { + let inputs = self.inputs + let outputs = self.outputs + + let order_in_ix = redeemer.order_in_ix + let pool_in_ix = redeemer.pool_in_ix + let signer = redeemer.signer + let hash = redeemer.hash + + expect Some(order_input) = list.at(inputs, order_in_ix) + let Input { output: order_input_out, .. } = order_input + + expect Output { + address: Address { payment_credential: order_pc, .. }, + datum: InlineDatum(order_datum), + .. + } = order_input_out + + let correct_order_input_address = + when order_pc is { + Script(vh) -> + vh == royalty_withdraw_request_vh && list.length(inputs) == 2 + _ -> False + } + + expect order_conf: RoyaltyWithdrawConfig = order_datum + let RoyaltyWithdrawConfig { withdraw_data: wd, signature, additional_bytes } = + order_conf + + let WithdrawData { + pool_nft: pool_nft_req, + withdraw_royalty_x: withdraw_x, + withdraw_royalty_y: withdraw_y, + .. + } = wd + + expect Some(pool_input) = list.at(inputs, pool_in_ix) + let Input { output: pool_in_output, .. } = pool_input + + expect Output { + value: prev_pool_value, + address: prev_addr, + datum: InlineDatum(pool_in_datum), + .. + } = pool_in_output + + expect prev_cfg: DoubleRoyaltyPoolConfig = pool_in_datum + + let DoubleRoyaltyPoolConfig { + pool_nft: prev_pool_nft, + pool_x: prev_pool_x, + pool_y: prev_pool_y, + pool_lq: prev_pool_lq, + fee_num: prev_fee_num, + treasury_fee: prev_treasury_fee, + first_royalty_fee: prev_first_fee, + second_royalty_fee: prev_second_fee, + treasury_x: prev_treasury_x, + treasury_y: prev_treasury_y, + first_royalty_x: prev_first_rx, + first_royalty_y: prev_first_ry, + second_royalty_x: prev_second_rx, + second_royalty_y: prev_second_ry, + dao_policy: prev_dao_policy, + treasury_address: prev_treasury_address, + first_royalty_pub_key: prev_first_pk, + second_royalty_pub_key: prev_second_pk, + nonce: prev_nonce, + } = prev_cfg + + let prev_x_val = asset_quantity_of(prev_pool_value, prev_pool_x) + let prev_y_val = asset_quantity_of(prev_pool_value, prev_pool_y) + let prev_lq_val = asset_quantity_of(prev_pool_value, prev_pool_lq) + + let prev_lovelace_token2token = + if prev_pool_x.policy == ada_policy_id || prev_pool_y.policy == ada_policy_id { + 0 + } else { + assets.lovelace_of(prev_pool_value) + } + + let prev_len = v_len(prev_pool_value) + let correct_pool = prev_pool_nft == pool_nft_req + + expect Some(pool_out_output) = + list.find( + outputs, + fn(o) { asset_quantity_of(o.value, prev_pool_nft) == 1 }, + ) + + expect Output { + value: new_value, + address: new_addr, + datum: InlineDatum(pool_out_datum), + .. + } = pool_out_output + + expect new_cfg: DoubleRoyaltyPoolConfig = pool_out_datum + + let DoubleRoyaltyPoolConfig { + first_royalty_x: new_first_rx, + first_royalty_y: new_first_ry, + second_royalty_x: new_second_rx, + second_royalty_y: new_second_ry, + .. + } = new_cfg + + let new_x_val = asset_quantity_of(new_value, prev_pool_x) + let new_y_val = asset_quantity_of(new_value, prev_pool_y) + let new_lq_val = asset_quantity_of(new_value, prev_pool_lq) + + let new_lovelace_token2token = + if prev_pool_x.policy == ada_policy_id || prev_pool_y.policy == ada_policy_id { + 0 + } else { + assets.lovelace_of(new_value) + } + + let new_len = v_len(new_value) + + let correct_final_pool_address = prev_addr == new_addr + let correct_tokens_qty_in_pool = prev_len == new_len + let pool_identity = asset_quantity_of(new_value, prev_pool_nft) == 1 + + let royalty_withdraw_is_correct = + if signer == 0 { + withdraw_x <= prev_first_rx && withdraw_y <= prev_first_ry && new_first_rx == prev_first_rx - withdraw_x && new_first_ry == prev_first_ry - withdraw_y && prev_second_rx == new_second_rx && prev_second_ry == new_second_ry + } else { + withdraw_x <= prev_second_rx && withdraw_y <= prev_second_ry && new_second_rx == prev_second_rx - withdraw_x && new_second_ry == prev_second_ry - withdraw_y && prev_first_rx == new_first_rx && prev_first_ry == new_first_ry + } + + let tokens_diff_is_correct = + prev_lq_val == new_lq_val && prev_x_val - withdraw_x == new_x_val && prev_y_val - withdraw_y == new_y_val + + let correct_lovelace_token2token = + prev_lovelace_token2token == new_lovelace_token2token + + let payload: WithdrawRoyaltyDataToSign = + WithdrawRoyaltyDataToSign { withdraw_data: wd, pool_nonce: prev_nonce } + let payload_raw = builtin.serialise_data(payload) + let payload_to_sign = + if hash { + blake2b_224(payload_raw) + } else { + payload_raw + } + let message = bytearray.concat(additional_bytes, payload_to_sign) + let signer_key = + if signer == 0 { + prev_first_pk + } else { + prev_second_pk + } + let signature_is_correct = + crypto.verify_ed25519_signature(signer_key, message, signature) + + let expected_new_cfg: DoubleRoyaltyPoolConfig = + DoubleRoyaltyPoolConfig { + pool_nft: prev_pool_nft, + pool_x: prev_pool_x, + pool_y: prev_pool_y, + pool_lq: prev_pool_lq, + fee_num: prev_fee_num, + treasury_fee: prev_treasury_fee, + first_royalty_fee: prev_first_fee, + second_royalty_fee: prev_second_fee, + treasury_x: prev_treasury_x, + treasury_y: prev_treasury_y, + first_royalty_x: new_first_rx, + first_royalty_y: new_first_ry, + second_royalty_x: new_second_rx, + second_royalty_y: new_second_ry, + dao_policy: prev_dao_policy, + treasury_address: prev_treasury_address, + first_royalty_pub_key: prev_first_pk, + second_royalty_pub_key: prev_second_pk, + nonce: prev_nonce + 1, + } + + let final_pool_config_is_correct = expected_new_cfg == new_cfg + + let strict_inputs = list.length(inputs) == 2 + + correct_order_input_address && correct_final_pool_address && correct_tokens_qty_in_pool && pool_identity && royalty_withdraw_is_correct && tokens_diff_is_correct && signature_is_correct && + final_pool_config_is_correct && correct_pool && correct_lovelace_token2token && strict_inputs + } + + else(_) { + fail + } +} diff --git a/validators_v3/validators/royalty_pool/single_royalty_withdraw_pool.ak b/validators_v3/validators/royalty_pool/single_royalty_withdraw_pool.ak new file mode 100644 index 0000000..a432fb5 --- /dev/null +++ b/validators_v3/validators/royalty_pool/single_royalty_withdraw_pool.ak @@ -0,0 +1,232 @@ +use aiken/builtin +use aiken/collection/list +use aiken/crypto.{blake2b_224} +use aiken/primitive/bytearray +use cardano/address.{Address, Credential, Script} +use cardano/assets.{ada_policy_id} +use cardano/transaction.{InlineDatum, Input, Output, Transaction} +use splash/orders/royalty_withdraw.{ + RoyaltyWithdrawConfig, RoyaltyWithdrawRedeemer, WithdrawData, + WithdrawRoyaltyDataToSign, +} +use splash/royalty_pool/single_royalty_pool.{SingleRoyaltyPoolConfig} +use splash/value_ext.{asset_quantity_of, v_len} + +// Single Royalty Withdrawal Contract (Aiken) +// +// Purpose +// - Securely process royalty withdrawals from a pool with a single royalty slot. +// Enforces correctness, immutability, and authorization. +// +// Enforced rules +// 1) Restricted Field Modifications +// - Only these fields may change: +// • royalty_x, royalty_y +// • nonce (must increase by exactly +1) +// - All other fields (pool_x, pool_y, pool_lq, fees, dao_policy, +// treasury_address, royalty_pub_key, etc.) must be unchanged. +// +// 2) Withdrawal Limits +// - Requested withdraw_x/withdraw_y must not exceed the current +// royalty_x/royalty_y in the input datum. +// +// 3) Input Structure +// - Exactly two inputs: (1) the withdraw-request UTxO and (2) the pool UTxO. +// - The withdraw-request input must be locked by the expected script hash +// (royalty_withdraw_request_vh) to prevent spoofed requests. +// +// 4) Pool Identity, Address & Output Selection +// - The pool output is identified by pool_nft quantity == 1. +// - The pool address (input → output) must remain the same. +// +// 5) Value Deltas (outputs vs inputs) +// - pool_x and pool_y quantities in the pool output value must be reduced +// exactly by withdraw_x / withdraw_y. +// - pool_lq quantity must remain unchanged. +// +// 6) ADA Invariant for Token-to-Token Pools +// - If both pool_x and pool_y are non-ADA (policy != ada_policy_id), +// the lovelace amount in the pool output must equal the input’s. +// - The “shape” of the value (token entry count) should remain unchanged. +// +// 7) Signature Verification +// - Message = additional_bytes || CBOR(WithdrawRoyaltyDataToSign +// { withdraw_data, pool_nonce = old.nonce }). +// - The signature must verify against royalty_pub_key. +// +// 8) Final Datum Check +// - The new RoyaltyPoolConfig must equal the previous one except for: +// • royalty_x / royalty_y updated by the withdrawal amounts, and +// • nonce = old.nonce + 1. + +const royalty_withdraw_request_vh = + #"92c094b90cf3637a96a13e9bc9a04ce8bb7e48c7ed0b5d1cc5ca7332" + +validator royalty_withdraw_pool { + withdraw( + redeemer: RoyaltyWithdrawRedeemer, + _account: Credential, + self: Transaction, + ) { + let inputs = self.inputs + let outputs = self.outputs + + let order_in_ix = redeemer.order_in_ix + let pool_in_ix = redeemer.pool_in_ix + let hash = redeemer.hash + + expect Some(order_input) = list.at(inputs, order_in_ix) + let Input { output: order_input_out, .. } = order_input + + expect Output { + address: Address { payment_credential: order_pc, .. }, + datum: InlineDatum(order_datum), + .. + } = order_input_out + + let correct_order_input_address = + when order_pc is { + Script(vh) -> + vh == royalty_withdraw_request_vh && list.length(inputs) == 2 + _ -> False + } + + expect order_conf: RoyaltyWithdrawConfig = order_datum + let RoyaltyWithdrawConfig { withdraw_data: wd, signature, additional_bytes } = + order_conf + + let WithdrawData { + pool_nft: pool_nft_req, + withdraw_royalty_x: withdraw_x, + withdraw_royalty_y: withdraw_y, + .. + } = wd + + expect Some(pool_input) = list.at(inputs, pool_in_ix) + let Input { output: pool_in_output, .. } = pool_input + + expect Output { + value: prev_value, + address: prev_addr, + datum: InlineDatum(pool_in_datum), + .. + } = pool_in_output + + expect prev_cfg: SingleRoyaltyPoolConfig = pool_in_datum + + let SingleRoyaltyPoolConfig { + pool_nft: prev_pool_nft, + pool_x: prev_pool_x, + pool_y: prev_pool_y, + pool_lq: prev_pool_lq, + fee_num: prev_fee_num, + treasury_fee: prev_treasury_fee, + royalty_fee: prev_royalty_fee, + treasury_x: prev_treasury_x, + treasury_y: prev_treasury_y, + royalty_x: prev_rx, + royalty_y: prev_ry, + dao_policy: prev_dao_policy, + treasury_address: prev_treasury_address, + royalty_pub_key: prev_pk, + nonce: prev_nonce, + } = prev_cfg + + let prev_x_val = asset_quantity_of(prev_value, prev_pool_x) + let prev_y_val = asset_quantity_of(prev_value, prev_pool_y) + let prev_lq_val = asset_quantity_of(prev_value, prev_pool_lq) + + let prev_lovelace_token2token = + if prev_pool_x.policy == ada_policy_id || prev_pool_y.policy == ada_policy_id { + 0 + } else { + assets.lovelace_of(prev_value) + } + + let prev_len = v_len(prev_value) + let correct_pool = prev_pool_nft == pool_nft_req + + expect Some(pool_out_output) = + list.find( + outputs, + fn(o) { asset_quantity_of(o.value, prev_pool_nft) == 1 }, + ) + + expect Output { + value: new_value, + address: new_addr, + datum: InlineDatum(pool_out_datum), + .. + } = pool_out_output + + expect new_cfg: SingleRoyaltyPoolConfig = pool_out_datum + + let SingleRoyaltyPoolConfig { royalty_x: new_rx, royalty_y: new_ry, .. } = + new_cfg + + let new_x_val = asset_quantity_of(new_value, prev_pool_x) + let new_y_val = asset_quantity_of(new_value, prev_pool_y) + let new_lq_val = asset_quantity_of(new_value, prev_pool_lq) + + let new_lovelace_token2token = + if prev_pool_x.policy == ada_policy_id || prev_pool_y.policy == ada_policy_id { + 0 + } else { + assets.lovelace_of(new_value) + } + + let new_len = v_len(new_value) + + let correct_final_pool_address = prev_addr == new_addr + let correct_tokens_qty_in_pool = prev_len == new_len + let pool_identity = asset_quantity_of(new_value, prev_pool_nft) == 1 + + let royalty_withdraw_ok = + withdraw_x <= prev_rx && withdraw_y <= prev_ry && new_rx == prev_rx - withdraw_x && new_ry == prev_ry - withdraw_y && prev_lq_val == new_lq_val && prev_x_val - withdraw_x == new_x_val && prev_y_val - withdraw_y == new_y_val + + let correct_lovelace_token2token = + prev_lovelace_token2token == new_lovelace_token2token + + let payload: WithdrawRoyaltyDataToSign = + WithdrawRoyaltyDataToSign { withdraw_data: wd, pool_nonce: prev_nonce } + let payload_raw = builtin.serialise_data(payload) + let payload_to_sign = + if hash { + blake2b_224(payload_raw) + } else { + payload_raw + } + let message = bytearray.concat(additional_bytes, payload_to_sign) + let signature_is_correct = + crypto.verify_ed25519_signature(prev_pk, message, signature) + + let expected_new_cfg: SingleRoyaltyPoolConfig = + SingleRoyaltyPoolConfig { + pool_nft: prev_pool_nft, + pool_x: prev_pool_x, + pool_y: prev_pool_y, + pool_lq: prev_pool_lq, + fee_num: prev_fee_num, + treasury_fee: prev_treasury_fee, + royalty_fee: prev_royalty_fee, + treasury_x: prev_treasury_x, + treasury_y: prev_treasury_y, + royalty_x: new_rx, + royalty_y: new_ry, + dao_policy: prev_dao_policy, + treasury_address: prev_treasury_address, + royalty_pub_key: prev_pk, + nonce: prev_nonce + 1, + } + + let final_pool_config_is_correct = expected_new_cfg == new_cfg + + let strict_inputs = list.length(inputs) == 2 + + correct_order_input_address && correct_final_pool_address && correct_tokens_qty_in_pool && pool_identity && royalty_withdraw_ok && signature_is_correct && strict_inputs && final_pool_config_is_correct && correct_pool && correct_lovelace_token2token + } + + else(_) { + fail + } +}