github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/sdk/auth/consts.go (about)

     1  package auth
     2  
     3  import (
     4  	"github.com/gnolang/gno/tm2/pkg/crypto"
     5  )
     6  
     7  const (
     8  	// module name
     9  	ModuleName = "auth"
    10  
    11  	// StoreKey is string representation of the store key for auth
    12  	StoreKey = "acc"
    13  
    14  	// FeeCollectorName the root string for the fee collector account address
    15  	FeeCollectorName = "fee_collector"
    16  
    17  	// QuerierRoute is the querier route for acc
    18  	QuerierRoute = StoreKey
    19  
    20  	// AddressStoreKeyPrefix prefix for account-by-address store
    21  	AddressStoreKeyPrefix = "/a/"
    22  
    23  	// param key for global account number
    24  	GlobalAccountNumberKey = "globalAccountNumber"
    25  )
    26  
    27  // AddressStoreKey turn an address to key used to get it from the account store
    28  func AddressStoreKey(addr crypto.Address) []byte {
    29  	return append([]byte(AddressStoreKeyPrefix), addr.Bytes()...)
    30  }
    31  
    32  // NOTE: do not modify.
    33  // XXX: consider parameterization at the keeper level.
    34  var feeCollector crypto.Address
    35  
    36  func FeeCollectorAddress() crypto.Address {
    37  	if feeCollector.IsZero() {
    38  		feeCollector = crypto.AddressFromPreimage([]byte(FeeCollectorName))
    39  	}
    40  	return feeCollector
    41  }