how to check how many token been sold for my Smart contract - wordpress

I want to create a smart contract and launch it for ICO. I also create a website where people can buy my token. I want know how to check how many token been sold (live)? so i can create a live bar counter to show how many percentages of the token already been sold.
Or is there a way i can monitor the token sale process in the smart contract?

A token contract is no different than any other smart contract. There are no special built in Solidity features or logic associated with them. They are just regular smart contracts that follow a specification.
So, if you want access to the number of tokens sold, you code that into your contract. While tokens sold is not part of the standard ERC20/ERC721 interface, nothing prevents you from adding a constant function to retrieve this information. In fact, if you're using the basic Zeppelin Crowdsale contract, you can just calculate it using the public state variables weiRaised / rate (Chances are you should be creating your own Crowdsale subcontract, so it's better to add the functionality you want there).

We can use the Etherscan Developer API to review transactions against a given contract address and find out the total supply or number of items available for sale.
There is a lot you can do with the Etherscan Developer API. For example, here's one URL that pulls data from Ethereum Mainnet -> Etherscan -> JSON parser -> Shields.io and renders it as an image to calculate the number of Su Squares remaining for sale:
Source: https://img.shields.io/badge/dynamic/json.svg?label=Su+Squares+available&url=https%3A%2F%2Fapi.etherscan.io%2Fapi%3Fmodule%3Daccount%26action%3Dtokenbalance%26contractaddress%3D0xE9e3F9cfc1A64DFca53614a0182CFAD56c10624F%26address%3D0xE9e3F9cfc1A64DFca53614a0182CFAD56c10624F%26tag%3Dlatest%26apikey%3DYourApiKeyToken&query=%24.result
^ I don't know if SO is going to cache the image here. But that URL is a live URL which pulls the number of Su Squares available hot off the blockchain.

Related

question about getting started with the Here API

I am just getting started and thought I might see if anyone knew a good place to start...
I want to do a filtered list of Here Places in a mobile app. Every time I think I've found the right path, like Here Places, it appears deprecated.
Where is the right place to start?
You can check GS7 services in Here Here Maps.
Please find below details for your use-case scenario.
Services Overview
Discover provides users the ability to find a known place or address (partial or complete), as well as discover an unknown place. The latter requires information to help the end-user make a decision whether or not to visit. The expectation is that multiple items may be returned and the end-user will select the most appropriate.
Autosuggest provides term and query suggestions as the end-user types. Spell correction is included.
Geocode returns the geocoordinates for a single requested address. (NOTE: If the query is ambiguous, the API may return multiple items.)
Autocomplete provides completion of the entered keystrokes to the valid addresses. No spell correction is included.
Browse enables end-users to slice and dice HERE Map Content through various filters.
Lookup by ID finds one result based on its unique location ID.
Reverse Geocode returns the nearest address to known geo-coordinates.
Endpoint URLs
The following are the current endpoint URLs for submitting API requests:
autosuggest - https://autosuggest.search.hereapi.com/v1/autosuggest
search - https://discover.search.hereapi.com/v1/discover
geocode - https://geocode.search.hereapi.com/v1/geocode
autocomplete - https://autocomplete.search.hereapi.com/v1/autocomplete
browse - https://browse.search.hereapi.com/v1/browse
lookup by ID - https://lookup.search.hereapi.com/v1/lookup
revgeocode - https://revgeocode.search.hereapi.com/v1/revgeocode
Please check the following link for more information.
If you want to start with a mobile app, I would recommend the HERE SDK for Flutter. There is a good staring point to search for HERE places.
Even better, there is also a free app with all the source code you need. It's open source, so you can use it for your own projects. Just try it out and see if it gives you what you need.
Searching for places is not requiring much code:
_searchEngine.searchByText(query, searchOptions, (SearchError? searchError, List<Place>? list) async {
if (searchError != null) {
return;
}
// If error is null, list is guaranteed to be not empty.
for (Place searchResult in list) {
...
}
});
This code is written in Dart, so you can compile and run it on iOS and Android devices.

Google cloud usage API

with my company we were interested in the translation API.
I need to know if there is a way to retrieve the usage state of an account for a specific period.
(For example I would like to be able to know that last month I translated X characters that corresponds to Y USD).
I'm sure that such an API exists, but I really can't find any reference to it.
Translation API bills per character translated and counts translated characters for the whole project in order to create a bill for the customer.
To view your current billing status, including usage and your current bill, see the Billing page (GCP Console => Billing). Billing reports for a particular service contain fields Product name (Translate), Usage (number of characters) and Cost.
See Cloud Billing > Doc > View your billing reports and cost trends
More detailed information about consumption of the Translation API is not provided. At this time Translation API does not have such functionality.
A similar problem was raised on Issue Tracker in 2017 but to no avail: https://issuetracker.google.com/35903950.

What the best clockify API endpoint to get time entries of (grouped by) saved reports?

