generate purescript stuff
This commit is contained in:
parent
70367702fb
commit
8c5f10279e
7 changed files with 478 additions and 0 deletions
103
agora-purescript-bridge/src/Agora/Stake.purs
Normal file
103
agora-purescript-bridge/src/Agora/Stake.purs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
-- File auto generated by purescript-bridge! --
|
||||
module Agora.Stake where
|
||||
|
||||
import Prelude
|
||||
|
||||
import Agora.Proposal (ProposalId, ResultTag)
|
||||
import Agora.SafeMoney (GTTag)
|
||||
import Data.Generic.Rep (class Generic)
|
||||
import Data.Lens (Iso', Lens', Prism', iso, prism')
|
||||
import Data.Lens.Iso.Newtype (_Newtype)
|
||||
import Data.Lens.Record (prop)
|
||||
import Data.Maybe (Maybe(..))
|
||||
import Data.Newtype (class Newtype)
|
||||
import Data.Tagged (Tagged)
|
||||
import GHC.Num.Integer (Integer)
|
||||
import Plutus.V1.Ledger.Crypto (PubKeyHash)
|
||||
import Plutus.V1.Ledger.Value (AssetClass)
|
||||
import Type.Proxy (Proxy(Proxy))
|
||||
|
||||
newtype Stake = Stake
|
||||
{ gtClassRef :: Tagged GTTag AssetClass
|
||||
, proposalSTClass :: AssetClass
|
||||
}
|
||||
|
||||
derive instance Generic Stake _
|
||||
|
||||
derive instance Newtype Stake _
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
_Stake :: Iso' Stake {gtClassRef :: Tagged GTTag AssetClass, proposalSTClass :: AssetClass}
|
||||
_Stake = _Newtype
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
newtype ProposalLock = ProposalLock
|
||||
{ vote :: ResultTag
|
||||
, proposalId :: ProposalId
|
||||
}
|
||||
|
||||
derive instance Generic ProposalLock _
|
||||
|
||||
derive instance Newtype ProposalLock _
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
_ProposalLock :: Iso' ProposalLock {vote :: ResultTag, proposalId :: ProposalId}
|
||||
_ProposalLock = _Newtype
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
data StakeRedeemer
|
||||
= DepositWithdraw (Tagged GTTag Integer)
|
||||
| Destroy
|
||||
| PermitVote ProposalLock
|
||||
| RetractVotes (Array ProposalLock)
|
||||
| WitnessStake
|
||||
|
||||
derive instance Generic StakeRedeemer _
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
_DepositWithdraw :: Prism' StakeRedeemer (Tagged GTTag Integer)
|
||||
_DepositWithdraw = prism' DepositWithdraw case _ of
|
||||
(DepositWithdraw a) -> Just a
|
||||
_ -> Nothing
|
||||
|
||||
_Destroy :: Prism' StakeRedeemer Unit
|
||||
_Destroy = prism' (const Destroy) case _ of
|
||||
Destroy -> Just unit
|
||||
_ -> Nothing
|
||||
|
||||
_PermitVote :: Prism' StakeRedeemer ProposalLock
|
||||
_PermitVote = prism' PermitVote case _ of
|
||||
(PermitVote a) -> Just a
|
||||
_ -> Nothing
|
||||
|
||||
_RetractVotes :: Prism' StakeRedeemer (Array ProposalLock)
|
||||
_RetractVotes = prism' RetractVotes case _ of
|
||||
(RetractVotes a) -> Just a
|
||||
_ -> Nothing
|
||||
|
||||
_WitnessStake :: Prism' StakeRedeemer Unit
|
||||
_WitnessStake = prism' (const WitnessStake) case _ of
|
||||
WitnessStake -> Just unit
|
||||
_ -> Nothing
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
newtype StakeDatum = StakeDatum
|
||||
{ stakedAmount :: Tagged GTTag Integer
|
||||
, owner :: PubKeyHash
|
||||
, lockedBy :: Array ProposalLock
|
||||
}
|
||||
|
||||
derive instance Generic StakeDatum _
|
||||
|
||||
derive instance Newtype StakeDatum _
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
_StakeDatum :: Iso' StakeDatum {stakedAmount :: Tagged GTTag Integer, owner :: PubKeyHash, lockedBy :: Array ProposalLock}
|
||||
_StakeDatum = _Newtype
|
||||
Loading…
Add table
Add a link
Reference in a new issue