This is my code for cross contract calls:
const NO_DEPOSIT: Balance = 0;
const GAS: Gas = 25_000_000_000_000;
#[ext_contract(ext_erc20)]
pub trait ExtErc20 {
fn get_total_supply(&self) -> U128;
}
Function call:
pub fn get_total_supply_erc20(&self, erc20_id: AccountId) -> Promise {
ext_erc20::get_total_supply(&erc20_id, NO_DEPOSIT, GAS)
}
Javascript code:
const data = await nearvar.contract.get_total_supply_erc20({"erc20_id": "dev-1608541613194-2197959"})
console.log(data)
It gives "Exceeded the prepaid gas" error. I also tried with different gas values, but it didn't work.
Fungible token, get total supply:
pub fn get_total_supply(&self) -> U128 {
self.total_supply.into()
}