Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion socialmedia/socialmedia.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@ export function createRefCodeLabelLink(frontendCode: string): string {
}

const refCode = createRefCode(frontendCode);
return refCode ? `[${refCode}](https://app.deuro.com?ref=${refCode})` : '';
if (!refCode) return '';

// Special case for Cake Wallet
if (refCode === 'Cake Wallet') {
return `[${refCode}](https://cakewallet.com/)`;
}

return `[${refCode}](https://app.deuro.com?ref=${refCode})`;
}
3 changes: 3 additions & 0 deletions socialmedia/telegram/telegram.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export class TelegramService implements OnModuleInit, SocialMediaFct {
}

async doSendSavingUpdates(savingSaved: FrontendCodeSavingsQuery): Promise<void> {
if (BigInt(savingSaved.amount) === 0n) return;
const messageInfo = SavingUpdateMessage(savingSaved);
this.sendMessageAll(messageInfo[0], messageInfo[1]);
}
Expand All @@ -221,11 +222,13 @@ export class TelegramService implements OnModuleInit, SocialMediaFct {
}

async doSendTradeUpdates(trade: TradeQuery, depsMarketCap: number, totalShares: bigint): Promise<void> {
if (BigInt(trade.amount) === 0n) return;
const messageInfo = TradeMessage(trade, depsMarketCap, totalShares);
this.sendMessageAll(messageInfo[0], messageInfo[1]);
}

async doSendBridgeUpdates(bridge: StablecoinBridgeQuery, stablecoin: string): Promise<void> {
if (BigInt(bridge.amount) === 0n) return;
const messageInfo = StablecoinBridgeMessage(bridge, stablecoin);
this.sendMessageAll(messageInfo[0], messageInfo[1]);
}
Expand Down
3 changes: 2 additions & 1 deletion socialmedia/twitter/messages/SavingUpdate.message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { formatUnits } from 'viem';

export function SavingUpdateMessage(saving: FrontendCodeSavingsQuery): string[] {
const refCode = createRefCode(saving.frontendCode);
const usedRef = refCode ? `🪢 used Ref: ${refCode}` : '';
const displayRef = refCode === 'Cake Wallet' ? '@cakewallet' : refCode;
const usedRef = displayRef ? `🪢 used Ref: ${displayRef}` : '';

const message = `
New dEURO Savings!
Expand Down
3 changes: 2 additions & 1 deletion socialmedia/twitter/messages/Trade.message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { formatUnits } from 'viem';

export function TradeMessage(trade: TradeQuery, marketCap: number, totalShares: bigint): string[] {
const refCode = createRefCode(trade.frontendCode);
const usedRef = refCode ? `🪢 used Ref: ${refCode}` : '';
const displayRef = refCode === 'Cake Wallet' ? '@cakewallet' : refCode;
const usedRef = displayRef ? `🪢 used Ref: ${displayRef}` : '';

const actualShares = Number(formatUnits(totalShares, 18));
const sharesBefore = actualShares - Number(formatUnits(BigInt(trade.shares), 18));
Expand Down
3 changes: 3 additions & 0 deletions socialmedia/twitter/twitter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class TwitterService implements OnModuleInit, SocialMediaFct {
}

async doSendSavingUpdates(savingSaved: FrontendCodeSavingsQuery): Promise<void> {
if (BigInt(savingSaved.amount) === 0n) return;
const messageInfo = SavingUpdateMessage(savingSaved);
await this.sendPost(messageInfo[0], messageInfo[1]);
}
Expand All @@ -51,11 +52,13 @@ export class TwitterService implements OnModuleInit, SocialMediaFct {
}

async doSendTradeUpdates(trade: TradeQuery, depsMarketCap: number, totalShares: bigint): Promise<void> {
if (BigInt(trade.amount) === 0n) return;
const messageInfo = TradeMessage(trade, depsMarketCap, totalShares);
await this.sendPost(messageInfo[0], messageInfo[1]);
}

async doSendBridgeUpdates(bridge: StablecoinBridgeQuery, stablecoin: string): Promise<void> {
if (BigInt(bridge.amount) === 0n) return;
const messageInfo = StablecoinBridgeMessage(bridge, stablecoin);
this.sendPost(messageInfo[0], messageInfo[1]);
}
Expand Down