From ae8b4c9b608387631a21bc5baf18d3c86a3ad5c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:38:31 +0000 Subject: [PATCH 1/4] chore(deps): update abatilo/actions-poetry action to v2.2.0 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76974d5..15ffe3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: python-version: 3.10.8 - name: Set up Poetry - uses: abatilo/actions-poetry@v2.1.6 + uses: abatilo/actions-poetry@v2.2.0 with: poetry-version: 1.1.13 From 3613561e37f5da1f7aeead77254cf869f261cfc1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:40:24 +0000 Subject: [PATCH 2/4] chore(deps): update abatilo/actions-poetry action to v2.2.0 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76974d5..15ffe3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: python-version: 3.10.8 - name: Set up Poetry - uses: abatilo/actions-poetry@v2.1.6 + uses: abatilo/actions-poetry@v2.2.0 with: poetry-version: 1.1.13 From 46110ae30b31d0a2ad4fe855b2ff1bfd37e650f3 Mon Sep 17 00:00:00 2001 From: cusma Date: Tue, 6 Dec 2022 09:57:58 +0100 Subject: [PATCH 3/4] Update base branch --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index 5d4107a..7546fd9 100644 --- a/renovate.json +++ b/renovate.json @@ -4,7 +4,7 @@ "ignoreDeps": [], "schedule": "before 3am on the first day of the month", "assignees": ["cusma"], - "baseBranches": ["main"], + "baseBranches": ["develop"], "separateMajorMinor": true, "rebaseStalePrs": true, "lockFileMaintenance": { From a63050adfc6e148b7d0341fd15d799b9d4951f76 Mon Sep 17 00:00:00 2001 From: cusma Date: Fri, 30 Dec 2022 10:13:41 +0100 Subject: [PATCH 4/4] Add test deployment guideline. --- src/contracts/README.md | 92 +++++++++++++++++++++++++++ src/contracts/tmpl_algorealm_law.teal | 75 ++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 src/contracts/README.md create mode 100644 src/contracts/tmpl_algorealm_law.teal diff --git a/src/contracts/README.md b/src/contracts/README.md new file mode 100644 index 0000000..6a4d1f4 --- /dev/null +++ b/src/contracts/README.md @@ -0,0 +1,92 @@ +# AlgoRealm Depoloyment + +The following procedure describe the AlgoRealm depoloyment process, which could +be useful in case of testing purposes. The deployment process consists in 4 +steps: three for the artifacts creation and one for the artifacts binding. + +### 1. AlgoRealm Test ASAs + +#### Crown of Test + +Creates the *Crown of Test* ASA with: + +- Name: `Crown of Test` +- Unit Name: `CROWN` +- Total: `1` +- Decimals: `0` +- `manager` and the `clawback` addresses active; + +Get the `TEST_CROWN_ID`. + +#### Sceptre of Test + +Creates the *Sceptre of Test* ASA with: + +- Name: `Sceptre of Test` +- Unit Name: `SCEPTRE` +- Total: `1` +- Decimals: `0` +- `manager` and the `clawback` addresses active; + +Get the `TEST_SCEPTRE_ID`. + +### 2. AlgoRealm Test App + +Depoloy the *AlgoRealm Test App* with: + +- Approval Program: `algorealm_approval.teal` (compiling TEAL to AVM bytecode); +- Clear Program: `algorealm_clear.teal` (compiling TEAL to AVM bytecode); +- Global Ints: `2`; +- Global Bytes: `3`; +- Local Ints: `0`; +- Local Bytes: `0`; + +Get the `TEST_ALGOREALM_APP_ID`. + +### 3. AlgoRealm Test Law + +Replace the `TMPL_` parameters in the `tmpl_algorealm_law.teal` Smart Signature +with the `TEST_` IDs obtained in the previous steps, specifically: + +1. The `TEST_ALGOREALM_APP_ID` here: + +```teal +// To the AlgoRealm App +gtxn 0 ApplicationID +int TMPL_ALGOREALM_APP_ID +``` + +2. The `TEST_CROWN_ID` and the `TEST_SCEPTRE_ID` here: + +```teal +// Either of the Crown of Entropy +gtxn 2 XferAsset +int TMPL_CROWN_ASA_ID +== +// Or of the Sceptre of Proof +gtxn 2 XferAsset +int TMPL_SCEPTRE_ASA_ID +``` + +Save the updated TEAL source code as `algorealm_test_law.teal` and then compile +it to obtain the public key `TEST_ALGOREALM_ADDR` associated to the Smart +Signature. + +Fund the `TEST_ALGOREALM_ADDR` with some ALGOs. + +## 4. Bindings + +Once all the artifacts are ready: + +- `TEST_CROWN_ID`; +- `TEST_SCEPTRE_ID`; +- `TEST_ALGOREALM_APP_ID`; +- `TEST_ALGOREALM_ADDR`; + +They must be **binded** as follows: + +1. As a `manager`, set `TEST_ALGOREALM_ADDR` as `clawback` address of `TEST_CROWN_ID`; +2. As a `manager`, set `TEST_ALGOREALM_ADDR` as `clawback` address of `TEST_SCEPTRE_ID`; +3. Call the `TEST_ALGOREALM_APP_ID` passing the `TEST_ALGOREALM_ADDR` as first argument of the AppCall. + +A new testing instance of AlgoRealm is now succesfully depolyed! diff --git a/src/contracts/tmpl_algorealm_law.teal b/src/contracts/tmpl_algorealm_law.teal new file mode 100644 index 0000000..55088ee --- /dev/null +++ b/src/contracts/tmpl_algorealm_law.teal @@ -0,0 +1,75 @@ +// AlgoRealm Law +#pragma version 2 + +// Must be a Group of 3 txns +global GroupSize +int 3 +== + +// First txn must be an AppCall +gtxn 0 TypeEnum +int appl +== +// To the AlgoRealm App +gtxn 0 ApplicationID +int TMPL_ALGOREALM_APP_ID +== +&& +&& + +// Second txn must be a Payment donation +gtxn 1 TypeEnum +int pay +== +// From the AlgoRealm App caller +gtxn 1 Sender +gtxn 0 Sender +== +&& +// To the Rewards Pool +gtxn 1 Receiver +addr 737777777777777777777777777777777777777777777777777UFEJ2CI +== +&& +&& + +// Third txn must be the NFT AssetTransfer +gtxn 2 TypeEnum +int axfer +== +// To the AlgoRealm donor +gtxn 2 AssetReceiver +gtxn 1 Sender +== +&& +// Either of the Crown of Entropy +gtxn 2 XferAsset +int TMPL_CROWN_ASA_ID +== +// Or of the Sceptre of Proof +gtxn 2 XferAsset +int TMPL_SCEPTRE_ASA_ID +== +|| +&& +// The transfer is of a unique NFT +gtxn 2 AssetAmount +int 1 +== +&& +// Paying at most 1000 microAlgos as txn fee +gtxn 2 Fee +int 1000 +<= +&& +// With no AssetCloseTo +gtxn 2 AssetCloseTo +global ZeroAddress +== +&& +// With no RekeyTo +gtxn 2 RekeyTo +global ZeroAddress +== +&& +&&