Skip to content

Commit

Permalink
Remove funding process on create contract when it's created by funder
Browse files Browse the repository at this point in the history
  • Loading branch information
go7066 committed Feb 13, 2024
1 parent 2145d9b commit 07cc5aa
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 32 deletions.
11 changes: 0 additions & 11 deletions examples/gno.land/r/demo/teritori/escrow/escrow.gno
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,6 @@ func CreateContract(
projectBudget += uint64(amount)
}

// If contract creator is funder then he needs to send all the needed fund to contract
funded := false
if caller.String() == funder {
tori20.TransferFrom(
users.AddressOrName(caller.String()),
users.AddressOrName(std.CurrentRealm().Addr().String()),
projectBudget)

funded = true
}

contractId := uint64(len(contracts))
contracts = append(contracts, Contract{
id: contractId,
Expand Down
68 changes: 47 additions & 21 deletions examples/gno.land/r/demo/teritori/escrow/escrow_teritori_testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,31 @@ gnokey maketx addpkg \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgdir="./escrow" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
teritori

# Get TORI GRC20 balance
gnokey maketx call \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/tori20" \
-func="Faucet" \
teritori

# Approve to realm
gnokey maketx call \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/tori20" \
-func="Approve" \
-args="g16al92c4weus9jddxl3784lm52p5dz84vts25r4" \
-args="25" \
teritori

# Create Contract
Expand All @@ -41,17 +65,19 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="CreateContract" \
-args="g1c5y8jpe585uezcvlmgdjmk5jt2glfw88wxa3xq" \
-args="$TERITORI" \
-args="gopher20" \
-args="{}" \
-args="60" \
-args="Milestone1,Milestone2" \
-args="Milestone1 Description,Milestone2 Description" \
-args="10,15" \
-args="86400,86400" \
-args="https://ref.com/m1,https://ref.com/m2" \
-args="MS_PRIORITY_HIGH,MS_PRIORITY_LOW" \
-args="" \
teritori

Expand All @@ -62,7 +88,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="CancelContract" \
-args="0" \
teritori
Expand All @@ -74,7 +100,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="AcceptContract" \
-args="0" \
gopher2
Expand All @@ -85,7 +111,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="FundMilestone" \
-args="0" \
teritori
Expand All @@ -97,7 +123,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="PauseContract" \
-args="0" \
teritori
Expand All @@ -109,7 +135,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="CompleteContract" \
-args="0" \
teritori
Expand All @@ -121,7 +147,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="ResumeContract" \
-args="1" \
teritori
Expand All @@ -133,7 +159,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="PayPartialMilestone" \
-args="0" \
-args="5" \
Expand All @@ -146,7 +172,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="PayAndCompleteActiveMilestone" \
-args="0" \
teritori
Expand All @@ -158,7 +184,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="FundMilestone" \
-args="0" \
teritori
Expand All @@ -170,7 +196,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="AddUpcomingMilestone" \
-args="0" \
-args="Milestone3" \
Expand All @@ -186,7 +212,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="CancelUpcomingMilestone" \
-args="0" \
-args="3" \
Expand All @@ -199,7 +225,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="SuggestConflictHandler" \
-args="0" \
-args="gno.land/r/demo/conflict_solver_01" \
Expand All @@ -212,7 +238,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="ApproveConflictHandler" \
-args="0" \
-args="gno.land/r/demo/conflict_solver_01" \
Expand All @@ -225,7 +251,7 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="CompleteContractByConflictHandler" \
-args="0" \
-args="50" \
Expand All @@ -238,26 +264,26 @@ gnokey maketx call \
-broadcast="true" \
-remote="51.15.236.215:26657" \
-chainid="teritori-1" \
-pkgpath="gno.land/r/demo/escrow_15" \
-pkgpath="gno.land/r/demo/escrow_16" \
-func="GiveFeedback" \
-args="0" \
-args="Amazing work" \
teritori

# Query Contracts
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_15
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_16
RenderContracts(0, 10)" -remote="51.15.236.215:26657"

# Query contract
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_15
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_16
RenderContract(0)" -remote="51.15.236.215:26657"

# Query config
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_15
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_16
RenderConfig()" -remote="51.15.236.215:26657"

# Query escrow address
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_15
gnokey query "vm/qeval" -data="gno.land/r/demo/escrow_16
CurrentRealm()" -remote="51.15.236.215:26657"


Expand Down

0 comments on commit 07cc5aa

Please sign in to comment.