fn mft_on_transfer(
        &mut self,
        token_id: String,
        sender_id: AccountId,
        amount: U128,
        msg: String,
    ) -> PromiseOrValue<U128> {
 
        let seed_id: String;
        match parse_token_id(token_id.clone()) {
            TokenOrPool::Pool(pool_id) => {
                seed_id = format!("{}{}{}", env::predecessor_account_id(), MFT_TAG, pool_id);
            }
            TokenOrPool::Token(_) => {
                // for seed deposit, using mft to transfer 'root' token is not supported.
                env::panic(ERR35_ILLEGAL_TOKEN_ID.as_bytes());
            }
        }

        assert!(msg.is_empty(), "ERR_MSG_INCORRECT");

        // if seed not exist, it will panic
        let amount: u128 = amount.into();
        let seed_farm = self.get_seed(&seed_id);
        if amount < seed_farm.get_ref().min_deposit {
            env::panic(
                format!(
                    "{} {}", 
                    ERR34_BELOW_MIN_SEED_DEPOSITED, 
                    seed_farm.get_ref().min_deposit
                )
                .as_bytes()
            )
        }
        
        self.internal_seed_deposit(&seed_id, &sender_id, amount, SeedType::MFT);

        self.assert_storage_usage(&sender_id);

        env::log(
            format!(
                "{} deposit MFT seed {} with amount {}.",
                sender_id, seed_id, amount,
            )
            .as_bytes(),
        );

        PromiseOrValue::Value(U128(0))
    }
/// Callback on receiving tokens by this contract.
Callback on receiving tokens by this contract.
Callback on receiving tokens by this contract .
fn mft_on_transfer(
        &mut self,
        token_id: String,
        sender_id: AccountId,
        amount: U128,
        msg: String,
    ) -> PromiseOrValue<U128> {
        let seed_id: String;
        match parse_token_id(token_id.clone()) {
            TokenOrPool::Pool(pool_id) => {
                seed_id = format!("{}{}{}", env::predecessor_account_id(), MFT_TAG, pool_id);
            }
            TokenOrPool::Token(_) => {
                // for seed deposit, using mft to transfer 'root' token is not supported.
                env::panic(ERR35_ILLEGAL_TOKEN_ID.as_bytes());
            }
        }
        assert!(msg.is_empty(), "ERR_MSG_INCORRECT");
        // if seed not exist, it will panic
        let amount: u128 = amount.into();
        let seed_farm = self.get_seed(&seed_id);
        if amount < seed_farm.get_ref().min_deposit {
            env::panic(
                format!(
                    "{} {}", 
                    ERR34_BELOW_MIN_SEED_DEPOSITED, 
                    seed_farm.get_ref().min_deposit
                )
                .as_bytes()
            )
        }
        self.internal_seed_deposit(&seed_id, &sender_id, amount, SeedType::MFT);
        self.assert_storage_usage(&sender_id);
        env::log(
            format!(
                "{} deposit MFT seed {} with amount {}.",
                sender_id, seed_id, amount,
            )
            .as_bytes(),
        );
        PromiseOrValue::Value(U128(0))
    }
fn mft_on_transfer ( & mut self , token_id : String , sender_id : AccountId , amount : U128 , msg : String , ) -> PromiseOrValue < U128 > { let seed_id : String ; match parse_token_id ( token_id . clone ( ) ) { TokenOrPool :: Pool ( pool_id ) => { seed_id = format ! ( " " env predecessor_account_id ( ) MFT_TAG pool_id ) ; } TokenOrPool :: Token ( _ ) => { // for seed deposit, using mft to transfer 'root' token is not supported. env :: panic ( ERR35_ILLEGAL_TOKEN_ID . as_bytes ( ) ) ; } } assert ! ( msg is_empty ( ) " " ) ; // if seed not exist, it will panic let amount : u128 = amount . into ( ) ; let seed_farm = self . get_seed ( & seed_id ) ; if amount < seed_farm . get_ref ( ) . min_deposit { env :: panic ( format ! ( " " ERR34_BELOW_MIN_SEED_DEPOSITED seed_farm get_ref ( ) min_deposit ) . as_bytes ( ) ) } self . internal_seed_deposit ( & seed_id , & sender_id , amount , SeedType :: MFT ) ; self . assert_storage_usage ( & sender_id ) ; env :: log ( format ! ( " " sender_id seed_id amount ) . as_bytes ( ) , ) ; PromiseOrValue :: Value ( U128 ( 0 ) ) }
Callback on receiving tokens by this contract.
Callback on receiving tokens by this contract .
&mut self
token_id
String
sender_id
AccountId
amount
U128
msg
String
&mut self
token_id
String
sender_id
AccountId
amount
U128
msg
String