Skip to content

Commit f33ef01

Browse files
committed
ci: add aptos move fmt & lint hooks to precommit
1 parent 62d6905 commit f33ef01

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@ repos:
151151
entry: cargo +1.82.0 clippy --manifest-path ./target_chains/ethereum/sdk/stylus/Cargo.toml --all-targets -- --deny warnings
152152
pass_filenames: false
153153
files: target_chains/ethereum/sdk/stylus
154+
- id: fmt-aptos-lazer
155+
name: Format Aptos Lazer contracts
156+
language: system
157+
entry: aptos move fmt --package-path lazer/contracts/aptos
158+
pass_filenames: false
159+
files: lazer/contracts/aptos
160+
- id: lint-aptos-lazer
161+
name: Lint Aptos Lazer contracts
162+
language: system
163+
entry: aptos move lint --package-dir lazer/contracts/aptos --check-test-code
164+
pass_filenames: false
165+
files: lazer/contracts/aptos

lazer/contracts/aptos/sources/pyth_lazer.move

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ module pyth_lazer::pyth_lazer {
3838

3939
/// Initialize the Lazer contract with top authority and treasury. One-time operation.
4040
public entry fun initialize(
41-
account: &signer,
42-
top_authority: address,
43-
treasury: address,
41+
account: &signer, top_authority: address, treasury: address
4442
) {
4543
// Initialize must be called by the contract account
4644
assert!(signer::address_of(account) == @pyth_lazer, ENO_PERMISSIONS);
@@ -77,7 +75,7 @@ module pyth_lazer::pyth_lazer {
7775
let valid = false;
7876
while (i < storage.trusted_signers.length()) {
7977
let signer_info = vector::borrow(&storage.trusted_signers, (i as u64));
80-
if (signer_info.pubkey == trusted_signer
78+
if (&signer_info.pubkey == &trusted_signer
8179
&& signer_info.expires_at > timestamp::now_seconds()) {
8280
valid = true;
8381
break
@@ -94,6 +92,7 @@ module pyth_lazer::pyth_lazer {
9492
EINVALID_SIGNATURE
9593
);
9694
}
95+
9796
/// Upsert a trusted signer's information or remove them
9897
public entry fun update_trusted_signer(
9998
account: &signer, trusted_signer: vector<u8>, expires_at: u64
@@ -111,7 +110,7 @@ module pyth_lazer::pyth_lazer {
111110

112111
while (i < num_signers) {
113112
let signer_info = vector::borrow(&storage.trusted_signers, (i as u64));
114-
if (signer_info.pubkey == trusted_signer) {
113+
if (&signer_info.pubkey == &trusted_signer) {
115114
found = true;
116115
break
117116
};
@@ -140,6 +139,7 @@ module pyth_lazer::pyth_lazer {
140139
let storage = borrow_global<Storage>(@pyth_lazer);
141140
storage.trusted_signers
142141
}
142+
143143
/// Signer pubkey getter
144144
public fun get_signer_pubkey(info: &TrustedSignerInfo): vector<u8> {
145145
info.pubkey
@@ -149,6 +149,4 @@ module pyth_lazer::pyth_lazer {
149149
public fun get_signer_expires_at(info: &TrustedSignerInfo): u64 {
150150
info.expires_at
151151
}
152-
153-
154152
}

0 commit comments

Comments
 (0)