2

From the docs:

AUTOMATIC SELLING AND BUYING

So far, you've relied on utility and trust to value your token. But if you want you can make the token's value be backed by ether (or other tokens) by creating a fund that automatically sells and buys them at market value.

First, let's set the price for buying and selling:

uint256 public sellPrice;
uint256 public buyPrice;

function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner {
    sellPrice = newSellPrice;
    buyPrice = newBuyPrice;
}

This is acceptable for a price that doesn't change very often, as every new price change will require you to execute a transaction and spend a bit of ether. If you want to have a constant floating price we recommend investigating standard data feeds

If you check the link, you'll probably find that it does not explain how to make the price constantly floating. So how to do this?

1

The idea is that instead of you personally setting the price, there would be one centralized price feed that your contract queries every time it needs to know the price. These largely don't exist, but can be implemented pretty simply.

The link is to a proposed standard for data-feed contracts so that you could add and remove feeds from various sources without worrying about ABI differences.

  • I don't see how can this help save the costs charges for the price change, could you explain this? Also, is the proposed standard still just an idea or there are some attempts to implement it? – Polyakoff Feb 3 '17 at 20:49
  • @Polyakoff Basically it only saves the costs in that the costs are shared since many smartcontracts and use a single datafeed. No idea about the second question sadly. – JasoonS Jul 3 '17 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.