Skip to content

Commit

Permalink
optimize order
Browse files Browse the repository at this point in the history
  • Loading branch information
m1n999999 committed Jun 19, 2024
1 parent c111ba4 commit ab519eb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@
}
}
],
"compiledCode": "5904f80100003232323232323223223232322322533300a3232533300c3007300d37546022602400426464a64646660206018006264a66602266446464a666030603600426464a66602e602464a666030602660326ea8004520001375a603a60346ea8004c94ccc060c04cc064dd50008a6103d87a8000132330010013756603c60366ea8008894ccc074004530103d87a80001323232533301d3371e9110673656c6c657200375c603c0062601e660426ea00052f5c026600a00a0046eb4c078008c084008c07c004c8cc004004dd5980e980f180d1baa301d301e00322533301c00114c103d87a80001323232533301c3371e0206eb8c07400c4c038cc080dd3000a5eb804cc014014008dd5980e8011810001180f000899299980c180a180c9baa001132323375e980103d879800000232533301a30160011533301d301c37540042930b0a99980d180a8008a99980e980e1baa00214985858c068dd5000980e980d1baa0011632323300100100722533301d00114c0103d87a80001323232533301d3375e00c603c0062601e6604200297ae0133005005002301e0023021002301f00130083301b0014bd700b180d800980b9baa001163019001323300100100322533301800114bd7009919299980b99baf301c30193754603860326ea8c070c074c064dd500118041980d9ba90154bd7009980d80119802002000899802002000980e001180d0009bac30160013756602c602e602e602e602e602e602e602e602e602e002294458c048dd5002899299980898060020998009bab30163017301730173017301730173013375400c60066602a60046602a6ea40152f5c097ae01330013756602c602e602e602e602e602e602e60266ea8018c00ccc054c008cc054dd4802a5eb812f5c044646600200200644a66602e00229404c94ccc054cdd7802180b180d0010a51133003003001301a001374a90011ba548000c038dd50031bae3011300e37540122c602000260186ea80045261365632533300930050011533300c300b37540042930b0a99980498020008a99980618059baa00214985854ccc024cdc3a40080022a66601860166ea80085261616300937540026464a666010600860126ea80144c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc064c0700084c8c8c9265333018301430193754012264646464a66603e6044004264649319299980f180d000899192999811981300109924c64a666042603a00226464a66604c605200426493180e8008b181380098119baa00215333021301c0011323232323232533302a302d002149858dd6981580098158011bad30290013029002375a604e00260466ea800858c084dd50008b181200098101baa0031533301e301900115333021302037540062930b0b180f1baa00230160031630200013020002301e001301a37540122c6020014601e0162c6eb4c068004c068008c94ccc05cc05800454ccc050c03cc0540045288a99980a1808180a8008a5016163754603000260300046eb4c058004c058008c050004c050008c048004c048008c040004c040008dd7180700098051baa0051625333008300430093754002264646464a66601e60240042930b1bae30100013010002375c601c00260146ea8004588c94ccc020c0100044c8c94ccc034c04000852616375c601c00260146ea800854ccc020c00c0044c8c94ccc034c04000852616375c601c00260146ea800858c020dd50009b8748008dc3a40006eb80055cd2ab9d5573caae7d5d02ba157441",
"hash": "b6e16c9e7ceb46fc0051c5076aaa4796fd6cf1c6157ed997abee8615"
"compiledCode": "5904fb0100003232323232323223223232322322533300a3232533300c3007300d3754602260240042646464a646466602260180082660066eacc058c05cc05cc05cc05cc05cc05cc04cdd500318011980a98009980a9ba90054bd7025eb8054ccc044cdc3a40080082660066eacc058c05cc05cc05cc05cc05cc05cc04cdd500318011980a98009980a9ba90054bd7025eb804c94ccc048cc88c8c94ccc064c0700084c8c94ccc060c04cc94ccc064c050c068dd50008a400026eb4c078c06cdd500099299980c980a180d1baa00114c103d87a8000132330010013756603e60386ea8008894ccc078004530103d87a80001323232533301e3371e9110673656c6c657200375c603e0062601e660446ea00052f5c026600a00a0046eb4c07c008c088008c080004c8cc004004dd5980f180f980d9baa301e301f00322533301d00114c103d87a80001323232533301d3371e0226eb8c07800c4c038cc084dd3000a5eb804cc014014008dd5980f0011810801180f800899299980c980a980d1baa001132323375e980103d879800000232533301b30170011533301e301d37540042930b0a99980d980b0008a99980f180e9baa00214985858c06cdd5000980f180d9baa0011632323300100100722533301e00114c0103d87a80001323232533301e3375e00c603e0062601e6604400297ae0133005005002301f0023022002302000130083301c0014bd700b180e000980c1baa00116301a001323300100100322533301900114bd7009919299980c19baf301d301a3754603a60346ea8c074c078c068dd500118041980e1ba90164bd7009980e00119802002000899802002000980e801180d8009bac30170013756602e603060306030603060306030603060306030002294458c04cdd50031ba548008dd2a400044646600200200644a66602a00229404c94ccc04ccdd7802180a180c0010a511330030030013018001300e375400c6eb8c044c038dd50048b180800098061baa00114984d958c94ccc024c01400454ccc030c02cdd50010a4c2c2a66601260080022a66601860166ea800852616153330093370e90020008a99980618059baa00214985858c024dd500099192999804180218049baa005132323232323232323232323232325333019301c00213232324994ccc060c050c064dd5004899191919299980f98110010991924c64a66603c603400226464a666046604c00426493192999810980e800899192999813181480109924c603a0022c604e00260466ea800854ccc084c0700044c8c8c8c8c8c94ccc0a8c0b400852616375a605600260560046eb4c0a4004c0a4008dd6981380098119baa00216302137540022c604800260406ea800c54ccc078c06400454ccc084c080dd50018a4c2c2c603c6ea8008c05800c58c080004c080008c078004c068dd50048b180800518078058b1bad301a001301a002325333017301600115333014300f301500114a22a6660286020602a00229405858dd5180c000980c0011bad30160013016002301400130140023012001301200230100013010002375c601c00260146ea80145894ccc020c010c024dd5000899191919299980798090010a4c2c6eb8c040004c040008dd7180700098051baa001162325333008300400113232533300d3010002149858dd7180700098051baa00215333008300300113232533300d3010002149858dd7180700098051baa00216300837540026e1d2002370e90001bae0015734aae7555cf2ab9f5740ae855d101",
"hash": "877e1929cccd31aa9555c8a9190b66bf2b8760fe2cfd00a6f0c6dbb9"
},
{
"title": "seller.validate_seller_spending",
Expand Down
2 changes: 1 addition & 1 deletion plutus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ export const OrderValidateOrder = Object.assign(
return {
type: "PlutusV2",
script: applyParamsToScript(
"5904f80100003232323232323223223232322322533300a3232533300c3007300d37546022602400426464a64646660206018006264a66602266446464a666030603600426464a66602e602464a666030602660326ea8004520001375a603a60346ea8004c94ccc060c04cc064dd50008a6103d87a8000132330010013756603c60366ea8008894ccc074004530103d87a80001323232533301d3371e9110673656c6c657200375c603c0062601e660426ea00052f5c026600a00a0046eb4c078008c084008c07c004c8cc004004dd5980e980f180d1baa301d301e00322533301c00114c103d87a80001323232533301c3371e0206eb8c07400c4c038cc080dd3000a5eb804cc014014008dd5980e8011810001180f000899299980c180a180c9baa001132323375e980103d879800000232533301a30160011533301d301c37540042930b0a99980d180a8008a99980e980e1baa00214985858c068dd5000980e980d1baa0011632323300100100722533301d00114c0103d87a80001323232533301d3375e00c603c0062601e6604200297ae0133005005002301e0023021002301f00130083301b0014bd700b180d800980b9baa001163019001323300100100322533301800114bd7009919299980b99baf301c30193754603860326ea8c070c074c064dd500118041980d9ba90154bd7009980d80119802002000899802002000980e001180d0009bac30160013756602c602e602e602e602e602e602e602e602e602e002294458c048dd5002899299980898060020998009bab30163017301730173017301730173013375400c60066602a60046602a6ea40152f5c097ae01330013756602c602e602e602e602e602e602e60266ea8018c00ccc054c008cc054dd4802a5eb812f5c044646600200200644a66602e00229404c94ccc054cdd7802180b180d0010a51133003003001301a001374a90011ba548000c038dd50031bae3011300e37540122c602000260186ea80045261365632533300930050011533300c300b37540042930b0a99980498020008a99980618059baa00214985854ccc024cdc3a40080022a66601860166ea80085261616300937540026464a666010600860126ea80144c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc064c0700084c8c8c9265333018301430193754012264646464a66603e6044004264649319299980f180d000899192999811981300109924c64a666042603a00226464a66604c605200426493180e8008b181380098119baa00215333021301c0011323232323232533302a302d002149858dd6981580098158011bad30290013029002375a604e00260466ea800858c084dd50008b181200098101baa0031533301e301900115333021302037540062930b0b180f1baa00230160031630200013020002301e001301a37540122c6020014601e0162c6eb4c068004c068008c94ccc05cc05800454ccc050c03cc0540045288a99980a1808180a8008a5016163754603000260300046eb4c058004c058008c050004c050008c048004c048008c040004c040008dd7180700098051baa0051625333008300430093754002264646464a66601e60240042930b1bae30100013010002375c601c00260146ea8004588c94ccc020c0100044c8c94ccc034c04000852616375c601c00260146ea800854ccc020c00c0044c8c94ccc034c04000852616375c601c00260146ea800858c020dd50009b8748008dc3a40006eb80055cd2ab9d5573caae7d5d02ba157441",
"5904fb0100003232323232323223223232322322533300a3232533300c3007300d3754602260240042646464a646466602260180082660066eacc058c05cc05cc05cc05cc05cc05cc04cdd500318011980a98009980a9ba90054bd7025eb8054ccc044cdc3a40080082660066eacc058c05cc05cc05cc05cc05cc05cc04cdd500318011980a98009980a9ba90054bd7025eb804c94ccc048cc88c8c94ccc064c0700084c8c94ccc060c04cc94ccc064c050c068dd50008a400026eb4c078c06cdd500099299980c980a180d1baa00114c103d87a8000132330010013756603e60386ea8008894ccc078004530103d87a80001323232533301e3371e9110673656c6c657200375c603e0062601e660446ea00052f5c026600a00a0046eb4c07c008c088008c080004c8cc004004dd5980f180f980d9baa301e301f00322533301d00114c103d87a80001323232533301d3371e0226eb8c07800c4c038cc084dd3000a5eb804cc014014008dd5980f0011810801180f800899299980c980a980d1baa001132323375e980103d879800000232533301b30170011533301e301d37540042930b0a99980d980b0008a99980f180e9baa00214985858c06cdd5000980f180d9baa0011632323300100100722533301e00114c0103d87a80001323232533301e3375e00c603e0062601e6604400297ae0133005005002301f0023022002302000130083301c0014bd700b180e000980c1baa00116301a001323300100100322533301900114bd7009919299980c19baf301d301a3754603a60346ea8c074c078c068dd500118041980e1ba90164bd7009980e00119802002000899802002000980e801180d8009bac30170013756602e603060306030603060306030603060306030002294458c04cdd50031ba548008dd2a400044646600200200644a66602a00229404c94ccc04ccdd7802180a180c0010a511330030030013018001300e375400c6eb8c044c038dd50048b180800098061baa00114984d958c94ccc024c01400454ccc030c02cdd50010a4c2c2a66601260080022a66601860166ea800852616153330093370e90020008a99980618059baa00214985858c024dd500099192999804180218049baa005132323232323232323232323232325333019301c00213232324994ccc060c050c064dd5004899191919299980f98110010991924c64a66603c603400226464a666046604c00426493192999810980e800899192999813181480109924c603a0022c604e00260466ea800854ccc084c0700044c8c8c8c8c8c94ccc0a8c0b400852616375a605600260560046eb4c0a4004c0a4008dd6981380098119baa00216302137540022c604800260406ea800c54ccc078c06400454ccc084c080dd50018a4c2c2c603c6ea8008c05800c58c080004c080008c078004c068dd50048b180800518078058b1bad301a001301a002325333017301600115333014300f301500114a22a6660286020602a00229405858dd5180c000980c0011bad30160013016002301400130140023012001301200230100013010002375c601c00260146ea80145894ccc020c010c024dd5000899191919299980798090010a4c2c6eb8c040004c040008dd7180700098051baa001162325333008300400113232533300d3010002149858dd7180700098051baa00215333008300300113232533300d3010002149858dd7180700098051baa00216300837540026e1d2002370e90001bae0015734aae7555cf2ab9f5740ae855d101",
[sellerHash],
{ dataType: "list", items: [{ dataType: "bytes" }] } as any,
),
Expand Down
4 changes: 2 additions & 2 deletions src/tests/performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { calculateInitialLiquidity, toUnit } from "../utils";
import { LP_COLATERAL, TREASURY_MIN_ADA } from "..";

let MAX_COLLECT_SELLER_COUNT = 30;
let MAX_COLLECT_ORDER_COUNT = 50;
let MAX_COLLECT_ORDER_COUNT = 51;
let MAX_REFUND_ORDER_COUNT = 50;
let MAX_REDEEM_ORDER_COUNT = 53;
let MAX_REDEEM_ORDER_COUNT = 54;

let warehouse: GenWarehouse;
let defaultMaxTxSize = T.PROTOCOL_PARAMETERS_DEFAULT.maxTxSize;
Expand Down
20 changes: 10 additions & 10 deletions validators/order.ak
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ validator(
expect ScriptContext { transaction, purpose: Spend(_) } = context
let OrderDatum { factory_policy_id, .. } = datum
when redeemer is {
CollectOrder -> {
let Transaction { withdrawals, .. } = transaction
// Delegate Logic of CollectOrder and RedeemOrder to Factory Withdrawal
dict.has_key(withdrawals, Inline(ScriptCredential(factory_policy_id)))
}
RedeemOrder -> {
let Transaction { withdrawals, .. } = transaction
// Delegate Logic of CollectOrder and RedeemOrder to Factory Withdrawal
dict.has_key(withdrawals, Inline(ScriptCredential(factory_policy_id)))
}
UpdateOrder -> {
let Transaction { inputs, redeemers, .. } = transaction
assert(
Expand All @@ -33,16 +43,6 @@ validator(
@"Using-seller: Tx don't have any seller",
)
}
CollectOrder -> {
let Transaction { withdrawals, .. } = transaction
// Delegate Logic of CollectOrder and RedeemOrder to Factory Withdrawal
dict.has_key(withdrawals, Inline(ScriptCredential(factory_policy_id)))
}
RedeemOrder -> {
let Transaction { withdrawals, .. } = transaction
// Delegate Logic of CollectOrder and RedeemOrder to Factory Withdrawal
dict.has_key(withdrawals, Inline(ScriptCredential(factory_policy_id)))
}
}
}
}

0 comments on commit ab519eb

Please sign in to comment.