<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aaron Bassett</title>
    <description>The latest articles on DEV Community by Aaron Bassett (@aaronbassett).</description>
    <link>https://dev.to/aaronbassett</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F346522%2F25c1d4ec-0b0b-4a21-bb80-0f274c69e873.jpg</url>
      <title>DEV Community: Aaron Bassett</title>
      <link>https://dev.to/aaronbassett</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aaronbassett"/>
    <language>en</language>
    <item>
      <title>Deprecated dispatchables removed from Polkadot SDK</title>
      <dc:creator>Aaron Bassett</dc:creator>
      <pubDate>Thu, 28 Sep 2023 10:44:21 +0000</pubDate>
      <link>https://dev.to/aaronbassett/deprecated-dispatchables-removed-from-polkadot-sdk-3hph</link>
      <guid>https://dev.to/aaronbassett/deprecated-dispatchables-removed-from-polkadot-sdk-3hph</guid>
      <description>&lt;h2&gt;
  
  
  What’s happening?
&lt;/h2&gt;

&lt;p&gt;In December last year, &lt;a href="https://github.com/paritytech/substrate/pull/12951"&gt;a PR was opened to&lt;/a&gt; to deprecate Currency and introduce holds and freezing into fungible traits. As part of this PR, &lt;code&gt;Balances::set_balance&lt;/code&gt; was replaced by &lt;a href="https://paritytech.github.io/polkadot-sdk/master/pallet_balances/pallet/struct.Pallet.html#method.force_set_balance"&gt;&lt;code&gt;Balances::force_set_balance&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;Balances::transfer&lt;/code&gt; was replaced with &lt;a href="https://paritytech.github.io/polkadot-sdk/master/pallet_balances/pallet/struct.Pallet.html#method.transfer_allow_death"&gt;&lt;code&gt;Balances::transfer_allow_death&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As much of the ecosystem uses &lt;code&gt;transfer&lt;/code&gt;, a compatibility stub was added to give ecosystem teams time to move to these replacements. This time has elapsed and &lt;a href="https://github.com/paritytech/polkadot-sdk/pull/1226"&gt;the stub has been removed in this PR&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why was this change made?
&lt;/h2&gt;

&lt;p&gt;Some improvements were made along with the deprecation of the Currency trait. The hope is that these changes make the dispatchable's names better reflect their functions.&lt;/p&gt;

&lt;p&gt;For example, when calling &lt;code&gt;transfer&lt;/code&gt;, it was not immediately apparent that it could end up with an account being reaped. However, &lt;code&gt;transfer_allow_death&lt;/code&gt; is more explicit about the potential repercussions of using this dispatchable over an alternative such as &lt;code&gt;transfer_keep_alive&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code changes
&lt;/h2&gt;

&lt;p&gt;You should use the fungible trait API for Balances rather than calling these dispatchables directly, as the long-term plan is to remove the dispatchables and have all pallet access be via &lt;a href="https://docs.substrate.io/learn/xcm-communication/"&gt;XCM&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, if you need to refactor your code to use the replacements, note the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Balances::set_balance&lt;/code&gt; becomes &lt;a href="https://paritytech.github.io/polkadot-sdk/master/pallet_balances/pallet/struct.Pallet.html#method.force_set_balance"&gt;&lt;code&gt;Balances::force_set_balance&lt;/code&gt;&lt;/a&gt; and only accepts the free balance &lt;em&gt;(not the reserved balance since this no longer makes sense)&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Balances::transfer&lt;/code&gt; becomes &lt;a href="https://paritytech.github.io/polkadot-sdk/master/pallet_balances/pallet/struct.Pallet.html#method.transfer_allow_death"&gt;&lt;code&gt;Balances::transfer_allow_death&lt;/code&gt;&lt;/a&gt; or &lt;a href="https://paritytech.github.io/polkadot-sdk/master/pallet_balances/pallet/struct.Pallet.html#method.transfer_keep_alive"&gt;&lt;code&gt;Balances::transfer_keep_alive&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Find out more
&lt;/h2&gt;

&lt;p&gt;Learn more about this change on the &lt;a href="https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-41-v0-9-42/2828"&gt;Polkadot forum&lt;/a&gt; or in &lt;a href="https://github.com/paritytech/substrate/pull/12951"&gt;the original PR&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>rust</category>
      <category>substrate</category>
      <category>blockchain</category>
    </item>
  </channel>
</rss>
