Part 1: Create the smart contract
On this first section, you will:
- Create the game smart contract importing an existing LIGO library
- Deploy your smart contract to the Ghostnet
- Get the Shifumi Git repository folders to copy the game UI and CSS for the second party
Smart contract
-
Clone the repository and start a new Taqueria project:
git clone https://github.com/marigold-dev/training-dapp-shifumi.git
taq init shifumi
cd shifumi
taq install @taqueria/plugin-ligo -
Download the LIGO Shifumi template, and copy the files to Taqueria contracts folder:
TAQ_LIGO_IMAGE=ligolang/ligo:1.2.0 taq ligo --command "init contract --template shifumi-jsligo shifumiTemplate"
cp -r shifumiTemplate/src/* contracts/ -
Compile the contract. It creates the default required file
main.storageList.jsligo
:TAQ_LIGO_IMAGE=ligolang/ligo:1.2.0 taq compile main.jsligo
-
Edit
main.storageList.jsligo
initial storage and save it:#import "main.jsligo" "Contract"
const default_storage: Contract.storage = {
metadata: Big_map.literal(
list(
[
["", bytes `tezos-storage:contents`],
[
"contents",
bytes
`
{
"name": "Shifumi Example",
"description": "An Example Shifumi Contract",
"version": "beta",
"license": {
"name": "MIT"
},
"authors": [
"smart-chain <tezos@smart-chain.fr>"
],
"homepage": "https://github.com/ligolang/shifumi-jsligo",
"source": {
"tools": "jsligo",
"location": "https://github.com/ligolang/shifumi-jsligo/contracts"
},
"interfaces": [
"TZIP-016"
]
}
`
]
]
)
) as big_map<string, bytes>,
next_session: 0 as nat,
sessions: Map.empty as map<nat, Contract.Session.t>,
} -
Compile again:
TAQ_LIGO_IMAGE=ligolang/ligo:1.2.0 taq compile main.jsligo
-
Deploy to Ghostnet:
taq install @taqueria/plugin-taquito
taq deploy main.tz -e "testing"Note: If this is your first time using Taqueria, look at this training first: https://github.com/marigold-dev/training-dapp-1#ghostnet-testnet
For advanced users, just go to
.taq/config.local.testing.json
, replace account with alice settings and then redeploy{
"networkName": "ghostnet",
"accounts": {
"taqOperatorAccount": {
"publicKey": "edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn",
"publicKeyHash": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb",
"privateKey": "edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq"
}
}
}Your smart contract is ready on Ghostnet!
┌──────────┬──────────────────────────────────────┬───────┐
│ Contract │ Address │ Alias │
├──────────┼────────────────── ────────────────────┼───────┤
│ main.tz │ KT1QjiZcAq63yVSCkfAr9zcFvmKBhQ7nVSWd │ main │
└──────────┴──────────────────────────────────────┴───────┘
Summary
That's all for the smart contract. On the next section, you will create the mobile application and connect to your smart contract
When you are ready, continue to Part 2: Create an Ionic mobile application.