Injective | Documentation
InjectiveGithub
Injective | Documentation
Injective | Documentation
  • About Injective
  • Getting Started
    • Wallet
      • Create a wallet
      • Accounts
      • Staking
      • Governance
      • Auction
    • Token Standards
      • INJ coin
      • Token Factory
      • CW20 Standard
    • Transactions
      • Gas and Fees
  • Guides
    • Create a Wallet
    • Bridge
      • From Ethereum
      • Using Wormhole
      • Using IBC
      • From Solana
    • Launch a Token
    • Launch a Market
    • Denom Metadata
    • Get INJ
  • Toolkits
    • injectived
      • Install injectived
      • Using injectived
      • Commands
    • Injective TS SDK
    • Injective Go SDK
    • Injective Python SDK
    • Injective CW SDK
    • Injective Rust
    • The Graph
  • References
  • Glossary
  • Developers
    • Getting Started
      • Guides
        • Testnet Proposals
        • Convert addresses
        • Calculations
          • Min Price Tick Size
          • Min Quantity Tick Size
        • Testnet Faucet Integration
    • Exchange Developers
      • Build a DEX
      • Provider Oracle
    • Cosmwasm Developers
      • Your First Smart Contract
      • Guides
        • Local Development
        • Mainnet Deployment
        • Whitelisting deployment address
        • Create your Swap Contract
        • Creating UIs
      • Using Injective Queries and Messages
      • CW20 Adapter
      • Injective Test Tube
    • Modules
      • Injective
        • Auction
          • State
          • Messages
          • EndBlock
          • Events
          • Params
          • Errors
        • Exchange
          • Derivative Markets Concepts
          • Spot Markets Concepts
          • Binary Option Markets Concepts
          • Other Concepts
          • State
          • State Transitions
          • Messages
          • Proposals
          • BeginBlock
          • EndBlock
          • Events
          • Params
          • MsgPrivilegedExecuteContract
          • Errors
        • Insurance
          • State
          • State Transitions
          • Messages
          • EndBlock
          • Events
          • Params
          • Improvements
          • Errors
        • OCR
          • Concepts
          • State
          • Messages
          • Proposals
          • BeginBlock
          • Hooks
          • Events
          • Params
          • Errors
        • Oracle
          • State
          • Keeper
          • Messages
          • Proposals
          • Events
          • Improvements
          • Errors
        • Peggy
          • Definitions
          • Workflow
          • State
          • Messages
          • Slashing
          • EndBlock
          • Events
          • Params
          • Relay Semantics
          • Improvements
          • Errors
        • Permissions
          • Concepts
          • State
          • State Transition
          • Errors
        • TokenFactory
          • Concepts
          • State
          • Messages
          • Events
          • Params
          • Errors
        • WasmX
          • Concepts
          • Data
          • Proposals
          • Messages
          • Params
          • Errors
        • Lanes
        • TxFees
      • Core
        • Auth
        • AuthZ
        • Bank
        • Consensus
        • Crisis
        • Distribution
        • Evidence
        • Feegrant
        • Gov
        • Group
        • Mint
        • NFT
        • Params
        • Slashing
        • Staking
        • Upgrade
        • Circuit
        • Genutils
    • dApps Documentation
  • Nodes
    • Getting Started
      • Interact with a node
      • Running a node
        • Setting up the keyring
        • Join a network
        • Cosmovisor
        • Upgrade your node
    • Validators
      • Mainnet
        • Peggo
        • Canonical Chain Upgrades
          • Upgrade to 10002-rc1
          • Upgrade to 10002-rc2
          • Upgrade to 10003-rc1
          • Upgrade to 10004-rc1
          • Upgrade to 10004-rc1-patch
          • Upgrade to 10005-rc1
          • Upgrade to 10006-rc1
          • Upgrade to 10007-rc1
          • Upgrade to 10008 - Camelot
          • Upgrade to 10009
          • Upgrade to v1.10
          • Upgrade to v1.11
          • Upgrade to v1.12.0 - Volan
          • Upgrade to v1.12.1
          • Upgrade to v1.13.0 - Altaris
          • Upgrade to v1.13.2
          • Upgrade to v1.13.3
          • Upgrade to v1.14.0
          • Upgrade to v1.14.1
          • Upgrade to v1.15.0
      • Testnet
        • Testnet Peggo
    • Public Endpoints
    • Premium Endpoints
    • Injective Indexer Setup
  • Traders
    • Getting Started
    • Documentation
    • API Reference
  • Useful Links
    • Injective 101
    • Injective Hub
    • Injective Explorer
    • Chain API Reference
    • Indexer API Reference
    • Testnet Faucet
Powered by GitBook
On this page
  • Create Namespace
  • Update Namespace
  • Update Actor Roles
  • Claim Voucher
Edit on GitHub
Export as PDF
  1. Developers
  2. Modules
  3. Injective
  4. Permissions

State Transition

Create Namespace

message MsgCreateNamespace {
  option (amino.name) = "permissions/MsgCreateNamespace";
  option (cosmos.msg.v1.signer) = "sender";
  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];

  Namespace namespace = 2 [ (gogoproto.nullable) = false ];
}

