Hot answers tagged

6

From where these exchanges get the current market price of ether? The price is dependent on what users are currently valuing ether at. The exchanges don't set the prices, nor get them from anywhere else. If someone who is trading on one exchange is willing to pay more than someone trading on another exchange, then the price of ether on the first exchange ...


4

This must be done off-chain for standard tokens. The ERC-721 standard specification -- http://eips.ethereum.org/EIPS/eip-721 -- does not provide an interface to query historical ownership of a token. Other extensions to the standard may include this additional functionality but this will be implemented on a contract-by-contract basis. For example, ...


4

The USD/ETH price is not intrinsically available on the blockchain. Therefore you need services such as Oraclize for pulling price feeds to your contract. Specifically, you could use the Kraken ticker API and use a simple Oraclize query to integrate that data into your contract. Beware that this is significantly more complicated than just hard-coding one ...


4

Absolutely. Everyone should. There's a great site here that will help you understand gas and gas prices. It's called Ethereum Gas Station. I'm not sure who publishes it, but it's very well done. They just recently made this post which explains something they call the Safe Gas Price.


4

The price being shown by Etherscan is the price of your token on the open market, using data from market sources, such as exchanges. It's not the same thing as the purchase price you set in the contract itself. Until your token is being actively traded, and people apportion value to it, your dollar price will be zero.


3

You'll first need the address of the contract for the pair whose price(s) you want to access. Two ways to do this: Find the addresses of the two tokens separately, and feed them into the UniswapV2Factory contract to get the address of the pair's contract; or... Go to Uniswap, enter the two tokens into the usual interface, then visit the "View Pair ...


3

Gas prices rise based on people trying to outbid each other to make transactions faster. There is no direct tie to eth price, but it is typical to see more congestion when eth prices are higher, because there is more interest in the eth market. If congestion in the network (ie number of people trying to make transactions) is constant and people are not ...


3

Distinguish between price and rate. Call rate the value inside your smart contact. The rate should not be adjustable. By making it non-adjustable, anyone who is interested in your ICO knows what they are getting before buying. They don't have to trust anyone or anything. They "see" the exact exchange rate in the code. Because the code is immutable (and the ...


3

