Skip to content

Commit

Permalink
[apps] Increase faucet and rgas reward (#3141)
Browse files Browse the repository at this point in the history
* [apps] Increase faucet and rgas reward

* release
  • Loading branch information
jolestar authored Dec 31, 2024
1 parent 7b45e49 commit 00b3351
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Binary file added apps/gas_faucet/released/2/package.rpd
Binary file not shown.
17 changes: 12 additions & 5 deletions apps/gas_faucet/sources/gas_faucet.move
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ module gas_faucet::gas_faucet {

const INIT_GAS_AMOUNT: u256 = 5000000_00000000;
const ONE_RGAS: u256 = 1_00000000;
const FAUCET_RGAS_PER_USER: u256 = 50_00000000;

//0.0001 BTC
const SAT_LEVEL_ZERO: u64 = 1000;
//0.01 BTC
const SAT_LEVEL_ONE: u64 = 1000000;
//0.1 BTC
Expand Down Expand Up @@ -114,7 +117,8 @@ module gas_faucet::gas_faucet {
let faucet = object::borrow(faucet_obj);
assert!(faucet.is_open, ErrorFaucetNotOpen);

if (!faucet.allow_repeat && table::contains(&faucet.claim_records, claimer)) {
let claimed_rgas_amount = *table::borrow_with_default(&faucet.claim_records, claimer, &0u256);
if (!faucet.allow_repeat && claimed_rgas_amount >= FAUCET_RGAS_PER_USER) {
abort ErrorAlreadyClaimed
};

Expand All @@ -126,6 +130,11 @@ module gas_faucet::gas_faucet {
if (claim_rgas_amount == 0) {
claim_rgas_amount = ONE_RGAS;
};
if (claim_rgas_amount > claimed_rgas_amount) {
claim_rgas_amount = claim_rgas_amount - claimed_rgas_amount;
}else{
claim_rgas_amount = ONE_RGAS;
};
let remaining_rgas_amount = coin_store::balance(&faucet.rgas_store);
if (claim_rgas_amount > remaining_rgas_amount) {
abort ErrorFaucetNotEnoughRGas
Expand Down Expand Up @@ -177,12 +186,10 @@ module gas_faucet::gas_faucet {
fun sat_amount_to_rgas(sat_amount: u64): u256{
if (sat_amount == 0) {
0
}else if(sat_amount <= SAT_LEVEL_ONE){
}else if(sat_amount <= SAT_LEVEL_ZERO){
ONE_RGAS
}else if(sat_amount <= SAT_LEVEL_TWO){
2 * ONE_RGAS
}else{
3 * ONE_RGAS
FAUCET_RGAS_PER_USER
}
}

Expand Down
Binary file added apps/invitation_record/released/3/package.rpd
Binary file not shown.
2 changes: 1 addition & 1 deletion apps/invitation_record/sources/invitation.move
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ module invitation_record::invitation {
assert!(user_invitation_records.remaining_luckey_ticket >= amount, ErrorNoRemainingLuckeyTicket);
while (amount > 0) {
let reward_amount = rand_u64_range(10_000_000, 100_000_000, amount);
if (reward_amount % 150 == 0) {
if (reward_amount % 18 == 0) {
reward_amount = reward_amount * 1000
};
let rgas_coin = coin_store::withdraw(&mut invitation_conf.rgas_store, (reward_amount as u256));
Expand Down

0 comments on commit 00b3351

Please sign in to comment.