# Referrals

## <img src="https://2135759466-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRYNX64PnHzxj938qjx2k%2Fuploads%2FabRjsj0ZSkW2uL7qG6gq%2Flogo2.png?alt=media&#x26;token=8726852e-5484-450c-83ff-fb7e1c96496a" alt="" data-size="line">Telau referrals are the most lucrative.

{% hint style="success" %}
**Earn 50% of the fees generated by your referral !**

*E.g: If your referral generates a 100 SOL volume, you'll earn 0.5 SOL from him.*
{% endhint %}

{% embed url="<https://azadbus70.wistia.com/medias/noz9euj9za>" %}

```rust
                    "menu_referrals" => {
                        handle_referrals(&bot, chat_id, user_id, &db_pool, None).await?;
                    }
                    "ref_w_back" => {
                        let mid = if let Some(MaybeInaccessibleMessage::Regular(m)) = &q.message {
                            Some(m.id)
                        } else { None };
                        handle_referrals(&bot, chat_id, user_id, &db_pool, mid).await?;
                    }
                    "ref_w_perc" => {
                        if let Some(MaybeInaccessibleMessage::Regular(message)) = &q.message {
                            let message_text = "💸 Enter withdraw amount (%)";
                            let sent_msg = bot.send_message(id, half_escape_telegram(message_text))
                                .reply_markup(ForceReply::new())
                                .await?;
                            waiting_for_key.lock().await.insert(id.into(), Some(("ref_w_perc".to_string(), sent_msg.id, Some(*message.clone()))));
                        }
                    }
                    "ref_w_amount" => {
                        if let Some(MaybeInaccessibleMessage::Regular(message)) = &q.message {
                            let message_text = "💸 Enter withdraw amount (SOL)";
                            let sent_msg = bot.send_message(id, half_escape_telegram(message_text))
                                .reply_markup(ForceReply::new())
                                .await?;
                            waiting_for_key.lock().await.insert(id.into(), Some(("ref_w_amount".to_string(), sent_msg.id, Some(*message.clone()))));
                        }
                    }
                    "ref_w_address" => {
                        if let Some(MaybeInaccessibleMessage::Regular(message)) = &q.message {
                            let message_text = "📫 Enter withdraw address";
                            let sent_msg = bot.send_message(id, half_escape_telegram(message_text))
                                .reply_markup(ForceReply::new())
                                .await?;
                            waiting_for_key.lock().await.insert(id.into(), Some(("ref_w_address".to_string(), sent_msg.id, Some(*message.clone()))));
                        }
                    }
                    "ref_w_confirm" => {
                        if let Some(MaybeInaccessibleMessage::Regular(message)) = &q.message {
                            confirm_referrals_withdraw(
                                &bot,
                                chat_id,
                                user_id,
                                &db_pool,
                                &*solana_client,
                                &*fees_collector_kp,
                                message
                            ).await?;
                        }
                    }
                    "referrals_withdraw" => {
                        let mid = if let Some(MaybeInaccessibleMessage::Regular(m)) = &q.message {
                            Some(m.id)
                        } else { None };
                        handle_referrals_withdraw(&bot, chat_id, user_id, &db_pool, mid).await?;
                    }
                    "menu_help" => {
                        handle_help(&bot, chat_id, HelpMenuMode::Main, None).await?;
                    }
                    "help_howto" => {
                        if let Some(MaybeInaccessibleMessage::Regular(m)) = &q.message {
                            handle_help(&bot, chat_id, HelpMenuMode::HowTo, Some(m.id)).await?;
                        } else {
                            handle_help(&bot, chat_id, HelpMenuMode::HowTo, None).await?;
                        }
                    }
                    "help_referrals" => {
                        if let Some(MaybeInaccessibleMessage::Regular(m)) = &q.message {
                            handle_help(&bot, chat_id, HelpMenuMode::Referral, Some(m.id)).await?;
                        } else {
                            handle_help(&bot, chat_id, HelpMenuMode::Referral, None).await?;
                        }
                    }
```