// Namespace defines a permissions namespace
message Namespace {
  string denom = 1; // tokenfactory denom to which this namespace applies to
  string contract_hook = 2; // address of smart contract to apply code-based restrictions

  repeated Role role_permissions = 3; // permissions for each role
  repeated ActorRoles actor_roles = 4; // roles for each actor
  repeated RoleManager role_managers = 5; //  managers for each role
  repeated PolicyStatus policy_statuses = 6; // status for each policy
  repeated PolicyManagerCapability policy_manager_capabilities = 7; // capabilities for each manager for each policy
}

// Role is only used for storage
message Role {
  string name = 1;
  uint32 role_id = 2;
  uint32 permissions = 3;
}

// AddressRoles defines roles for an actor
message ActorRoles {
  string actor = 1;
  repeated string roles = 2;
}

// RoleManager defines roles for a manager address
message RoleManager {
  string manager = 1;
  repeated string roles = 2;
}

message PolicyStatus {
  Action action = 1;
  bool is_disabled = 2;
  bool is_sealed = 3;
}

message PolicyManagerCapability {
  string manager = 1;
  Action action = 2;
  bool can_disable = 3;
  bool can_seal = 4;
}

// each Action enum value should be a power of two
enum Action {
  // 0 is reserved for ACTION_UNSPECIFIED
  UNSPECIFIED = 0;
  // 1 is reserved for MINT
  MINT = 1;
  // 2 is reserved for RECEIVE
  RECEIVE = 2;
  // 4 is reserved for BURN
  BURN = 4;
  // 8 is reserved for SEND
  SEND = 8;
  // 16 is reserved for SUPER_BURN
  SUPER_BURN = 16;

  //
  // MANAGER ACTIONS BELOW
  //

  // 2^27 is reserved for MODIFY_POLICY_MANAGERS
  MODIFY_POLICY_MANAGERS = 0x8000000; // 2^27 or 134217728
  // 2^28 is reserved for MODIFY_CONTRACT_HOOK
  MODIFY_CONTRACT_HOOK = 0x10000000; // 2^28 or 268435456
  // 2^29 is reserved for MODIFY_ROLE_PERMISSIONS
  MODIFY_ROLE_PERMISSIONS = 0x20000000; // 2^29 or 536870912
  // 2^30 is reserved for MODIFY_ROLE_MANAGERS
  MODIFY_ROLE_MANAGERS = 0x40000000; // 2^30 or 1073741824
}

Update Namespace

message MsgUpdateNamespace {
  option (amino.name) = "permissions/MsgUpdateNamespace";
  option (cosmos.msg.v1.signer) = "sender";
  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];

  string denom = 2; // denom whose namespace updates are to be applied

  message SetContractHook { string new_value = 1; }
  SetContractHook contract_hook = 3; // address of smart contract to apply code-based restrictions

  repeated Role role_permissions = 4; // role permissions to update
  repeated RoleManager role_managers = 5; //  role managers to update
  repeated PolicyStatus policy_statuses = 6; // policy statuses to update
  repeated PolicyManagerCapability policy_manager_capabilities = 7; // policy manager capabilities to update
}

message Role {
  string name = 1;
  uint32 role_id = 2;
  uint32 permissions = 3;
}

// RoleManager defines roles for a manager address
message RoleManager {
  string manager = 1;
  repeated string roles = 2;
}

message PolicyStatus {
  Action action = 1;
  bool is_disabled = 2;
  bool is_sealed = 3;
}

message PolicyManagerCapability {
  string manager = 1;
  Action action = 2;
  bool can_disable = 3;
  bool can_seal = 4;
}

// each Action enum value should be a power of two
enum Action {
  // 0 is reserved for ACTION_UNSPECIFIED
  UNSPECIFIED = 0;
  // 1 is reserved for MINT
  MINT = 1;
  // 2 is reserved for RECEIVE
  RECEIVE = 2;
  // 4 is reserved for BURN
  BURN = 4;
  // 8 is reserved for SEND
  SEND = 8;
  // 16 is reserved for SUPER_BURN
  SUPER_BURN = 16;

  //
  // MANAGER ACTIONS BELOW
  //

  // 2^27 is reserved for MODIFY_POLICY_MANAGERS
  MODIFY_POLICY_MANAGERS = 0x8000000; // 2^27 or 134217728
  // 2^28 is reserved for MODIFY_CONTRACT_HOOK
  MODIFY_CONTRACT_HOOK = 0x10000000; // 2^28 or 268435456
  // 2^29 is reserved for MODIFY_ROLE_PERMISSIONS
  MODIFY_ROLE_PERMISSIONS = 0x20000000; // 2^29 or 536870912
  // 2^30 is reserved for MODIFY_ROLE_MANAGERS
  MODIFY_ROLE_MANAGERS = 0x40000000; // 2^30 or 1073741824
}

Update Actor Roles

  • Roles can be given or revoked from addresses with MsgUpdateActorRoles

message MsgUpdateActorRoles {
  option (amino.name) = "permissions/MsgUpdateActorRoles";
  option (cosmos.msg.v1.signer) = "sender";
  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];

  string denom = 2; // namespace denom to which this updates are applied

  repeated RoleActors role_actors_to_add = 3; // roles to add for given actors
  repeated RoleActors role_actors_to_revoke = 5; // roles to revoke from given actors
}

message RoleActors {
  string role = 1;
  repeated string actors = 2;
}

Claim Voucher

message MsgClaimVoucher {
  option (amino.name) = "permissions/MsgClaimVoucher";
  option (cosmos.msg.v1.signer) = "sender";
  string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];

  string denom = 2;
}
PreviousStateNextErrors

Last updated 1 month ago