Getting token and contract information using Nethereum - smartcontracts

I am looking at this staking contract (pancake swap):
0x73feaa1ee314f8c655e354234017be2193c9e24e
and it's token (cake):
0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82
you can find a summary here:
https://bscscan.com/token/0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82?a=0x73feaa1ee314f8c655e354234017be2193c9e24e
On bscscan, I can get the following information:
price of token $12.54
market cap $2.9b
supply 231m
holders 137k
balance 88m (cake)
With nethereum, when I call:
web3.Eth.GetBalance.SendRequestAsync
I get:
with staking contract address: 479430015101300880
with token address: 3459819507903896496
and I'm not sure what the units are, nor how to map this to the information from bscscan.
I'm trying to get both the token value, but also what is the balance in the contract and I can't seem to find a way to do this.
so I looked at the nethereum playground and found an example dealing with ERC20 tokens, but when I put my addresses in it, the output is 0 and absolutely no error message, etc.

Related

How to reserve specific range of token IDs for whitelisted sale in solidity smart contract

Hello I am writing a erc721a solidity smart contract of a nft collection.
And I want to do whitelisted sale and public sale at the same time. So I wonder how can I reserve token IDs #1 to #100 for whitelisted sale and token ID #101 to last token ID for public sale..
Please can someone help me in this case. Thanks :D

Reason provided by the contract: "ERC20: transfer amount exceeds allowance"

I'm new to solidity and I wanted to develop a subscription contract where a user can subscribe to a merchants plan and pay. But I'm unable to subscribe function and transfer the token to merchant.
I'm using open zeppelin ERC20 standard token to transfer.
IERC20 token = IERC20(plans[planId].token);
token.transferFrom(
payable(msg.sender),
payable(plan.merchant),
plan.amount
);
I don't know why but this keeps giving me allowance error even though I have increased the allowance of the user.
Since you're invoking the token.transferFrom() from the subscription contract, the token owner needs to increaseAllowance() for the subscription contract to manipulate their tokens.
Example:
Your subscription contract is deployed on address 0x123.
Token address is 0x456, and it has 18 decimals.
The user needs to execute increaseAllowance(0x123, 500 * 1e18) on the token contract in order to increase the allowance by 500 tokens.
Mind the subscription contract address as the first param, and the decimals as the second param (so the actual value passed to the second param is 500000000000000000000 because it includes the decimals as units as well).

What contract to query for getting user's staking rewards info for Pancakeswap Auto CAKE pool?

I managed already to write code interacting with Auto CAKE pool contract in order to get user balance. This can be done by interacting with bsc smart contract 0xa80240Eb5d7E05d3F250cF000eEc0891d00b51CC and calling userInfo function.
Hoewever, this function does not return the current balance but it returns the " cakeAtLastUserAction", which is the total number of CAKE deposited in this contract by the user. It doesn't include the CAKE rewards generated in-between.
What contract should be queried to get the number of CAKE rewards generated for a user with the Pancakeswap AutoCAKE pool?

Total Supply api for Coinmarketcap listing

I'm looking at updating the Coinmarketcap listing for a token on the Solana blockchain.
For Total Supply Coinmarketcap asks to provide:
"API endpoint that displays ONLY 'Total Supply' as a numerical value (e.g. http://chainz.cryptoid.info/grs/api.dws?q=totalcoins)"
How would I go about doing this?
The getTokenSupply endpoint on the Solana JSON RPC will get you close: https://docs.solana.com/developing/clients/jsonrpc-api#gettokensupply
Unfortunately, it isn't a normal REST API endpoint, so it requires some parameters, and it provides JSON output. In the output, you'll need the uiAmountString. You may need to add in something to proxy the call and extract the value if CoinMarketCap is so stringent.

how to get the full token balance of an address BSCSCAN API

I'm working on BSCSCAN API. My goal is to get full balance for a given address as you can see on this page:
https://bscscan.com/tokenholdings?a=0x1c82bdb6a93f50a564155ddbcb9cf1b1a244d169
I checked the documentation on BscScan Website, and it seems I just could get:
-BNB BALANCE (not the full token balance) for a given address
-BALANCE of an address by giving the contract address of a single token
While I want to get the full balance for a given address. What is the right endpoints I should use? Thank you in advice.
This API returns the Value of BNB and not the Value of Tokens in BNB
https://api.bscscan.com/api?module=account&action=balance&address=0x0Bb3A1517624Ff45186Df879E9292f67750F8EB0&apikey=YOURAPIKEYBSCSCAN
This API returns the token Balance of and address
https://api.bscscan.com/api?module=account&action=tokenbalance&contractaddress=YOURCONTRACTADDRESS&address=YOURADDRESS&tag=latest&apikey=YOURAPIKEY