You can set gas limit and gas price for each network in truffle.js Here is sample of truffle.js, module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! migrations_directory: "./migrations", networks: { development: { host: "127.0.0.1", ...


3

You are missing something. The amount of gas a transaction requires to submit depends on the amount of processing that miners have to do. A reasonable proxy to this is the amount of input data associated with a transaction. When submitting a contract you submit the encoded bytecode of the contract. The cost you incurred is significantly more than such a ...


3

Etherscan does this. For example, here's a random old transaction: https://etherscan.io/tx/0x135ba7f5b2ffd81b0dbb3483716e87e5f8d374b2736f3d24967962893bc827fb By default, it shows the value in USD based on the current Ethereum price, but if you click on the dollar amount, it switches to the USD value at the time of the transaction.


2

I agree with @Jesse. "without knowing the index?" It will work out better with the question reframed as "How can I organize storage so deletes are efficient?" There is a process to delete from an indexed mapping (where you have implemented with an array and a mapping. In summary, move the last item of the unordered list into the row to delete and then ...


2

When adding to the array, you can also store the index you added it to. You can use a second mapping to do that: mapping(bytes32 => mapping(address => uint256)) public authorisation_arrayIndex; When adding to the authorisation mapping: authorisation_arrayIndex[hash][addr] = authorisation[hash].length; authorisation[hash].push(addr); Also, maybe you ...


2

The EVM has the notion of gas because computations need to be ending. Each block has a gas limit and different operations cost a certain amount of gas, thus we can only have a limited amount of computations in a block. Otherwise the blockchain wouldn't progress, all validators would be stuck trying to validate the computation. This would be the case if ...


2

I don't have an idea as how token price is setup. There are two prices to consider here: The price you sell the tokens for during the ICO/crowdsale; The price your token trades at on exchanges once the ICO is complete. You can control the price in point 1; you have no control over the price in point 2. If you see this example of token BOMB, it has ...


2

You can write a query to filter all the liquidity pairs on Uniswap and get the pair address { pairs (where :{token0 : "0x0f7f961648ae6db43c75663ac7e5414eb79b5704", token1 :"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}) { // token1 is the ethereum address id createdAtTimestamp volumeUSD //any other field you want } }


2

Assuming the network has the same level of congestion a transaction when ETH price is $1200 will use the same amount of Ether as the same transaction when ETH price is $1500. In your case, that means that waiting for the ETH price to dip would have no effect as you would end up with the same amount of Ether in the destination account. In terms of the dollar ...


2

There are a few concepts here a bit mixed up: a) Token value vs token cost If it's about value, the token price is linked to an offer-demand balance determined by the market, so nothing related to the cost of minting it. If it's about cost of generating the token, you could define a minting function that starting from token 101 (by looking at a counter), you ...


2

The first price is given by the rate you will make in Liquidity Pool when it was created. If you create a token and then first make the LP at 100 ETH = 100 TKN then your token will start at 1ETH price. You will need to have both 100ETH and 100TKN in your wallet to create the LP. After that it will follow the market desire. If the people starts to buy TKN, ...


2

This has been a pain for me for a long time. You basically have to compare the liquidity of the different pairs and run the Uniswap formula for calculating the price. Y * I / (X + I) I is your input amount of source tokens X is the balance of the pool in the source token Y is the balance of the pool in the target token In the end, the process we came up to ...


2

You don't code initial price of coin You can decide on initial price , you can start with as low as you want or as high as you want 1:) https://youtu.be/cizLhxSKrAc check this video out You can choose whichever price you want to list if for . But take note of marketcap (number of coins issued multiplied by price of the coin) . Higher the market cap less ...


2

Depending on the token and its liquidity, the problem you may face is that you can't check all the places it's being traded at. Even if you check Uniswap, someone can just create another pool in another decentralized exchange - or even in Uniswap. But burning and minting will not affect the price directly either. In the long run they should affect the price, ...


1

I don't think you want the first four letters (characters). It's fine now, but what would happen if the price dropped to $900 ? Your system would break. What you probably want is to drop the last 5 numbers. And, preferably rounded up (although rounding probably starts to matter only when the price drops to some very low numbers). Since the value is an ...


1

there is a Dodge chart... It has really helped me with investing.


1

The price of a cryptocurrency is determined by what people are willing to pay for it. What people are willing to pay for it is determined by what each person believes is the future value of ETH. What each person believes is the future value of ETH is determined by the available information about Ethereum and the rest of the world. If we now look at your ...


1

price = ETHUSD(0x123abc...).priceETHUSD(); Replace 0x123abc... with the actual address of the deployed ETHUSD contract you want to use.


1

You can achieve this without sending any actual transactions. //create a web3 instance const web3 = new Web3(Web3.givenProvider || "ws://localhost:8546"); //create contract instance, leave address empty if creating new contract myContract = new web3.eth.Contract(jsonInterface, address, options) //check gas needed to deploy contract myContract.deploy({ ...


1

When you issue the transactions in Ropsten you'll see their gas usage. After that you need to decide a correct gas price for your transaction in the mainnet. You can use for example https://ethgasstation.info/ when deciding on a good gas price. You can use that same calculator to calculate the actual costs of your transactions once you have decided on the ...


1

Sort of. In Ethereum networks there is always gas involved. And as this is Ethereum StackExchange, I assume you are referring only to Ethereum networks. The trick is how the gas price is specified. You have at least two ways how to get free transactions: 1) Send a transaction with zero gas price to whichever network (even the mainnet). No matter how much ...


1

Usually, they lock the price just before starting the crowdsale. They set it to a certain value, and it will stay like that during the entire crowdsale. It can be something like that : function startCrowdsale(uint _price) { crowdsale_started = true; price = _price; //more code } Another way, but more costly, is the use of an oracle.


Only top voted, non community-wiki answers of a minimum length are eligible