What specifies the price of a jetton?
What specifies the price of a jetton?
When added to a liquidity pool protocol, a jetton is defined by supply and demand. If you are looking for a way to sell a jetton at a single fixed price, then you're likely looking for an ICO smart contract:
https://github.com/ton-blockchain/token-contract/blob/main/ft/jetton-minter-ICO.fc#L56
Where the amount of TON sent with the transaction is multiplied by some value of jetton to mint to the sender.
```clike
int jetton_amount = buy_amount; ;; rate 1 jetton = 1 toncoin; multiply to price here
;; additional code
mint_tokens(sender_address, jetton_wallet_code, amount, master_msg);
```
When added to a liquidity pool protocol, a jetton is defined by supply and demand. If you are looking for a way to sell a jetton at a single fixed price, then you're likely looking for an ICO smart contract:
https://github.com/ton-blockchain/token-contract/blob/main/ft/jetton-minter-ICO.fc#L56
Where the amount of TON sent with the transaction is multiplied by some value of jetton to mint to the sender.
```clike
int jetton_amount = buy_amount; ;; rate 1 jetton = 1 toncoin; multiply to price here
var master_msg = begin_cell()
.store_uint(op::internal_transfer(), 32)
.store_uint(0, 64) ;; quert_id
.store_coins(jetton_amount)
.store_slice(my_address()) ;; from_address
.store_slice(sender_address) ;; response_address
.store_coins(0) ;; no forward_amount
.store_uint(0, 1) ;; forward_payload in this slice, not separate cell
.end_cell();
mint_tokens(sender_address, jetton_wallet_code, amount, master_msg);
```
What specifies the price of a jetton?
When added to a liquidity pool protocol, a jetton is defined by supply and demand. If you are looking for a way to sell a jetton at a single fixed price, then you're likely looking for an ICO smart contract:
https://github.com/ton-blockchain/token-contract/blob/main/ft/jetton-minter-ICO.fc#L56
Where the amount of TON sent with the transaction is multiplied by some value of jetton to mint to the sender.
```clike
int jetton_amount = buy_amount; ;; rate 1 jetton = 1 toncoin; multiply to price here
var master_msg = begin_cell()
.store_uint(op::internal_transfer(), 32)
.store_uint(0, 64) ;; quert_id
.store_coins(jetton_amount)
.store_slice(my_address()) ;; from_address
.store_slice(sender_address) ;; response_address
.store_coins(0) ;; no forward_amount
.store_uint(0, 1) ;; forward_payload in this slice, not separate cell
.end_cell();
mint_tokens(sender_address, jetton_wallet_code, amount, master_msg);
```