Skip to content

Commit

Permalink
Merge pull request #392 from geniusyield/389-gov
Browse files Browse the repository at this point in the history
feat: governance voting & proposal procedures, refactor transaction build sc…
  • Loading branch information
sourabhxyz authored Jan 14, 2025
2 parents 07d9065 + e3fabc0 commit 89f1962
Show file tree
Hide file tree
Showing 47 changed files with 845 additions and 291 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* Adds additional certificates such as those related to governance, drep participation, stake pool registration, etc.
* Tracks node version 10.1.3 and corresponding updated CLB version.
* Update default value of `GYAwaitTxParameters` to now have 100 max attempts.
* `GYInScript` and `GYStakeValScript` are now defined as a type synonyms around `GYBuildPlutusScript` whereas `GYMintScript` is a type synonym around `GYBuildScript` which now also includes simple scripts (besides plutus scripts). Pattern synonyms are provided for backwards compatibility. These and related functions such as `stakeValidatorVersionFromWitness`, `gyStakeValScriptToSerialisedScript` are now exported from `GeniusYield.Types.BuildScript` instead of `GeniusYield.Types.Script`.
* `GYTxWdrlWitness`, `GYTxCertWitness` are now defined as a type synonyms around generic `GYTxBuildWitness` and now also includes simple scripts. Pattern synonyms are provided to maintain backwards compatibility.
* Adds support for governance actions, namely proposal procedures & voting procedures.

## 0.7.0

Expand Down
5 changes: 5 additions & 0 deletions atlas-cardano.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ common common
LambdaCase
MultiWayIf
OverloadedStrings
PatternSynonyms
RecordWildCards
RoleAnnotations
TypeFamilyDependencies
Expand Down Expand Up @@ -129,13 +130,16 @@ library
GeniusYield.Types.Blueprint.Schema
GeniusYield.Types.Blueprint.TH
GeniusYield.Types.Blueprint.Validator
GeniusYield.Types.BuildScript
GeniusYield.Types.BuildWitness
GeniusYield.Types.Certificate
GeniusYield.Types.Credential
GeniusYield.Types.Datum
GeniusYield.Types.Delegatee
GeniusYield.Types.DRep
GeniusYield.Types.Epoch
GeniusYield.Types.Era
GeniusYield.Types.Governance
GeniusYield.Types.KeyHash
GeniusYield.Types.Key
GeniusYield.Types.Key.Class
Expand Down Expand Up @@ -371,6 +375,7 @@ test-suite atlas-privnet-tests
GeniusYield.Test.Privnet.Blueprint
GeniusYield.Test.Privnet.Committee
GeniusYield.Test.Privnet.DRep
GeniusYield.Test.Privnet.Gov
GeniusYield.Test.Privnet.SimpleScripts
GeniusYield.Test.Privnet.Stake
GeniusYield.Test.Privnet.Stake.Key
Expand Down
2 changes: 1 addition & 1 deletion src/GeniusYield/Api/TestTokens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ mintTestTokens tn amt = do

let txSkeleton =
mustHaveInput (GYTxIn utxo GYTxInWitnessKey)
<> mustMint (GYMintScript policy) unitRedeemer tn amt'
<> mustMint (GYBuildPlutusScript $ GYBuildPlutusScriptInlined policy) unitRedeemer tn amt'

