INNER CODE UNIT · Rust
do_prerequisites
yourarj/token-listing-sniper-bot · src/util/mod.rs:41
pub async fn do_prerequisites(
token_contract: &Bep20Token,
wallet: LocalWallet,
spender: Address,
) {
let address = &format!("{:?}", wallet);
let (total_supply, allowed_amt) =
Self::print_bep20_token_details(&token_contract, address, spender).await;
// if allowed spend amount is less than half of supply set it to total supply
if allowed_amt.le(&total_supply
.checked_div(U256::from(2u8))
.expect("div_error"))
{
token_contract
.approve_spend_allowance(spender, total_supply)
.await;
let _details = Self::print_bep20_token_details(&token_contract, address, spender);