[SOLVED] Display BSC Contract Info

this is the abi that I found here: https://bscscan.com/address/0x28e4f32fa7e842ad0a6e530bb6b4ec03b36d5078#code

{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:“address”,“name”:“from”,“type”:“address”},{“indexed”:true,“internalType”:“address”,“name”:“to”,“type”:“address”},{“indexed”:false,“internalType”:“uint256”,“name”:“value”,“type”:“uint256”}],“name”:“Transfer”,“type”:“event”}

i dont know why it is not working sir still invalid abi,please verify

you didn’t copy paste from here and you used the right quotes, right? as in not

with the quotes that are here

it looks like this worked for me:

curl -X 'POST' \
  'https://deep-index.moralis.io/api/v2/0x28e4f32fa7e842ad0a6e530bb6b4ec03b36d5078/events?chain=bsc&topic=Transfer%28address%2Caddress%2Cuint256%29' \
  -H 'accept: application/json' \
  -H 'X-API-Key: fasdfaf' \
  -H 'Content-Type: application/json' \
  -d '{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"}'

for sync the contract events i have too first get post method api ? or u just showing that abi is right ?
bcz i see in video and documentation i try similar to that steps…

watch address worked as i say before but event sync contract is not working

I only gave you an example where that abi works for the api

you can try to copy paste this abi:
{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"}

worked thnqqq sir
now i get 89 transaction , in dashboard and my holders is 11 so i m thinking the logic , how to get holders exact number ,so i have to delete those transactions which are going to change cpt in rewards , and those sender who has 1 cpt left after the transaction … is this right logic ?

maybe some transactions are made by some owners, only changing the quantity
you also have to take in consideration the case when a owner gets to have 0 tokens after sending all the tokens to another address so that you remove that address from the list of owners

hey sir , i want to know one simple thing that i call 3 tokens price bnb ,cpt ,cardano
but i want value of my token so i multiply my userbalance with current price of our token cpt in usd price but it takes usd price of all three tokens and value is getting error …
so how i change the constant usdprice for cardano and bnb soo only cpt token usd price will call …

can you give some exact example?

so https://dashboard.cptoken.app/ it is my website in this website u can see value under cpt balance

so defnition of value is cpt balance of user multiply with current cpt price in usd…

soo when i m doing multiplication of t*usdprice , then it is taking all three usd prices of cardano ,bnb,cpt

and i m trying to change the let usdprice for bnb and cardano how i change that constant ?
u can see that every function have let usdprice .

       // cpt price
  async function getPrice() {
    price= await Moralis.Web3API.token.getTokenPrice({address: "0x28e4f32fa7e842ad0a6e530bb6b4ec03b36d5078", chain: "bsc"})
    console.log(price);
    let ethPrice = (price.nativePrice.value / (8**price.nativePrice.decimals)) + "BNB"
    console.log(ethPrice)
    let usdPrice = price.usdPrice + " USD"
    console.log(usdPrice)
    document.getElementById("BNB_price").innerHTML = ethPrice;
    document.getElementById("usd_price").innerHTML = usdPrice;


    }
    getPrice();
// bnb price
    async function takePrice() {
    price= await Moralis.Web3API.token.getTokenPrice({address: "0x3ee2200efb3400fabb9aacf31297cbdd1d435d47", chain: "bsc"})
    console.log(price);
 
    let usdPrice = price.usdPrice 
    console.log(usdPrice)
   
    document.getElementById("usd1").innerHTML = usdPrice;


    }
    takePrice();
//  cardano price
    async function givePrice() {
    price= await Moralis.Web3API.token.getTokenPrice({address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", chain: "bsc"})
    console.log(price);
 
    let usdPrice = price.usdPrice 
    console.log(usdPrice)
   
    document.getElementById("usd2").innerHTML = usdPrice;


    }
    givePrice();


I didn’t understand exactly the problem, but you have the price in USD for cpt, cardano and wbnb

and after you get those prices, you can compute relative prices between them by doing cumputations using the usd price

let usdPrice = price.usdPrice + " USD"
i m just asking how to change this constant usdprice in takeprice and giveprice function , if i m changing this constant then my code does not give output result as price of bnb and cardano.

I don’t understand, can you give a 2-3 lines of code example of what you want to do, what is the expected output and what is the current output?

 const tokenBalance = usercptBalance()

      tokenBalance.then(
        function (value) {
          console.log(value);     
            let t =Moralis.Units.FromWei(value);
             document.getElementById("cpt").innerHTML = t;}
              for taking value  i have to multiply t with usdprice of cpt .
             let value = t * usdprice ; 
document.getelementbyid("").innerhtml = value ;
  
      ); 

expected output will be userbalance * cpt price in usd
current is userbalance * cpt price *cardano price * bnb price

bcz of constant usd price bcz if i m changing usd price constant then code is not working

you have price for coin_1 = $10, and price for coin_2 = $20;
what do you want to do?

somehow I am not able to follow

i have three coins bnb , caradano , cpt

in all three prices there is common constant used let usdprice

so when i m trying to call usdprice for cpt token to multiply with usersbalance to get value of token… then all three tokens price are multiplied it is showing some big amount …
somehow i m changing the usdprice constant soo then nothing works!