store proposal timing conf in the governor datum
This commit is contained in:
parent
50bf78aae8
commit
fbe3edc45a
7 changed files with 32 additions and 30 deletions
|
|
@ -67,13 +67,13 @@ import Agora.Stake (
|
|||
import Sample.Shared (
|
||||
authorityTokenSymbol,
|
||||
defaultProposalThresholds,
|
||||
defaultProposalTimingConfig,
|
||||
govAssetClass,
|
||||
govSymbol,
|
||||
govValidatorAddress,
|
||||
gstUTXORef,
|
||||
minAda,
|
||||
proposalPolicySymbol,
|
||||
proposalTimingConfig,
|
||||
proposalValidatorAddress,
|
||||
signer,
|
||||
signer2,
|
||||
|
|
@ -114,6 +114,7 @@ mintGST =
|
|||
GovernorDatum
|
||||
{ proposalThresholds = defaultProposalThresholds
|
||||
, nextProposalId = ProposalId 0
|
||||
, proposalTimings = defaultProposalTimingConfig
|
||||
}
|
||||
governorOutputDatum :: Datum
|
||||
governorOutputDatum = Datum $ toBuiltinData governorOutputDatum'
|
||||
|
|
@ -207,6 +208,7 @@ createProposal =
|
|||
GovernorDatum
|
||||
{ proposalThresholds = defaultProposalThresholds
|
||||
, nextProposalId = thisProposalId
|
||||
, proposalTimings = defaultProposalTimingConfig
|
||||
}
|
||||
governorInputDatum :: Datum
|
||||
governorInputDatum = Datum $ toBuiltinData governorInputDatum'
|
||||
|
|
@ -236,7 +238,7 @@ createProposal =
|
|||
, cosigners = [signer]
|
||||
, thresholds = defaultProposalThresholds
|
||||
, votes = emptyVotesFor effects
|
||||
, timingConfig = proposalTimingConfig
|
||||
, timingConfig = defaultProposalTimingConfig
|
||||
, startingTime = tmpProposalStartingTime
|
||||
}
|
||||
)
|
||||
|
|
@ -378,6 +380,7 @@ mintGATs =
|
|||
GovernorDatum
|
||||
{ proposalThresholds = defaultProposalThresholds
|
||||
, nextProposalId = ProposalId 5
|
||||
, proposalTimings = defaultProposalTimingConfig
|
||||
}
|
||||
governorInputDatum :: Datum
|
||||
governorInputDatum = Datum $ toBuiltinData governorInputDatum'
|
||||
|
|
@ -412,7 +415,7 @@ mintGATs =
|
|||
, cosigners = [signer, signer2]
|
||||
, thresholds = defaultProposalThresholds
|
||||
, votes = proposalVotes
|
||||
, timingConfig = proposalTimingConfig
|
||||
, timingConfig = defaultProposalTimingConfig
|
||||
, startingTime = tmpProposalStartingTime
|
||||
}
|
||||
proposalInputDatum :: Datum
|
||||
|
|
@ -565,6 +568,7 @@ mutateState =
|
|||
GovernorDatum
|
||||
{ proposalThresholds = defaultProposalThresholds
|
||||
, nextProposalId = ProposalId 5
|
||||
, proposalTimings = defaultProposalTimingConfig
|
||||
}
|
||||
governorInputDatum :: Datum
|
||||
governorInputDatum = Datum $ toBuiltinData governorInputDatum'
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import Plutus.V1.Ledger.Value qualified as Value
|
|||
--------------------------------------------------------------------------------
|
||||
|
||||
import Agora.Governor (
|
||||
GovernorDatum (GovernorDatum, nextProposalId, proposalThresholds),
|
||||
GovernorDatum (..),
|
||||
)
|
||||
import Agora.Proposal (
|
||||
Proposal (..),
|
||||
|
|
@ -79,7 +79,7 @@ proposalCreation =
|
|||
, cosigners = [signer]
|
||||
, thresholds = defaultProposalThresholds
|
||||
, votes = emptyVotesFor effects
|
||||
, timingConfig = proposalTimingConfig
|
||||
, timingConfig = defaultProposalTimingConfig
|
||||
, startingTime = tmpProposalStartingTime
|
||||
}
|
||||
)
|
||||
|
|
@ -91,6 +91,7 @@ proposalCreation =
|
|||
GovernorDatum
|
||||
{ proposalThresholds = defaultProposalThresholds
|
||||
, nextProposalId = ProposalId 0
|
||||
, proposalTimings = defaultProposalTimingConfig
|
||||
}
|
||||
)
|
||||
govAfter :: Datum
|
||||
|
|
@ -100,6 +101,7 @@ proposalCreation =
|
|||
GovernorDatum
|
||||
{ proposalThresholds = defaultProposalThresholds
|
||||
, nextProposalId = ProposalId 1
|
||||
, proposalTimings = defaultProposalTimingConfig
|
||||
}
|
||||
)
|
||||
in ScriptContext
|
||||
|
|
@ -174,7 +176,7 @@ cosignProposal newSigners =
|
|||
, cosigners = [signer]
|
||||
, thresholds = defaultProposalThresholds
|
||||
, votes = emptyVotesFor effects
|
||||
, timingConfig = proposalTimingConfig
|
||||
, timingConfig = defaultProposalTimingConfig
|
||||
, startingTime = tmpProposalStartingTime
|
||||
}
|
||||
stakeDatum :: StakeDatum
|
||||
|
|
@ -185,7 +187,7 @@ cosignProposal newSigners =
|
|||
validTimeRange =
|
||||
closedBoundedInterval
|
||||
10
|
||||
(proposalTimingConfig.draftTime - 10)
|
||||
(defaultProposalTimingConfig.draftTime - 10)
|
||||
in TxInfo
|
||||
{ txInfoInputs =
|
||||
[ TxInInfo
|
||||
|
|
@ -295,7 +297,7 @@ voteOnProposal params =
|
|||
, cosigners = [stakeOwner]
|
||||
, thresholds = defaultProposalThresholds
|
||||
, votes = ProposalVotes initialVotes
|
||||
, timingConfig = proposalTimingConfig
|
||||
, timingConfig = defaultProposalTimingConfig
|
||||
, startingTime = tmpProposalStartingTime
|
||||
}
|
||||
proposalInputDatum :: Datum
|
||||
|
|
@ -384,7 +386,7 @@ voteOnProposal params =
|
|||
---
|
||||
|
||||
validTimeRange =
|
||||
closedBoundedInterval (proposalTimingConfig.draftTime + 1) (proposalTimingConfig.votingTime - 1)
|
||||
closedBoundedInterval (defaultProposalTimingConfig.draftTime + 1) (defaultProposalTimingConfig.votingTime - 1)
|
||||
in TxInfo
|
||||
{ txInfoInputs =
|
||||
[ TxInInfo proposalRef proposalInput
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ module Sample.Shared (
|
|||
proposalPolicySymbol,
|
||||
proposalValidatorHash,
|
||||
proposalValidatorAddress,
|
||||
proposalTimingConfig,
|
||||
defaultProposalTimingConfig,
|
||||
tmpProposalStartingTime,
|
||||
|
||||
-- ** Authority
|
||||
|
|
@ -190,8 +190,8 @@ authorityToken = authorityTokenFromGovernor governor
|
|||
authorityTokenSymbol :: CurrencySymbol
|
||||
authorityTokenSymbol = authorityTokenSymbolFromGovernor governor
|
||||
|
||||
proposalTimingConfig :: ProposalTimingConfig
|
||||
proposalTimingConfig =
|
||||
defaultProposalTimingConfig :: ProposalTimingConfig
|
||||
defaultProposalTimingConfig =
|
||||
ProposalTimingConfig
|
||||
{ draftTime = 50
|
||||
, votingTime = 1000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue