apply Emily's suggestions

* add `PMaxTimeRangeWidth`
* several `Default` instances for testing
* a bunch of docstrings
* fix the tests/samples
This commit is contained in:
fanghr 2022-05-25 21:07:09 +08:00
parent c6c93f587a
commit 6f9de51541
12 changed files with 142 additions and 75 deletions

View file

@ -37,13 +37,17 @@ import Agora.Proposal (
ProposalId (ProposalId),
ProposalThresholds,
)
import Agora.Proposal.Time (PProposalTimingConfig, ProposalTimingConfig)
import Agora.Proposal.Time (
MaxTimeRangeWidth,
PMaxTimeRangeWidth,
PProposalTimingConfig,
ProposalTimingConfig,
)
import Agora.SafeMoney (GTTag)
import Agora.Utils (tclet)
--------------------------------------------------------------------------------
import Plutarch.Api.V1 (PPOSIXTime)
import Plutarch.DataRepr (
DerivePConstantViaData (..),
PDataFields,
@ -56,7 +60,7 @@ import Plutarch.Unsafe (punsafeCoerce)
--------------------------------------------------------------------------------
import Plutus.V1.Ledger.Api (POSIXTime, TxOutRef)
import Plutus.V1.Ledger.Api (TxOutRef)
import Plutus.V1.Ledger.Value (AssetClass (..))
import PlutusTx qualified
@ -71,7 +75,7 @@ data GovernorDatum = GovernorDatum
, proposalTimings :: ProposalTimingConfig
-- ^ The timing configuration for proposals.
-- Will get copied over upon the creation of proposals.
, createProposalTimeRangeMaxDuration :: POSIXTime
, createProposalTimeRangeMaxWidth :: MaxTimeRangeWidth
-- ^ The maximum valid duration of a transaction that creats a proposal.
}
deriving stock (Show, GHC.Generic)
@ -126,7 +130,7 @@ newtype PGovernorDatum (s :: S) = PGovernorDatum
'[ "proposalThresholds" ':= PProposalThresholds
, "nextProposalId" ':= PProposalId
, "proposalTimings" ':= PProposalTimingConfig
, "createProposalTimeRangeMaxDuration" ':= PPOSIXTime
, "createProposalTimeRangeMaxWidth" ':= PMaxTimeRangeWidth
]
)
}