Difference between revisions of "How-to: Interact with SNS canisters"

From Internet Computer Wiki
Jump to: navigation, search
m (typos)
 
(27 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This article explains how to interact with the canisters of SNS-1. It can also serve as an explanation of how to interact with an SNS and the dapp canisters it controls more generally.
+
This article explains how to interact with an SNS and the dapp canisters it controls. There are two ways to interact with canisters - via the [https://dashboard.internetcomputer.org/ dashboard], where you can click through a friendly user interface, or via the command line using [https://internetcomputer.org/docs/current/developer-docs/build/install-upgrade-remove DFX].
  
== What is SNS-1 ==
+
For more information on the SNS, see the [https://internetcomputer.org/sns/faq SNS FAQ].
SNS-1 is envisaged to be the first SNS DAO to be created on the Internet Computer. Symbolically we propose for the SNS-1 to be an experimental DAO owned and driven by the IC community. At conception, it consists only as a blank canvas for the community to paint the future upon. It signifies the beginning, an exemplar to experiment & educate with, and a beacon to inspire a community of SNSs.
+
 
The dapp the SNS-1 DAO initially controls can be found [https://sqbzf-5aaaa-aaaam-aavya-cai.ic0.app/ here]. Initially it just points to an immutable letter stored on a [https://internetcomputer.org/docs/current/concepts/trust-in-canisters/#complete-immutability blackholed canister].
+
'''Disclaimer: participation in any SNS is at your own risk.'''
  
 
== Finding all SNS and dapp canisters ==  
 
== Finding all SNS and dapp canisters ==  
  
 
If you want to interact with a dapp and the SNS DAO that governs the dapp, you likely know either the dapp canister ID or the SNS root canister ID by which an SNS is identified.
 
If you want to interact with a dapp and the SNS DAO that governs the dapp, you likely know either the dapp canister ID or the SNS root canister ID by which an SNS is identified.
We first describe how starting from SNS root canister ID you can find and interact with all SNS and dapp canisters.
+
This article first describes how, starting from SNS root canister ID, you can find and interact with all SNS and dapp canisters.
  
 
== Finding all SNS and dapp canisters - starting from SNS ==
 
== Finding all SNS and dapp canisters - starting from SNS ==
  
Get the SNS root canister. The SNS root canister is the SNS canister that knows about and controls all the other SNS canisters and the dapp canisters. Therefore it is the canister by which an SNS can be identified. Given this canister ID you can verify it is indeed an “official SNS” that runs a SNS wasm that has been vetted by the NNS.  
+
==== Get the SNS root canister ====
All SNS root canisters, and thus all SNSs, are listed in the NNS canister called SNS wasm modules canister, or SNS-W for short. SNS-W is a fixed canister ID in the NNS subnet and its canister ID is qaa6y-5yaaa-aaaaa-aaafa-cai. Call the method list_deployed_snses and find all root canister IDs in the returned list. You can now check that the SNS root canister ID you knew is one of them.
+
The SNS root canister is the SNS canister that knows about and controls all the other SNS canisters and the dapp canisters. Therefore it is the canister by which an SNS can be identified. Given this canister ID you can verify it is indeed an “official SNS” that runs an SNS wasm that has been vetted by the NNS.  
 +
All SNS root canisters, and thus all SNSs, are listed in the NNS canister called SNS wasm modules canister, or SNS-W for short. SNS-W is a fixed canister ID in the NNS subnet and its canister ID is <syntaxhighlight inline>qaa6y-5yaaa-aaaaa-aaafa-cai</syntaxhighlight>. Call the method <syntaxhighlight inline>list_deployed_snses</syntaxhighlight> and find all root canister IDs in the returned list. You can now check that the SNS root canister ID you know is one of them.
  
<!--*
+
''' DFX.'''
=== DFX ===
+
  <nowiki> $ dfx canister --network ic call qaa6y-5yaaa-aaaaa-aaafa-cai list_deployed_snses '(record {})' </nowiki>
  <nowiki> $ dfx canister --network ic call nns-sns-wasm list_deployed_snses '(record {})' </nowiki>
+
 
-->
+
'''Dashboard.'''
=== Dashboard ===
+
In the SNS-W canister interface, navigate to the SNS-W canister, for example by entering its ID in the search bar.
In the SNS-W canister interface, click ‘+’ next to <syntaxhighlight inline>list_deployed_snses</syntaxhighlight>, and then click “Call”.  
+
You will get to a [https://dashboard.internetcomputer.org/canister/qaa6y-5yaaa-aaaaa-aaafa-cai page] that summarises this canister and all its methods.
 +
Click ‘+’ next to <syntaxhighlight inline>list_deployed_snses</syntaxhighlight>, and then click “Call”.
  
Get all SNS and dapp canister IDs. From the last step, you know that the root canister ID has been verified as a “true” SNS root canister ID deployed through the blessed canister wasm path. You can next get the rest of the canister IDs associated with that SNS by calling <syntaxhighlight inline>list_sns_canisters</syntaxhighlight> on the SNS root canister.
+
====Get all SNS and dapp canister IDs====
 +
From the last step, you know that the root canister ID has been verified as a “true” SNS root canister ID deployed through the blessed canister wasm path. You can next get the rest of the canister IDs associated with that SNS by calling <syntaxhighlight inline>list_sns_canisters</syntaxhighlight> on the SNS root canister.
 
This list contains a list of all canisters that collectively make up the SNS.
 
This list contains a list of all canisters that collectively make up the SNS.
 
The response from this method also has a “dapps” entry that lists the dapp canisters that are governed by the SNS.
 
The response from this method also has a “dapps” entry that lists the dapp canisters that are governed by the SNS.
  
<!--*
+
'''DFX.'''
=== DFX ===
+
  <nowiki> $ dfx canister --network ic call zxeu2-7aaaa-aaaaq-aaafa-cai list_sns_canisters '(record {} )' </nowiki>
  <nowiki> $ dfx canister --network ic call sns-root list_sns_canisters '(record {} )' </nowiki>
 
  
=== Dashboard === -->
+
''' Dashboard.'''
 
On the dashboard, enter the canister ID of SNS root in the search tab. You should see all the methods of SNS root now. Similarly to the last step, click ‘+’ next to <syntaxhighlight inline>list_sns_canisters</syntaxhighlight>, and then click “Call”.  
 
On the dashboard, enter the canister ID of SNS root in the search tab. You should see all the methods of SNS root now. Similarly to the last step, click ‘+’ next to <syntaxhighlight inline>list_sns_canisters</syntaxhighlight>, and then click “Call”.  
 +
This will return the canister IDs of all SNS canisters and the dapp canisters.
  
Get the summary of all SNS and dapp canisters. Finally, you can get the summary and ownership graph of the SNS including the dapps. To do so, call <syntaxhighlight inline>get_sns_canisters_summary</syntaxhighlight> on the SNS root canister. This will return the status of each canister in the SNS, including information such as the canister’s controller and cycles balance.
+
====Get the summary of all SNS and dapp canisters====
\<!--*
+
Finally, you can get the summary and ownership graph of the SNS including the dapps. To do so, call <syntaxhighlight inline>get_sns_canisters_summary</syntaxhighlight> on the SNS root canister. This will return the status of each canister in the SNS, including information such as the canister’s controller and cycles balance.
=== DFX ===
+
 
  <nowiki> $ dfx canister --network ic call sns-root get_sns_canisters_summary '(record {} )' </nowiki>
+
''' DFX. '''
 +
  <nowiki> $ dfx canister --network ic call zxeu2-7aaaa-aaaaq-aaafa-cai get_sns_canisters_summary '(record {} )' </nowiki>
 +
 
 +
'''Dashboard.'''
 +
On the dashboard, where you should still be in the SNS root canister interface from the last Step, click ‘+’ next to <syntaxhighlight inline>get_sns_canisters_summary</syntaxhighlight>. You see the option to choose an argument, but you don't have to select this. Click “Call”.
  
=== Dashboard === -->
+
====Verify the controller hierarchy ====
On the dashboard, where you should still be in the SNS root canister interface from the last Step, click ‘+’ next to <syntaxhighlight inline>get_sns_canisters_summary</syntaxhighlight>, and then click “Call”.  
+
In an SNS, the control hierarchy is as follows.
 +
The SNS root canister controls all SNS canisters, except for the swap canister that implements the decentralization swap and which is controlled by the NNS root canister. The SNS root canister also controls the dapp canisters that are governed by the NNS.
 +
Thus you can check that all canister's controller except swap is SNS root and that the swap canister's controller is NNS root <syntaxhighlight inline>r7inp-6aaaa-aaaaa-aaabq-cai</syntaxhighlight>. The swap canister also has itself as a controller for technical reasons.
 +
Finally, the SNS root canister itself is controlled by the SNS governance canister.  
  
Look at the dapp canisters.  
+
'''Dashboard.'''
 +
You can verify all of this by inspecting what you received in <syntaxhighlight inline>get_sns_canisters_summary</syntaxhighlight> in the last step or you can search for the individual canister IDs, which will lead you to an overview page for each canister, where the controllers are summarised on top.
  
 
== Finding all SNS and dapp canisters - starting from the dapp ==
 
== Finding all SNS and dapp canisters - starting from the dapp ==
 
If you have a dapp canister ID, you can first query the canister to find its controller. If the dapp is controlled by an SNS, then this will return you the SNS root canister ID and you can then proceed as explained in the section above.  
 
If you have a dapp canister ID, you can first query the canister to find its controller. If the dapp is controlled by an SNS, then this will return you the SNS root canister ID and you can then proceed as explained in the section above.  
 +
Often you might just have the URL to interact with the dapp. To follow the above approach to find the underlying canister's controller, you need the dapp canister's ID, which you can get by removing <syntaxhighlight inline>.ic0.app</syntaxhighlight> from the URL.
 +
 
== Inspecting the SNS canisters ==
 
== Inspecting the SNS canisters ==
Preparation
+
 
<!--*
+
'''DFX Preparation. '''
=== DFX ===
+
Download these snippets into an empty repo so that dfx can point at the correct network and correct canisters. This allows to call the canisters and read the output in a human friendly way.
Download these snippets into an empty repo so that dfx can point at the correct testnet and correct canisters. This allows to call the canisters and read the output in a human friendly way.
 
  
 
Snippet 1: [https://gitlab.com/-/snippets/2431348 dfx.json and candid files]
 
Snippet 1: [https://gitlab.com/-/snippets/2431348 dfx.json and candid files]
  
Check the initialization parameters. The SNS governance canister stores all the initial parameters that were provided to SNS-W when the SNS was first installed. SNS governance can be queried for this information to learn how the SNS was set up. This information includes the initial token distribution, as well as the initial neurons, consisting of developer and airdrop neurons.
+
====List the neurons that exist in SNS Governance====
 +
Before the decentralization swap finishes, the only neurons are the developer and airdrop neurons. Thus, during this time, you can inspect all neurons and see with which neurons the governance canister was initialized.
 +
In SNS governance, <syntaxhighlight inline>list_neurons</syntaxhighlight> returns the full neurons.  
 +
This method is paginated: As it is possible that there are more neurons than fit into one message, <syntaxhighlight inline>list_neurons</syntaxhighlight> just returns a number of neurons that you can enter by choosing the parameter <syntaxhighlight inline>limit</syntaxhighlight>. The neurons have a deterministic order so you can get the "next portion" or next "page" by entering in <syntaxhighlight inline>start_page_at</syntaxhighlight> the last neuron of the previously returned page (which will not be included in the next page). Proceeding this way allows you to get the full list of neurons over multiple calls.  
  
=== DFX ===
+
''' DFX. '''
<nowiki> $ dfx canister --network ic call sns-governance get_sns_initialization_parameters '(record {})' </nowiki>
+
<syntaxhighlight> $ dfx canister --network ic call zqfso-syaaa-aaaaq-aaafq-cai list_neurons '(record { of_principal=null; limit=100: nat32; start_page_at=null  } )' </syntaxhighlight>
  
=== Dashboard === -->
+
'''Dashboard.''' On the dashboard, navigate to the SNS governance canister by entering the canister ID in the search bar.  
On the dashboard, navigate to the SNS governance canister by entering the canister ID in the search bar. Then, click ‘+’ next to <syntaxhighlight inline>get_sns_initialization_parameters</syntaxhighlight>, and click “Call”.  
+
Then, click ‘+’ next to <syntaxhighlight inline>list_neurons</syntaxhighlight>. You don't need to choose anything for <syntaxhighlight inline>of_principle</syntaxhighlight> if you want to look at all neurons. Choose a limit as described above. For the first page you don't need to select a <syntaxhighlight inline>start_page_at</syntaxhighlight> and can click “Call”. For the subsequent calls, adjust <syntaxhighlight inline>start_page_at</syntaxhighlight> as described above.
  
List the neurons that exist in SNS Governance. Before the decentralization sale finishes, the only neurons are the developer and airdrop neurons. Thus, you can look at all neurons and see that they match the initialization that you saw in Step 1.
+
==== Check out how many tokens are sold in the decentralization swap. ====
 +
As long as the SNS has not launched yet, there are some tokens reserved for the SNS decentralization swap. They are stored in the SNS ledger account that is owned by the SNS swap canister (previously called swap). Thus, to learn how many tokens are in the decentralization swap, call <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight> to get the balance of the Swap canister. The returned value is given in fractions of 10E-8 of an SNS token.
  
<!--*  
+
'''(Future) Dashboard.''' ''For this to work, the SNS ledger canister needs to be upgraded a new version.''
=== DFX ===
+
<!--*On the dashboard, navigate to the SNS ledger canister by entering the canister ID in the search bar. Then, click ‘+’ next to <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight>, and provide as the argument the ID of the SNS swap canister. Then press <syntaxhighlight inline>call</syntaxhighlight>.
<nowiki> $ dfx canister --network ic call sns-governance list_neurons '(record { of_principal=null; limit=100: nat32; start_page_at=null  } )' </nowiki>
+
-->
  
=== Dashboard === -->
+
'''DFX'''
On the dashboard, navigate to the SNS governance canister by entering the canister ID in the search bar. Then, click ‘+’ next to <syntaxhighlight inline>list_neurons</syntaxhighlight>, and click “Call”.
+
<syntaxhighlight>
 
+
$ dfx canister --network https://ic0.app call zfcdd-tqaaa-aaaaq-aaaga-cai --query icrc1_balance_of '(record {owner = principal "zcdfx-6iaaa-aaaaq-aaagq-cai" })'
Check out how many tokens are sold in the decentralization sale. As long as the SNS has not launched yet, there are some tokens reserved for the SNS decentralization sale. They are stored in the SNS ledger account that is owned by the SNS sale canister (previously called swap). Thus, to learn how many tokens are in the decentralization sale, call <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight> to get the balance of the Swap canister. The returned value is given in fractions of 10E-8 of an SNS token.
+
</syntaxhighlight>
  
 
<!--*  
 
<!--*  
=== DFX ===
+
DFX  
 
  <nowiki> $ dfx canister --network ic call sns-ledger icrc1_balance_of '(record { owner = principal "wmio3-kqaaa-aaaaa-aaasq-cai"; subaccount = null;})' </nowiki>
 
  <nowiki> $ dfx canister --network ic call sns-ledger icrc1_balance_of '(record { owner = principal "wmio3-kqaaa-aaaaa-aaasq-cai"; subaccount = null;})' </nowiki>
 +
-->
  
=== Dashboard === -->
+
====Learn how many tokens are in the SNS treasury.====  
On the dashboard, navigate to the SNS ledger canister by entering the canister ID in the search bar. Then, click ‘+’ next to <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight>, and provide as the argument the ID of the SNS ledger canister. Then press <syntaxhighlight inline>call</syntaxhighlight>.
+
The SNS treasury is a SNS ledger account that is owned by SNS governance. Specifically, it is on a defined subaccount of the SNS governance’s ledger account. To learn it, use <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight> to get the balance of the SNS ledger account with the following arguments:
  
Learn how much tokens are in the SNS treasury. The SNS treasury is a SNS ledger account that is owned by SNS governance. Specifically, it is on a defined subaccount of the SNS governance’s ledger account. To learn it, use <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight> to get the balance of the SNS ledger account with the following arguments:
+
'''DFX'''
 +
<syntaxhighlight>
 +
dfx canister --network https://ic0.app call --query zfcdd-tqaaa-aaaaq-aaaga-cai icrc1_balance_of '(record {owner = principal "zqfso-syaaa-aaaaq-aaafq-cai"; subaccount = blob "\ce\c2\14\5a\75\0f\d4\a4\72\b2\a0\21\f6\df\f1\e4\a9\07\29\97\00\06\2a\0a\02\bc\1e\a6\5c\a2\92\58" })'
 +
</syntaxhighlight>
  
 
<!--*  
 
<!--*  
 
=== DFX ===
 
=== DFX ===
 
  <nowiki> $ dfx canister --network ic call sns-ledger icrc1_balance_of '(record { owner = principal "w6ozc-gaaaa-aaaaa-aaarq-cai"; subaccount = opt vec {45;90;183;220;109;161;20;55;134;152;60;18;176;240;131;123;255;182;167;138;177;190;202;83;86;198;249;176;218;98;20;65}: opt vec nat8;})' </nowiki>
 
  <nowiki> $ dfx canister --network ic call sns-ledger icrc1_balance_of '(record { owner = principal "w6ozc-gaaaa-aaaaa-aaarq-cai"; subaccount = opt vec {45;90;183;220;109;161;20;55;134;152;60;18;176;240;131;123;255;182;167;138;177;190;202;83;86;198;249;176;218;98;20;65}: opt vec nat8;})' </nowiki>
 +
-->
  
=== Dashboard === -->
+
'''(Future) Dashboard.''' ''For this to work, the SNS ledger canister needs to be upgraded to a new version.''
On the dashboard, navigate to the SNS ledger canister by entering the canister ID in the search bar. Then, click ‘+’ next to <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight>, and provide as the argument TODO. Then press “Call”.
+
<!--* On the dashboard, navigate to the SNS ledger canister by entering the canister ID in the search bar. Then, click ‘+’ next to <syntaxhighlight inline>icrc1_balance_of</syntaxhighlight>, and provide as the argument TODO. Then press “Call”.
 +
-->

Latest revision as of 05:58, 16 November 2023

This article explains how to interact with an SNS and the dapp canisters it controls. There are two ways to interact with canisters - via the dashboard, where you can click through a friendly user interface, or via the command line using DFX.

For more information on the SNS, see the SNS FAQ.

Disclaimer: participation in any SNS is at your own risk.

Finding all SNS and dapp canisters

If you want to interact with a dapp and the SNS DAO that governs the dapp, you likely know either the dapp canister ID or the SNS root canister ID by which an SNS is identified. This article first describes how, starting from SNS root canister ID, you can find and interact with all SNS and dapp canisters.

Finding all SNS and dapp canisters - starting from SNS

Get the SNS root canister

The SNS root canister is the SNS canister that knows about and controls all the other SNS canisters and the dapp canisters. Therefore it is the canister by which an SNS can be identified. Given this canister ID you can verify it is indeed an “official SNS” that runs an SNS wasm that has been vetted by the NNS. All SNS root canisters, and thus all SNSs, are listed in the NNS canister called SNS wasm modules canister, or SNS-W for short. SNS-W is a fixed canister ID in the NNS subnet and its canister ID is qaa6y-5yaaa-aaaaa-aaafa-cai. Call the method list_deployed_snses and find all root canister IDs in the returned list. You can now check that the SNS root canister ID you know is one of them.

DFX.

 $ dfx canister --network ic call qaa6y-5yaaa-aaaaa-aaafa-cai list_deployed_snses '(record {})' 

Dashboard. In the SNS-W canister interface, navigate to the SNS-W canister, for example by entering its ID in the search bar. You will get to a page that summarises this canister and all its methods. Click ‘+’ next to list_deployed_snses, and then click “Call”.

Get all SNS and dapp canister IDs

From the last step, you know that the root canister ID has been verified as a “true” SNS root canister ID deployed through the blessed canister wasm path. You can next get the rest of the canister IDs associated with that SNS by calling list_sns_canisters on the SNS root canister. This list contains a list of all canisters that collectively make up the SNS. The response from this method also has a “dapps” entry that lists the dapp canisters that are governed by the SNS.

DFX.

 $ dfx canister --network ic call zxeu2-7aaaa-aaaaq-aaafa-cai list_sns_canisters '(record {} )' 

Dashboard. On the dashboard, enter the canister ID of SNS root in the search tab. You should see all the methods of SNS root now. Similarly to the last step, click ‘+’ next to list_sns_canisters, and then click “Call”. This will return the canister IDs of all SNS canisters and the dapp canisters.

Get the summary of all SNS and dapp canisters

Finally, you can get the summary and ownership graph of the SNS including the dapps. To do so, call get_sns_canisters_summary on the SNS root canister. This will return the status of each canister in the SNS, including information such as the canister’s controller and cycles balance.

DFX.

 $ dfx canister --network ic call zxeu2-7aaaa-aaaaq-aaafa-cai get_sns_canisters_summary '(record {} )' 

Dashboard. On the dashboard, where you should still be in the SNS root canister interface from the last Step, click ‘+’ next to get_sns_canisters_summary. You see the option to choose an argument, but you don't have to select this. Click “Call”.

Verify the controller hierarchy

In an SNS, the control hierarchy is as follows. The SNS root canister controls all SNS canisters, except for the swap canister that implements the decentralization swap and which is controlled by the NNS root canister. The SNS root canister also controls the dapp canisters that are governed by the NNS. Thus you can check that all canister's controller except swap is SNS root and that the swap canister's controller is NNS root r7inp-6aaaa-aaaaa-aaabq-cai. The swap canister also has itself as a controller for technical reasons. Finally, the SNS root canister itself is controlled by the SNS governance canister.

Dashboard. You can verify all of this by inspecting what you received in get_sns_canisters_summary in the last step or you can search for the individual canister IDs, which will lead you to an overview page for each canister, where the controllers are summarised on top.

Finding all SNS and dapp canisters - starting from the dapp

If you have a dapp canister ID, you can first query the canister to find its controller. If the dapp is controlled by an SNS, then this will return you the SNS root canister ID and you can then proceed as explained in the section above. Often you might just have the URL to interact with the dapp. To follow the above approach to find the underlying canister's controller, you need the dapp canister's ID, which you can get by removing .ic0.app from the URL.

Inspecting the SNS canisters

DFX Preparation. Download these snippets into an empty repo so that dfx can point at the correct network and correct canisters. This allows to call the canisters and read the output in a human friendly way.

Snippet 1: dfx.json and candid files

List the neurons that exist in SNS Governance

Before the decentralization swap finishes, the only neurons are the developer and airdrop neurons. Thus, during this time, you can inspect all neurons and see with which neurons the governance canister was initialized. In SNS governance, list_neurons returns the full neurons. This method is paginated: As it is possible that there are more neurons than fit into one message, list_neurons just returns a number of neurons that you can enter by choosing the parameter limit. The neurons have a deterministic order so you can get the "next portion" or next "page" by entering in start_page_at the last neuron of the previously returned page (which will not be included in the next page). Proceeding this way allows you to get the full list of neurons over multiple calls.

DFX.

 $ dfx canister --network ic call zqfso-syaaa-aaaaq-aaafq-cai list_neurons '(record { of_principal=null; limit=100: nat32; start_page_at=null  } )'

Dashboard. On the dashboard, navigate to the SNS governance canister by entering the canister ID in the search bar. Then, click ‘+’ next to list_neurons. You don't need to choose anything for of_principle if you want to look at all neurons. Choose a limit as described above. For the first page you don't need to select a start_page_at and can click “Call”. For the subsequent calls, adjust start_page_at as described above.

Check out how many tokens are sold in the decentralization swap.

As long as the SNS has not launched yet, there are some tokens reserved for the SNS decentralization swap. They are stored in the SNS ledger account that is owned by the SNS swap canister (previously called swap). Thus, to learn how many tokens are in the decentralization swap, call icrc1_balance_of to get the balance of the Swap canister. The returned value is given in fractions of 10E-8 of an SNS token.

(Future) Dashboard. For this to work, the SNS ledger canister needs to be upgraded a new version.

DFX

$ dfx canister --network https://ic0.app call zfcdd-tqaaa-aaaaq-aaaga-cai --query icrc1_balance_of '(record {owner = principal "zcdfx-6iaaa-aaaaq-aaagq-cai" })'


Learn how many tokens are in the SNS treasury.

The SNS treasury is a SNS ledger account that is owned by SNS governance. Specifically, it is on a defined subaccount of the SNS governance’s ledger account. To learn it, use icrc1_balance_of to get the balance of the SNS ledger account with the following arguments:

DFX

dfx canister --network https://ic0.app call --query zfcdd-tqaaa-aaaaq-aaaga-cai icrc1_balance_of '(record {owner = principal "zqfso-syaaa-aaaaq-aaafq-cai"; subaccount = blob "\ce\c2\14\5a\75\0f\d4\a4\72\b2\a0\21\f6\df\f1\e4\a9\07\29\97\00\06\2a\0a\02\bc\1e\a6\5c\a2\92\58" })'


(Future) Dashboard. For this to work, the SNS ledger canister needs to be upgraded to a new version.