Make a bid
Connect to wallet
Click the Connect to Wallet button; it opens a popup window to select an account:
Click on the account you want to connect with, and click Connect. Once connected the Connect to Wallet button is not diplayed.
If you've just installed the wallet, there is no account registered yet and you need to import a faucet account. To do so:
- Download a faucet account file from the faucet (instructions here)
- Import the faucet file in Temple wallet (instructions here)
info
Faucet accounts are credited with fake tezies on the Tezos testnet in order to interact with test contracts.
Initial attempt
Click the Post Bid button to make a bid of 10 tezies. The wallet generates a popup window for you to confirm the transaction:
For information, the raw transaction parameter is displayed below:
[{
"destination": "KT1LyBhUUP6vnqwAyJTrZ3y2iA6BeZtSSnbk",
"kind": "transaction",
"amount": 10000000,
"parameters": {
"entrypoint": "bid",
"value": { "prim": "Unit" }
}
}]
Click Confirm; the following message is displayed for 4 seconds:
This message is defined in the bid
entrypoint of the contract:
entry bid () {
require {
r1 otherwise "Asset Not For Sale" : state = ForSale;
...
}
effect { ... }
}
The asset has not been set up for sale by the owner.
Set asset up for sale
Say the owner requires a minimum price of 7 tezies.
Enter the following Completium CLI command to invoke the entrypoint upforsale
:
completium-cli call ownership --entry upforsale --arg '{ "price" : "7tz" }'
Check and confirm the transaction parameter: type 'Y' and press enter.
When prompt returns, you can check the transaction detail in the contract indexer Better Call Dev. You can display the contract's URL with the command:
completium-cli show contract ownership
On the contract page in Better Call Dev, in the 'Operations' tab, click on the upforsale
transaction to display the detail:
Better Call Dev highlights in yellow the effect of the transaction on the storage.
Second attempt
Now the asset is up for sale, click the Post Bid button again. Now a waiting message is displayed:
Check the effect on the contract storage:
Notes:
bestbid
andbestbidder
variables have been updatedendofbid
has been incremented by 2 minutes- transferred amount is 10 tezies
Bid period is over
If the time window (5 minutes) to make a bid has expired, the error message below is displayed:
Id r2
is defined in the smart contract as the id of the execution condition of the bid
entrypoint:
entry bid() {
require {
...
r2: now < endofbid otherwise "Bid Period is Over";
...
}
...
}
The solution is to set back the contract state to Owned
by calling the claim
from admin
account. This is done with the following command:
completium-cli call ownership --entry claim
Once confirmed, you may proceed to Set asset up for sale step above.