Skip to content

Commit

Permalink
feat(gas-service): add method to collect gas (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth authored May 14, 2024
1 parent 4ad5495 commit d04fcdd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions move/gas_service/sources/gas_service/gas_service.move
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ module gas_service::gas_service {
balance: Balance<SUI>,
}

public struct RefunderCap has key, store {
public struct GasCollectorCap has key, store {
id: UID,
}

public struct NativeGasPaidForContractCall has copy, drop {
sender: address,
destination_chain: String,
destination_address: String,
payload_hash: address,
sender: address,
destination_chain: String,
destination_address: String,
payload_hash: address,
value: u64,
refund_address: address,
}

public struct NativeGasAdded has copy, drop {
tx_hash: address,
tx_hash: address,
log_index: u64,
value: u64,
value: u64,
refund_address: address,
}

Expand All @@ -40,7 +40,7 @@ module gas_service::gas_service {
balance: balance::zero<SUI>(),
});

transfer::public_transfer(RefunderCap {
transfer::public_transfer(GasCollectorCap {
id: object::new(ctx),
}, ctx.sender());
}
Expand Down Expand Up @@ -85,10 +85,10 @@ module gas_service::gas_service {
});
}

public fun refund(self: &mut GasService, _: &RefunderCap, receiver: address, amount: u64, ctx: &mut TxContext) {
public fun refund(self: &mut GasService, _: &GasCollectorCap, receiver: address, amount: u64, ctx: &mut TxContext) {
transfer::public_transfer(
coin::take(&mut self.balance, amount, ctx),
receiver,
)
}
}
}

0 comments on commit d04fcdd

Please sign in to comment.