<p>Reference Scripts, the ability for a transaction to reference scripts from a prior transaction is scheduled to be available later this year, sometime in June I believe. <a href="https://github.com/cardano-foundation/CIPs/pull/161" rel="nofollow noreferrer">https://github.com/cardano-foundation/CIPs/pull/161</a></p>
<p>However, I'm not sure this will be what you're looking for.  In Solidity, smart contracts are like recipes: do X, then do Y, and then do Z.  On Cardano, a validator (smart contract) is a function that return a boolean representing whether the provided transaction may spend the funds may, yes or no?</p>
<p>Because of this difference, contract composition will look different.  Composability on Solidity resembles a micro service architecture, each service (contract) can synchronously call other services (contracts) via an exposed api.  Composability on Cardano, on the other hand, will more closely resemble an event driven ecosystem (or FRP).  Services will emit events that can be consumed to trigger downstream events.</p>

CC BY-SA 4.0
2022-02-13T16:01:45.980Z
Thanks for the response Matt! So let's say (in the current cardano environment), one of the parameters to my validator function is the total supply of a native asset, are you saying that it is not possible to query the total supply of this native asset from it's policy script? Apologies if my initial question was not quite clear.
Zlac116
CC BY-SA 4.0
2022-12-16T23:39:58.283Z
**Composability on Cardano, on the other hand, will more closely resemble an event driven ecosystem** Can you please elaborate?
sinoTrinity
CC BY-SA 4.0
2022-02-13T15:30:18.597Z
2022-02-13T15:30:18.597Z
Matt Ho
<p>I would like to understand how one can reference an external plutus script in one transaction. In  solidity (for the other script), one can import the contract <code>interface</code> into their script, create an object using the smart contract address and then call the visible functions of the other script (as below).</p>
<pre><code>address token = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
IERC20(token).totalSupply();
</code></pre>
<p>I presume to achieve a similar effect in plutus, you would need to perform this all in the off-chain <code>Contract</code> code? And in order to do all of this you would need both the code for the other script as well as the address?</p>

<plutus><plutus-pioneer-program><smart-contract>
Referencing an external plutus script
# Referencing an external plutus script

(Asked by: username_0 on 2022-02-13)

I would like to understand how one can reference an external plutus script in one transaction. In  solidity (for the other script), one can import the contract interface into their script, create an object using the smart contract address and then call the visible functions of the other script (as below).
address token = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
IERC20(token).totalSupply();

I presume to achieve a similar effect in plutus, you would need to perform this all in the off-chain Contract code? And in order to do all of this you would need both the code for the other script as well as the address?

**Tags:** plutus, plutus-pioneer-program, smart-contract

---

## 1 answers

### Answer by username_1 on 2022-02-13. Score: 3

Reference Scripts, the ability for a transaction to reference scripts from a prior transaction is scheduled to be available later this year, sometime in June I believe. <https://github.com/cardano-foundation/CIPs/pull/161>

However, I'm not sure this will be what you're looking for. In Solidity, smart contracts are like recipes: do X, then do Y, and then do Z. On Cardano, a validator (smart contract) is a function that return a boolean representing whether the provided transaction may spend the funds may, yes or no?

Because of this difference, contract composition will look different. Composability on Solidity resembles a micro service architecture, each service (contract) can synchronously call other services (contracts) via an exposed api. Composability on Cardano, on the other hand, will more closely resemble an event driven ecosystem (or FRP). Services will emit events that can be consumed to trigger downstream events.

> **Comments:**
> **username_0**: Thanks for the response Matt! So let's say (in the current cardano environment), one of the parameters to my validator function is the total supply of a native asset, are you saying that it is not possible to query the total supply of this native asset from it's policy script? Apologies if my initial question was not quite clear.  
> **username_2**: **Composability on Cardano, on the other hand, will more closely resemble an event driven ecosystem** Can you please elaborate?  

---

