From 170c7f194bc631636e086ee09b65b8026b67bd6a Mon Sep 17 00:00:00 2001 From: Cletusgizo Date: Tue, 7 Oct 2025 16:39:53 +0100 Subject: [PATCH 1/2] Add deploy_assignment as subdirectory; backup nested .git to deploy_assignment/.git_backup --- deploy_assignment/.git_backup/COMMIT_EDITMSG | 1 + deploy_assignment/.git_backup/HEAD | 1 + deploy_assignment/.git_backup/config | 8 +++ deploy_assignment/.git_backup/description | 1 + .../.git_backup/hooks/applypatch-msg.sample | 25 ++++++++ .../.git_backup/hooks/commit-msg.sample | 25 ++++++++ deploy_assignment/.git_backup/hooks/docs.url | 1 + .../hooks/fsmonitor-watchman.sample | 16 ++++++ .../.git_backup/hooks/post-update.sample | 12 ++++ .../.git_backup/hooks/pre-applypatch.sample | 27 +++++++++ .../.git_backup/hooks/pre-commit.sample | 19 ++++++ .../.git_backup/hooks/pre-merge-commit.sample | 16 ++++++ .../.git_backup/hooks/pre-push.sample | 46 +++++++++++++++ .../.git_backup/hooks/pre-rebase.sample | 40 +++++++++++++ .../hooks/prepare-commit-msg.sample | 54 ++++++++++++++++++ deploy_assignment/.git_backup/index | Bin 0 -> 611 bytes deploy_assignment/.git_backup/info/exclude | 5 ++ deploy_assignment/.git_backup/logs/HEAD | 1 + .../.git_backup/logs/refs/heads/master | 1 + .../0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 | Bin 0 -> 504 bytes .../33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 | Bin 0 -> 318 bytes .../40/96f8b27497efe5343f6879dc4d240bf8473f7d | Bin 0 -> 65 bytes .../48/9e0593dcd183929ad2c125df5327bedcf955a4 | Bin 0 -> 212 bytes .../4d/448f83224a96dcb29b9807c5034f742880a1ff | Bin 0 -> 66 bytes .../a9/d9b908f1957b8eb800012646aebf459ac1a5b4 | Bin 0 -> 583 bytes .../af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 | Bin 0 -> 564 bytes .../b9/985f011a4963ae61990bd5c8c764b6cbe01766 | Bin 0 -> 138 bytes .../c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d | Bin 0 -> 54 bytes .../ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 | Bin 0 -> 881 bytes .../.git_backup/refs/heads/master | 1 + deploy_assignment/.gitignore | 5 ++ deploy_assignment/Scarb.lock | 24 ++++++++ deploy_assignment/Scarb.toml | 52 +++++++++++++++++ deploy_assignment/snfoundry.toml | 11 ++++ deploy_assignment/src/lib.cairo | 47 +++++++++++++++ deploy_assignment/tests/test_contract.cairo | 47 +++++++++++++++ 36 files changed, 486 insertions(+) create mode 100644 deploy_assignment/.git_backup/COMMIT_EDITMSG create mode 100644 deploy_assignment/.git_backup/HEAD create mode 100644 deploy_assignment/.git_backup/config create mode 100644 deploy_assignment/.git_backup/description create mode 100644 deploy_assignment/.git_backup/hooks/applypatch-msg.sample create mode 100644 deploy_assignment/.git_backup/hooks/commit-msg.sample create mode 100644 deploy_assignment/.git_backup/hooks/docs.url create mode 100644 deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample create mode 100644 deploy_assignment/.git_backup/hooks/post-update.sample create mode 100644 deploy_assignment/.git_backup/hooks/pre-applypatch.sample create mode 100644 deploy_assignment/.git_backup/hooks/pre-commit.sample create mode 100644 deploy_assignment/.git_backup/hooks/pre-merge-commit.sample create mode 100644 deploy_assignment/.git_backup/hooks/pre-push.sample create mode 100644 deploy_assignment/.git_backup/hooks/pre-rebase.sample create mode 100644 deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample create mode 100644 deploy_assignment/.git_backup/index create mode 100644 deploy_assignment/.git_backup/info/exclude create mode 100644 deploy_assignment/.git_backup/logs/HEAD create mode 100644 deploy_assignment/.git_backup/logs/refs/heads/master create mode 100644 deploy_assignment/.git_backup/objects/0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 create mode 100644 deploy_assignment/.git_backup/objects/33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 create mode 100644 deploy_assignment/.git_backup/objects/40/96f8b27497efe5343f6879dc4d240bf8473f7d create mode 100644 deploy_assignment/.git_backup/objects/48/9e0593dcd183929ad2c125df5327bedcf955a4 create mode 100644 deploy_assignment/.git_backup/objects/4d/448f83224a96dcb29b9807c5034f742880a1ff create mode 100644 deploy_assignment/.git_backup/objects/a9/d9b908f1957b8eb800012646aebf459ac1a5b4 create mode 100644 deploy_assignment/.git_backup/objects/af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 create mode 100644 deploy_assignment/.git_backup/objects/b9/985f011a4963ae61990bd5c8c764b6cbe01766 create mode 100644 deploy_assignment/.git_backup/objects/c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d create mode 100644 deploy_assignment/.git_backup/objects/ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 create mode 100644 deploy_assignment/.git_backup/refs/heads/master create mode 100644 deploy_assignment/.gitignore create mode 100644 deploy_assignment/Scarb.lock create mode 100644 deploy_assignment/Scarb.toml create mode 100644 deploy_assignment/snfoundry.toml create mode 100644 deploy_assignment/src/lib.cairo create mode 100644 deploy_assignment/tests/test_contract.cairo diff --git a/deploy_assignment/.git_backup/COMMIT_EDITMSG b/deploy_assignment/.git_backup/COMMIT_EDITMSG new file mode 100644 index 0000000..c1b50c3 --- /dev/null +++ b/deploy_assignment/.git_backup/COMMIT_EDITMSG @@ -0,0 +1 @@ +feat: deployment task done diff --git a/deploy_assignment/.git_backup/HEAD b/deploy_assignment/.git_backup/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/deploy_assignment/.git_backup/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/deploy_assignment/.git_backup/config b/deploy_assignment/.git_backup/config new file mode 100644 index 0000000..1ce7b3d --- /dev/null +++ b/deploy_assignment/.git_backup/config @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + symlinks = true + ignorecase = false + precomposeunicode = false diff --git a/deploy_assignment/.git_backup/description b/deploy_assignment/.git_backup/description new file mode 100644 index 0000000..7ffa683 --- /dev/null +++ b/deploy_assignment/.git_backup/description @@ -0,0 +1 @@ +Unnamed repository; everything before the `;` is the name of the repository. diff --git a/deploy_assignment/.git_backup/hooks/applypatch-msg.sample b/deploy_assignment/.git_backup/hooks/applypatch-msg.sample new file mode 100644 index 0000000..945f2f6 --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/applypatch-msg.sample @@ -0,0 +1,25 @@ +#!/bin/sh +# A sample hook to check commit messages created by `git am` +########################################################### +# +# When you receive a patch via email, the `git am` command is commonly used to apply +# that patch. During the `git am` process, the `applypatch-msg` hook is executed before +# creating the commit. Its purpose is to validate and modify the commit log message +# before the patch is applied as a commit in your Git repository. +# +# This script serves as an example to validate that the commit message introduced by +# the patch from an email would pass the `commit-msg` hook, which would be executed +# if you had created the commit yourself. +# +# This hook is the first and followed up by `pre-applypatch` and `post-applypatch`. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +# Retrieve the path of the commit-msg hook script. +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" + +# If the commit-msg hook script is executable, execute it and pass any command-line arguments to it. +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} + +# Be sure to exit without error if `exec` isn't called. +: diff --git a/deploy_assignment/.git_backup/hooks/commit-msg.sample b/deploy_assignment/.git_backup/hooks/commit-msg.sample new file mode 100644 index 0000000..a7f612f --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/commit-msg.sample @@ -0,0 +1,25 @@ +#!/bin/sh +# A sample hook to check commit messages created by `git commit` +################################################################ +# +# This example script checks commit messages for duplicate `Signed-off-by` +# lines and rejects the commit if these are present. +# +# It is called by "git commit" with a single argument: the name of the file +# that contains the final commit message, which would be used in the commit. +# A a non-zero exit status after issuing an appropriate message stops the operation. +# The hook is allowed to edit the commit message file by rewriting the file +# containing it. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +# Check for duplicate Signed-off-by lines in the commit message. +# The following command uses grep to find lines starting with "Signed-off-by: " +# in the commit message file specified by the first argument `$1`. +# It then sorts the lines, counts the number of occurrences of each line, +# and removes any lines that occur only once. +# If there are any remaining lines, it means there are duplicate Signed-off-by lines. +test "$(grep '^Signed-off-by: ' "$1" | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" = "" || { + echo "Remove duplicate Signed-off-by lines and repeat the commit." 1>&2 + exit 1 +} diff --git a/deploy_assignment/.git_backup/hooks/docs.url b/deploy_assignment/.git_backup/hooks/docs.url new file mode 100644 index 0000000..bbec397 --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/docs.url @@ -0,0 +1 @@ +https://git-scm.com/docs/githooks diff --git a/deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample b/deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample new file mode 100644 index 0000000..cd8985b --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample @@ -0,0 +1,16 @@ +#!/usr/bin/sh +# How to use hook-based fs-monitor integrations +############################################### + +# This script is meant as a placeholder for integrating filesystem monitors with git +# using hooks in order to speed up commands like `git-status`. +# +# To setup the fs-monitor for use with watchman, run +# `git config core.fsmonitor .git/hooks/fsmonitor-watchman` and paste the content of +# the example script over at https://github.com/git/git/blob/aa9166bcc0ba654fc21f198a30647ec087f733ed/templates/hooks--fsmonitor-watchman.sample +# into `.git/hooks/fsmonitor-watchman`. +# +# Note that by now and as of this writing on MacOS and Windows and starting from git 2.35.1 +# one can use the built-in fs-monitor implementation using `git config core.fsmonitor true` + +exit 42 diff --git a/deploy_assignment/.git_backup/hooks/post-update.sample b/deploy_assignment/.git_backup/hooks/post-update.sample new file mode 100644 index 0000000..506a065 --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/post-update.sample @@ -0,0 +1,12 @@ +#!/bin/sh +# A sample hook that runs after receiving a pack on a remote +############################################################ +# This hook is called after a pack was received on the remote, i.e. after a successful `git push` operation. +# It's useful on the server side only. +# +# There many more receive hooks which are documented in the official documentation: https://git-scm.com/docs/githooks. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +# Update static files to support the 'dumb' git HTTP protocol. +exec git update-server-info diff --git a/deploy_assignment/.git_backup/hooks/pre-applypatch.sample b/deploy_assignment/.git_backup/hooks/pre-applypatch.sample new file mode 100644 index 0000000..de06c7f --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/pre-applypatch.sample @@ -0,0 +1,27 @@ +#!/bin/sh +# A sample hook to check commit messages created by `git am` +########################################################### + +# This hook script is triggered by `git am` without any context just before creating a commit, +# which is useful to inspect the current tree or run scripts for further verification. +# +# If it exits with a non-zero exit code, the commit will not be created. Everything printed +# to the output or error channels will be visible to the user. +# +# Note that there is a sibling hook called `post-applypatch` (also without further context) +# which is run after the commit was created. It is useful to use the commit hash for further +# processing, like sending information to the involved parties. +# Finally, the `applypatch-msg` hook is called at the very beginning of the `git am` operation +# to provide access to the commit-message. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +# Retrieve the path to the pre-commit hook script using the "git rev-parse" command. +precommit="$(git rev-parse --git-path hooks/pre-commit)" + +# Check if the pre-commit hook script exists and is executable. +# If it does, execute it passing the arguments from this script (if any) using the "exec" command. +test -x "$precommit" && exec "$precommit" ${1+"$@"} + +# Be sure to exit without error if `exec` isn't called. +: diff --git a/deploy_assignment/.git_backup/hooks/pre-commit.sample b/deploy_assignment/.git_backup/hooks/pre-commit.sample new file mode 100644 index 0000000..9d256d4 --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/pre-commit.sample @@ -0,0 +1,19 @@ +#!/bin/sh +# A sample hook to prevent commits with merge-markers +##################################################### +# This example hook rejects changes that are about to be committed with merge markers, +# as that would be a clear indication of a failed merge. It is triggered by `git commit` +# and returning with non-zero exit status prevents the commit from being created. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +# Check for merge markers in modified files +for file in $(git diff --cached --name-only); do + if grep -q -E '^(<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|)$' "$file"; then + echo "Error: File '$file' contains merge markers. Please remove them before committing." + exit 1 + fi +done + +# Exit with success if there are no errors +exit 0 diff --git a/deploy_assignment/.git_backup/hooks/pre-merge-commit.sample b/deploy_assignment/.git_backup/hooks/pre-merge-commit.sample new file mode 100644 index 0000000..0896f5b --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/pre-merge-commit.sample @@ -0,0 +1,16 @@ +#!/bin/sh +# A sample hook to check commits created by `git merge` +####################################################### +# +# This hook is invoked by `git merge` without further context right before creating a commit. +# It should be used to validate the current state that is supposed to be committed, or exit +# with a non-zero status to prevent the commit. +# All output will be visible to the user. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +# Check if the pre-commit hook exists and is executable. If it is, it executes the pre-commit hook script. +test -x "$GIT_DIR/hooks/pre-commit" && exec "$GIT_DIR/hooks/pre-commit" + +# Be sure to exit without error if `exec` isn't called. +: diff --git a/deploy_assignment/.git_backup/hooks/pre-push.sample b/deploy_assignment/.git_backup/hooks/pre-push.sample new file mode 100644 index 0000000..fca1cea --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/pre-push.sample @@ -0,0 +1,46 @@ +#!/bin/sh +# Check for "DELME" in commit messages of about-to-be-pushed commits +#################################################################### +# This hook script is triggered by `git push` right after a connection to the remote +# was established and its initial response was received, and right before generating +# and pushing a pack-file. +# The operation will be aborted when exiting with a non-zero status. +# +# The following arguments are provided: +# +# $1 - The symbolic name of the remote to push to, like "origin" or the URL like "https://github.com/GitoxideLabs/gitoxide" if there is no such name. +# $2 - The URL of the remote to push to, like "https://github.com/GitoxideLabs/gitoxide". +# +# The hook should then read from standard input in a line-by-line fashion and split the following space-separated fields: +# +# * local ref - the left side of a ref-spec, i.e. "local" of the "local:refs/heads/remote" ref-spec +# * local hash - the hash of the commit pointed to by `local ref` +# * remote ref - the right side of a ref-spec, i.e. "refs/heads/remote" of the "local:refs/heads/remote" ref-spec +# * remote hash - the hash of the commit pointed to by `remote ref` +# +# In this example, we abort the push if any of the about-to-be-pushed commits have "DELME" in their commit message. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +remote="$1" +url="$2" + +# Check each commit being pushed +while read _local_ref local_hash _remote_ref _remote_hash; do + # Skip if the local hash is all zeroes (deletion) + zero_sha=$(printf "%0${#local_hash}d" 0) + if [ "$local_hash" = "$zero_sha" ]; then + continue + fi + # Get the commit message + commit_msg=$(git log --format=%s -n 1 "$local_hash") + + # Check if the commit message contains "DELME" + if echo "$commit_msg" | grep -iq "DELME"; then + echo "Error: Found commit with 'DELME' in message. Push aborted to $remote ($url) aborted." 1>&2 + exit 1 + fi +done + +# If no commit with "DELME" found, allow the push +exit 0 diff --git a/deploy_assignment/.git_backup/hooks/pre-rebase.sample b/deploy_assignment/.git_backup/hooks/pre-rebase.sample new file mode 100644 index 0000000..4850120 --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/pre-rebase.sample @@ -0,0 +1,40 @@ +#!/bin/sh +# A sample hook to validate the branches involved in a rebase operation +####################################################################### +# +# This hook is invoked right before `git rebase` starts its work and +# prevents anything else to happen by returning a non-zero exit code. +# +# The following arguments are provided: +# +# $1 - the branch that contains the commit from which $2 was forked. +# $2 - the branch being rebased or no second argument at all if the rebase applies to `HEAD`. +# +# This example hook aborts the rebase operation if the branch being rebased is not up to date +# with the latest changes from the upstream branch, or if there are any uncommitted changes. +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +upstream_branch=$1 +if [ "$#" -eq 2 ]; then + branch_being_rebased=$2 +else + branch_being_rebased=$(git symbolic-ref --quiet --short HEAD) || exit 0 # ignore rebases on detached heads +fi + +# Check if the branch being rebased is behind the upstream branch +if git log --oneline ${upstream_branch}..${branch_being_rebased} > /dev/null; then + echo "Warning: The branch being rebased (${branch_being_rebased}) is behind the upstream branch (${upstream_branch})." 1>&2 + echo "Please update your branch before rebasing." 1>&2 + exit 1 +fi + +# Check if there are any uncommitted changes +if ! git diff-index --quiet HEAD --; then + echo "Warning: There are uncommitted changes in your branch ${branch_being_rebased}." 1>&2 + echo "Please commit or stash your changes before rebasing." 1>&2 + exit 2 +fi + +# All good, let the rebase proceed. +exit 0 diff --git a/deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample b/deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..a38ff5a --- /dev/null +++ b/deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample @@ -0,0 +1,54 @@ +#!/bin/sh +# A hook called by `git commit` to adjust the commit message right before the user sees it +########################################################################################## +# +# This script is called by `git commit` after commit message was initialized and right before +# an editor is launched. +# +# It receives one to three arguments: +# +# $1 - the path to the file containing the commit message. It can be edited to change the message. +# $2 - the kind of source of the message contained in $1. Possible values are +# "message" - a message was provided via `-m` or `-F` +# "commit" - `-c`, `-C` or `--amend` was given +# "squash" - the `.git/SQUASH_MSG` file exists +# "merge" - this is a merge or the `.git/MERGE` file exists +# "template" - `-t` was provided or `commit.template` was set +# $3 - If $2 is "commit" then this is the hash of the commit. +# It can also take other values, best understood by studying the source code at +# https://github.com/git/git/blob/aa9166bcc0ba654fc21f198a30647ec087f733ed/builtin/commit.c#L745 +# +# The following example +# +# To enable this hook remove the `.sample` suffix from this file entirely. + +COMMIT_MSG_FILE=$1 + +# Check if the commit message file is empty or already contains a message +if [ -s "$COMMIT_MSG_FILE" ]; then + # If the commit message is already provided, exit without making any changes. + # This can happen if the user provided a message via `-m` or a template. + exit 0 +fi + +# Retrieve the branch name from the current HEAD commit +BRANCH_NAME=$(git symbolic-ref --short HEAD) + +# Generate a default commit message based on the branch name +DEFAULT_MSG="" + +case "$BRANCH_NAME" in + "feature/*") + DEFAULT_MSG="feat: " + ;; + "bugfix/*") + DEFAULT_MSG="fix: " + ;; + *) + DEFAULT_MSG="chore: " + ;; +esac + +# Set the commit message that will be presented to the user. +echo "$DEFAULT_MSG" > "$COMMIT_MSG_FILE" + diff --git a/deploy_assignment/.git_backup/index b/deploy_assignment/.git_backup/index new file mode 100644 index 0000000000000000000000000000000000000000..e721640e66991e050a27662eda5fe6cd4f26a264 GIT binary patch literal 611 zcmZ?q402{*U|<4bwv49+e%5ApCuTg=pT_Rtewu-SgO$O=|1|?c;}Ql2<`)pmVCyjL z$EK3$@1L63XH?$tRpI{OZePp5rI(&rl9`^DUz7?o3k))z8gq)iQ1XP)Q1d>an#UAs zEMK4Y*me1hPkXj9x1Kb)nZcL)m4PcbIk6~7FDE}a8(|*Meb(ZPVD}mCseqdI2Gu-H zq4!I6)D=IvrBS^@U+dy--vot}6%%0QmE`BemzH0emr_)z2QxF{so^q}2@KC*G}OFzsOGWBue`aF zf}{tzcNUcq!yPH>x0Pn;Efr4`w_rXG;bEHcZux literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/info/exclude b/deploy_assignment/.git_backup/info/exclude new file mode 100644 index 0000000..5793df4 --- /dev/null +++ b/deploy_assignment/.git_backup/info/exclude @@ -0,0 +1,5 @@ +# This file contains repository-wide exclude patterns that git will ignore. +# They are local and will not be shared when pushing or pulling. +# When using Rust the following would be typical exclude patterns. +# Remove the '# ' prefix to let them take effect. +# /target/ diff --git a/deploy_assignment/.git_backup/logs/HEAD b/deploy_assignment/.git_backup/logs/HEAD new file mode 100644 index 0000000..9a4af5f --- /dev/null +++ b/deploy_assignment/.git_backup/logs/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 b9985f011a4963ae61990bd5c8c764b6cbe01766 Cletusgizo 1759851150 +0100 commit (initial): feat: deployment task done diff --git a/deploy_assignment/.git_backup/logs/refs/heads/master b/deploy_assignment/.git_backup/logs/refs/heads/master new file mode 100644 index 0000000..9a4af5f --- /dev/null +++ b/deploy_assignment/.git_backup/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 b9985f011a4963ae61990bd5c8c764b6cbe01766 Cletusgizo 1759851150 +0100 commit (initial): feat: deployment task done diff --git a/deploy_assignment/.git_backup/objects/0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 b/deploy_assignment/.git_backup/objects/0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 new file mode 100644 index 0000000000000000000000000000000000000000..143d73483428774ebe3cae09119b8dc42cbcede0 GIT binary patch literal 504 zcmV5ad$QXVg5S>A zn`~KCMI|RY$$U?{HLit==FRID1$?1M3$w6 zTBG;cc647yy9}@!O*QanRt2E#{u9s#_d_d=wQ{zn%@mNy*^CFh3oyE%frKoK`O8XJ zzD27ra@FY`C&S<2xlaKfbx&3Ug7EfaG*}$9Ku*EH6|9#qPQIh|&Jb39Y7MEXHNuOY zQZ~V>de_{(T|)t%W!&|^gN9Gn9}@VEIvr9XN=dLB%giPeRaMXL@~ibz+6%Zw9)Mj& z&C`47CGTbc=#cS&BN-Tx>=bo)684O)fOkiE&<8id-6Hlj(cOW>KS#XSfUJWDWZ082 z&}tC2E;p6Tb3hwWr3#}6+v-E)RG=vPT`#+5XgfE*3}$wL-6L`7G2j>l`6n=q+D$C$ zS55O0f@V3#WLbwDrdlr=_?3MZ@Kr{$+Bmf%F^l%UG(!f}GMLo2#;I+o@4XQVA$hn- z*WpH?{kMez-ltJGjY=UqQgc?)Xh+c-Jb)p)jk)57+$3^FGD$!j-2TL09)G?Py^}s` u@$p9D3*vvq_fFPiH;KsOMn~x`9i+#ca?$enQiF@y9s@YJSp5NEX;TahC-uz$ literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 b/deploy_assignment/.git_backup/objects/33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 new file mode 100644 index 0000000000000000000000000000000000000000..57f746c5e94abc15c6db8e8dede3709f72b8acff GIT binary patch literal 318 zcmV-E0m1%w0j-fcPs1=2g_->;EHi>q$F*ap5))-$p-Z=_s;=#uG-~Taaf%4P9;X8; z5|4%PK925p?y<+#QdR1kTl&~~q%{WYVL(sqNTY+^(&dW2tk(2t`Ml1^EB3Kz1AU-5 zA)8GH?f^Azw>gq zHongoaeH)!cs@;j;vR%57RDMO=2C$XAf+x{Wh;XPS0J4i%5f-!P)1c=6_Ps%-YX%U z@{lA}DfWkpude?Y-b0BpVI*V=sxk`89HpIWC<|?Ko_@_;Dm5ss&}uN%Tzl>-Epjkg Q{vOy50Zhq#0E$h)#LLT=t^fc4 literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/40/96f8b27497efe5343f6879dc4d240bf8473f7d b/deploy_assignment/.git_backup/objects/40/96f8b27497efe5343f6879dc4d240bf8473f7d new file mode 100644 index 0000000000000000000000000000000000000000..cd9a65dd34404c8fcb4d0ba8077156a55cf230b8 GIT binary patch literal 65 zcmV-H0KWft0ZYosPf{>5WGG22N>44}(ksqO%P-AKDXNT5PE5{7)#pM8loTZ<0|k=v X%TkLH(}AplqWrYX93TS#Tv-^Haj6>) literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/48/9e0593dcd183929ad2c125df5327bedcf955a4 b/deploy_assignment/.git_backup/objects/48/9e0593dcd183929ad2c125df5327bedcf955a4 new file mode 100644 index 0000000000000000000000000000000000000000..314fde3c8a891666f6970bb28948b6d2266dcc18 GIT binary patch literal 212 zcmV;_04x7^0V^p=O;s>5v|unaFfcPQQP4}zEXhpI%P&f0aG3UEQ_1xAPfhGID)0EJ zaQ|?(uZ5}#PEIUJ(#y$D&So%{uTOjIy8OncJzJSuPnz7!;LH7rqN*f6H;3W|&$6emj@Bla5=Jm6NK?^&q7er5g7eo&W#< literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/a9/d9b908f1957b8eb800012646aebf459ac1a5b4 b/deploy_assignment/.git_backup/objects/a9/d9b908f1957b8eb800012646aebf459ac1a5b4 new file mode 100644 index 0000000000000000000000000000000000000000..9caf31afd7bc9c2cd3d3dfdc0b7a0158845c5d4e GIT binary patch literal 583 zcmV-N0=WHn0j*R~Z__Xk<~hIO&>q%krRgedLm5mfAhbRprgj3PsoI?6lA0xUWnWr} zssA0@Nwa2aiv;*7vCrRk-`#hPav8z#$?4gvAP8V22vy2r1ch^j8U=BY!TlBHx%?;v zDHhXx&$F>NGp>O*7nq4yYA9sFQyw$oQUDW)0V2h5!E%r(&ql%{t4$Ox>?0RmQZwR?}Kz)EPIu?z(WJ z)gB()vWR!Eh%mWZ^!*CT>TjzU*&X9?UCvR3;WN)}wX8+o@5$D+mzLa+V6m9isHjsJ z7hb=Ieisgh&c+ZkAtXVB&_ArLY_Hg54cc2bZE366X>FO2N;*Cq)f2ICyRMK0F*>%G zzLo!`=bvT1h0oRABCndSom0@F`KL1JnJn`JGNai%h33Ix;{O)RDza-+)UN4k$@2G= ztm<0dZ&0hEt?GFlYRxlInCIM0?~G`!!yuTk_@PL8Tn3ketHsZ+sYu3e+33foiDZkh V`nC){9RK=!O^H>^^ESBaEJgqT literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 b/deploy_assignment/.git_backup/objects/af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 new file mode 100644 index 0000000000000000000000000000000000000000..d47cc02d29f74907f3f08e13fa0bbdb7ff1261ca GIT binary patch literal 564 zcmV-40?Yk)0j*R`i`y^|?b*L#$Q~>gH>6>gfRFaaQfd+eHZJl? zE{Q9h@r<^TQq+_s$v&gBL`gAt+(U^<{ghbf7#`c;4^nlh?YD#DGaP00%1vsq6dMwz z@Y6Rc%WCd~%rU3OLTyo}E0Pl{;!2P$_?O75OZ5O(CddUifvFoI6S$!SzPxIhNr|r! ze7NuC4ITzlLu99F38G;wb`rNN8u|=wqDrx7(qUN_!q&GKcw~tD=V2?2 zeYQfZ*NCV8zG2b#j|_-!#q_S`(@gu0f*2Fjcd?noW4K6lPfEjfu-xXX4#6Mlv>Pu> Cx*om& literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/b9/985f011a4963ae61990bd5c8c764b6cbe01766 b/deploy_assignment/.git_backup/objects/b9/985f011a4963ae61990bd5c8c764b6cbe01766 new file mode 100644 index 0000000000000000000000000000000000000000..ea0ce96dcce9de6490b4d4d88dfd6b3e927695c7 GIT binary patch literal 138 zcmV;50CoR(0iBIO3c@fD06pgwdlw{|xU?%Gf-i~LZ7nv9wA+Ke-kyAbw_#wITuT`Y zkmJr~RXDb+o;XStY$FFw5;6voj$&x;D!F5#baZL8N1fp|s;x^ud@7vtkFR}6!+6NG sTmT#5mJrFq-lO+!v)j`2uh?~(>;$5(vA&B=29}m5NS)Mu0ijYrwWD4^u>b%7 literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d b/deploy_assignment/.git_backup/objects/c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d new file mode 100644 index 0000000000000000000000000000000000000000..e8a09d000338c15aab83db1863e7ab0e7f0e4f85 GIT binary patch literal 54 zcmV-60LlM&0V^p=O;s>9XD~D{Ff%bx$jMC7OHRxz%4b-4b0^2gsnvZu7#P*u*6nwl Mb#Unx08=LsS}ai(ApigX literal 0 HcmV?d00001 diff --git a/deploy_assignment/.git_backup/objects/ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 b/deploy_assignment/.git_backup/objects/ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 new file mode 100644 index 0000000000000000000000000000000000000000..b5e8dedf3cd94b6dce5d6f4286777cea30d7abd4 GIT binary patch literal 881 zcmV-%1CIQ70j*X|Z`(!??ODHKAYIx6sgD?FQJ{y`anK&(6mi>&AuvmFNG-J7C3cs# zm0zDXOZp?O5ld)wkwkLeyf^b^hNW>OZQg7)-(B~r+N+kgGpjnLUua%)Z``3!A?Vh2 zY~y@(!#-$d?R5J{Fy-ybE8$T_Z@# zF~1L%RnA7Qs<;IK&E6|KAN{}x9V)N;2xbwS1tyGql11-Wa9=~`$OhK-s-p;%3QnU1J&v7QuUHHeK#gKi>@;% zqlCPSWz#~mQ&L(9G7%lwZ|RiJg5FBanLbV8Kar@Wz*RzD5Z~!oG}@;WN#>4+htZ;_75SC1itSCOAr7wcq4X~_C|Lf+~9NHS2-@fiU@W%JSFtwpXbzjccW|e zfGv%y_JywVs9M1{C@~u87?KP6O%B6*lG8mk9);j*YAIP{HCP1)BaJ>Q{p=nc2bJf-Ty&c&_>#* zdZP{JnBIA%w0B3En`lAj&NjM5m(#hNB&?GjSmGcwdsL<2Ox1OUpOIy;1q|_;GZ-XI zynuaC4s9kw5Zb1Zgjut5gQ=-x8l-`ALvS|TDjUUCxQ0mBkXWMMh|~-=4ZfFyBrBg1 zX*nfI#A$1=Tx|J;hbDb8exy&*%YZUdk;aXK zonWO(1zNR`7Ef#N$WRM { + /// Increase contract balance. + fn increase_balance(ref self: TContractState, amount: felt252); + /// Retrieve contract balance. + fn get_balance(self: @TContractState) -> felt252; + /// set contract balance + fn set_balance(ref self: TContractState, amount: felt252); + ///reset contract balance + fn reset_balance(ref self: TContractState); +} + +/// Simple contract for managing balance. +#[starknet::contract] +mod HelloStarknet { + use starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess}; + + #[storage] + struct Storage { + balance: felt252, + } + + #[abi(embed_v0)] + impl HelloStarknetImpl of super::IHelloStarknet { + fn increase_balance(ref self: ContractState, amount: felt252) { + assert(amount != 0, 'Amount cannot be 0'); + self.balance.write(self.balance.read() + amount); + } + + fn get_balance(self: @ContractState) -> felt252 { + self.balance.read() + } + fn set_balance(ref self: ContractState, amount: felt252) { + assert(amount != 0, 'Amount should greater than 0'); + self.balance.write(self.balance.read() + amount); + } + + fn reset_balance(ref self: ContractState) { + self.balance.write(0) + } + } +} + +///Assignment +/// https://hackmd.io/@2HvjOfndR8aIXDSoavRrVw/B1zFPtM6gg \ No newline at end of file diff --git a/deploy_assignment/tests/test_contract.cairo b/deploy_assignment/tests/test_contract.cairo new file mode 100644 index 0000000..afc393e --- /dev/null +++ b/deploy_assignment/tests/test_contract.cairo @@ -0,0 +1,47 @@ +use starknet::ContractAddress; + +use snforge_std_deprecated::{declare, ContractClassTrait, DeclareResultTrait}; + +use deploy_assignment::IHelloStarknetSafeDispatcher; +use deploy_assignment::IHelloStarknetSafeDispatcherTrait; +use deploy_assignment::IHelloStarknetDispatcher; +use deploy_assignment::IHelloStarknetDispatcherTrait; + +fn deploy_contract(name: ByteArray) -> ContractAddress { + let contract = declare(name).unwrap().contract_class(); + let (contract_address, _) = contract.deploy(@ArrayTrait::new()).unwrap(); + contract_address +} + +#[test] +fn test_increase_balance() { + let contract_address = deploy_contract("HelloStarknet"); + + let dispatcher = IHelloStarknetDispatcher { contract_address }; + + let balance_before = dispatcher.get_balance(); + assert(balance_before == 0, 'Invalid balance'); + + dispatcher.increase_balance(42); + + let balance_after = dispatcher.get_balance(); + assert(balance_after == 42, 'Invalid balance'); +} + +#[test] +#[feature("safe_dispatcher")] +fn test_cannot_increase_balance_with_zero_value() { + let contract_address = deploy_contract("HelloStarknet"); + + let safe_dispatcher = IHelloStarknetSafeDispatcher { contract_address }; + + let balance_before = safe_dispatcher.get_balance().unwrap(); + assert(balance_before == 0, 'Invalid balance'); + + match safe_dispatcher.increase_balance(0) { + Result::Ok(_) => core::panic_with_felt252('Should have panicked'), + Result::Err(panic_data) => { + assert(*panic_data.at(0) == 'Amount cannot be 0', *panic_data.at(0)); + } + }; +} From 15bdcddd6f29e8270779123b768d0408f60b06eb Mon Sep 17 00:00:00 2001 From: Cletusgizo Date: Tue, 7 Oct 2025 16:53:11 +0100 Subject: [PATCH 2/2] feat: Deploy_assignment --- deploy_assignment/.git_backup/COMMIT_EDITMSG | 1 - deploy_assignment/.git_backup/HEAD | 1 - deploy_assignment/.git_backup/config | 8 --- deploy_assignment/.git_backup/description | 1 - .../.git_backup/hooks/applypatch-msg.sample | 25 -------- .../.git_backup/hooks/commit-msg.sample | 25 -------- deploy_assignment/.git_backup/hooks/docs.url | 1 - .../hooks/fsmonitor-watchman.sample | 16 ------ .../.git_backup/hooks/post-update.sample | 12 ---- .../.git_backup/hooks/pre-applypatch.sample | 27 --------- .../.git_backup/hooks/pre-commit.sample | 19 ------ .../.git_backup/hooks/pre-merge-commit.sample | 16 ------ .../.git_backup/hooks/pre-push.sample | 46 --------------- .../.git_backup/hooks/pre-rebase.sample | 40 ------------- .../hooks/prepare-commit-msg.sample | 54 ------------------ deploy_assignment/.git_backup/index | Bin 611 -> 0 bytes deploy_assignment/.git_backup/info/exclude | 5 -- deploy_assignment/.git_backup/logs/HEAD | 1 - .../.git_backup/logs/refs/heads/master | 1 - .../0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 | Bin 504 -> 0 bytes .../33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 | Bin 318 -> 0 bytes .../40/96f8b27497efe5343f6879dc4d240bf8473f7d | Bin 65 -> 0 bytes .../48/9e0593dcd183929ad2c125df5327bedcf955a4 | Bin 212 -> 0 bytes .../4d/448f83224a96dcb29b9807c5034f742880a1ff | Bin 66 -> 0 bytes .../a9/d9b908f1957b8eb800012646aebf459ac1a5b4 | Bin 583 -> 0 bytes .../af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 | Bin 564 -> 0 bytes .../b9/985f011a4963ae61990bd5c8c764b6cbe01766 | Bin 138 -> 0 bytes .../c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d | Bin 54 -> 0 bytes .../ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 | Bin 881 -> 0 bytes .../.git_backup/refs/heads/master | 1 - deploy_assignment/task/assignment | 31 ++++++++++ 31 files changed, 31 insertions(+), 300 deletions(-) delete mode 100644 deploy_assignment/.git_backup/COMMIT_EDITMSG delete mode 100644 deploy_assignment/.git_backup/HEAD delete mode 100644 deploy_assignment/.git_backup/config delete mode 100644 deploy_assignment/.git_backup/description delete mode 100644 deploy_assignment/.git_backup/hooks/applypatch-msg.sample delete mode 100644 deploy_assignment/.git_backup/hooks/commit-msg.sample delete mode 100644 deploy_assignment/.git_backup/hooks/docs.url delete mode 100644 deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample delete mode 100644 deploy_assignment/.git_backup/hooks/post-update.sample delete mode 100644 deploy_assignment/.git_backup/hooks/pre-applypatch.sample delete mode 100644 deploy_assignment/.git_backup/hooks/pre-commit.sample delete mode 100644 deploy_assignment/.git_backup/hooks/pre-merge-commit.sample delete mode 100644 deploy_assignment/.git_backup/hooks/pre-push.sample delete mode 100644 deploy_assignment/.git_backup/hooks/pre-rebase.sample delete mode 100644 deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample delete mode 100644 deploy_assignment/.git_backup/index delete mode 100644 deploy_assignment/.git_backup/info/exclude delete mode 100644 deploy_assignment/.git_backup/logs/HEAD delete mode 100644 deploy_assignment/.git_backup/logs/refs/heads/master delete mode 100644 deploy_assignment/.git_backup/objects/0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 delete mode 100644 deploy_assignment/.git_backup/objects/33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 delete mode 100644 deploy_assignment/.git_backup/objects/40/96f8b27497efe5343f6879dc4d240bf8473f7d delete mode 100644 deploy_assignment/.git_backup/objects/48/9e0593dcd183929ad2c125df5327bedcf955a4 delete mode 100644 deploy_assignment/.git_backup/objects/4d/448f83224a96dcb29b9807c5034f742880a1ff delete mode 100644 deploy_assignment/.git_backup/objects/a9/d9b908f1957b8eb800012646aebf459ac1a5b4 delete mode 100644 deploy_assignment/.git_backup/objects/af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 delete mode 100644 deploy_assignment/.git_backup/objects/b9/985f011a4963ae61990bd5c8c764b6cbe01766 delete mode 100644 deploy_assignment/.git_backup/objects/c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d delete mode 100644 deploy_assignment/.git_backup/objects/ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 delete mode 100644 deploy_assignment/.git_backup/refs/heads/master create mode 100644 deploy_assignment/task/assignment diff --git a/deploy_assignment/.git_backup/COMMIT_EDITMSG b/deploy_assignment/.git_backup/COMMIT_EDITMSG deleted file mode 100644 index c1b50c3..0000000 --- a/deploy_assignment/.git_backup/COMMIT_EDITMSG +++ /dev/null @@ -1 +0,0 @@ -feat: deployment task done diff --git a/deploy_assignment/.git_backup/HEAD b/deploy_assignment/.git_backup/HEAD deleted file mode 100644 index cb089cd..0000000 --- a/deploy_assignment/.git_backup/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/master diff --git a/deploy_assignment/.git_backup/config b/deploy_assignment/.git_backup/config deleted file mode 100644 index 1ce7b3d..0000000 --- a/deploy_assignment/.git_backup/config +++ /dev/null @@ -1,8 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true - symlinks = true - ignorecase = false - precomposeunicode = false diff --git a/deploy_assignment/.git_backup/description b/deploy_assignment/.git_backup/description deleted file mode 100644 index 7ffa683..0000000 --- a/deploy_assignment/.git_backup/description +++ /dev/null @@ -1 +0,0 @@ -Unnamed repository; everything before the `;` is the name of the repository. diff --git a/deploy_assignment/.git_backup/hooks/applypatch-msg.sample b/deploy_assignment/.git_backup/hooks/applypatch-msg.sample deleted file mode 100644 index 945f2f6..0000000 --- a/deploy_assignment/.git_backup/hooks/applypatch-msg.sample +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# A sample hook to check commit messages created by `git am` -########################################################### -# -# When you receive a patch via email, the `git am` command is commonly used to apply -# that patch. During the `git am` process, the `applypatch-msg` hook is executed before -# creating the commit. Its purpose is to validate and modify the commit log message -# before the patch is applied as a commit in your Git repository. -# -# This script serves as an example to validate that the commit message introduced by -# the patch from an email would pass the `commit-msg` hook, which would be executed -# if you had created the commit yourself. -# -# This hook is the first and followed up by `pre-applypatch` and `post-applypatch`. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -# Retrieve the path of the commit-msg hook script. -commitmsg="$(git rev-parse --git-path hooks/commit-msg)" - -# If the commit-msg hook script is executable, execute it and pass any command-line arguments to it. -test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} - -# Be sure to exit without error if `exec` isn't called. -: diff --git a/deploy_assignment/.git_backup/hooks/commit-msg.sample b/deploy_assignment/.git_backup/hooks/commit-msg.sample deleted file mode 100644 index a7f612f..0000000 --- a/deploy_assignment/.git_backup/hooks/commit-msg.sample +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# A sample hook to check commit messages created by `git commit` -################################################################ -# -# This example script checks commit messages for duplicate `Signed-off-by` -# lines and rejects the commit if these are present. -# -# It is called by "git commit" with a single argument: the name of the file -# that contains the final commit message, which would be used in the commit. -# A a non-zero exit status after issuing an appropriate message stops the operation. -# The hook is allowed to edit the commit message file by rewriting the file -# containing it. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -# Check for duplicate Signed-off-by lines in the commit message. -# The following command uses grep to find lines starting with "Signed-off-by: " -# in the commit message file specified by the first argument `$1`. -# It then sorts the lines, counts the number of occurrences of each line, -# and removes any lines that occur only once. -# If there are any remaining lines, it means there are duplicate Signed-off-by lines. -test "$(grep '^Signed-off-by: ' "$1" | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" = "" || { - echo "Remove duplicate Signed-off-by lines and repeat the commit." 1>&2 - exit 1 -} diff --git a/deploy_assignment/.git_backup/hooks/docs.url b/deploy_assignment/.git_backup/hooks/docs.url deleted file mode 100644 index bbec397..0000000 --- a/deploy_assignment/.git_backup/hooks/docs.url +++ /dev/null @@ -1 +0,0 @@ -https://git-scm.com/docs/githooks diff --git a/deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample b/deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample deleted file mode 100644 index cd8985b..0000000 --- a/deploy_assignment/.git_backup/hooks/fsmonitor-watchman.sample +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/sh -# How to use hook-based fs-monitor integrations -############################################### - -# This script is meant as a placeholder for integrating filesystem monitors with git -# using hooks in order to speed up commands like `git-status`. -# -# To setup the fs-monitor for use with watchman, run -# `git config core.fsmonitor .git/hooks/fsmonitor-watchman` and paste the content of -# the example script over at https://github.com/git/git/blob/aa9166bcc0ba654fc21f198a30647ec087f733ed/templates/hooks--fsmonitor-watchman.sample -# into `.git/hooks/fsmonitor-watchman`. -# -# Note that by now and as of this writing on MacOS and Windows and starting from git 2.35.1 -# one can use the built-in fs-monitor implementation using `git config core.fsmonitor true` - -exit 42 diff --git a/deploy_assignment/.git_backup/hooks/post-update.sample b/deploy_assignment/.git_backup/hooks/post-update.sample deleted file mode 100644 index 506a065..0000000 --- a/deploy_assignment/.git_backup/hooks/post-update.sample +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# A sample hook that runs after receiving a pack on a remote -############################################################ -# This hook is called after a pack was received on the remote, i.e. after a successful `git push` operation. -# It's useful on the server side only. -# -# There many more receive hooks which are documented in the official documentation: https://git-scm.com/docs/githooks. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -# Update static files to support the 'dumb' git HTTP protocol. -exec git update-server-info diff --git a/deploy_assignment/.git_backup/hooks/pre-applypatch.sample b/deploy_assignment/.git_backup/hooks/pre-applypatch.sample deleted file mode 100644 index de06c7f..0000000 --- a/deploy_assignment/.git_backup/hooks/pre-applypatch.sample +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# A sample hook to check commit messages created by `git am` -########################################################### - -# This hook script is triggered by `git am` without any context just before creating a commit, -# which is useful to inspect the current tree or run scripts for further verification. -# -# If it exits with a non-zero exit code, the commit will not be created. Everything printed -# to the output or error channels will be visible to the user. -# -# Note that there is a sibling hook called `post-applypatch` (also without further context) -# which is run after the commit was created. It is useful to use the commit hash for further -# processing, like sending information to the involved parties. -# Finally, the `applypatch-msg` hook is called at the very beginning of the `git am` operation -# to provide access to the commit-message. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -# Retrieve the path to the pre-commit hook script using the "git rev-parse" command. -precommit="$(git rev-parse --git-path hooks/pre-commit)" - -# Check if the pre-commit hook script exists and is executable. -# If it does, execute it passing the arguments from this script (if any) using the "exec" command. -test -x "$precommit" && exec "$precommit" ${1+"$@"} - -# Be sure to exit without error if `exec` isn't called. -: diff --git a/deploy_assignment/.git_backup/hooks/pre-commit.sample b/deploy_assignment/.git_backup/hooks/pre-commit.sample deleted file mode 100644 index 9d256d4..0000000 --- a/deploy_assignment/.git_backup/hooks/pre-commit.sample +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# A sample hook to prevent commits with merge-markers -##################################################### -# This example hook rejects changes that are about to be committed with merge markers, -# as that would be a clear indication of a failed merge. It is triggered by `git commit` -# and returning with non-zero exit status prevents the commit from being created. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -# Check for merge markers in modified files -for file in $(git diff --cached --name-only); do - if grep -q -E '^(<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|)$' "$file"; then - echo "Error: File '$file' contains merge markers. Please remove them before committing." - exit 1 - fi -done - -# Exit with success if there are no errors -exit 0 diff --git a/deploy_assignment/.git_backup/hooks/pre-merge-commit.sample b/deploy_assignment/.git_backup/hooks/pre-merge-commit.sample deleted file mode 100644 index 0896f5b..0000000 --- a/deploy_assignment/.git_backup/hooks/pre-merge-commit.sample +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# A sample hook to check commits created by `git merge` -####################################################### -# -# This hook is invoked by `git merge` without further context right before creating a commit. -# It should be used to validate the current state that is supposed to be committed, or exit -# with a non-zero status to prevent the commit. -# All output will be visible to the user. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -# Check if the pre-commit hook exists and is executable. If it is, it executes the pre-commit hook script. -test -x "$GIT_DIR/hooks/pre-commit" && exec "$GIT_DIR/hooks/pre-commit" - -# Be sure to exit without error if `exec` isn't called. -: diff --git a/deploy_assignment/.git_backup/hooks/pre-push.sample b/deploy_assignment/.git_backup/hooks/pre-push.sample deleted file mode 100644 index fca1cea..0000000 --- a/deploy_assignment/.git_backup/hooks/pre-push.sample +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# Check for "DELME" in commit messages of about-to-be-pushed commits -#################################################################### -# This hook script is triggered by `git push` right after a connection to the remote -# was established and its initial response was received, and right before generating -# and pushing a pack-file. -# The operation will be aborted when exiting with a non-zero status. -# -# The following arguments are provided: -# -# $1 - The symbolic name of the remote to push to, like "origin" or the URL like "https://github.com/GitoxideLabs/gitoxide" if there is no such name. -# $2 - The URL of the remote to push to, like "https://github.com/GitoxideLabs/gitoxide". -# -# The hook should then read from standard input in a line-by-line fashion and split the following space-separated fields: -# -# * local ref - the left side of a ref-spec, i.e. "local" of the "local:refs/heads/remote" ref-spec -# * local hash - the hash of the commit pointed to by `local ref` -# * remote ref - the right side of a ref-spec, i.e. "refs/heads/remote" of the "local:refs/heads/remote" ref-spec -# * remote hash - the hash of the commit pointed to by `remote ref` -# -# In this example, we abort the push if any of the about-to-be-pushed commits have "DELME" in their commit message. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -remote="$1" -url="$2" - -# Check each commit being pushed -while read _local_ref local_hash _remote_ref _remote_hash; do - # Skip if the local hash is all zeroes (deletion) - zero_sha=$(printf "%0${#local_hash}d" 0) - if [ "$local_hash" = "$zero_sha" ]; then - continue - fi - # Get the commit message - commit_msg=$(git log --format=%s -n 1 "$local_hash") - - # Check if the commit message contains "DELME" - if echo "$commit_msg" | grep -iq "DELME"; then - echo "Error: Found commit with 'DELME' in message. Push aborted to $remote ($url) aborted." 1>&2 - exit 1 - fi -done - -# If no commit with "DELME" found, allow the push -exit 0 diff --git a/deploy_assignment/.git_backup/hooks/pre-rebase.sample b/deploy_assignment/.git_backup/hooks/pre-rebase.sample deleted file mode 100644 index 4850120..0000000 --- a/deploy_assignment/.git_backup/hooks/pre-rebase.sample +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# A sample hook to validate the branches involved in a rebase operation -####################################################################### -# -# This hook is invoked right before `git rebase` starts its work and -# prevents anything else to happen by returning a non-zero exit code. -# -# The following arguments are provided: -# -# $1 - the branch that contains the commit from which $2 was forked. -# $2 - the branch being rebased or no second argument at all if the rebase applies to `HEAD`. -# -# This example hook aborts the rebase operation if the branch being rebased is not up to date -# with the latest changes from the upstream branch, or if there are any uncommitted changes. -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -upstream_branch=$1 -if [ "$#" -eq 2 ]; then - branch_being_rebased=$2 -else - branch_being_rebased=$(git symbolic-ref --quiet --short HEAD) || exit 0 # ignore rebases on detached heads -fi - -# Check if the branch being rebased is behind the upstream branch -if git log --oneline ${upstream_branch}..${branch_being_rebased} > /dev/null; then - echo "Warning: The branch being rebased (${branch_being_rebased}) is behind the upstream branch (${upstream_branch})." 1>&2 - echo "Please update your branch before rebasing." 1>&2 - exit 1 -fi - -# Check if there are any uncommitted changes -if ! git diff-index --quiet HEAD --; then - echo "Warning: There are uncommitted changes in your branch ${branch_being_rebased}." 1>&2 - echo "Please commit or stash your changes before rebasing." 1>&2 - exit 2 -fi - -# All good, let the rebase proceed. -exit 0 diff --git a/deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample b/deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample deleted file mode 100644 index a38ff5a..0000000 --- a/deploy_assignment/.git_backup/hooks/prepare-commit-msg.sample +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# A hook called by `git commit` to adjust the commit message right before the user sees it -########################################################################################## -# -# This script is called by `git commit` after commit message was initialized and right before -# an editor is launched. -# -# It receives one to three arguments: -# -# $1 - the path to the file containing the commit message. It can be edited to change the message. -# $2 - the kind of source of the message contained in $1. Possible values are -# "message" - a message was provided via `-m` or `-F` -# "commit" - `-c`, `-C` or `--amend` was given -# "squash" - the `.git/SQUASH_MSG` file exists -# "merge" - this is a merge or the `.git/MERGE` file exists -# "template" - `-t` was provided or `commit.template` was set -# $3 - If $2 is "commit" then this is the hash of the commit. -# It can also take other values, best understood by studying the source code at -# https://github.com/git/git/blob/aa9166bcc0ba654fc21f198a30647ec087f733ed/builtin/commit.c#L745 -# -# The following example -# -# To enable this hook remove the `.sample` suffix from this file entirely. - -COMMIT_MSG_FILE=$1 - -# Check if the commit message file is empty or already contains a message -if [ -s "$COMMIT_MSG_FILE" ]; then - # If the commit message is already provided, exit without making any changes. - # This can happen if the user provided a message via `-m` or a template. - exit 0 -fi - -# Retrieve the branch name from the current HEAD commit -BRANCH_NAME=$(git symbolic-ref --short HEAD) - -# Generate a default commit message based on the branch name -DEFAULT_MSG="" - -case "$BRANCH_NAME" in - "feature/*") - DEFAULT_MSG="feat: " - ;; - "bugfix/*") - DEFAULT_MSG="fix: " - ;; - *) - DEFAULT_MSG="chore: " - ;; -esac - -# Set the commit message that will be presented to the user. -echo "$DEFAULT_MSG" > "$COMMIT_MSG_FILE" - diff --git a/deploy_assignment/.git_backup/index b/deploy_assignment/.git_backup/index deleted file mode 100644 index e721640e66991e050a27662eda5fe6cd4f26a264..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 611 zcmZ?q402{*U|<4bwv49+e%5ApCuTg=pT_Rtewu-SgO$O=|1|?c;}Ql2<`)pmVCyjL z$EK3$@1L63XH?$tRpI{OZePp5rI(&rl9`^DUz7?o3k))z8gq)iQ1XP)Q1d>an#UAs zEMK4Y*me1hPkXj9x1Kb)nZcL)m4PcbIk6~7FDE}a8(|*Meb(ZPVD}mCseqdI2Gu-H zq4!I6)D=IvrBS^@U+dy--vot}6%%0QmE`BemzH0emr_)z2QxF{so^q}2@KC*G}OFzsOGWBue`aF zf}{tzcNUcq!yPH>x0Pn;Efr4`w_rXG;bEHcZux diff --git a/deploy_assignment/.git_backup/info/exclude b/deploy_assignment/.git_backup/info/exclude deleted file mode 100644 index 5793df4..0000000 --- a/deploy_assignment/.git_backup/info/exclude +++ /dev/null @@ -1,5 +0,0 @@ -# This file contains repository-wide exclude patterns that git will ignore. -# They are local and will not be shared when pushing or pulling. -# When using Rust the following would be typical exclude patterns. -# Remove the '# ' prefix to let them take effect. -# /target/ diff --git a/deploy_assignment/.git_backup/logs/HEAD b/deploy_assignment/.git_backup/logs/HEAD deleted file mode 100644 index 9a4af5f..0000000 --- a/deploy_assignment/.git_backup/logs/HEAD +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 b9985f011a4963ae61990bd5c8c764b6cbe01766 Cletusgizo 1759851150 +0100 commit (initial): feat: deployment task done diff --git a/deploy_assignment/.git_backup/logs/refs/heads/master b/deploy_assignment/.git_backup/logs/refs/heads/master deleted file mode 100644 index 9a4af5f..0000000 --- a/deploy_assignment/.git_backup/logs/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -0000000000000000000000000000000000000000 b9985f011a4963ae61990bd5c8c764b6cbe01766 Cletusgizo 1759851150 +0100 commit (initial): feat: deployment task done diff --git a/deploy_assignment/.git_backup/objects/0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 b/deploy_assignment/.git_backup/objects/0f/29e90db6baa7dd50e846807cf7c15a2c5e2371 deleted file mode 100644 index 143d73483428774ebe3cae09119b8dc42cbcede0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 504 zcmV5ad$QXVg5S>A zn`~KCMI|RY$$U?{HLit==FRID1$?1M3$w6 zTBG;cc647yy9}@!O*QanRt2E#{u9s#_d_d=wQ{zn%@mNy*^CFh3oyE%frKoK`O8XJ zzD27ra@FY`C&S<2xlaKfbx&3Ug7EfaG*}$9Ku*EH6|9#qPQIh|&Jb39Y7MEXHNuOY zQZ~V>de_{(T|)t%W!&|^gN9Gn9}@VEIvr9XN=dLB%giPeRaMXL@~ibz+6%Zw9)Mj& z&C`47CGTbc=#cS&BN-Tx>=bo)684O)fOkiE&<8id-6Hlj(cOW>KS#XSfUJWDWZ082 z&}tC2E;p6Tb3hwWr3#}6+v-E)RG=vPT`#+5XgfE*3}$wL-6L`7G2j>l`6n=q+D$C$ zS55O0f@V3#WLbwDrdlr=_?3MZ@Kr{$+Bmf%F^l%UG(!f}GMLo2#;I+o@4XQVA$hn- z*WpH?{kMez-ltJGjY=UqQgc?)Xh+c-Jb)p)jk)57+$3^FGD$!j-2TL09)G?Py^}s` u@$p9D3*vvq_fFPiH;KsOMn~x`9i+#ca?$enQiF@y9s@YJSp5NEX;TahC-uz$ diff --git a/deploy_assignment/.git_backup/objects/33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 b/deploy_assignment/.git_backup/objects/33/1f7f66e345a7d8f2bcb50385c934d9680e6df5 deleted file mode 100644 index 57f746c5e94abc15c6db8e8dede3709f72b8acff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmV-E0m1%w0j-fcPs1=2g_->;EHi>q$F*ap5))-$p-Z=_s;=#uG-~Taaf%4P9;X8; z5|4%PK925p?y<+#QdR1kTl&~~q%{WYVL(sqNTY+^(&dW2tk(2t`Ml1^EB3Kz1AU-5 zA)8GH?f^Azw>gq zHongoaeH)!cs@;j;vR%57RDMO=2C$XAf+x{Wh;XPS0J4i%5f-!P)1c=6_Ps%-YX%U z@{lA}DfWkpude?Y-b0BpVI*V=sxk`89HpIWC<|?Ko_@_;Dm5ss&}uN%Tzl>-Epjkg Q{vOy50Zhq#0E$h)#LLT=t^fc4 diff --git a/deploy_assignment/.git_backup/objects/40/96f8b27497efe5343f6879dc4d240bf8473f7d b/deploy_assignment/.git_backup/objects/40/96f8b27497efe5343f6879dc4d240bf8473f7d deleted file mode 100644 index cd9a65dd34404c8fcb4d0ba8077156a55cf230b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 65 zcmV-H0KWft0ZYosPf{>5WGG22N>44}(ksqO%P-AKDXNT5PE5{7)#pM8loTZ<0|k=v X%TkLH(}AplqWrYX93TS#Tv-^Haj6>) diff --git a/deploy_assignment/.git_backup/objects/48/9e0593dcd183929ad2c125df5327bedcf955a4 b/deploy_assignment/.git_backup/objects/48/9e0593dcd183929ad2c125df5327bedcf955a4 deleted file mode 100644 index 314fde3c8a891666f6970bb28948b6d2266dcc18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 212 zcmV;_04x7^0V^p=O;s>5v|unaFfcPQQP4}zEXhpI%P&f0aG3UEQ_1xAPfhGID)0EJ zaQ|?(uZ5}#PEIUJ(#y$D&So%{uTOjIy8OncJzJSuPnz7!;LH7rqN*f6H;3W|&$6emj@Bla5=Jm6NK?^&q7er5g7eo&W#< diff --git a/deploy_assignment/.git_backup/objects/a9/d9b908f1957b8eb800012646aebf459ac1a5b4 b/deploy_assignment/.git_backup/objects/a9/d9b908f1957b8eb800012646aebf459ac1a5b4 deleted file mode 100644 index 9caf31afd7bc9c2cd3d3dfdc0b7a0158845c5d4e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 583 zcmV-N0=WHn0j*R~Z__Xk<~hIO&>q%krRgedLm5mfAhbRprgj3PsoI?6lA0xUWnWr} zssA0@Nwa2aiv;*7vCrRk-`#hPav8z#$?4gvAP8V22vy2r1ch^j8U=BY!TlBHx%?;v zDHhXx&$F>NGp>O*7nq4yYA9sFQyw$oQUDW)0V2h5!E%r(&ql%{t4$Ox>?0RmQZwR?}Kz)EPIu?z(WJ z)gB()vWR!Eh%mWZ^!*CT>TjzU*&X9?UCvR3;WN)}wX8+o@5$D+mzLa+V6m9isHjsJ z7hb=Ieisgh&c+ZkAtXVB&_ArLY_Hg54cc2bZE366X>FO2N;*Cq)f2ICyRMK0F*>%G zzLo!`=bvT1h0oRABCndSom0@F`KL1JnJn`JGNai%h33Ix;{O)RDza-+)UN4k$@2G= ztm<0dZ&0hEt?GFlYRxlInCIM0?~G`!!yuTk_@PL8Tn3ketHsZ+sYu3e+33foiDZkh V`nC){9RK=!O^H>^^ESBaEJgqT diff --git a/deploy_assignment/.git_backup/objects/af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 b/deploy_assignment/.git_backup/objects/af/c393ec62a3bd7e3b97b9938e5b959593aacdf5 deleted file mode 100644 index d47cc02d29f74907f3f08e13fa0bbdb7ff1261ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmV-40?Yk)0j*R`i`y^|?b*L#$Q~>gH>6>gfRFaaQfd+eHZJl? zE{Q9h@r<^TQq+_s$v&gBL`gAt+(U^<{ghbf7#`c;4^nlh?YD#DGaP00%1vsq6dMwz z@Y6Rc%WCd~%rU3OLTyo}E0Pl{;!2P$_?O75OZ5O(CddUifvFoI6S$!SzPxIhNr|r! ze7NuC4ITzlLu99F38G;wb`rNN8u|=wqDrx7(qUN_!q&GKcw~tD=V2?2 zeYQfZ*NCV8zG2b#j|_-!#q_S`(@gu0f*2Fjcd?noW4K6lPfEjfu-xXX4#6Mlv>Pu> Cx*om& diff --git a/deploy_assignment/.git_backup/objects/b9/985f011a4963ae61990bd5c8c764b6cbe01766 b/deploy_assignment/.git_backup/objects/b9/985f011a4963ae61990bd5c8c764b6cbe01766 deleted file mode 100644 index ea0ce96dcce9de6490b4d4d88dfd6b3e927695c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmV;50CoR(0iBIO3c@fD06pgwdlw{|xU?%Gf-i~LZ7nv9wA+Ke-kyAbw_#wITuT`Y zkmJr~RXDb+o;XStY$FFw5;6voj$&x;D!F5#baZL8N1fp|s;x^ud@7vtkFR}6!+6NG sTmT#5mJrFq-lO+!v)j`2uh?~(>;$5(vA&B=29}m5NS)Mu0ijYrwWD4^u>b%7 diff --git a/deploy_assignment/.git_backup/objects/c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d b/deploy_assignment/.git_backup/objects/c1/cb95301bb4be9d0c882eb6b1757716b7d32a5d deleted file mode 100644 index e8a09d000338c15aab83db1863e7ab0e7f0e4f85..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54 zcmV-60LlM&0V^p=O;s>9XD~D{Ff%bx$jMC7OHRxz%4b-4b0^2gsnvZu7#P*u*6nwl Mb#Unx08=LsS}ai(ApigX diff --git a/deploy_assignment/.git_backup/objects/ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 b/deploy_assignment/.git_backup/objects/ef/a4b87e73e2da287bb82f2ad1bb4d602064a890 deleted file mode 100644 index b5e8dedf3cd94b6dce5d6f4286777cea30d7abd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 881 zcmV-%1CIQ70j*X|Z`(!??ODHKAYIx6sgD?FQJ{y`anK&(6mi>&AuvmFNG-J7C3cs# zm0zDXOZp?O5ld)wkwkLeyf^b^hNW>OZQg7)-(B~r+N+kgGpjnLUua%)Z``3!A?Vh2 zY~y@(!#-$d?R5J{Fy-ybE8$T_Z@# zF~1L%RnA7Qs<;IK&E6|KAN{}x9V)N;2xbwS1tyGql11-Wa9=~`$OhK-s-p;%3QnU1J&v7QuUHHeK#gKi>@;% zqlCPSWz#~mQ&L(9G7%lwZ|RiJg5FBanLbV8Kar@Wz*RzD5Z~!oG}@;WN#>4+htZ;_75SC1itSCOAr7wcq4X~_C|Lf+~9NHS2-@fiU@W%JSFtwpXbzjccW|e zfGv%y_JywVs9M1{C@~u87?KP6O%B6*lG8mk9);j*YAIP{HCP1)BaJ>Q{p=nc2bJf-Ty&c&_>#* zdZP{JnBIA%w0B3En`lAj&NjM5m(#hNB&?GjSmGcwdsL<2Ox1OUpOIy;1q|_;GZ-XI zynuaC4s9kw5Zb1Zgjut5gQ=-x8l-`ALvS|TDjUUCxQ0mBkXWMMh|~-=4ZfFyBrBg1 zX*nfI#A$1=Tx|J;hbDb8exy&*%YZUdk;aXK zonWO(1zNR`7Ef#N$WRM –name " + +Step 2 +funded the address gotten from the first step: +go to https://starknet-faucet.vercel.app/ to fund your account. + +Step 3 +Deployed the account using: +sncast deploy –url –name + +Step 4 +Deployed my HelloStarknet contract: + +Step 5: +Test function increase_balance by 80 in the terminal using +![1](https://hackmd.io/_uploads/rkBnuKMael.png) + +Test function set_count to "30" in the terminal: + +![Screenshot from 2025-10-07 13-35-10](https://hackmd.io/_uploads/HJJVYtGael.png) + +Test function reset_balance + +Used Sncast to transfer STRK for the terminal + +The token reflected in the wallet almost immediately