Cardano Smart Contracts have been pre-programmed to be
automated digital agreements. They execute themselves and are not able to be changed. They don't
permit any intermediary or any third party.
We can divide smart contracts into two categories:
In one case in which you need to add the value concept of one actor (or group of players) to
another person (or an entire number of actors), It must be a representation of the value concept
and the rules and circumstances that govern it, and an event that will activate it. It is also
known as a financial contract, and it's best to execute it with a specific domain language.
In another scenario, you'll need to design a program or application. This application is
comprised of a triangular structure:
A client program is software that runs on your personal computer.
The server is the one that runs another server (or several servers).
A smart contract can
be described as the component of code that permits the decentralization of operations to occur.
How do I make Cardano intelligent contracts?
Cardano employs Marlowe
as well as its 8 distinct steps for making a smart contract. The eight steps include:
- Pay
- Close
- Actions, observations, and values
- Oracles
- If
- When
- Let
- Assert
Each step of the process of execution, even when returning to a previous state and the ongoing of
the contract, there is the possibility that it could affect the payment process and cause
warnings. To explain these contracts, it is necessary to explain the Marlowe observations and
values that are necessary to supply the external data.
Pay
A contract for payment Pays a cont will transfer the value
v of token t from account A to the payee p, which could be one of the contract participants or
an account that is part of the contract. When the value of v falls below or if there are not
enough funds to pay in full, an alert is issued (even when there are positive balances on
additional tokens within the accounts). In the second case, the payment will be partially made
(of the total amount of funds available). In the case of a continuation, it is identified in the
contract with the word count.
Close
The phrase "close" describes which way the agreement will be terminated (or ended). Its primary
function is to pay account owners with an outstanding balance. The process is repeated on each
of the accounts. However, all accounts are reimbursed through one transaction. Before examining
other kinds of contracts, it is necessary to establish the definition of the values,
observations, and actions.
Valuations, actions, and observations
The phrase "values" is a reference to numbers that change over time, like "the current slot
number," "the present balance on a particular account's account," and any previously made
decisions. They are often referred to as volatile numbers. Furthermore, values can be mixed with
subtraction, addition, negation, subtraction, and contingent upon an observation.
In each stage of execution, these observations are valuable. However, actions take place at
specific times throughout the execution. As mentioned previously, actions may include:
- depositing funds
- selecting one of many options, such as an oracle value (see the following section). Or
- indicates some external value.
Oracles
Cardano Oracles are being designed to be used throughout the
Cardano blockchain and will be available to users on both Marlowe and Cardano ADA smart contracts. Oracles are designed as
the
decisions taken by a user with the Oracle function "Kraken."
Also, it is possible to get the inverted rates of the currency pairs mentioned by
substituting
the prefix in with the suffix inv.
If
If the conditional exists, and obs cont1 is executed, it will continue to be cont1 or cont2
depending on what the Boolean number of observations is.
When
In the shape of a timeout, the most difficult contract function is Object () (native code).
It is
triggered by events that could happen at any time. The clauses in the contract describe what
happens when certain actions take place.
To ensure that the deal is completed, the timeout contingency will remain in place as soon as
the
timeout, as well as the slot number, are met.
Let's
A lease agreement the let id Val Cont function lets a contract identify a value using an
identification number. Values expressed in the expression are then evaluated and stored with
the
name ID. It was later extended in continuation.
This method not only permits us to use abbreviations, but it also permits us to record and
save
information that is volatile and can fluctuate over time, for example, the price of oil at
present or the slot number currently in use at a certain time in contract execution. This
information can be utilized later on in the contract's execution.
Assert
A contract that states "Assert Obs Cont" doesn't change the status of the contract and it
continues to operate as cont. However, it gives an alert if the assertion Obs is false. It
could
be used to ensure that a property is valid at any time in the contract since the static
analysis
is ineffective should any execution results be incorrectly asserted.