Skip to content

Commit

Permalink
Create proposal and vote (#52)
Browse files Browse the repository at this point in the history
* add governance policy

* create governance tokens

* use mustPayToPubKeyAddress for governance tokens

* start governance with protocol

* format

* fix proposal modules names

* mint gov tokens from Nami

* add duration field to governance

* add CreateProposal

* add governanceScriptinfo

* fix CreateProposal

* fix reference ver token

* update scripts

* add vote validator

* fix create proposal redeemer

* dist

* rm unused function

* refactor script info

* make fmt

* fix according to onchain

* add check gov tokens in wallet
  • Loading branch information
olgaklimenko authored Aug 24, 2023
1 parent 1cfc7ae commit cd25ffa
Show file tree
Hide file tree
Showing 39 changed files with 1,379 additions and 42 deletions.
1 change: 1 addition & 0 deletions conf/governance.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"governanceTokenName":"DonatPool_governance_testnet","governanceCurrency":"77e817f46569ad3026fc419fe01623eff862dbb4d4e7c60c4740a19e"}
2 changes: 1 addition & 1 deletion dist/535.index.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions exe/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import Fundraising.Create as CreateFundraising
import Fundraising.Donate as Donate
import Fundraising.ReceiveFunds as ReceiveFunds
import Fundraising.UserData (CreateFundraisingParams, FundraisingData)
import Governance.MintGovernanceTokens as GovTokens
import Info.AllFundraisings as AllFundraisings
import Info.AppInfo as AppInfo
import Info.UserData (AppInfo, FundraisingInfo)
import Info.UserRelatedFundraisings as UserRelatedFundraisings
import Management.Proposal.UserData (ProposalInfo, VoteData)
import Proposal.Create as CreateProposal
import Proposal.Model (PProposalParameters)
import Proposal.Vote as Vote
import Protocol.UserData (ProtocolData)
import Shared.NetworkData (NetworkParams)

Expand All @@ -22,6 +27,9 @@ data Contracts = Contracts
, receiveFunds :: (Unit -> Effect Unit) -> (String -> Effect Unit) -> ProtocolData -> NetworkParams -> FundraisingData -> Effect Unit
, getAllFundraisings :: (Array FundraisingInfo -> Effect Unit) -> (String -> Effect Unit) -> ProtocolData -> NetworkParams -> Effect Unit
, getUserRelatedFundraisings :: (Array FundraisingInfo -> Effect Unit) -> (String -> Effect Unit) -> ProtocolData -> NetworkParams -> Effect Unit
, mintGovernanceTokens :: (Unit -> Effect Unit) -> (String -> Effect Unit) -> NetworkParams -> Effect Unit
, createProposal :: (ProposalInfo -> Effect Unit) -> (String -> Effect Unit) -> ProtocolData -> PProposalParameters -> NetworkParams -> Effect Unit
, vote :: (Unit -> Effect Unit) -> (String -> Effect Unit) -> ProtocolData -> VoteData -> NetworkParams -> Effect Unit
}

main :: Contracts
Expand All @@ -32,4 +40,8 @@ main = Contracts
, receiveFunds: ReceiveFunds.runReceiveFunds
, getAllFundraisings: AllFundraisings.runGetAllFundraisings
, getUserRelatedFundraisings: UserRelatedFundraisings.runGetUserRelatedFundraisings
, mintGovernanceTokens: GovTokens.runMintGovernanceTokens
, createProposal: CreateProposal.runCreateProposal
, vote: Vote.runVote
}

