-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improved api for stake validators, fixes to coin selection to r…
…equire for collateral in case of withdrawal/ceritificate script witness, improved privnet test now also including stake validator, modified api of `stakeAddressInfo` to now return `Nothing` in case key is not registered Related to #294
- Loading branch information
1 parent
767b8c8
commit bd26908
Showing
19 changed files
with
359 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
{-| | ||
Module : GeniusYield.OnChain.AStakeValidator | ||
Copyright : (c) 2023 GYELD GMBH | ||
License : Apache 2.0 | ||
Maintainer : support@geniusyield.co | ||
Stability : develop | ||
-} | ||
module GeniusYield.OnChain.AStakeValidator | ||
( mkAStakeValidator | ||
) where | ||
|
||
import PlutusLedgerApi.V2 | ||
import PlutusTx.Prelude as PlutusTx | ||
|
||
{-# INLINABLE mkAStakeValidator #-} | ||
mkAStakeValidator :: Address -> BuiltinData -> BuiltinData -> () | ||
mkAStakeValidator addr _ ctx' = case scriptContextPurpose ctx of | ||
Certifying _ -> () | ||
Rewarding _ -> if paidToAddress then () else error () | ||
_ -> error () | ||
where | ||
ctx :: ScriptContext | ||
ctx = unsafeFromBuiltinData ctx' | ||
|
||
info :: TxInfo | ||
info = scriptContextTxInfo ctx | ||
|
||
paidToAddress :: Bool | ||
paidToAddress = any (\o -> txOutAddress o == addr) $ txInfoOutputs info |
25 changes: 25 additions & 0 deletions
25
src-plutustx/GeniusYield/OnChain/AStakeValidator/Compiled.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
{-| | ||
Module : GeniusYield.OnChain.AStakeValidator.Compiled | ||
Copyright : (c) 2023 GYELD GMBH | ||
License : Apache 2.0 | ||
Maintainer : support@geniusyield.co | ||
Stability : develop | ||
-} | ||
module GeniusYield.OnChain.AStakeValidator.Compiled ( | ||
originalAStakeValidator, | ||
) where | ||
|
||
import GeniusYield.OnChain.AStakeValidator | ||
import PlutusCore.Version (plcVersion100) | ||
import qualified PlutusLedgerApi.V2 | ||
import qualified PlutusTx | ||
|
||
originalAStakeValidator | ||
:: PlutusLedgerApi.V2.Address | ||
-> PlutusTx.CompiledCode (PlutusTx.BuiltinData -> PlutusTx.BuiltinData -> ()) | ||
originalAStakeValidator addr = | ||
$$(PlutusTx.compile [|| mkAStakeValidator ||]) | ||
`PlutusTx.unsafeApplyCode` PlutusTx.liftCode plcVersion100 addr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.