Skip to content

Template Buyoffers

hugomartinez edited this page Dec 11, 2023 · 2 revisions

Template Buyoffers

Template buyoffers are similar to buyoffers, except that they allow users to lock in a price for a specific template owned by any other user, instead of just a specific asset. The buyer can then wait for someone to accept the offer, or cancel it at any time.


Creating a Template Buyoffer

Template buyoffers are paid from internal balance of the buyer. Therefore, the buyer first needs to deposit the necessary tokens (More Details).

After depositing the required tokens, the buyoffer can be created using the createtbuyo action. The price needs to be in the symbol of the token that is used to pay for the buyoffer.

Fulfilling the Template Buyoffer

Fulfilling a template buyoffer requires that the last created AtomicAssets offer to be from the recipient to the AtomicMarket account and need to offer the assets of the buyoffer and ask for nothing in return. The memo needs to be buyoffer.

It is then recommended to use the createoffer action from the AtomicAssets contract in the same transaction as the fulfilltbuyo action.

The offer previously created by the recipient is then accepted by the AtomicMarket contract, and the assets are consequently transferred to the buyer. The price is deducted from the buyer's balance and the seller / the marketplaces / the collection all have their share of the price added to their balance (Fee structure).


Cancelling Template Buyoffers

Template buyoffers can be cancelled by the buyer using the canceltbuyo action.


A note about smart contract buyers

When a template buyoffer is accepted, the AtomicAssets assets are transferred from the contract to the buyer. This triggers an inline notification to the sender of the offer = the buyer. The buyer could deploy a smart contract on their account that makes the transaction throw.

An attacker could for example create a buyoffer for way above market price, and then make every accept attempt throw through a smart contract deployed on their account. This is not harmful in and of itself, however it can cause a bad experience for the tricked seller who probably won't understand why they can't accept the offer.

When developing public marketplaces, we therefore advise not to display template buyoffers of accounts that have a smart contract deployed, or only display them from trusted smart contract accounts.