TransferSnsTreasuryFunds: What's from_treasury

In a TransferSnsTreasuryFunds payload, there is a field from_treasury. What’s its purpose and what value should be provided?

type TransferSnsTreasuryFunds = record {
  from_treasury : int32; // <----- ??????
  to_principal : opt principal;
  to_subaccount : opt Subaccount;
  memo : opt nat64;
  amount_e8s : nat64;
};

It’s an enumerated type, to select either the ICP treasury or the SNS token treasury (e.g., CHAT, WTN, etc.) of the SNS.

1 Like

Thanks Dylan!

Both fields seem undocumented on the portal.

I see that the TransferSnsTreasuryFunds proposal allows transferring funds from either the ICP treasury or the SNS token treasury, as determined by the from_treasury field.

Is there any way to use this proposal type to transfer a different token (other than ICP or the SNS token) from the SNS treasury? If not, is there an alternative mechanism for handling such transfers?

Would appreciate any insights—thanks!

1 Like

Hi @Darshan

Currently, SNS treasuries can hold only ICP and its native SNS tokens.

We’re considering adding support for more tokens to SNS treasuries, but this is probably not going to be implemented in the next few months.

2 Likes

You can do so by registering a generic nervous system function and then transfer them

This can be done through the toolkit https://ic-toolkit.app
If you navigate the the SNS wallet you see all the tokens the SNS owns, if a function is registered it will allow you to propose a transfer, if not you will be prompted to register the function.

Note that there is a “validate” method required to register the function, this method lives on a toolkit owned canister which can be considered a third party dependency

It’s probably also possible in the coming week through the new ui in https://dev.ic-toolkit.app

(this does not works for ICP and the native token)

And the first mentioned website only supports other SNS tokens for now

3 Likes

Thanks for the clarification! Just to confirm—if a governance canister’s subaccount holds a token other than ICP or the SNS token, transferring it requires a custom function. Since only the governance canister should be able to call this function, how can I ensure that the caller is the governance canister with a specific subaccount

Basically the same as I described earlier, but then with a subaccount specified in the “from_subaccount” on the transfer arguments

https://dashboard.internetcomputer.org/canister/mxzaz-hqaaa-aaaar-qaada-cai#icrc1_transfer

2 Likes

hey so validate method is there for icrc1 transfer method on toolkit owned canister can you please provide me the link of that canister that will be so helpful thank you in advance

Here is the code

And here is the canister
https://dashboard.internetcomputer.org/canister/xho54-tyaaa-aaaap-antuq-cai

1 Like