return (GYToken (mintingPolicyId policy) tn, txSkeleton)
1 change: 0 additions & 1 deletion src/GeniusYield/Imports.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE PatternSynonyms #-}
{-# OPTIONS_GHC -Wno-orphans #-}

{- |
Expand Down
1 change: 0 additions & 1 deletion src/GeniusYield/Providers/Blockfrost.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import Data.Time.Clock.POSIX qualified as Time
import GeniusYield.Imports
import GeniusYield.Providers.Common
import GeniusYield.Types
import GeniusYield.Types.ProtocolParameters (ApiProtocolParameters)
import GeniusYield.Utils (serialiseToBech32WithPrefix)
import Money qualified
import Ouroboros.Consensus.HardFork.History (EraParams (eraGenesisWin))
Expand Down
1 change: 0 additions & 1 deletion src/GeniusYield/Providers/Maestro.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import GHC.Natural (wordToNatural)
import GeniusYield.Imports
import GeniusYield.Providers.Common
import GeniusYield.Types
import GeniusYield.Types.ProtocolParameters (ApiProtocolParameters)
import Maestro.Client.V1 qualified as Maestro
import Maestro.Client.V1.Accounts qualified as Maestro
import Maestro.Types.V1 qualified as Maestro
Expand Down
1 change: 0 additions & 1 deletion src/GeniusYield/Providers/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import Data.Text qualified as Txt
import GeniusYield.CardanoApi.Query
import GeniusYield.Providers.Common (SubmitTxException (SubmitTxException), makeLastEraEndUnbounded)
import GeniusYield.Types
import GeniusYield.Types.ProtocolParameters (ApiProtocolParameters)
import Ouroboros.Network.Protocol.LocalTxSubmission.Type (SubmitResult (..))

-------------------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions src/GeniusYield/Test/Privnet/Examples/Gift.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternSynonyms #-}

{- |
Module : GeniusYield.Test.Privnet.Examples.Gift
Expand Down Expand Up @@ -610,7 +609,7 @@ grabGifts validator = do
{ gyTxInTxOutRef = oref
, gyTxInWitness =
GYTxInWitnessScript
(GYInScript validator)
(GYBuildPlutusScriptInlined validator)
(datumFromPlutus' od)
unitRedeemer
}
Expand Down Expand Up @@ -639,7 +638,7 @@ grabGiftsRef ref validator = do
{ gyTxInTxOutRef = oref
, gyTxInWitness =
GYTxInWitnessScript
(GYInReference ref $ validatorToScript validator)
(GYBuildPlutusScriptReference ref $ validatorToScript validator)
(datumFromPlutus' od)
unitRedeemer
}
Expand Down
2 changes: 1 addition & 1 deletion src/GeniusYield/Test/Privnet/Examples/Misc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tests setup =
txBodyMint <-
buildTxBody $
mustHaveInput (GYTxIn utxoAsParam GYTxInWitnessKey)
<> mustMint (GYMintReference refScript policyAsScript) unitRedeemer tn amt
<> mustMint (GYBuildPlutusScript $ GYBuildPlutusScriptReference refScript policyAsScript) unitRedeemer tn amt
signAndSubmitConfirmed_ txBodyMint

-- wait a tiny bit.
Expand Down
4 changes: 2 additions & 2 deletions src/GeniusYield/Test/Privnet/Examples/Oracle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ tests setup =
{ gyTxInTxOutRef = ref
, gyTxInWitness =
GYTxInWitnessScript
(GYInScript @PlutusV2 readOracleValidatorV2)
(GYBuildPlutusScriptInlined @PlutusV2 readOracleValidatorV2)
(datumFromPlutusData (d :: ()))
unitRedeemer
}
Expand Down Expand Up @@ -107,7 +107,7 @@ tests setup =
{ gyTxInTxOutRef = ref
, gyTxInWitness =
GYTxInWitnessScript
(GYInScript @PlutusV2 readOracleValidatorV2)
(GYBuildPlutusScriptInlined @PlutusV2 readOracleValidatorV2)
(datumFromPlutusData (d :: ()))
unitRedeemer
}
Expand Down
2 changes: 1 addition & 1 deletion src/GeniusYield/Test/Privnet/Examples/Treat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ grabTreats validator = do
{ gyTxInTxOutRef = oref
, gyTxInWitness =
GYTxInWitnessScript
(GYInScript validator)
(GYBuildPlutusScriptInlined validator)
(datumFromPlutus' od)
unitRedeemer
}
Expand Down
4 changes: 1 addition & 3 deletions src/GeniusYield/Test/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE PatternSynonyms #-}

{- |
Module : GeniusYield.Test.Utils
Copyright : (c) 2023 GYELD GMBH
Expand Down Expand Up @@ -218,7 +216,7 @@ mintTestAssets tokens = do
buildTxBody @PlutusV2 $
foldMap
( \(tk, amt) ->
mustMint (GYMintScript $ fakePolicy tk) unitRedeemer (fakeCoinName tk) $ toInteger amt
mustMint (GYBuildPlutusScript $ GYBuildPlutusScriptInlined $ fakePolicy tk) unitRedeemer (fakeCoinName tk) $ toInteger amt
)
tokens
signAndSubmitConfirmed_ txBody
Expand Down
Loading

0 comments on commit 89f1962

Please sign in to comment.