From de5691c245ba9ce1083affc91ac347d03aa56c0c Mon Sep 17 00:00:00 2001 From: Francisco Joray Date: Mon, 1 Dec 2025 19:36:16 -0300 Subject: [PATCH 1/4] add `params-path` arg to `deploy-scripts` command --- game/src/deploy_params.json | 3 ++- game/src/game.rs | 30 ++++++++++++++++++++++-------- game/src/lib.rs | 19 ++++++++++++++++--- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/game/src/deploy_params.json b/game/src/deploy_params.json index 341d622..13de1fa 100644 --- a/game/src/deploy_params.json +++ b/game/src/deploy_params.json @@ -10,5 +10,6 @@ "max_ship_fuel": 100, "max_asteria_mining": 50, "min_asteria_distance": 10, - "ship_mint_lovelace_fee": 3000000 + "ship_mint_lovelace_fee": 3000000, + "scripts_directory": "game/src/scripts/" } diff --git a/game/src/game.rs b/game/src/game.rs index 04aea21..7d27f0e 100644 --- a/game/src/game.rs +++ b/game/src/game.rs @@ -1,4 +1,4 @@ -use crate::{CreateShipArgs, GatherFuelArgs, MineAsteriaArgs, MoveShipArgs}; +use crate::{CreateShipArgs, DeployScriptsArgs, GatherFuelArgs, MineAsteriaArgs, MoveShipArgs}; use anyhow::anyhow; use griffin_core::{ checks_interface::{babbage_minted_tx_from_cbor, babbage_tx_to_cbor}, @@ -900,10 +900,11 @@ pub async fn mine_asteria( } } -pub async fn deploy_scripts() -> anyhow::Result<()> { - let params_json: String = std::fs::read_to_string(DEPLOY_PARAMS_PATH)?; - let params: ScriptsParams = - serde_json::from_str(¶ms_json).map_err(|e| anyhow!("Invalid params JSON: {}", e))?; +pub async fn deploy_scripts(args: DeployScriptsArgs) -> anyhow::Result<()> { + let params_json: String = std::fs::read_to_string(args.params_path).unwrap(); + let params: ScriptsParams = serde_json::from_str(¶ms_json) + .map_err(|e| anyhow!("Invalid params JSON: {}", e)) + .unwrap(); let asteria_params = PallasPlutusData::Array(Indef( [ @@ -1025,9 +1026,21 @@ pub async fn deploy_scripts() -> anyhow::Result<()> { .unwrap(), ); - std::fs::write(PELLET_PATH, hex::encode(pellet_script.0)).unwrap(); - std::fs::write(ASTERIA_PATH, hex::encode(asteria_script.0)).unwrap(); - std::fs::write(SPACETIME_PATH, hex::encode(spacetime_script.0)).unwrap(); + std::fs::write( + params.scripts_directory.clone() + "pellet.txt", + hex::encode(pellet_script.0), + ) + .unwrap(); + std::fs::write( + params.scripts_directory.clone() + "asteria.txt", + hex::encode(asteria_script.0), + ) + .unwrap(); + std::fs::write( + params.scripts_directory.clone() + "spacetime.txt", + hex::encode(spacetime_script.0), + ) + .unwrap(); println!("All scripts written successfully!"); Ok(()) } @@ -1061,6 +1074,7 @@ struct ScriptsParams { max_asteria_mining: u64, min_asteria_distance: u64, ship_mint_lovelace_fee: u64, + scripts_directory: String, } #[derive(Serialize, Deserialize, Debug, Clone)] diff --git a/game/src/lib.rs b/game/src/lib.rs index 5641e12..7935726 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -23,7 +23,7 @@ pub enum Command { /// Mine Asteria using a ship MineAsteria(MineAsteriaArgs), /// Apply parameters and write game scripts - DeployScripts, + DeployScripts(DeployScriptsArgs), } impl GameCommand { @@ -54,8 +54,8 @@ impl GameCommand { let _ = game::mine_asteria(&db, &client, &keystore, args).await; Ok(()) } - Command::DeployScripts => { - let _ = game::deploy_scripts().await; + Command::DeployScripts(args) => { + let _ = game::deploy_scripts(args).await; Ok(()) } }, @@ -215,3 +215,16 @@ pub struct MineAsteriaArgs { )] pub mine_coin_amount: u64, } + +#[derive(Debug, Args, Clone)] +pub struct DeployScriptsArgs { + /// Path to the game parameters JSON file + #[arg( + long, + short, + verbatim_doc_comment, + required = true, + value_name = "GAME_PARAMS_PATH" + )] + pub params_path: String, +} From 81970ce8ea0f0fb34dd1b6e401e3e7ad0f1301c8 Mon Sep 17 00:00:00 2001 From: Francisco Joray Date: Mon, 1 Dec 2025 19:40:36 -0300 Subject: [PATCH 2/4] pass applied scripts directory as argument --- game/src/game.rs | 57 +++++++++++++++++++++++++++++++++--------------- game/src/lib.rs | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 18 deletions(-) diff --git a/game/src/game.rs b/game/src/game.rs index 7d27f0e..d0b3341 100644 --- a/game/src/game.rs +++ b/game/src/game.rs @@ -38,11 +38,6 @@ const ASTERIA_PARAMETERIZED: &str = "590cf90100003232323232323232323232323232223 const SPACETIME_PARAMETERIZED: &str = "592d94010000323232323232323232323232323232323232323232323223223222232232232232223253333330280021532323232323232323330283001302a37540142a660529211c52756e6e696e672032206172672076616c696461746f72206d696e740013232533302a3232323232323232325333033300c303537540102646464a66606c601e60706ea80384c8c8c94ccc0e4c048c0ecdd500089919191919299981f180c98201baa0011323232325333046001153304303e161325333047304a0021325333044301f30463754002264646464a666090604860946ea80044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc16d4ccc16c0805288a9982e24811d6d7573745f62655f76616c69645f61737465726961203f2046616c73650014a02a6660b6a6660b6010294454cc171241206d7573745f6d696e745f65787065637465645f76616c7565203f2046616c73650014a02a6660b6a6660b600e294454cc171241216d7573745f726573706563745f6d696e5f64697374616e6365203f2046616c73650014a02a6660b6a6660b600c294454cc1712411b6d7573745f686176655f736869705f6e616d65203f2046616c73650014a02a6660b6a6660b600a294454cc1712411c6d7573745f686176655f70696c6f745f6e616d65203f2046616c73650014a02a6660b6a6660b6008294454cc1712411d6d7573745f686176655f6c61746573745f74696d65203f2046616c73650014a02a6660b6a6660b6006294454cc1712411c6d7573745f686f6c645f736869705f746f6b656e203f2046616c73650014a02a6660b6a6660b6004294454cc1712411e6d7573745f686f6c645f696e697469616c5f6675656c203f2046616c73650014a02a6660b6002294454cc17124011a6d7573745f686f6c645f335f617373657473203f2046616c73650014a029405280a5014a029405280a5014a06068664600200244a6660c0002290000981d99801001183180099198008009bab3025305e375403244a6660c0002297ae01323332223233001001003225333066001100313233068374e660d06ea4018cc1a0dd49bae30650013306837506eb4c1980052f5c06600600660d400460d00026eb8c17c004dd59830000998018019832001183100099b8733301f3756604660b86ea805c1252201044655454c0003f303433301e3756604460b66ea805809401ccdc39bad305d305e305e305e305e305a37540246eb4c174c168dd500819b8f375c60b860ba60ba60ba60b26ea8044010cdc79bae30193058375402000866e240e0c8cdc018009bad301e3058375402060026eb4c07cc160dd50081299982a99b88001480004c0cc0044004cdd79ba601f374c64646466660026666002a6660ac606490000a5eb7bdb1804c8c8cc0040052f5bded8c044a6660ba0022660bc66ec0dd48131ba60034bd6f7b630099191919299982e98049980501500109983119bb037520546e9801c01454ccc174cdc781500109983119bb037520546e9801c00c4cc188cdd81ba9002374c0026600c00c0066eacc17c00cdd7182e8011830801182f8009919800800a5eb7bdb180894ccc1700044cc174cdd81ba90074c010101004bd6f7b630099191919299982e18041980480580109983099bb037520169810101000051533305c3371e0160042660c266ec0dd4805a61010100003133061337606ea4008dd4000998030030019bad305e003375c60b800460c000460bc0020460089001023245044655454c0003c22225333059303200110041323233001001006225333060001133061337606ea4018dd3001a5eb7bdb1804c8c8c8c94ccc180c030cc0340280084cc194cdd81ba900a374c00e00a2a6660c066e3c0280084c94ccc184c0e8c18cdd500089983319bb0375201660ce60c86ea80040104010c94ccc1854ccc1940045288a5014c0103d87a80001303e33066374c00297ae03233001001002225333066001133067337606ea402cdd400525eb7bdb1804c8c8c8c94ccc198c048cc04c03c0084cc1accdd81ba900f375001c00a2a6660cc66e3c03c0084c94ccc19cc100c1a4dd500089983619bb0375202060da60d46ea80040104010c94ccc19cc1000045300103d87a8000130443306c375000297ae03370000201c2660d666ec0dd48011ba800133006006003375a60d00066eb8c198008c1a8008c1a00044cc194cdd81ba9002374c0026600c00c0066eacc18800cdd7183000118320011831000991900119198008008011129998300008a4c264a6660c200229309919299982f981c18309baa3300c375c60c260ca0086eb8c1840084cc014014cc19000800454cc1812401326b65797320696e206173736f63696174697665206c697374206172656e277420696e20617363656e64696e67206f7264657200163065002306300130630013305e337606ea4008dd4000a5eb7bdb180dd7a60103d879800022533305533720004002298103d8798000153330553371e0040022980103d87a800014c103d87b8000330024890550494c4f540030033004375a603660aa6ea804ccc005220104534849500030023003375a603460a86ea804888cdc500100091b9800123732660046ea00052201003001001222533333305700213232323232323300b0020013371491010128000025333053337100069007099b80483c80400c54ccc14ccdc4001a410004266e00cdc0241002800690068a9982a24929576861742061726520796f7520646f696e673f204e6f2049206d65616e2c20736572696f75736c792e001653330560011337149101035b5d2900004133714911035b5f2000375c60aa66600e00266ec1300102415d00375266e292210129000042233760980103422c2000375266601001000466e28dd7182b0009bae3057001375860a80046eb4c148004c8cdd81ba83052001374e60a60026ea80084c94ccc1500044cdc5245027b7d00002133714911037b5f2000375c60a664646600200200644a6660ae00220062664466ec130103422c2000375266601201260ae00466e29221023a20003330090093058002337146eb8c15c004dd7182c000982c80099801001182d00099bb04c10342207d0037520046eac0084c94ccc1500044cdc52441025b5d00002133714911035b5f2000375c60a666600a00266ec1300102415d0037520044466ec1300103422c2000375266600c00c00466e28dd7182a0009bae3055001375800426600a6eb40080044c8c8cdc524410268270000132333001001337006e3400920013371491101270000322253330533371000490000800899191919980300319b8000548004cdc599b80002533305633710004900a0a40c02903719b8b33700002a6660ac66e2000520141481805206e0043370c004901019b8300148080cdc70020011bae00222232330010010042253330540011004133003305600133002002305700122323300100100322533304e30270011337149110130000031533304e337100029000099b8a489012d0033002002302c00113300533708002900a19b8b3370066e1400520144818000cc0040048894ccc12ccdc4801240002002266600600666e1000920143371666e00cdc28012402890300008a9982481f0b180818251baa3011304a375402aa66608c603e60906ea80044c94ccc12c00454cc120110584c8c94ccc13400454cc128118584c8c94ccc13c00454cc130120584c8c94ccc14400454cc138128584c8c94ccc14c00454cc140130584c94ccc150c15c008526153305104d16325333333058001153305104d16153305104d16153305104d161375a0022a660a209a2c60aa00260aa00464a6666660ac0022a6609e0962c2a6609e0962c2a6609e0962c2a6609e0962c26eb8004c14c004c14c008c94cccccc15000454cc1341245854cc1341245854cc1341245854cc134124584dd7000982880098288011929999998290008a998258238b0a998258238b0a998258238b09bad001153304b04716304f001304f0023253333330500011533049045161533049045161533049045161375a0022a6609208a2c609a00260926ea800454cc11c10c594cccccc134004400454cc1181085854cc1181085854cc1181085854cc11810858c128c11cdd50008a99822a493165787065637420496e6c696e65446174756d28736869705f646174756d29203d20736869705f73746174652e646174756d00163007304637540022a6608807e2c6090002646600200202644a66608e002297ae0132325333045325333046302230483754002266e3c04cdd7182618249baa00114a0601c60906ea8c038c120dd50010998250011980200200089980200200098258011824800a999820180c98211baa0011325333045001153304203c16132325333047001153304403e161325333048304b002149854cc1140fc58c94cccccc13000454cc1140fc5854cc1140fc5854cc1140fc5854cc1140fc584dd7000982480098248011929999998250008a9982181e8b0a9982181e8b0a9982181e8b09bad001153304303d163047001304337540022a660820762ca66666608e00220022a660800742c2a660800742c2a660800742c2a660800742c608860826ea800454cc0fd2413e65787065637420496e6c696e65446174756d28617374657269615f646174756d29203d20617374657269615f696e7075742e6f75747075742e646174756d0016300130403754600e60806ea80108c10cc110c110004c06cccc004dd59802981f1baa3005303e37540046eb8c010c0f8dd50141bae3005303e375405044464a66607c603460806ea8004520001375a608860826ea8004c94ccc0f8c068c100dd50008a60103d87a8000132330010013756608a60846ea8008894ccc110004530103d87a8000132323253330433371e00e6eb8c11400c4c080cc120dd4000a5eb804cc014014008dd698228011824001182300099804001801181f981e1baa001153303a03116323300100100c22533303e00114c103d87a800013232533303c32533303d3016303f375400229404cdc79bae304330403754002056600a607e6ea8c014c0fcdd51803181f9baa00213019330410024bd70099802002000982100118200009181f0009181e981f000899299981d8008a9981c01a8b099299981e181f8010a99981c19b8748004dd6981d8008a51153303903616153303903616303d001325333037301330393754002297adef6c6013756607a60746ea8004cc00400800c88c8cc00400400c894ccc0f40045300103d87a80001323232533303c3371e00c6eb8c0f800c4c064cc104dd3000a5eb804cc014014008dd5981f0011820801181f800991980080080211299981d0008a5eb7bdb1804c8c8c8c94ccc0e8cdc7a44100002100313303f337606ea4008dd3000998030030019bab303c003375c6074004607c00460780026eb8c0e4c0d8dd50040a9981a24926657870656374204d696e742873686970796172645f706f6c69637929203d20707572706f7365001630383039303930390023756606e002606e606e0046eb0c0d4004c0d4c0d4008dd6181980098179baa303200230313032001302d37540182930a99815a4811856616c696461746f722072657475726e65642066616c7365001365632533302a30030011533302e302d37540042930a998158148b0a99981518030008a99981718169baa002149854cc0ac0a45854cc0ac0a458c0acdd5000a99999981800588058a998148138b0a998148138b0a998148138b0a998148138b0a99814a491d52756e6e696e672033206172672076616c696461746f72207370656e640013323232232322533302f323232323232323232323232323232323232323232325333045301e30473754002264a66608c604460906ea80584c8c94ccc120c084c128dd5000899192999825181318261baa001132323232323232323232323232325323233305a303300d1323232325333062001153305f05016132533306330660021325333060303b30623754002264646464a6660c8608060cc6ea80044c8c94ccc198c108c1a0dd50008991919192999835182198361baa001132323232323232323232323253330765333076305230263301f044230293035307a3754606c60f46ea80045288a9983ba481236d7573745f7370656e645f6f6e655f7363726970745f696e707574203f2046616c73650014a02a6660eca6660ec054294454cc1dd241206d7573745f696e636c7564655f70696c6f745f746f6b656e203f2046616c73650014a02a6660eca6660ec008294454cc1dd2411d6d7573745f686176655f656e6f7567685f6675656c203f2046616c73650014a02a6660eca6660ec00c294454cc1dd2411e6d7573745f726573706563745f6d61785f7370656564203f2046616c73650014a02a6660eca6660ec00a294454cc1dd241206d7573745f726573706563745f6c61746573745f74696d65203f2046616c73650014a02a6660eca6660ec004294454cc1dd241216d7573745f73756274726163745f6675656c5f746f6b656e73203f2046616c73650014a02a6660eca6660ec010294454cc1dd2411c6d7573745f6275726e5f7370656e745f6675656c203f2046616c73650014a02a6660eca6660ec014294454cc1dd241156d7573745f7570646174655f78203f2046616c73650014a02a6660eca6660ec012294454cc1dd241156d7573745f7570646174655f79203f2046616c73650014a02a6660eca6660ec00e294454cc1dd2411f6d7573745f7570646174655f75707065725f626f756e64203f2046616c73650014a02a6660eca6660ec016294454cc1dd241216d7573745f70726573657276655f70696c6f745f746f6b656e203f2046616c73650014a02a6660eca6660ec006294454cc1dd2411c6d7573745f686f6c645f736869705f746f6b656e203f2046616c73650014a02a6660ec002294454cc1dd24011a6d7573745f686f6c645f335f617373657473203f2046616c73650014a029405280a5014a029405280a5014a029405280a5014a0609e604460486eacc0d0c1e0dd500b99b8733301f3756606660ee6ea80581912201044655454c0033702014018609e66603c6eacc0c8c1d8dd500a81481b19b8900a008301900d32323371266e08dd6983c0011bad30783079001337046eb4c1e0004dd6983c183c801183a1baa02c3073375460ec60e66ea801ccdc39bad307530763076307630763072375401c012602a609800c66e1cdd6981618381baa00c3370006402266e1cdd6981518379baa00b3370006602266e3c0b0dd7183898391839183918371baa00a3330153756605260da6ea8c0a4c1b4dd501102d2441044655454c00153306b4915865787065637420536f6d6528737065656429203d0a20202020202020202020726174696f6e616c2e6e65772864697374616e63652c2074785f6c61746573745f74696d65202d2074785f6561726c696573745f74696d65290016330260023370200600a66e08004140c8cdc0180080698008061299983419b88001480004c1180044004dd6983618349baa001153306705c16302330683754604860d06ea80b8dd6983518339baa001153306505916302130663754604260cc6ea80b0cc0e40041594cccccc1a4004400454cc1881545854cc1881545854cc1881545854cc18815458c198c18cdd50008a998308298b180498311baa00115330600511630640013300602923375e603860c26ea8004c070c184dd5180e98309baa016375a60c460c60046eb4c184004c174dd50170a99982d181b0068991929998300008a9982e8270b09929998309832001099299982f181c98301baa0011323232325333062303b306437540022646464a6660ca608060ce6ea80044c8c8c8c94ccc1a4c114c1acdd5000899191919191919191929998392999839182698111980d820118129818983b1baa303230763754002294454cc1cd2401246d7573745f7370656e645f74776f5f7363726970745f696e70757473203f2046616c73650014a02a6660e4a6660e401e294454cc1cd2411c6d7573745f62655f76616c69645f70656c6c6574203f2046616c73650014a02a6660e4a6660e404c294454cc1cd241206d7573745f696e636c7564655f70696c6f745f746f6b656e203f2046616c73650014a02a6660e4a6660e4010294454cc1cd241216d7573745f686176655f70656c6c65745f706f736974696f6e203f2046616c73650014a02a6660e4a6660e4006294454cc1cd2411c6d7573745f6164645f6675656c5f746f6b656e73203f2046616c73650014a02a6660e4a6660e400e294454cc1cd241206d7573745f6e6f745f6578636565645f6361706163697479203f2046616c73650014a02a6660e4a6660e400a294454cc1cd241206d7573745f726573706563745f6c61746573745f74696d65203f2046616c73650014a02a6660e4a6660e400c294454cc1cd2411b6d7573745f70726573657276655f646174756d203f2046616c73650014a02a6660e4a6660e4008294454cc1cd2411c6d7573745f686f6c645f736869705f746f6b656e203f2046616c73650014a02a6660e4a6660e4004294454cc1cd2411a6d7573745f686f6c645f335f617373657473203f2046616c73650014a02a6660e4002294454cc1cd24011c6d7573745f6e6f745f6d696e745f746f6b656e73203f2046616c73650014a029405280a5014a029405280a5014a0294052819baf374c603a07698101a000304a301d301f3756605e60e66ea8050cdc399980d1bab302e307237540260be911044655454c003370000c02a60946660326eacc0b4c1c4dd5009012018980a9bad30733070375400a66ebc034110cdc499b80002011055533306a3370e0626eb4c0a0c1b4dd5002099b8702f375a605260da6ea801052819980a1bab3028306c3754605060d86ea8084165221044655454c00153306a05e163026306b3754604c60d66ea80c54ccc19cc100c1a4dd500089929998360008a9983482f8b0991929998370008a998358308b0991929998380008a998368318b0992999838983a0010a4c2a660dc0c82c64a6666660ea0022a660dc0c82c2a660dc0c82c2a660dc0c82c2a660dc0c82c26eb8004c1c8004c1c8008c94cccccc1cc00454cc1b01885854cc1b01885854cc1b0188584dd68008a998360310b183800098380011929999998388008a998350300b0a998350300b0a998350300b09bad001153306a06016306e001306a37540022a660d00bc2ca6666660dc00220022a660ce0ba2c2a660ce0ba2c2a660ce0ba2c2a660ce0ba2c60d660d06ea800454cc1992413c65787065637420496e6c696e65446174756d2870656c6c65745f646174756d29203d2070656c6c65745f696e7075742e6f75747075742e646174756d0016300e30673754604660ce6ea8008c10cccc038dd5981118331baa3022306637540026eb8c084c198dd50281bae3022306637540a060d060ca6ea800454cc18d2401ff65787065637420536f6d652870656c6c65745f696e70757429203d0a202020202020202020206c6973742e66696e64280a202020202020202020202020696e707574732c0a202020202020202020202020666e28696e70757429207b0a20202020202020202020202020207768656e20696e7075742e6f75747075742e616464726573732e7061796d656e745f63726564656e7469616c206973207b0a20202020202020202020202020202020566572696669636174696f6e4b657943726564656e7469616c285f29202d3e2046616c73650a2020202020202020202020202020202053637269707443726564656e7469616c28616464725f7061796d656e6b7429202d3e0a202020202020202020202020202020202020616464725f7061796d656e74203d3d2070656c6c65745f76616c696461746f725f616464726573730a20202020202020202020202020207d0a2020202020202020202020207d2c0a202020202020202020202900163301b02f2325333063303c3065375400229404cdc79bae3069306637540020a6604060ca6ea8c080c194dd5181098329baa00133037001054533333306700110011533060053161533060053161533060053161533060053163064306137540022a660be0a22c600e60c06ea800454cc17813c58c188004cc01009c8cdd7980d182f9baa001301a305f3754603660be6ea8050dd69830182e9baa02e1533305a303500d132533305b3034305d375400226464a6660ba607260be6ea80044c8c8c8c94ccc1854ccc184c0f0c044cc0280bc8c050c080c194dd5181098329baa00114a22a660c49201246d7573745f7370656e645f74776f5f7363726970745f696e70757473203f2046616c73650014a02a6660c2a6660c200c294454cc1892411d6d7573745f62655f76616c69645f61737465726961203f2046616c73650014a02a6660c2a6660c202a294454cc189241206d7573745f696e636c7564655f70696c6f745f746f6b656e203f2046616c73650014a02a6660c2a6660c2008294454cc189241226d7573745f686176655f617374657269615f706f736974696f6e203f2046616c73650014a02a6660c2a6660c2006294454cc1892411c6d7573745f6275726e5f736869705f746f6b656e203f2046616c73650014a02a6660c2a6660c2002294454cc1892411d6d7573745f6275726e5f6675656c5f746f6b656e73203f2046616c73650014a02a6660c2004294454cc1892401206d7573745f726573706563745f6c61746573745f74696d65203f2046616c73650014a029405280a5014a029405281803981f1998059bab301f30633754603e60c66ea80601412201044655454c003007375a60ca60c46ea800ccdc4199804980501400a010a400066ebcdd31983119bb037500486ea00892f5bded8c06e98cc1892f7b6301010000010100004bd6f7b6300a9982f0290b180d182f9baa301a305f375404a607666600c6eacc068c178dd5180d182f1baa3061305e37540026eb8c064c178dd50241bae301a305e37540902a660b80a62c66028050464a6660b8606a60bc6ea8004528099b8f375c60c460be6ea8004128c064c178dd5180c982f1baa301a305e375400226464a6660b8a6660b8607060186600a0544601e603660c06ea8c070c180dd50008a51153305d491236d7573745f7370656e645f6f6e655f7363726970745f696e707574203f2046616c73650014a02a6660b8a6660b8020294454cc175241206d7573745f696e636c7564655f70696c6f745f746f6b656e203f2046616c73650014a02a6660b8a6660b8004294454cc1752411c6d7573745f6275726e5f736869705f746f6b656e203f2046616c73650014a02a6660b8002294454cc17524011d6d7573745f6275726e5f6675656c5f746f6b656e73203f2046616c73650014a029405280a50300230393330063756603460bc6ea8c068c178dd5009825a441044655454c003371066600a600c04802003a90001b8733300430050230494881044655454c00371203044646600200200644a6660be002297ae013232533305d300500213306200233004004001133004004001306300230610012305d305e305e0012223253330593035305b37540022900009bad305f305c375400264a6660b2606a60b66ea80045300103d87a800013233001001375660c060ba6ea8008894ccc17c004530103d87a80001323232533305e3371e00e6eb8c18000c4c0eccc18cdd4000a5eb804cc014014008dd6983000118318011830800998068018011191980080080111299982d8008a5eb7bdb1804c8c8c8c94ccc16ccdc7a441000021003133060337606ea4008dd3000998030030019bab305d003375c60b600460be00460ba002600200244a6660b0002290000981999801001182d8009191980080080111299982c0008a5eb804c8ccc888c8cc00400400c894ccc178004400c4c8cc180dd3998301ba90063306037526eb8c174004cc180dd41bad305e0014bd7019801801983100118300009bae3057001375660b00026600600660b800460b4002600200244a6660aa002290000981819801001182c00092999827981418289baa300d30523754002294052898279baa021533304c3025304e37546600c03446466002002646600200264a6660a0605860a46ea800452f5bded8c026eacc158c14cdd5000998021bab300e30523754601c60a46ea800c014894ccc15000452f5c02660aa60a460ac0026600400460ae00244a6660a600229404c94ccc140cdc79bae305600201114a226600600600260ac00229445281119198008008019129998298008a60103d87a8000132323253330523371e00c6eb8c15000c4c0bccc15cdd3000a5eb804cc014014008dd5982a001182b801182a8009bae3050304d37540022a660969215d6578706563742053637269707443726564656e7469616c2873686970796172645f706f6c69637929203d0a202020202020736869705f696e7075742e6f75747075742e616464726573732e7061796d656e745f63726564656e7469616c00163007304c3754600e60986ea8c020c130dd5000982718259baa001153304949013665787065637420536f6d6528736869705f696e70757429203d2066696e645f696e70757428696e707574732c20736869705f726566290016323300201623375e600e60986ea8004008c134c128dd500b9119198008008019129998270008a60103d87a800013232533304c300500213029330510024bd70099802002000982900118280008a99823a48120657870656374205370656e6428736869705f72656629203d20707572706f73650016304b304837540022a6608c92015865787065637420536f6d65286d61785f73706565645f726174696f6e616c29203d0a202020202020726174696f6e616c2e6e6577286d61785f73706565642e64697374616e63652c206d61785f73706565642e74696d6529001633001375a6004608e6ea80c0dd6980198239baa030225333045301e00114c103d87a80001533304533710002900009811198251811198251ba830230023304a3750604600297ae04bd7009811198251811198251ba80023304a375000297ae04bd70118248009182418248009bad30463047002375c608a002608a0046eb8c10c004c10c008dd6982080098208011bad303f001303b3754020607a607c607c607c0046eacc0f0004c0f0c0f0008dd6181d000981d181d0011bac303800130343754606e004606c606e00260646ea8004526153303049011856616c696461746f722072657475726e65642066616c7365001365632533302e30070011325333033001153303002816132325333035001153303202a1613253330363039002149854cc0cc0ac58c94cccccc0e800454cc0cc0ac5854cc0cc0ac5854cc0cc0ac584dd68008a998198158b181b800981b80119299999981c0008a998188148b0a998188148b0a998188148b09bad0011533031029163035001303137540042a66605c6014002264a6660660022a660600502c264a666068606e0042930a998188148b19299999981c0008a998188148b0a998188148b0a998188148b09bad0011533031029163035001303137540042a66605c60120022a66606460626ea8008526153302f027161533302e300800115333032303137540042930a998178138b0a998178138b18179baa00153333330340011001153302d02516153302d02516153302d02516153302d025163300100202422533302b3004302d3754004264a6660600022a6605a0042c26464a6660640022a6605e0082c26464a6660680022a6606200c2c26464a66606c0022a660660102c26464a6660700022a6606a0142c264a66607260780042930a9981b0058b19299999981e8008a9981b0058b0a9981b0058b0a9981b0058b09bad001153303600b16303a001303a00232533333303b0011533034009161533034009161533034009161533034009161375c0026070002607000464a6666660720022a6606400e2c2a6606400e2c2a6606400e2c2a6606400e2c26eb8004c0d8004c0d8008c94cccccc0dc00454cc0c00145854cc0c00145854cc0c0014584dd68008a998180028b181a000981a00119299999981a8008a998170018b0a998170018b0a998170018b09bad001153302e003163032001302e37540042a660580022ca66666606001620162a660520442c2a660520442c2a660520442c2a660520442c605c60566ea8028dc3a40006e1d2006370e90021b8748008dd2a40006e052000370090011b884800054cc0840045854cc0840045854cc0840045854cc08400459240191496e636f72726563742072656465656d6572207479706520666f722076616c696461746f72207370656e642e0a2020202020202020202020202020202020202020446f75626c6520636865636b20796f7520686176652077726170706564207468652072656465656d657220747970652061732073706563696669656420696e20796f757220706c757475732e6a736f6e00375a0026eb4004dd68009bad001375c0026eb800524196657870656374205b736869705f6f75747075745d203d0a202020202020202020206c6973742e66696c746572280a2020202020202020202020206f7574707574732c0a202020202020202020202020666e286f757470757429207b206f75747075742e61646472657373203d3d20736869705f696e7075742e6f75747075742e61646472657373207d2c0a20202020202020202020290049013965787065637420496e6c696e65446174756d28736869705f6f75747075745f646174756d29203d20736869705f6f75747075742e646174756d0049013765787065637420736869705f6f75747075745f646174756d3a2053686970446174756d203d20736869705f6f75747075745f646174756d004901476578706563742046696e6974652874785f6561726c696573745f74696d6529203d2076616c69646974795f72616e67652e6c6f7765725f626f756e642e626f756e645f74797065004901456578706563742046696e6974652874785f6c61746573745f74696d6529203d2076616c69646974795f72616e67652e75707065725f626f756e642e626f756e645f747970650049012f6578706563742070656c6c65745f646174756d3a2050656c6c6574446174756d203d2070656c6c65745f646174756d004901ff65787065637420536f6d6528617374657269615f696e70757429203d0a202020202020202020206c6973742e66696e64280a202020202020202020202020696e707574732c0a202020202020202020202020666e28696e70757429207b0a20202020202020202020202020207768656e20696e7075742e6f75747075742e616464726573732e7061796d656e745f63726564656e7469616c206973207b0a20202020202020202020202020202020566572696669636174696f6e4b657943726564656e7469616c285f29202d3e2046616c73650a2020202020202020202020202020202053637269707443726564656e7469616c28616464725f7061796d656d6e7429202d3e0a202020202020202020202020202020202020616464725f7061796d656e74203d3d20617374657269615f76616c696461746f725f616464726573730a20202020202020202020202020207d0a2020202020202020202020207d2c0a20202020202020202020290049011672656465656d65723a205368697052656465656d657200490110646174756d3a2053686970446174756d0049013265787065637420617374657269615f646174756d3a2041737465726961446174756d203d20617374657269615f646174756d00490159657870656374205b736869705f73746174655d203d0a202020202020202020207472616e73616374696f6e2e66696e645f7363726970745f6f757470757473286f7574707574732c2073686970796172645f706f6c696379290049012965787065637420736869705f646174756d3a2053686970446174756d203d20736869705f646174756d00490120657870656374205b285f2c202d31295d203d206d696e7465645f746f6b656e730049011a72656465656d65723a20536869707961726452656465656d6572005734ae7155ceaab9e5573eae815d0aba257481"; const PELLET_PARAMETERIZED: &str = "590d270100003232323232323232323232323232222325333333012002153232323233300e30013010375400c2a6601e92011c52756e6e696e672032206172672076616c696461746f72206d696e7400132325333010323232323253330153008301737540082646464a666030601660346ea80284c94ccc0654ccc0654ccc064c030c06cdd5191980080080391299980f8008a60103d87a800013232533301d3013323330073756600260426ea8c004c084dd50019bae3024302137540306eb8c004c084dd500c118121812800898091981100125eb804cc010010004c08c008c0840045288a5014a22a660349201296f7074696f6e2e69735f736f6d652861646d696e5f746f6b656e5f696e70757429203f2046616c73650014a02a666032002294454cc06924011d6d7573745f6d696e745f6675656c5f746f6b656e73203f2046616c73650014a02940c038ccc00400800d2201044655454c001533301833710666002004006911044655454c00480005288a9980ca491d6d7573745f6275726e5f6675656c5f746f6b656e73203f2046616c73650014a044464a666036601e603a6ea8004520001375a6042603c6ea8004c94ccc06cc03cc074dd50008a60103d87a80001323300100137566044603e6ea8008894ccc084004530103d87a8000132323253330203371e00e6eb8c08800c4c054cc094dd4000a5eb804cc014014008dd698110011812801181180099198008008021129998100008a6103d87a80001323232533301f3371e00e6eb8c08400c4c050cc090dd3000a5eb804cc014014008dd5981080118120011811000991980080080191299980e0008a5eb7bdb1804c8c8c8c94ccc070cdc7a441000021003133021337606ea4008dd3000998030030019bab301e003375c60380046040004603c0026eb8c06cc060dd50020a9980b24922657870656374204d696e74286675656c5f706f6c69637929203d20707572706f736500163756603460366036603660360046eb0c064004c054dd5180c001180b980c00098099baa008149854cc0452411856616c696461746f722072657475726e65642066616c73650013656325333010300300115333014301337540042930a998088078b0a99980818020008a99980a18099baa002149854cc04403c5854cc04403c58c044dd5000a99999980b00388038a998078068b0a998078068b0a998078068b0a998078068b0a99807a491d52756e6e696e672033206172672076616c696461746f72207370656e64001332323223232253330153232323232533301a300e301c37540082646464a66603a6020603e6ea80044c8c8c94ccc080c050c088dd5000899191919192999812980c18139baa0131323232533302c001153302902316132533302d3030002132533302a3370e900218161baa00113232323232323253330315333031300d33016019232330010013233001001325333035302930373754002297adef6c6013756607660706ea8004cc04cdd5980b181b9baa30163037375400601c44a666072002297ae013303a3037303b00133002002303c00122533303800114a0264a66606a66e3cccdc6240006e35221045348495000375c607600491104534849500014a22660060060026076002294454cc0c924011d6d7573745f696e7075745f736869705f746f6b656e203f2046616c73650014a02a666062a666062006294454cc0c92411d6d7573745f686f6c645f61646d696e5f746f6b656e203f2046616c73650014a02a666062a666062008294454cc0c92411d6d7573745f686176655f656e6f7567685f6675656c203f2046616c73650014a02a666062a666062004294454cc0c9241206d7573745f70726f766964655f6675656c5f616d6f756e74203f2046616c73650014a02a666062002294454cc0c924011b6d7573745f70726573657276655f646174756d203f2046616c73650014a029405280a5014a066ebc014088cdc39998069bab30113032375400e01e9101044655454c003370201801460446660186eacc040c0c4dd50031bae3014303137540506eb8c040c0c4dd501419b8900800a3301d00102853333330330011001153302c02716153302c02716153302c02716153302c027163030302d37540022a660569213365787065637420496e6c696e65446174756d286f75745f646174756d29203d2070656c6c65745f6f75747075742e646174756d0016302f30303030302c37540022a660540482c605c002646600200201e44a66605a002297ae013232533302b3375e6022605c6ea8008c044c0b8dd5180698171baa00e133030002330040040011330040040013031002302f001375c6058605a605a60526ea8060dd6981598141baa0131533302530013300a00d253330263330265333026301930283754601860526ea8c030c0a4dd5180418149baa00114a02945282511301c3330043756601060526ea8c020c0a4dd50009bae300c302937540406eb8c020c0a4dd50100a5014a22a6604c921296f7074696f6e2e69735f736f6d652861646d696e5f746f6b656e5f696e70757429203f2046616c73650014a04a66604a6030604e6ea80045288a503330013756600a604c6ea8c014c098dd5003001a45044655454c00222325333026301a302837540022900009bad302c3029375400264a66604c603460506ea8004530103d87a8000132330010013756605a60546ea8008894ccc0b0004530103d87a80001323232533302b3371e00e6eb8c0b400c4c080cc0c0dd4000a5eb804cc014014008dd6981680118180011817000998020018011119198008008019129998148008a60103d87a8000132323253330283371e00c6eb8c0a800c4c074cc0b4dd3000a5eb804cc014014008dd59815001181680118158009bae3026302337540022a660429215b6578706563742053637269707443726564656e7469616c286675656c5f706f6c69637929203d0a20202020202070656c6c65745f696e7075742e6f75747075742e616464726573732e7061796d656e745f63726564656e7469616c0016300530223754600a60446ea8c004c088dd5001118129813000981198101baa001153301e49013a65787065637420536f6d652870656c6c65745f696e70757429203d2066696e645f696e70757428696e707574732c2070656c6c65745f726566290016323300200523375e600860426ea8004008c088c07cdd50031119198008008019129998118008a60103d87a8000132325333021300500213016330260024bd7009980200200098138011812800918108008a9980da48122657870656374205370656e642870656c6c65745f72656629203d20707572706f736500163758603e604060400046eb0c078004c068dd5180e801180e180e800980c1baa001149854cc0592411856616c696461746f722072657475726e65642066616c7365001365632533301430070011325333019001153301601216132533301a301d002149854cc05c04c58c94cccccc07800454cc05c04c5854cc05c04c5854cc05c04c584dd68008a9980b8098b180d800980b9baa00215333014300800115333018301737540042930a9980a8088b0a9980a8088b180a9baa001533333301a0011001153301300f16153301300f16153301300f16153301300f163300100200e225333011300430133754004264a66602c0022a660260042c26464a6660300022a6602a0082c26464a6660340022a6602e00c2c264a666036603c0042930a9980c0038b19299999980f8008a9980c0038b0a9980c0038b0a9980c0038b0a9980c0038b09bae001301c001301c00232533333301d0011533016005161533016005161533016005161375a0022a6602c00a2c6034002603400464a6666660360022a660280062c2a660280062c2a660280062c26eb400454cc05000c58c060004c050dd50010a998090008b299999980b00388038a998078060b0a998078060b0a998078060b0a998078060b180a18089baa006370e90001b8748008dd2a40006e212000153300b00116153300b00116153300b00116153300b0011649191496e636f72726563742072656465656d6572207479706520666f722076616c696461746f72207370656e642e0a2020202020202020202020202020202020202020446f75626c6520636865636b20796f7520686176652077726170706564207468652072656465656d657220747970652061732073706563696669656420696e20796f757220706c757475732e6a736f6e00490195657870656374205b70656c6c65745f6f75747075745d203d0a2020202020202020202066696c746572280a2020202020202020202020206f7574707574732c0a202020202020202020202020666e286f757470757429207b206f75747075742e61646472657373203d3d2070656c6c65745f696e7075742e6f75747075742e61646472657373207d2c0a202020202020202020202900490129657870656374206f75745f646174756d3a2050656c6c6574446174756d203d206f75745f646174756d0049011872656465656d65723a2050656c6c657452656465656d657200490112646174756d3a2050656c6c6574446174756d0049011672656465656d65723a204675656c52656465656d6572005734ae7155ceaab9e5573eae815d0aba257481"; -const ASTERIA_PATH: &str = "game/src/scripts/asteria.txt"; -const SPACETIME_PATH: &str = "game/src/scripts/spacetime.txt"; -const PELLET_PATH: &str = "game/src/scripts/pellet.txt"; -const DEPLOY_PARAMS_PATH: &str = "game/src/deploy_params.json"; - pub async fn create_ship( db: &Db, client: &HttpClient, @@ -52,13 +47,17 @@ pub async fn create_ship( ) -> anyhow::Result<()> { log::debug!("The args are:: {:?}", args); - let params_json: String = std::fs::read_to_string(DEPLOY_PARAMS_PATH)?; - let params: ScriptsParams = - serde_json::from_str(¶ms_json).map_err(|e| anyhow!("Invalid params JSON: {}", e))?; + let params_json: String = std::fs::read_to_string(args.params_path).unwrap(); + let params: ScriptsParams = serde_json::from_str(¶ms_json) + .map_err(|e| anyhow!("Invalid params JSON: {}", e)) + .unwrap(); - let asteria_script_hex: &str = &std::fs::read_to_string(ASTERIA_PATH)?; - let spacetime_script_hex: &str = &std::fs::read_to_string(SPACETIME_PATH)?; - let pellet_script_hex: &str = &std::fs::read_to_string(PELLET_PATH)?; + let asteria_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "asteria.txt").unwrap(); + let spacetime_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "spacetime.txt").unwrap(); + let pellet_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "pellet.txt").unwrap(); let asteria_script: PlutusScript = PlutusScript(hex::decode(asteria_script_hex).unwrap()); let asteria_hash: PolicyId = compute_plutus_v2_script_hash(asteria_script.clone()); @@ -280,8 +279,15 @@ pub async fn gather_fuel( ) -> anyhow::Result<()> { log::debug!("The args are:: {:?}", args); - let spacetime_script_hex: &str = &std::fs::read_to_string(SPACETIME_PATH)?; - let pellet_script_hex: &str = &std::fs::read_to_string(PELLET_PATH)?; + let params_json: String = std::fs::read_to_string(args.params_path).unwrap(); + let params: ScriptsParams = serde_json::from_str(¶ms_json) + .map_err(|e| anyhow!("Invalid params JSON: {}", e)) + .unwrap(); + + let spacetime_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "spacetime.txt").unwrap(); + let pellet_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "pellet.txt").unwrap(); let spacetime_script: PlutusScript = PlutusScript(hex::decode(spacetime_script_hex).unwrap()); let shipyard_policy: PolicyId = compute_plutus_v2_script_hash(spacetime_script.clone()); @@ -478,8 +484,15 @@ pub async fn move_ship( ) -> anyhow::Result<()> { log::debug!("The args are:: {:?}", args); - let spacetime_script_hex: &str = &std::fs::read_to_string(SPACETIME_PATH)?; - let pellet_script_hex: &str = &std::fs::read_to_string(PELLET_PATH)?; + let params_json: String = std::fs::read_to_string(args.params_path).unwrap(); + let params: ScriptsParams = serde_json::from_str(¶ms_json) + .map_err(|e| anyhow!("Invalid params JSON: {}", e)) + .unwrap(); + + let spacetime_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "spacetime.txt").unwrap(); + let pellet_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "pellet.txt").unwrap(); let spacetime_script: PlutusScript = PlutusScript(hex::decode(spacetime_script_hex).unwrap()); let shipyard_policy: PolicyId = compute_plutus_v2_script_hash(spacetime_script.clone()); @@ -679,9 +692,17 @@ pub async fn mine_asteria( ) -> anyhow::Result<()> { log::debug!("The args are:: {:?}", args); - let asteria_script_hex: &str = &std::fs::read_to_string(ASTERIA_PATH)?; - let spacetime_script_hex: &str = &std::fs::read_to_string(SPACETIME_PATH)?; - let pellet_script_hex: &str = &std::fs::read_to_string(PELLET_PATH)?; + let params_json: String = std::fs::read_to_string(args.params_path).unwrap(); + let params: ScriptsParams = serde_json::from_str(¶ms_json) + .map_err(|e| anyhow!("Invalid params JSON: {}", e)) + .unwrap(); + + let asteria_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "asteria.txt").unwrap(); + let spacetime_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "spacetime.txt").unwrap(); + let pellet_script_hex: &str = + &std::fs::read_to_string(params.scripts_directory.clone() + "pellet.txt").unwrap(); let asteria_script: PlutusScript = PlutusScript(hex::decode(asteria_script_hex).unwrap()); let asteria_hash: PolicyId = compute_plutus_v2_script_hash(asteria_script.clone()); diff --git a/game/src/lib.rs b/game/src/lib.rs index 7935726..d3107a5 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -104,6 +104,16 @@ pub struct CreateShipArgs { value_name = "TIME_TO_LIVE" )] pub ttl: u64, + + /// Path to the game parameters JSON file + #[arg( + long, + short, + verbatim_doc_comment, + required = true, + value_name = "GAME_PARAMS_PATH" + )] + pub params_path: String, } #[derive(Debug, Args, Clone)] @@ -136,6 +146,16 @@ pub struct GatherFuelArgs { value_name = "VALIDITY_INTERVAL_START" )] pub validity_interval_start: u64, + + /// Path to the game parameters JSON file + #[arg( + long, + short, + verbatim_doc_comment, + required = true, + value_name = "GAME_PARAMS_PATH" + )] + pub params_path: String, } #[derive(Debug, Args, Clone)] @@ -185,6 +205,16 @@ pub struct MoveShipArgs { value_name = "TIME_TO_LIVE" )] pub ttl: u64, + + /// Path to the game parameters JSON file + #[arg( + long, + short, + verbatim_doc_comment, + required = true, + value_name = "GAME_PARAMS_PATH" + )] + pub params_path: String, } #[derive(Debug, Args, Clone)] @@ -214,6 +244,16 @@ pub struct MineAsteriaArgs { value_name = "MINE_COIN_AMOUNT" )] pub mine_coin_amount: u64, + + /// Path to the game parameters JSON file + #[arg( + long, + short, + verbatim_doc_comment, + required = true, + value_name = "GAME_PARAMS_PATH" + )] + pub params_path: String, } #[derive(Debug, Args, Clone)] From 06b13f4d0284e5dfb78579347b9b482ef9b514c4 Mon Sep 17 00:00:00 2001 From: Francisco Joray Date: Mon, 1 Dec 2025 19:42:25 -0300 Subject: [PATCH 3/4] update game docs with new deployed scripts usage --- docs/tutorial/game_usage.md | 18 ++++++++++++++---- game/README.md | 8 ++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/tutorial/game_usage.md b/docs/tutorial/game_usage.md index 4a903b3..8ddfca3 100644 --- a/docs/tutorial/game_usage.md +++ b/docs/tutorial/game_usage.md @@ -13,17 +13,17 @@ In this final section we explain how to use our particular application. ## Deploy Scripts -This command reads all the script parameters from `game/src/deploy_params.json` and applies them to the generic (parameterized) -scripts, writing the resulting ones in their respective files, inside the `scripts` directory. +This command reads all the script parameters provided in the argument JSON file and applies them to the generic (parameterized) +scripts, writing the resulting ones in their respective files, inside the `scripts_directory` specified in the same JSON file. ```console ./target/release/griffin-partner-chains-node game deploy-scripts ---params +--params-path ``` ### Arguments details: -*params*: path to the JSON file containing all the script parameters. +*params-path*: path to the JSON file containing all the game scripts parameters and the target directory to write the resulting scripts. ### Create Ship @@ -36,6 +36,7 @@ This command creates the player’s Ship. The transaction also mints the initial --pos-x --pos-y --ttl +--params-path ``` #### Arguments details: @@ -44,6 +45,7 @@ This command creates the player’s Ship. The transaction also mints the initial - *pos-x*: initial “x” coordinate of the Ship output. - *pos-y*: initial “y” coordinate of the Ship output. - *ttl*: the transaction’s time-to-live. The resulting POSIX time of the validity interval is used to set the initial `last-move-latest-time` field in the Ship output datum. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. ### Gather Fuel @@ -56,6 +58,7 @@ This command moves fuel tokens from a pellet UTxO to a ship UTxO, only if they h --witness --fuel --validity-interval-start +--params-path ``` #### Arguments details: @@ -65,6 +68,7 @@ This command moves fuel tokens from a pellet UTxO to a ship UTxO, only if they h - *witness*: public key of the pilot token owner. This is necessary since the pilot UTxO must be provided as input to prove the ship ownership. If omitted, Shawn’s pub key is the default value. - *fuel*: the amount of fuel to transfer from the pellet to the ship. - *validity-interval-start*: start of the transaction’s validity interval. The corresponding POSIX must be greater than the `last-move-latest-time` field in the ship datum, in order to respect the speed limit of the last move. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. ### Move Ship @@ -78,6 +82,7 @@ This command moves the ship to a different point in the grid (updates the `pos_x --pos-y --validity-interval-start --ttl +--params-path ``` #### Arguments details: @@ -88,6 +93,7 @@ witness: public key of the pilot token owner. This is necessary since the pilot - *pos-y*: new “y” coordinate of the ship. - *validity-interval-start*: start of the transaction’s validity interval. The corresponding POSIX must be greater than the `last-move-latest-time` field in the ship datum, in order to respect the speed limit of the last move. - *ttl*: the transaction’s time-to-live. The resulting POSIX time of the validity interval is used to set the initial `last-move-latest-time` field in the Ship output datum. The Manhattan distance traveled divided by the POSIX validity range must be less or equal to the max speed. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. ### Mine Asteria @@ -98,6 +104,8 @@ This command can be triggered when the ship reaches Asteria, i.e., its coordinat --ship --witness --validity-interval-start +--mine-coin-amount +--params-path ``` #### Arguments details: @@ -105,6 +113,8 @@ This command can be triggered when the ship reaches Asteria, i.e., its coordinat - *ship*: reference to the ship UTxO. - *witness*: public key of the pilot token owner. This is necessary since the pilot UTxO must be provided as input to prove the ship ownership. If omitted, Shawn’s pub key is the default value. - *validity-interval-start*: start of the transaction’s validity interval. The corresponding POSIX must be greater than the `last-move-latest-time` field in the ship datum, in order to respect the speed limit of the last move. +- *mine-coin-amount*: amount of coin to be mined from Asteria. This must be less or equal to the allowed maximum percentage of the total prize defined by MAX_ASTERIA_MINING. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. | Previous | Next | Up | |-----------------------------------------------------|---------------------------------------|----------------------------| diff --git a/game/README.md b/game/README.md index 31f5f2e..4b445d7 100644 --- a/game/README.md +++ b/game/README.md @@ -63,17 +63,17 @@ Each of the following actions must be run with a running instance of the node. ### Deploy Scripts -This command reads all the script parameters from `game/src/deploy_params.json` and applies them to the generic (parameterized) -scripts, writing the resulting ones in their respective files, inside the `scripts` directory. +This command reads all the script parameters provided in the argument JSON file and applies them to the generic (parameterized) +scripts, writing the resulting ones in their respective files, inside the `scripts_directory` specified in the same JSON file. ```console ./target/release/griffin-partner-chains-node game deploy-scripts ---params +--params-path ``` #### Arguments details: -*params*: path to the json file containing all the script parameters. +*params-path*: path to the JSON file containing all the game scripts parameters and the target directory to write the resulting scripts. ### Create Ship From 72e4e345dd0066e7ba3c28ecc6ab6944dcc5552d Mon Sep 17 00:00:00 2001 From: Francisco Joray Date: Tue, 2 Dec 2025 16:13:17 -0300 Subject: [PATCH 4/4] update game commands usage --- game/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/game/README.md b/game/README.md index 4b445d7..a877eef 100644 --- a/game/README.md +++ b/game/README.md @@ -86,6 +86,7 @@ This command creates the player’s Ship. The transaction also mints the initial --pos-x --pos-y --ttl +--params-path ``` #### Arguments details: @@ -94,6 +95,7 @@ This command creates the player’s Ship. The transaction also mints the initial - *pos-x*: initial “x” coordinate of the Ship output. - *pos-y*: initial “y” coordinate of the Ship output. - *ttl*: the transaction’s time-to-live. The resulting POSIX time of the validity interval is used to set the initial `last-move-latest-time` field in the Ship output datum. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. ### Gather Fuel @@ -106,6 +108,7 @@ This command moves fuel tokens from a pellet UTxO to a ship UTxO, only if they h --witness --fuel --validity-interval-start +--params-path ``` #### Arguments details: @@ -115,6 +118,7 @@ This command moves fuel tokens from a pellet UTxO to a ship UTxO, only if they h - *witness*: public key of the pilot token owner. This is necessary since the pilot UTxO must be provided as input to prove the ship ownership. If omitted, Shawn’s pub key is the default value. - *fuel*: the amount of fuel to transfer from the pellet to the ship. - *validity-interval-start*: start of the transaction’s validity interval. The corresponding POSIX must be greater than the `last-move-latest-time` field in the ship datum, in order to respect the speed limit of the last move. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. ### Move Ship @@ -128,6 +132,7 @@ This command moves the ship to a different point in the grid (updates de `pos_x` --pos-y --validity-interval-start --ttl +--params-path ``` #### Arguments details: @@ -138,6 +143,7 @@ witness: public key of the pilot token owner. This is necessary since the pilot - *pos-y*: new “y” coordinate of the ship. - *validity-interval-start*: start of the transaction’s validity interval. The corresponding POSIX must be greater than the `last-move-latest-time` field in the ship datum, in order to respect the speed limit of the last move. - *ttl*: the transaction’s time-to-live. The resulting POSIX time of the validity interval is used to set the initial `last-move-latest-time` field in the Ship output datum. The manhattan distance travelled divided by the POSIX validity range must be less or equal to the max speed. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory. ### Mine Asteria @@ -148,6 +154,8 @@ This command can be triggered when the ship reaches Asteria, i.e., its coordinat --ship --witness --validity-interval-start +--mine-coin-amount +--params-path ``` #### Arguments details: @@ -155,5 +163,7 @@ This command can be triggered when the ship reaches Asteria, i.e., its coordinat - *ship*: reference to the ship UTxO. - *witness*: public key of the pilot token owner. This is necessary since the pilot UTxO must be provided as input to prove the ship ownership. If omitted, Shawn’s pub key is the default value. - *validity-interval-start*: start of the transaction’s validity interval. The corresponding POSIX must be greater than the `last-move-latest-time` field in the ship datum, in order to respect the speed limit of the last move. +- *mine-coin-amount*: amount of coin to be mined from Asteria. This must be less or equal to the allowed maximum percentage of the total prize defined by MAX_ASTERIA_MINING. +- *params-path*: path to the JSON file containing all the game scripts parameters and the applied scripts directory.