I am trying to write AMM, here is my code:
pub struct Uniswap { uni_totalsupply: u128, uni_balance:LookupMap<AccountId, Balance>, } impl Uniswap { pub fn add_liquidity(&mut self, min_liquidity: u128, max_tokens: u128) { let deposit = env::attached_deposit(); assert!(max_tokens > 0, "Maximum tokens should be greater than zero"); assert!(deposit > 0, "Deposit must be greater than zero"); let total_liquidity = self.uni_totalsupply; if(total_liquidity > 0) { assert!(min_liquidity > 0, "Minimum liquidity must be greater than zero"); let near_reserve = near_balance_of_contract - deposit; let token_reserve = token_balance_of_contract; } } } How to get the near balance of the contract, and token balance of the contract?