SHA256
Обновить учёт поддержки, лайки и профиль перед MVP
This commit is contained in:
@@ -840,7 +840,7 @@ fn verified_pyth_price(account: &AccountInfo, feed: &str) -> Result<u128, Progra
|
||||
}
|
||||
|
||||
fn verify_stars_quote(lamports: u64, star_cents: u64, sol_oracle: &AccountInfo, usdt_oracle: &AccountInfo) -> ProgramResult {
|
||||
require!(star_cents >= 10 && lamports > 0, ShineUsersError::InvalidStars);
|
||||
require!(star_cents >= 10 && star_cents % 10 == 0 && lamports > 0, ShineUsersError::InvalidStars);
|
||||
let sol_usd = verified_pyth_price(sol_oracle, PYTH_SOL_FEED)?;
|
||||
let usdt_usd = verified_pyth_price(usdt_oracle, PYTH_USDT_FEED)?;
|
||||
let actual_num = (lamports as u128).checked_mul(sol_usd).and_then(|v| v.checked_mul(100))
|
||||
@@ -896,7 +896,7 @@ fn process_support_user(program_id: &Pubkey, accounts: &[AccountInfo], args: Sup
|
||||
let mut sender_stats = read_support_stats(&sender_raw)?;
|
||||
let mut recipient_stats = read_support_stats(&recipient_raw)?;
|
||||
sender_stats.support_sent = sender_stats.support_sent.checked_add(args.amount_star_cents).ok_or(ProgramError::from(ShineUsersError::MathOverflow))?;
|
||||
recipient_stats.support_received = recipient_stats.support_received.checked_add(author_star_cents).ok_or(ProgramError::from(ShineUsersError::MathOverflow))?;
|
||||
recipient_stats.support_received = recipient_stats.support_received.checked_add(args.amount_star_cents).ok_or(ProgramError::from(ShineUsersError::MathOverflow))?;
|
||||
let sender_data = append_stats_to_existing_signed_record(&sender_raw, sender_stats)?;
|
||||
let recipient_data = append_stats_to_existing_signed_record(&recipient_raw, recipient_stats)?;
|
||||
ensure_pda_size_and_rent(sender_pda, sender, system_program_ai, sender_data.len())?;
|
||||
|
||||
Reference in New Issue
Block a user