我在Plutus Playground中尝试了一些代码,但发现编译错误。有任何纠正的想法吗?我正在使用代码示例。地址分配似乎有所变化。我在其他地方看到了相同的错误。
module MyFirstPlutusSmartContract where
import qualified Language.PlutusTx as PlutusTx
import qualified Language.PlutusTx.Prelude as P
import Ledger
import Wallet
import Ledger.Validation
import Playground.Contract
myFirstValidator :: ValidatorScript
myFirstValidator = ValidatorScript (fromCompiledCode $$(PlutusTx.compile
[|| \(submittedPIN :: Int) (myPIN :: Int) (p :: PendingTx') ->
if submittedPIN == myPIN
then ()
else $$(P.error) ($$(P.traceH) "Please supply the correct PIN number to withdraw ada." ())
||]))
smartContractAddress :: Address'
smartContractAddress = scriptAddress myFirstValidator
watchSmartContract :: MockWallet ()
watchSmartContract = startWatching smartContractAddress
depositADA :: Int -> Value -> MockWallet ()
depositADA pin val = payToScript_ smartContractAddress val (DataScript (lifted pin))
withdrawADA :: Int -> MockWallet ()
withdrawADA pin = collectFromScript myFirstValidator (RedeemerScript
(lifted pin))
$(mkFunction 'watchSmartContract)
$(mkFunction 'depositADA)
$(mkFunction 'withdrawADA)
错误-
Line 13, Column 53:
error:
• Not in scope: type constructor or class ‘PendingTx'’
Line 19, Column 25:
error:
Not in scope: type constructor or class ‘Address'’
Perhaps you meant one of these:
‘Address’ (imported from Ledger),
‘AddressOf’ (imported from Ledger)
|
19 | smartContractAddress :: Address'
| ^^^^^^^^