Skip to content

Commit

Permalink
fix: conflict handler after testing
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Meier <[email protected]>
  • Loading branch information
n0izn0iz committed Feb 14, 2024
1 parent c6bc1a1 commit 39b0e81
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/gno.land/r/demo/teritori/escrow/escrow.gno
Original file line number Diff line number Diff line change
Expand Up @@ -822,19 +822,20 @@ func RespondToConflict(contractId uint64, message string) {
conflict := contract.conflicts[conflictId]

if conflict.initiator == contract.funder {
if contract.funder != caller.String() {
if contract.contractor != caller.String() {
panic("only contract funder can respond to this conflict")
}
} else if conflict.initiator == contract.contractor {
if contract.contractor != caller.String() {
if contract.funder != caller.String() {
panic("only contract contractor can respond to this conflict")
}
} else {
panic("conflict initiator is not valid")
}

contracts[contractId].conflicts[conflictId].responseMessage = &message
contracts[contractId].conflicts[conflictId].respondedAt = &time.Now()
now := time.Now()
contracts[contractId].conflicts[conflictId].respondedAt = &now
}

func ResolveConflict(contractId uint64, outcome ConflictOutcome, resolutionMessage string) {
Expand Down Expand Up @@ -890,7 +891,8 @@ func ResolveConflict(contractId uint64, outcome ConflictOutcome, resolutionMessa

contracts[contractId].conflicts[conflictId].resolutionMessage = &resolutionMessage
contracts[contractId].conflicts[conflictId].outcome = &outcome
contracts[contractId].conflicts[conflictId].resolvedAt = &time.Now()
now := time.Now()
contracts[contractId].conflicts[conflictId].resolvedAt = &now
}

func CompleteContractByConflictHandler(contractId uint64, milestoneId uint64, contractorAmount uint64) {
Expand Down

0 comments on commit 39b0e81

Please sign in to comment.