Asking here, after asking to Clockify support.
Trying to extend some of clockify capabilities to create extra reporting for our clients,
I’ve been playing with your API and specifically: the enpoint /reports/{reportsId}
• My goal:
Get all the time entries of a specific "saved report” (usually saved by our Project Managers)
• What I EXPECT from "/reports/{reportsId}”:
To get all the info and entities (users, time entries, projects, etc.) only regarding that particular reportId
• What I GET from "/reports/{reportsId}”:
Lots of info regarding the whole workspace, and I only see summaryReport
as more “specific to the saved report itself”...
• Questions:
Is this the correct behavior?
How do you filter down time entries of specific reports in URLs like https://clockify.me/bookmarks/BOOKMARK_HASH_HERE ?
Do you only call "/reports/{reportsId}” and filter down on client-side? (it seems to me that way, exploring the Network tab)
If that’s the way, what’s the point of calling the report endpoint? Only for the summaryReport object?
3- Is "/reports/{reportsId}” the best endpoint I can use to reach my goal? …or which way would you recommend me?
summaryReport.timeEntries will contain all the individual time entries from that particular report. Each entry has a user, project, client, time etc. Grouping by project is done on the client.
I'm not sure I fully understand your specific problem though. Are you suggesting the entries you get from the report endpoint do not belong to the given report?

Google reviews counter

I want to know if there is any api that can allow me to get the number of reviews from an url.
I know that google offers the possibility to get this number by using the placeid, but the only information I have is the url of the website of a company.
Any ideas please?
Maybe, but probably not.
Places API Text Search seems to be able to find places by their URL:
https://maps.googleapis.com/maps/api/place/textsearch/json?key=YOURKEY&query=http://www.starbucks.com/store/1014527/us/303-congress-street/303-congress-street-boston-ma-02210
However, this is not a documented feature of the API and I do not think this can be relied upon, so I'd recommend filing a feature request, to make this a supported, reliable feature.
As for the amount of reviews, you may be interested in:
Issue 3484: Add # of reviews to the Place Details Results
I've written an API like this for Reviewsmaker, but I target specific business names not URLs. See this example (I activated a key for this purpose for now):
http://reviewsmaker.com/api/google/?business=life%20made%20a%20little%20easier&api_key=4a2819f3-2874-4eee-9c46-baa7fa17971c
Or, try yourself with any business name:
http://reviewsmaker.com/api/google/?business=Toys R Us&api_key=4a2819f3-2874-4eee-9c46-baa7fa17971c
The following call would return a JSON object which shows:
{
"results":{
"business_name":"Life Made A Little Easier",
"business_address":"1702 Sheepshead Bay Rd, Brooklyn, NY 11235, USA",
"place_id":"ChIJ_xjIR2REwokRH2qEigdFCvs",
"review_count":38
},
"api":{
"author":"Ilan Patao",
"home":"www.reviewsmaker.com"
}
}
Pinging this EP using a Chronjob for example once every hour or two and return the review_count can pretty much build your own review monitoring app;
You can probably do what you're looking for if you query the Places API Text Search or the CSE (Custom Search Engine) API to lookup the URL, return back the matching name of the business associated with this URL and calling an endpoint like this one to return back the associated review count.
You can probably code this in py or PHP. Not sure how familiar you are with data parsing, but I was able to build my API based on Google's CSE API. CSE provides metadata in its results which contain the total reviews, so if you create a CSE engine and use the CSE API looking for business schemas, review schemas, etc; you can return back items and within the PageMap node there are objects with data that you need very little tweaking to do (such as string replacing, trimming) which will return back the values you're looking for.
Hope my answer helped, at least to lead you in the right direction :)

Shutterfly Order API .

I found this site
http://www.shutterfly.com/documentation/api_OrderImage.sfly
but there are no examples of actually walking through the whole process. Does anyone have any good documentation on using this API to take a local photo and allow someone to order a print via shutterfly?
I went through these steps:
Sign up for an account
Sign up as a developer
Create an application (I called mine Test). Note the generated Application Id and Shared Secret
The Shutterfly API page has a list of references for various Domain-specific APIs:
Address Book
Album Data
Folder Data
Go To Shutterfly UE
Image Upload
Interactive Sign-in
Image Request
Order
Pricing
Seamless Sign-in
User Data
User Authentication
Each uses RESTful principles. The documentation looks pretty comprehensive to me, if you need some background, here's links for RESTful APIs and ROME you may find useful
There is also an API Explorer section on the same page that allows you to test the methods via a form on their site. For example this form for CRUD operations on the album data.
Based on your comment, for your requirements, you would:
Use the Album GET to list albums, then get the data for a specific album.
Use the Image Get request to retrieve the image data, so your friend can verify the image(s) they want to purchase.
Authenticate the user
Use the Pricing POST request to get the estimated pricing for the image.
User the Order POST to submit the order over https
Update: Found a page describing using a Greasemonkey script which adds Shutterfly print ordering capability to Flickr. This might provide the basis for a solution.
For Reference:
The original link above is a middle step of the Shutterfly Open API ordering procedure.
The whole process goes through a series of steps allowing you to control much more than just pushing photos into somebody's album in Shutterfly.
With this process, your application can actually carry out the entire procedure of:
specifying the images and the sizes and quantities, or other products
calculating shipping, taxes, and totals
paying, and
launching the processing
It also includes the ability to see when the packages will be delivered and arrive.
Thus if you have a solid application for mapping your images onto paper and products, you can pretty much control the entire process.
Once the order is submitted, it will appear on the user's account at Shutterfly who the order was associated with.
Kudos to Shutterfly for making such a powerful tool! It would be great if other printing facilities had similar tools.

Resources