-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 implement lucid offchain tx building for gathering fuel and mining…
… asteria (#47) * scripts for gathering fuel and mining asteria. Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com> * fixed error in pellet validator. * added script refs directory. * fixed onchain rewards check. Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com> * fixed shipyard policy burn checks. * script for quitting game. * refactored offchain scripts. Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com> * added `fetchReferenceScript` function. * added `constants` file. Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com> * pretty print of tx urls. Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com> * updated params. --------- Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com>
- Loading branch information
1 parent
ab01df0
commit d5b4006
Showing
36 changed files
with
608 additions
and
215 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { AssetClassT } from "./types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "516238dd0a79bac4bebe041c44bad8bf880d74720733d2fc0d255d28", | ||
name: fromText("asteriaAdmin"), | ||
}; | ||
const ship_mint_lovelace_fee = 20_000_000n; | ||
const max_asteria_mining = 100n; | ||
const max_moving_distance = 5n; | ||
const max_ship_fuel = 30n; | ||
const fuel_per_step = 1n; | ||
const initial_fuel = max_ship_fuel; | ||
const min_asteria_distance = 50n; | ||
|
||
export { | ||
admin_token, | ||
ship_mint_lovelace_fee, | ||
max_asteria_mining, | ||
max_moving_distance, | ||
max_ship_fuel, | ||
fuel_per_step, | ||
initial_fuel, | ||
min_asteria_distance, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"txHash":"c2badd0df205f93fef630785163b86d6872c2190cf4dd7628a3934b89b56f9bb"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"txHash":"87f626782b975a1496d751746b2a78579f9378a4843e00e72c4e9a74f519f24f"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"txHash":"431aaa1871f6187d3f3ebebafd41ef17f712d3af54c0bba4ff780ed176179603"} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { admin_token } from "../constants.ts"; | ||
import { createAsteria } from "../transactions/create-asteria.ts"; | ||
import { AssetClassT } from "../types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const txHash = await createAsteria(admin_token); | ||
|
||
console.log(txHash); | ||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { AssetClassT } from "../types.ts"; | ||
import { admin_token } from "../constants.ts"; | ||
import { createPellet } from "../transactions/create-pellet.ts"; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
const fuel = 40n; | ||
const pos_x = 7n; | ||
const pos_y = -10n; | ||
|
||
const fuel = 90n; | ||
const pos_x = 12n; | ||
const pos_y = -50n; | ||
const txHash = await createPellet(admin_token, fuel, pos_x, pos_y); | ||
|
||
console.log(txHash); | ||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { AssetClassT } from "../types.ts"; | ||
import { | ||
admin_token, | ||
initial_fuel, | ||
ship_mint_lovelace_fee, | ||
} from "../constants.ts"; | ||
import { createShip } from "../transactions/create-ship.ts"; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
const ship_mint_lovelace_fee = 3000n; | ||
const initial_fuel = 15n; | ||
const pos_x = 20n; | ||
const pos_y = -13n; | ||
const pos_x = 7n; | ||
const pos_y = -10n; | ||
const asteria_tx_hash = | ||
"2ad4ee7c7cd9156de39f33c5a1c31e701fae299366bf886c85bbb00ac84f210b"; | ||
const asteria_tx_index = 0; | ||
|
||
const txHash = await createShip( | ||
admin_token, | ||
ship_mint_lovelace_fee, | ||
initial_fuel, | ||
pos_x, | ||
pos_y | ||
pos_y, | ||
asteria_tx_hash, | ||
asteria_tx_index | ||
); | ||
|
||
console.log(txHash); | ||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { deployAsteria } from "../../transactions/deploy/deploy-asteria.ts"; | ||
import { AssetClassT } from "../../types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
const ship_mint_lovelace_fee = 3000n; | ||
const max_asteria_mining = 50n; | ||
import { | ||
admin_token, | ||
max_asteria_mining, | ||
ship_mint_lovelace_fee, | ||
} from "../../constants.ts"; | ||
import { printTxURL } from "../../utils.ts"; | ||
|
||
const txHash = await deployAsteria( | ||
admin_token, | ||
ship_mint_lovelace_fee, | ||
max_asteria_mining | ||
); | ||
|
||
console.log(txHash); | ||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { deployPellet } from "../../transactions/deploy/deploy-pellet.ts"; | ||
import { AssetClassT } from "../../types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
import { admin_token } from "../../constants.ts"; | ||
import { printTxURL } from "../../utils.ts"; | ||
|
||
const txHash = await deployPellet(admin_token); | ||
|
||
console.log(txHash); | ||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { spendRefUTxOs } from "../../transactions/deploy/spend-refs.ts"; | ||
import { AssetClassT } from "../../types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
import { admin_token } from "../../constants.ts"; | ||
import { printTxURL } from "../../utils.ts"; | ||
|
||
const txHash = await spendRefUTxOs(admin_token); | ||
console.log(txHash); | ||
|
||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { admin_token } from "../constants.ts"; | ||
import { gatherFuel } from "../transactions/gather-fuel.ts"; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const gather_amount = 20n; | ||
const ship_tx_hash = | ||
"6ca378639a51b1283ec2c84deb772f62bff59603eca230aeb711fedee8389d69"; | ||
const pellet_tx_hash = | ||
"b1d5dedc6c9ba333d8eab4c9f05edda4563fc313fc9b124393ec3b64e3676fb0"; | ||
|
||
const txHash = await gatherFuel( | ||
admin_token, | ||
gather_amount, | ||
ship_tx_hash, | ||
pellet_tx_hash | ||
); | ||
|
||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { admin_token } from "../constants.ts"; | ||
import { mineAsteria } from "../transactions/mine-asteria.ts"; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const ship_tx_hash = | ||
"40930f706ba2bb29be56326a3171ffa17e2d7f4e1d9cdeac347e05f3559efcd8"; | ||
const asteria_tx_hash = | ||
"6ca378639a51b1283ec2c84deb772f62bff59603eca230aeb711fedee8389d69"; | ||
const max_asteria_mining = 50n; | ||
|
||
const txHash = await mineAsteria( | ||
admin_token, | ||
ship_tx_hash, | ||
asteria_tx_hash, | ||
max_asteria_mining | ||
); | ||
|
||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { fuel_per_step } from "../constants.ts"; | ||
import { moveShip } from "../transactions/move-ship.ts"; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const fuel_per_step = 1n; | ||
const delta_x = 2n; | ||
const delta_y = -3n; | ||
const ship_token_name = fromText("SHIP0"); | ||
const pilot_token_name = fromText("PILOT0"); | ||
const shipTxHash = | ||
"ca30a841e582f284b7b71d39c2cbc8b9a7fca9476d921b6b9d97c0c7e31bf2bc"; | ||
const delta_x = -7n; | ||
const delta_y = 10n; | ||
const ship_tx_hash = | ||
"85568f8fc35a103b6f5753a2634631477769f3bc9ae8ea7c60dd7f7c2f342cf8"; | ||
|
||
const txHash = await moveShip( | ||
fuel_per_step, | ||
delta_x, | ||
delta_y, | ||
ship_token_name, | ||
pilot_token_name, | ||
shipTxHash | ||
); | ||
const txHash = await moveShip(fuel_per_step, delta_x, delta_y, ship_tx_hash); | ||
|
||
console.log(txHash); | ||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { quit } from "../transactions/quit.ts"; | ||
import { printTxURL } from "../utils.ts"; | ||
|
||
const ship_tx_hash = | ||
"85568f8fc35a103b6f5753a2634631477769f3bc9ae8ea7c60dd7f7c2f342cf8"; | ||
|
||
const txHash = await quit(ship_tx_hash); | ||
|
||
printTxURL(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.