Skip to content

Commit

Permalink
Update auction-automation/automation.md (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
SalMiah111 authored Jul 14, 2023
1 parent 21f3da8 commit 4e5b386
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/16-auction-automation/automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ hide_table_of_contents: true

Before we start coding the auction smart contract, we'll discuss smart contract automation.

In this lesson, we will explore the concept of smart contract automation to make program execution more efficient. Smart contracts cannot execute automatically. They require an on-chain transaction to trigger their code and initiate any state changes on the blockchain. Essentially, we need to "poke" the smart contract by sending a message to wake it up and activate its logic. For instance, we can start an auction by sending a message to the auction contract.
In this lesson, we will explore the concept of smart contract automation to make program execution more efficient.

Smart contracts cannot execute automatically. They require an on-chain transaction to trigger their code and initiate any state changes on the blockchain.

Essentially, we need to "poke" the smart contract by sending a message to wake it up and activate its logic. For instance, we can start an auction by sending a message to the auction contract.

Once the auction time has elapsed, we need to process the auction's result. However, result processing will only occur once the contract receives the appropriate message.
In Gear, we tackle this challenge using delayed messages.
Expand All @@ -17,7 +21,9 @@ msg::send_delayed(program, payload, value, delay)
msg::send_bytes_delayed(program, payload, value, delay)
```

A delayed message executes after a specified delay, which is practical in our case, as we can initiate the auction by sending a message to the auction contract. Once all the necessary logic is complete, the auction contract will send a delayed message to itself, settling the auction after the specified time.
A delayed message executes after a specified delay, which is practical in our case, as we can initiate the auction by sending a message to the auction contract.

Once all the necessary logic is complete, the auction contract will send a delayed message to itself, settling the auction after the specified time.

Therefore, by utilizing delayed messages, we can automate the execution of a contract. As long as there is sufficient gas for execution, the contract can self-execute for an unlimited block number. However, if the gas runs out, the execution may be interrupted.

Expand Down

0 comments on commit 4e5b386

Please sign in to comment.