From 964553db686c512b97b7ced7a2c4057f857ed870 Mon Sep 17 00:00:00 2001 From: Foivos Date: Mon, 25 Nov 2024 14:03:22 +0200 Subject: [PATCH] made some public functions package functions --- move/axelar_gateway/sources/types/message.move | 7 ++----- move/axelar_gateway/sources/types/proof.move | 15 ++++++--------- .../sources/types/weighted_signer.move | 7 +++++-- .../sources/versioned/gas_service_v0.move | 8 ++++---- move/its/sources/types/address_tracker.move | 13 +++++-------- move/its/sources/types/coin_info.move | 5 +++-- move/its/sources/types/trusted_addresses.move | 5 ++++- 7 files changed, 29 insertions(+), 31 deletions(-) diff --git a/move/axelar_gateway/sources/types/message.move b/move/axelar_gateway/sources/types/message.move index bdd361a0..e89416cd 100644 --- a/move/axelar_gateway/sources/types/message.move +++ b/move/axelar_gateway/sources/types/message.move @@ -18,9 +18,9 @@ public struct Message has copy, drop, store { } /// ----------------- -/// Public Functions +/// Package Functions /// ----------------- -public fun new( +public(package) fun new( source_chain: String, message_id: String, source_address: String, @@ -36,9 +36,6 @@ public fun new( } } -/// ----------------- -/// Package Functions -/// ----------------- public(package) fun peel(bcs: &mut BCS): Message { // TODO: allow UTF-8 strings? Or keep it as more generic bytes? let source_chain = bcs.peel_vec_u8().to_ascii_string(); diff --git a/move/axelar_gateway/sources/types/proof.move b/move/axelar_gateway/sources/types/proof.move index ac4625de..e88d4570 100644 --- a/move/axelar_gateway/sources/types/proof.move +++ b/move/axelar_gateway/sources/types/proof.move @@ -40,23 +40,20 @@ const ESignerNotFound: vector = #[error] const ERedundantSignaturesProvided: vector = b"redundant signatures provided"; - -// ---------------- -// Public Functions -// ---------------- + +// ----------------- +// Package Functions +// ----------------- /// The signers of the proof -public fun signers(proof: &Proof): &WeightedSigners { +public(package) fun signers(proof: &Proof): &WeightedSigners { &proof.signers } /// The proof signatures -public fun signatures(proof: &Proof): &vector { +public(package) fun signatures(proof: &Proof): &vector { &proof.signatures } -// ----------------- -// Package Functions -// ----------------- public(package) fun new_signature(bytes: vector): Signature { assert!(bytes.length() == SIGNATURE_LENGTH, EInvalidSignatureLength); diff --git a/move/axelar_gateway/sources/types/weighted_signer.move b/move/axelar_gateway/sources/types/weighted_signer.move index 90d4479e..070d8e0b 100644 --- a/move/axelar_gateway/sources/types/weighted_signer.move +++ b/move/axelar_gateway/sources/types/weighted_signer.move @@ -18,11 +18,14 @@ public struct WeightedSigner has copy, drop, store { weight: u128, } -public fun pub_key(self: &WeightedSigner): vector { +// ----------------- +// Package Functions +// ----------------- +public(package) fun pub_key(self: &WeightedSigner): vector { self.pub_key } -public fun weight(self: &WeightedSigner): u128 { +public(package) fun weight(self: &WeightedSigner): u128 { self.weight } diff --git a/move/gas_service/sources/versioned/gas_service_v0.move b/move/gas_service/sources/versioned/gas_service_v0.move index 84a676d5..728de7bb 100644 --- a/move/gas_service/sources/versioned/gas_service_v0.move +++ b/move/gas_service/sources/versioned/gas_service_v0.move @@ -130,22 +130,22 @@ fun take( // Test Only // --------- #[test_only] -public fun version_control_mut(self: &mut GasService_v0): &mut VersionControl { +public(package) fun version_control_mut(self: &mut GasService_v0): &mut VersionControl { &mut self.version_control } #[test_only] -public fun balance(self: &GasService_v0): &Balance { +public(package) fun balance(self: &GasService_v0): &Balance { &self.balance } #[test_only] -public fun balance_mut(self: &mut GasService_v0): &mut Balance { +public(package) fun balance_mut(self: &mut GasService_v0): &mut Balance { &mut self.balance } #[test_only] -public fun destroy_for_testing(self: GasService_v0) { +public(package) fun destroy_for_testing(self: GasService_v0) { let GasService_v0 { balance, version_control: _ } = self; balance.destroy_for_testing(); } diff --git a/move/its/sources/types/address_tracker.move b/move/its/sources/types/address_tracker.move index 3229fe45..a2b406d1 100644 --- a/move/its/sources/types/address_tracker.move +++ b/move/its/sources/types/address_tracker.move @@ -23,11 +23,11 @@ public struct InterchainAddressTracker has store { trusted_addresses: Table, } -// ------- -// Getters -// ------- +// ----------------- +// Package Functions +// ----------------- /// Get the trusted address for a chain. -public fun trusted_address( +public(package) fun trusted_address( self: &InterchainAddressTracker, chain_name: String, ): &String { @@ -36,7 +36,7 @@ public fun trusted_address( } /// Check if the given address is trusted for the given chain. -public fun is_trusted_address( +public(package) fun is_trusted_address( self: &InterchainAddressTracker, chain_name: String, addr: String, @@ -44,9 +44,6 @@ public fun is_trusted_address( self.trusted_addresses.contains(chain_name) && self.trusted_addresses[chain_name] == addr } -// ----------------- -// Package Functions -// ----------------- /// Create a new interchain address tracker. public(package) fun new(ctx: &mut TxContext): InterchainAddressTracker { InterchainAddressTracker { diff --git a/move/its/sources/types/coin_info.move b/move/its/sources/types/coin_info.move index 9795dd01..64c3874a 100644 --- a/move/its/sources/types/coin_info.move +++ b/move/its/sources/types/coin_info.move @@ -37,8 +37,9 @@ public fun from_metadata(metadata: CoinMetadata): CoinInfo { } } -// === Views === - +// ----- +// Views +// ----- public fun name(self: &CoinInfo): String { self.name } diff --git a/move/its/sources/types/trusted_addresses.move b/move/its/sources/types/trusted_addresses.move index c4ad5e14..0e72745b 100644 --- a/move/its/sources/types/trusted_addresses.move +++ b/move/its/sources/types/trusted_addresses.move @@ -34,7 +34,10 @@ public fun new( } } -public fun destroy(self: TrustedAddresses): (vector, vector) { +/// ----------------- +/// Package Functions +/// ----------------- +public(package) fun destroy(self: TrustedAddresses): (vector, vector) { let TrustedAddresses { trusted_chains, trusted_addresses } = self; (trusted_chains, trusted_addresses) }