5 changes: 5 additions & 0 deletions scripts/governance.plutus
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cborHex": "59166b59166801000032323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232322222323232323232323232323232323253330463370e66606800a6eb8c130c100049220113446f6e6174506f6f6c476f7665726e616e636500480084c8c8c8c8c8c8c8c8c94ccc13cc8ccc1400052825153301d3375e60aa01060aa0082a6603a66ebcc15401cc15400c54cc074cdd7982a803182a8010a9980e99baf3055005305500113375e60aa60a800a60aa60a80022646464646464a6660aa66e24088dd6982d8020a99982a99b87001337000446eb4c16c0104c8c94ccc15ccc0b400800454ccc15ccdc39998229bab305d30273051005375c60ba02606490010a99982b99b87333045375660ba604e60a200a6eb8c1740480e12002132323232323232323232323253330633305a30690073069021153330633375e60d200660d20262a6660c6a6606266ebcc1a4018dd424000266ebcc1a4014dd4240002a6660c666460b244a6660ce002294054cc190c00cc1b00044c008c1ac0048cdd79835182f00098350029bac3069305d3069305d02c153330633375e60d260d00026ea120001325333064332305a22533306800114a02a6660ce66ebcc1b400400c5288980118360009ba93232323253330683370e90010010a99837a490333313200161375c60dc00260e000460e00026ea8c1acc17c004c1a800cdd61835191835183518351835181a800982f0008a9998321982d9981b1835183480f98350011981b1835183480f9991191ba8337006eb4008dd68009ba83370466e080092078483403cdd69835182818348099835183480f899191919191929998351983081a8028992999835998208150008a4c2a660e4921033831330016375660e060de60c800c2a660e2920103383132001653330693370e90000010991919191919191919299983929983819b87001480004cdc3800a40702646464a6660ea66e24dc6800a40802646464646493299983d0008a4c2a66100020f62c60fa0066eb4004c1f0004c1e800c54cc1f01e058dd7000983c800983b8020a9983c83b0b1b8d001375c00260ea00260e60066eb4004c1c8004c1c000cdd680098378008a998380388b183880118388009baa001304e0013047333222333305a003001233055305e32306f3063001306e306d3062001003153306e4912063616e27742067657420616e7920636f6e74696e75696e67206f757470757473001632375860d660be00260d460bc05a646eb0c1acc144c17c004c1a8c1780b4c1700b454cc1ad240104313331350016153306b4910338303500163069305d02c153306a4901033831340016153306a491115554784f206e6f7420636f6e73756d65640016153306a491033831300016153306a491033830390016153306a4910338303800163067001306600130650013064001306300130620013056005533305b3370e900000109919191919191919191919191919191919191919191919191919191919299983c19b89480000044c8c8c8c8c926533307d001149854cc20c041f858c2000400cdd6800983f800983e8018a9983f8398b1bad001307c001307a00653330743370e900000109919191919191919191919191924ca666102020022930a9984380841008b184200803299983f19b87480000084c8c8c8c8c8c8c926533308501001149854cc22c042180458c220040194ccc20804cdc3a4000004264646464646464932999844808008a4c2a6611e02114022c61180200ca66610c0266e1d2000002132325333088013370e6e340052038132324994ccc2280400452615330900108b0116308d01003153308f010840116375c0026118020022a66610c0266e1d2002002132325333088013370e6e340052038132324994ccc2280400452615330900108b0116308d01003153308f010850116375c0026118020022a6611a0211c022c611c02004611c020026ea8004c2200400454ccc20804cdc3a4004004264646464646464646464932999846008008a4c2a661240211a022c611e020066eb4004c23804004c2300400cdd68009845808009844808019bad00130880100115330890108a0116308a01002308a0100137540026108020022a6660fc66e1d20020021324994ccc1fc00452615330850108001161533085010860116308601002308601001375400261000200260fc00ca6660f066e1d200000213232533307a3370e6e340052038132324994ccc1f000452615330820107d16307f00315330810107616375c00260fc0022a6660f066e1d200200213232533307a3370e6e340052038132324994ccc1f000452615330820107d16307f00315330810107716375c00260fc0022a660fe100022c6100020046100020026ea8004c1e800454cc1ec1f058c1f0008c1f0004dd5000983b000983a0019bad00130730013071006533306b3370e900000109919299983699b873077001480004c94ccc1b8cdd79ba705f374e60e6002264a6660de66e1cdc6800a40802646464646493299983a0008a4c2a660f40ea2c60ee0066eb4004c1d8004c1d001454cc1d815458dd7183a0008a9983a82a8b183b0008a9983a02a8b1baa001307100115330720731630730023073001375400260da00260d60066eb4004c1a8004c1a000cdd680098338009832803299982f99b87480000084c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c926533306f001149854cc1d41c058c1c800cdd6800983880098378019bad001306e001306c003375a00260d600260d20066eb4004c1a0004c19800cdd680098328008a998330338b183380118338009baa001306100115330620631630630023063001375400260800102a660bc921033831370016153305e491033831360016153305e49103383037001632332302f233300237560024644460040066e9800448940048c94ccc164d5d180089128008911801001998179299982c99baf0013750900009128008911801001800800999119991818911ba63300337560046eac00488ccc0c888dd419b80375a0046eb4004008004008004ccc0c8dd7182e009018a40046660646eb8c1700440dd20025333056002100213330553375e60be60b60046ea40dcc16800800854cc171241033830360016153305c49103383034001653330550011480004ccc150cdd7982f182d0009ba9036375a60ba60b46eacc174c1680052000375660b260b0609a00860b0609803660ac00260940366460666607a608c002646eb0c15cc0f4c12c004c158c128064c15403054cc159240103383032001630530013052001305100130453051009304f001304e001304d00130410013232323232323035005533304b3370e900000109919191919191919191919191919191919191919191919191919191924ca6660ce0022930a998368340b1835003299983219b87480000084c8c94ccc198cdc39838000a4000264a6660ce66ebcdd382c1ba7306c00113253330683370e6e340052040132323232324994ccc1b4004526153307306e163070003375a00260de00260da00a2a660de09c2c6eb8c1b400454cc1b813858c1bc00454cc1b413858dd500098350008a998358360b183600118360009baa00130660013064006533305e3370e900000109919191919191919191919191924ca6660d60022930a998388360b1837003299983419b87480000084c8c8c8c8c8c8c926533306f001149854cc1d41c058c1c80194ccc1b0cdc3a40000042646464646464649329998398008a4c2a660f20e82c60ec00ca6660e066e1d20000021323253330723370e6e340052038132324994ccc1d0004526153307a075163077003153307906e16375c00260ec0022a6660e066e1d20020021323253330723370e6e340052038132324994ccc1d0004526153307a075163077003153307906f16375c00260ec0022a660ee0f02c60f000460f00026ea8004c1c800454ccc1b0cdc3a400400426464646464646464646493299983b0008a4c2a660f80ee2c60f20066eb4004c1e0004c1d800cdd6800983a80098398019bad001307200115330730741630740023074001375400260dc0022a6660d066e1d20020021324994ccc1a4004526153306f06a16153306f0701630700023070001375400260d400260d000ca6660c466e1d20000021323253330643370e6e340052038132324994ccc198004526153306c067163069003153306b06016375c00260d00022a6660c466e1d20020021323253330643370e6e340052038132324994ccc198004526153306c067163069003153306b06116375c00260d00022a660d20d42c60d400460d40026ea8004c19000454cc19419858c198008c198004dd50009830000982f0019bad001305d001305b003375a00260b400260b00066eb4004c15c004c15400cdd6800982a00098290019bad0013051001153305205316305300230530013754606200266644464a6660980022a660a4921033331300016132533304d001130520021533053490103333131001630500013303723370e6660726eacc144c140c11400401000d2002332304022533304e001103e13303f3003305300130023052001230513050304500132375860a260a0608a00260a060880026eb8c134004dd71826982600080818200090a99826a481033830310016304a00130490013048001303c00c3756608e608c607600264608e608c60760026666066646eb0c11cc0ec004c118c0e8024c0e0024800454cc11d241033330350016533303f3370e90000010991919191919191919191919191919299982729982619b87001480004cdc3800a4070264646464a6660a4a660a066e1c005200013370e002901c0991919299982a99b89480000044c8c9265333057001149854cc17416058c16800c54cc17014058dd6800982c800982b8020a9982c82b0b1b8d001375c00260aa00260a60082a660aa0a42c6e34004dd700098288009827803299982499b87480000084c8c8c8c8c8c8c8c8c8c8c8c8c9265333056001149854cc17015c58c1640194ccc14ccdc3a400000426464646464646493299982d0008a4c2a660c00b62c60ba00ca6660ae66e1d20000021323232323232324994ccc178004526153306405f163061006533305b3370e900000109919299982e99b87371a002901c0991924ca6660be0022930a998328300b18310018a9983202c8b1bae00130610011533305b3370e900100109919299982e99b87371a002901c0991924ca6660be0022930a998328300b18310018a9983202d0b1bae001306100115330620631630630023063001375400260ba0022a6660ae66e1d20020021323232323232323232324994ccc1840045261533067062163064003375a00260c600260c20066eb4004c180004c17800cdd6800982e8008a9982f02f8b182f801182f8009baa0013059001153330533370e900100109924ca6660a80022930a9982d02a8b0a9982d02d8b182d801182d8009baa00130550013053006533304d3370e900000109919299982799b87371a002901c0991924ca6660a20022930a9982b8290b182a0018a9982b0258b1bae00130530011533304d3370e900100109919299982799b87371a002901c0991924ca6660a20022930a9982b8290b182a0018a9982b0260b1bae0013053001153305405516305500230550013754002609e0022a660a00a22c60a200460a20026ea8004c12c004c1240194ccc10ccdc3a40000042646464646464646464646464646464649329998298008a4c2a660b20a82c60ac0066eb4004c154004c14c00cdd6800982900098280019bad001304f001304d003375a002609800260940066eb4004c12400454cc12812c58c12c008c12c004dd500098228008a998230238b182380118238009baa006533303b3370e90000010991919191919191919299982229982119b87001480004cdc3800a40702646464a66608e66e24dc6800a4080264646464649329998260008a4c2a660a409a2c609e0066eb4004c138004c13000c54cc13812858dd7000982580098248020a998258240b1b8d001375c002608e002608a0066eb4004c110004c10800cdd680098208008a998210218b182180118218009baa003482024bd00488ccc0d000800400c5281181b18010009181a980e000911980199ba548008cc088008084cdd2a400466044002042446600666e95200033021002330210040203374a900019810800998108020101119ba548000cc080008cc08000407d300103d87a8000223375e6e98008dd300091198101129998170008806899199802981b981a00111981099bb0303930350030010021001300230320010012223333004003220020020012301d3002001223232233001003002222533302d00113301e0030021323232533302f3375e00400226604266ec0008cc024c0e0018c0e000cccc02088008014c0d001054ccc0bccdc81bae002375c00226604200c666601044002006606800800a26604200666660104400200c00a60680086070004606e008606400244a666056004200226666006440026060004605e00400291010a50726f706f73616c49640022253330273370e002900008038998020019980280100091198021ba9002374c00244660066ea4008dd4000911980a99bb00020010034bd6f7b63024411050726f706f73616c5665726966696564004881002533301f00115330250021613253330200011302500215330260041630230014910333303600490103333037004901257074727946726f6d2854784964293a206d757374206265203332206279746573206c6f6e670049012a7074727946726f6d2854784964293a20636f6e7374727563746f72206669656c6473206c656e203e2031004901267074727946726f6d2854784964293a20696e76616c696420636f6e7374727563746f72206964002323232533301b3370e90010010a998110028b0a99980d99b87480100084c08400454cc08801858c08c008c08c004dd5180f18021809000a490333303200490103333031002301a301a001230092253330170011007132533301730040011330090013003301c00213003301c002301c0012223333004002480008cccc014009200075a6eac00400c8c008dd480091111980491299980b80088028a99980b19baf3020301c00100613004301f301c00113002301b0010014bd702ba0223300330050010023001222533301000112250011533300f3002301500113222300200330150011330030023014001232300223300200200123002233002002001223300300230123006001223375e6e9cc014008dd398028009191919299980619b87480080084c04800454cc04c01458c050008c050004dd5180798071801800a4903333034002301037540029201257074727946726f6d28504f53495854696d65293a206d75737420626520706f7369746976650049012c7074727946726f6d28505075624b657948617368293a206d757374206265203238206279746573206c6f6e670049012c7074727946726f6d285053637269707448617368293a206d757374206265203238206279746573206c6f6e670023300300100214a2ae6955cfa481317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f004901327074727946726f6d28546f6b656e4e616d65293a206d757374206265206174206d6f7374203332204279746573206c6f6e67004901387074727946726f6d2843757272656e637953796d626f6c293a206d757374206265203238206279746573206c6f6e67206f7220656d707479005744ae855ce2493f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72005573caae75",
"description": "Governance validator",
"type": "PlutusScriptV2"
}
5 changes: 5 additions & 0 deletions scripts/governancePolicy.plutus
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cborHex": "59012b5901280100003232323232322223232323232533300b332323230022330020020012300223300200200122533300f00114a02a6646601e0022944c00cc0300044c008d5d1000919baf300a300b0010093758601260146012601400c2930a99806a49115554784f206e6f7420636f6e73756d656400163008300900553330093370e900000109924ca6660140022930a99805a481317074727946726f6d2850446174615265636f72645b5d293a206c697374206973206c6f6e676572207468616e207a65726f0016153300b4913f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f720016300b00235573a0026ea80095d0918029baa0015734aae7d5ce2ab9e1",
"description": "Governance Minting Policy",
"type": "PlutusScriptV2"
}
Loading

0 comments on commit cd25ffa

Please sign in to comment.