Smart Contract Details
Open on Dero ExplorerInternal ID:
48156
Hash / Transaction:
Block:
Timestamp:
2024-02-01 18:43:51 UTC (1.8 years ago)
Creator:
secretnamebasis
(+6 more)
(295)
Raw Data:
[{"name":"SC_ACTION","datatype":"U","value":1},{"name":"SC_CODE","datatype":"S","value":"Function InitializePrivate() Uint64\n1 IF getCreator() != \"false\" THEN GOTO 99\n// mandatory: creator address for withdraw and update functions\n2 STORE(\"Creator\", ADDRESS_STRING(SIGNER()))\n3 STORE(\"nameHdr\", \"CEX appeal\")\n4 STORE(\"descrHdr\", \"Will you donate +200 DERO to a community initiative for the purpose of listing DERO on a to-be-determined CEX?\") \n5 STORE(\"typeHdr\", \"community\") \n6 STORE(\"iconURLHdr\", \"https://ipfs.io/ipfs/QmYgGwUj9NpeRQgm5HU89emAHxm6fcDWYRiBiu2V7jW6CS\") \n7 STORE(\"coverURL\", \"https://ipfs.io/ipfs/QmYgGwUj9NpeRQgm5HU89emAHxm6fcDWYRiBiu2V7jW6CS\") \n8 STORE(\"collection\", \"secretsystems\")\n98 RETURN 0\n99 RETURN 1\nEnd Function\n\n\n// public voting functions\n\nFunction Vote(choice Uint64) Uint64 // 0 = no, 1 = yes, 2 = abstain\n1 IF ASSETVALUE(SCID()) \u003c 1 || DEROVALUE() \u003c (getVotingFee() * ASSETVALUE(SCID())) || isVotingOpen() != 1 || choice \u003c 0 || choice \u003e 2 || (getRejectAnonymousVote() != 0 \u0026\u0026 isSignerKnown() != 1) THEN GOTO 5\n2 addVote(choice, ASSETVALUE(SCID()))\n3 addBalance(getVotingFee() * ASSETVALUE(SCID()))\n4 RETURN refund(0, DEROVALUE() - (getVotingFee() * ASSETVALUE(SCID())))\n5 RETURN refund(ASSETVALUE(SCID()), DEROVALUE())\nEnd Function\n\n\n// getVotes (0) = no, (1) = yes, (2) = abstain, (3) = invalid, (4) = total\n// getVotesMin (0) = no, (1) = yes, (2) = total\n\nFunction TallyVotes() Uint64\n\n1 DIM conclusion as Uint64\n2 LET conclusion = 2 // inconclusive\n\n// vote count based conclusion\n3 IF getVotesMin(0) == 0 || getVotesMin(0) \u003e getVotes(0) THEN GOTO 5\n4 LET conclusion = 0 // no\n5 IF getVotesMin(1) == 0 || getVotesMin(1) \u003e getVotes(1) THEN GOTO 7\n6 LET conclusion = 1 // yes\n7 IF conclusion != 2 THEN GOTO 15 // if concluded, then skip time based conclusion\n\n// time based conclusion\n8 IF getVotingEnd() == 0 || getVotingEnd() \u003e BLOCK_TIMESTAMP() THEN GOTO 16 // time not yet up, skip time based conclusion\n9 IF getVotesMin(2) != 0 \u0026\u0026 getVotesMin(2) \u003e getVotes(4) THEN GOTO 15 // concluded as inconclusive\n10 IF getVotes(0) == getVotes(1) THEN GOTO 15 // no and yes count is equal, concluded as inconclusive\n11 IF getVotes(0) \u003e getVotes(1) THEN GOTO 14 // no count is higher than yes count, concluded as no\n12 LET conclusion = 1 // yes\n13 GOTO 15\n14 LET conclusion = 0 // no\n15 STORE(\"Conclusion\", conclusion)\n16 RETURN 0\nEnd Function\n\n\n// public admin functions\n\nFunction UpdateDescription(description String) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setDescription(HEXDECODE(description))\n3 RETURN 1\nEnd Function\n\nFunction UpdateVotesMax(qty Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setVotesMax(qty)\n3 RETURN 1\nEnd Function\n\nFunction UpdateVotingStart(timestamp Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setVotingStart(timestamp)\n3 RETURN 1\nEnd Function\n\nFunction UpdateVotingEnd(timestamp Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setVotingEnd(timestamp)\n3 RETURN 1\nEnd Function\n\nFunction UpdateVotesMin(qty Uint64, option Uint64) Uint64 // 0 = no, 1 = yes, 2 = total\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setVotesMin(qty, option)\n3 RETURN 1\nEnd Function\n\nFunction UpdateVotingFee(qtyDeri Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setVotingFee(qtyDeri)\n3 RETURN 1\nEnd Function\n\nFunction UpdateDisplayVoters(display Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setDisplayVoters(display)\n3 RETURN 1\nEnd Function\n\nFunction UpdateRejectAnonymousVote(reject Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 3\n2 RETURN setRejectAnonymousVote(reject)\n3 RETURN 1\nEnd Function\n\nFunction Withdraw(qtyDeri Uint64) Uint64\n1 IF isCreator() != 1 THEN GOTO 7\n2 IF qtyDeri \u003e getBalance() THEN GOTO 5 // allow to override the balance\n3 STORE(\"Balance\", getBalance() - qtyDeri)\n4 GOTO 6\n5 STORE(\"Balance\", 0)\n6 RETURN SEND_DERO_TO_ADDRESS(SIGNER(), qtyDeri) != qtyDeri\n7 RETURN 1\nEnd Function\n\n// private helper functions\n\nFunction isCreator() Uint64\n1 IF getCreator() != ADDRESS_STRING(SIGNER()) THEN GOTO 3\n2 RETURN 1\n3 RETURN 0\nEnd Function\n\nFunction isSignerKnown() Uint64\n1 IF ADDRESS_STRING(SIGNER()) == \"\" THEN GOTO 3\n2 RETURN 1\n3 RETURN 0\nEnd Function\n\nFunction isModifiable() Uint64\n1 IF getVotesMax() != 0 THEN GOTO 3\n2 RETURN 1\n3 RETURN 0\nEnd Function\n\nFunction isVotingOpen() Uint64\n1 IF isModifiable() != 0 || getVotingStart() \u003e BLOCK_TIMESTAMP() || (getVotingEnd() != 0 \u0026\u0026 getVotingEnd() \u003c BLOCK_TIMESTAMP()) THEN GOTO 3\n2 RETURN 1\n3 RETURN 0\nEnd Function\n\nFunction refund(qtyToken Uint64, qtyDeri Uint64) Uint64\n1 IF isSignerKnown() != 1 THEN GOTO 7 \n2 IF qtyToken \u003c 1 THEN GOTO 4\n3 SEND_ASSET_TO_ADDRESS(SIGNER(), qtyToken, SCID())\n4 IF qtyDeri \u003c 1 THEN GOTO 11\n5 SEND_DERO_TO_ADDRESS(SIGNER(), qtyDeri)\n6 GOTO 11\n7 IF qtyToken \u003c 1 THEN GOTO 9 // handle signer unknown, refunding impossible\n8 addVote(3, qtyToken) // invalid vote\n9 IF qtyDeri \u003c 1 THEN GOTO 11\n10 addBalance(qtyDeri)\n11 RETURN 0\nEnd Function\n\nFunction addBalance(qty Uint64) Uint64\n1 RETURN STORE(\"Balance\", getBalance() + qty) != 1\nEnd Function\n\nFunction addVote(choice Uint64, qty Uint64) // 0 = no, 1 = yes, 2 = abstain, 3 = invalid\n1 STORE(getVotesStoreKey(choice), getVotes(choice) + qty)\n2 STORE(getVotesStoreKey(4), getVotes(4) + qty) // increase total vote count\n3 IF getDisplayVoters() != 1 || isSignerKnown() != 1 THEN GOTO 5\n4 STORE(getVotesStoreKey(choice) + \",\" + BLOCK_HEIGHT() + \",\" + BLOCK_TIMESTAMP(), ADDRESS_STRING(SIGNER()) + \",\" + qty)\n5 TallyVotes()\n6 RETURN\nEnd Function\n\n// private getter functions\n\nFunction getVotesMax() Uint64\n1 IF EXISTS(\"VotesMax\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"VotesMax\")\n3 RETURN 0\nEnd Function\n\nFunction getVotingStart() Uint64\n1 IF EXISTS(\"VotingStart\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"VotingStart\")\n3 RETURN 0\nEnd Function\n\nFunction getVotingEnd() Uint64\n1 IF EXISTS(\"VotingEnd\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"VotingEnd\")\n3 RETURN 0\nEnd Function\n\nFunction getVotesMin(option Uint64) Uint64 // 0 = no, 1 = yes, 2 = total\n1 IF EXISTS(getVotesMinStoreKey(option)) != 1 THEN GOTO 3\n2 RETURN LOAD(getVotesMinStoreKey(option))\n3 RETURN 0\nEnd Function\n\nFunction getVotingFee() Uint64\n1 IF EXISTS(\"VotingFee\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"VotingFee\")\n3 RETURN 0\nEnd Function\n\nFunction getCreator() String\n1 IF EXISTS(\"Creator\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"Creator\")\n3 RETURN \"false\"\nEnd Function\n\nFunction getDisplayVoters() Uint64\n1 IF EXISTS(\"DisplayVoters\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"DisplayVoters\")\n3 RETURN 0\nEnd Function\n\nFunction getRejectAnonymousVote() Uint64\n1 IF EXISTS(\"RejectAnonymousVote\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"RejectAnonymousVote\")\n3 RETURN 0\nEnd Function\n\nFunction getBalance() Uint64\n1 IF EXISTS(\"Balance\") != 1 THEN GOTO 3\n2 RETURN LOAD(\"Balance\")\n3 RETURN 0\nEnd Function\n\nFunction getVotes(option Uint64) Uint64 // 0 = no, 1 = yes, 2 = abstain, 3 = invalid, 4 = total\n1 IF EXISTS(getVotesStoreKey(option)) != 1 THEN GOTO 3\n2 RETURN LOAD(getVotesStoreKey(option))\n3 RETURN 0\nEnd Function\n\nFunction getVotesStoreKey(option Uint64) String\n1 IF option != 0 THEN GOTO 3\n2 RETURN \"VotesNo\"\n3 IF option != 1 THEN GOTO 5\n4 RETURN \"VotesYes\"\n5 IF option != 2 THEN GOTO 7\n6 RETURN \"VotesAbstain\"\n7 IF option != 3 THEN GOTO 9\n8 RETURN \"VotesInvalid\"\n9 IF option != 4 THEN GOTO 11\n10 RETURN \"VotesTotal\"\n11 RETURN \"\"\nEnd Function\n\nFunction getVotesMinStoreKey(option Uint64) String\n1 IF option != 0 THEN GOTO 3\n2 RETURN \"VotesNoMin\"\n3 IF option != 1 THEN GOTO 5\n4 RETURN \"VotesYesMin\"\n5 IF option != 2 THEN GOTO 7\n6 RETURN \"VotesTotalMin\"\n7 RETURN \"\"\nEnd Function\n\n// private setter functions\n\nFunction setVotesMax(qty Uint64) Uint64\n1 IF qty \u003c 1 || isModifiable() != 1 THEN GOTO 4\n2 STORE(\"VotesMax\", qty)\n3 RETURN SEND_ASSET_TO_ADDRESS(SIGNER(), qty, SCID()) != qty\n4 RETURN 1\nEnd Function\n\nFunction setVotingStart(timestamp Uint64) Uint64\n1 IF timestamp \u003c BLOCK_TIMESTAMP() || (getVotingEnd() != 0 \u0026\u0026 timestamp \u003e= getVotingEnd()) || isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(\"VotingStart\", timestamp) != 1\n3 RETURN 1\nEnd Function\n\nFunction setVotingEnd(timestamp Uint64) Uint64\n1 IF timestamp \u003c= BLOCK_TIMESTAMP() || (getVotingStart() != 0 \u0026\u0026 timestamp \u003c= getVotingStart()) || isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(\"VotingEnd\", timestamp) != 1\n3 RETURN 1\nEnd Function\n\nFunction setVotesMin(qty Uint64, option Uint64) Uint64 // 0 = no, 1 = yes, 2 = total\n1 IF option \u003c 0 || option \u003e 2 || isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(getVotesMinStoreKey(option), qty) != 1\n3 RETURN 1\nEnd Function\n\nFunction setVotingFee(qty Uint64) Uint64\n1 IF qty \u003c 0 || isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(\"VotingFee\", qty) != 1\n3 RETURN 1\nEnd Function\n\nFunction setDisplayVoters(display Uint64) Uint64\n1 IF (display != 0 \u0026\u0026 display != 1) || isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(\"DisplayVoters\", display) != 1\n3 RETURN 1\nEnd Function\n\nFunction setRejectAnonymousVote(reject Uint64) Uint64\n1 IF (reject != 0 \u0026\u0026 reject != 1) || isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(\"RejectAnonymousVote\", reject) != 1\n3 RETURN 1\nEnd Function\n\nFunction setDescription(description String) Uint64\n1 IF isModifiable() != 1 THEN GOTO 3\n2 RETURN STORE(\"Description\", description) != 1\n3 RETURN 1\nEnd Function"}]
Code:
Function InitializePrivate() Uint64
1 IF getCreator() != "false" THEN GOTO 99
// mandatory: creator address for withdraw and update functions
2 STORE("Creator", ADDRESS_STRING(SIGNER()))
3 STORE("nameHdr", "CEX appeal")
4 STORE("descrHdr", "Will you donate +200 DERO to a community initiative for the purpose of listing DERO on a to-be-determined CEX?")
5 STORE("typeHdr", "community")
6 STORE("iconURLHdr", "https://ipfs.io/ipfs/QmYgGwUj9NpeRQgm5HU89emAHxm6fcDWYRiBiu2V7jW6CS")
7 STORE("coverURL", "https://ipfs.io/ipfs/QmYgGwUj9NpeRQgm5HU89emAHxm6fcDWYRiBiu2V7jW6CS")
8 STORE("collection", "secretsystems")
98 RETURN 0
99 RETURN 1
End Function
// public voting functions
Function Vote(choice Uint64) Uint64 // 0 = no, 1 = yes, 2 = abstain
1 IF ASSETVALUE(SCID()) < 1 || DEROVALUE() < (getVotingFee() * ASSETVALUE(SCID())) || isVotingOpen() != 1 || choice < 0 || choice > 2 || (getRejectAnonymousVote() != 0 && isSignerKnown() != 1) THEN GOTO 5
2 addVote(choice, ASSETVALUE(SCID()))
3 addBalance(getVotingFee() * ASSETVALUE(SCID()))
4 RETURN refund(0, DEROVALUE() - (getVotingFee() * ASSETVALUE(SCID())))
5 RETURN refund(ASSETVALUE(SCID()), DEROVALUE())
End Function
// getVotes (0) = no, (1) = yes, (2) = abstain, (3) = invalid, (4) = total
// getVotesMin (0) = no, (1) = yes, (2) = total
Function TallyVotes() Uint64
1 DIM conclusion as Uint64
2 LET conclusion = 2 // inconclusive
// vote count based conclusion
3 IF getVotesMin(0) == 0 || getVotesMin(0) > getVotes(0) THEN GOTO 5
4 LET conclusion = 0 // no
5 IF getVotesMin(1) == 0 || getVotesMin(1) > getVotes(1) THEN GOTO 7
6 LET conclusion = 1 // yes
7 IF conclusion != 2 THEN GOTO 15 // if concluded, then skip time based conclusion
// time based conclusion
8 IF getVotingEnd() == 0 || getVotingEnd() > BLOCK_TIMESTAMP() THEN GOTO 16 // time not yet up, skip time based conclusion
9 IF getVotesMin(2) != 0 && getVotesMin(2) > getVotes(4) THEN GOTO 15 // concluded as inconclusive
10 IF getVotes(0) == getVotes(1) THEN GOTO 15 // no and yes count is equal, concluded as inconclusive
11 IF getVotes(0) > getVotes(1) THEN GOTO 14 // no count is higher than yes count, concluded as no
12 LET conclusion = 1 // yes
13 GOTO 15
14 LET conclusion = 0 // no
15 STORE("Conclusion", conclusion)
16 RETURN 0
End Function
// public admin functions
Function UpdateDescription(description String) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setDescription(HEXDECODE(description))
3 RETURN 1
End Function
Function UpdateVotesMax(qty Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setVotesMax(qty)
3 RETURN 1
End Function
Function UpdateVotingStart(timestamp Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setVotingStart(timestamp)
3 RETURN 1
End Function
Function UpdateVotingEnd(timestamp Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setVotingEnd(timestamp)
3 RETURN 1
End Function
Function UpdateVotesMin(qty Uint64, option Uint64) Uint64 // 0 = no, 1 = yes, 2 = total
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setVotesMin(qty, option)
3 RETURN 1
End Function
Function UpdateVotingFee(qtyDeri Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setVotingFee(qtyDeri)
3 RETURN 1
End Function
Function UpdateDisplayVoters(display Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setDisplayVoters(display)
3 RETURN 1
End Function
Function UpdateRejectAnonymousVote(reject Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 3
2 RETURN setRejectAnonymousVote(reject)
3 RETURN 1
End Function
Function Withdraw(qtyDeri Uint64) Uint64
1 IF isCreator() != 1 THEN GOTO 7
2 IF qtyDeri > getBalance() THEN GOTO 5 // allow to override the balance
3 STORE("Balance", getBalance() - qtyDeri)
4 GOTO 6
5 STORE("Balance", 0)
6 RETURN SEND_DERO_TO_ADDRESS(SIGNER(), qtyDeri) != qtyDeri
7 RETURN 1
End Function
// private helper functions
Function isCreator() Uint64
1 IF getCreator() != ADDRESS_STRING(SIGNER()) THEN GOTO 3
2 RETURN 1
3 RETURN 0
End Function
Function isSignerKnown() Uint64
1 IF ADDRESS_STRING(SIGNER()) == "" THEN GOTO 3
2 RETURN 1
3 RETURN 0
End Function
Function isModifiable() Uint64
1 IF getVotesMax() != 0 THEN GOTO 3
2 RETURN 1
3 RETURN 0
End Function
Function isVotingOpen() Uint64
1 IF isModifiable() != 0 || getVotingStart() > BLOCK_TIMESTAMP() || (getVotingEnd() != 0 && getVotingEnd() < BLOCK_TIMESTAMP()) THEN GOTO 3
2 RETURN 1
3 RETURN 0
End Function
Function refund(qtyToken Uint64, qtyDeri Uint64) Uint64
1 IF isSignerKnown() != 1 THEN GOTO 7
2 IF qtyToken < 1 THEN GOTO 4
3 SEND_ASSET_TO_ADDRESS(SIGNER(), qtyToken, SCID())
4 IF qtyDeri < 1 THEN GOTO 11
5 SEND_DERO_TO_ADDRESS(SIGNER(), qtyDeri)
6 GOTO 11
7 IF qtyToken < 1 THEN GOTO 9 // handle signer unknown, refunding impossible
8 addVote(3, qtyToken) // invalid vote
9 IF qtyDeri < 1 THEN GOTO 11
10 addBalance(qtyDeri)
11 RETURN 0
End Function
Function addBalance(qty Uint64) Uint64
1 RETURN STORE("Balance", getBalance() + qty) != 1
End Function
Function addVote(choice Uint64, qty Uint64) // 0 = no, 1 = yes, 2 = abstain, 3 = invalid
1 STORE(getVotesStoreKey(choice), getVotes(choice) + qty)
2 STORE(getVotesStoreKey(4), getVotes(4) + qty) // increase total vote count
3 IF getDisplayVoters() != 1 || isSignerKnown() != 1 THEN GOTO 5
4 STORE(getVotesStoreKey(choice) + "," + BLOCK_HEIGHT() + "," + BLOCK_TIMESTAMP(), ADDRESS_STRING(SIGNER()) + "," + qty)
5 TallyVotes()
6 RETURN
End Function
// private getter functions
Function getVotesMax() Uint64
1 IF EXISTS("VotesMax") != 1 THEN GOTO 3
2 RETURN LOAD("VotesMax")
3 RETURN 0
End Function
Function getVotingStart() Uint64
1 IF EXISTS("VotingStart") != 1 THEN GOTO 3
2 RETURN LOAD("VotingStart")
3 RETURN 0
End Function
Function getVotingEnd() Uint64
1 IF EXISTS("VotingEnd") != 1 THEN GOTO 3
2 RETURN LOAD("VotingEnd")
3 RETURN 0
End Function
Function getVotesMin(option Uint64) Uint64 // 0 = no, 1 = yes, 2 = total
1 IF EXISTS(getVotesMinStoreKey(option)) != 1 THEN GOTO 3
2 RETURN LOAD(getVotesMinStoreKey(option))
3 RETURN 0
End Function
Function getVotingFee() Uint64
1 IF EXISTS("VotingFee") != 1 THEN GOTO 3
2 RETURN LOAD("VotingFee")
3 RETURN 0
End Function
Function getCreator() String
1 IF EXISTS("Creator") != 1 THEN GOTO 3
2 RETURN LOAD("Creator")
3 RETURN "false"
End Function
Function getDisplayVoters() Uint64
1 IF EXISTS("DisplayVoters") != 1 THEN GOTO 3
2 RETURN LOAD("DisplayVoters")
3 RETURN 0
End Function
Function getRejectAnonymousVote() Uint64
1 IF EXISTS("RejectAnonymousVote") != 1 THEN GOTO 3
2 RETURN LOAD("RejectAnonymousVote")
3 RETURN 0
End Function
Function getBalance() Uint64
1 IF EXISTS("Balance") != 1 THEN GOTO 3
2 RETURN LOAD("Balance")
3 RETURN 0
End Function
Function getVotes(option Uint64) Uint64 // 0 = no, 1 = yes, 2 = abstain, 3 = invalid, 4 = total
1 IF EXISTS(getVotesStoreKey(option)) != 1 THEN GOTO 3
2 RETURN LOAD(getVotesStoreKey(option))
3 RETURN 0
End Function
Function getVotesStoreKey(option Uint64) String
1 IF option != 0 THEN GOTO 3
2 RETURN "VotesNo"
3 IF option != 1 THEN GOTO 5
4 RETURN "VotesYes"
5 IF option != 2 THEN GOTO 7
6 RETURN "VotesAbstain"
7 IF option != 3 THEN GOTO 9
8 RETURN "VotesInvalid"
9 IF option != 4 THEN GOTO 11
10 RETURN "VotesTotal"
11 RETURN ""
End Function
Function getVotesMinStoreKey(option Uint64) String
1 IF option != 0 THEN GOTO 3
2 RETURN "VotesNoMin"
3 IF option != 1 THEN GOTO 5
4 RETURN "VotesYesMin"
5 IF option != 2 THEN GOTO 7
6 RETURN "VotesTotalMin"
7 RETURN ""
End Function
// private setter functions
Function setVotesMax(qty Uint64) Uint64
1 IF qty < 1 || isModifiable() != 1 THEN GOTO 4
2 STORE("VotesMax", qty)
3 RETURN SEND_ASSET_TO_ADDRESS(SIGNER(), qty, SCID()) != qty
4 RETURN 1
End Function
Function setVotingStart(timestamp Uint64) Uint64
1 IF timestamp < BLOCK_TIMESTAMP() || (getVotingEnd() != 0 && timestamp >= getVotingEnd()) || isModifiable() != 1 THEN GOTO 3
2 RETURN STORE("VotingStart", timestamp) != 1
3 RETURN 1
End Function
Function setVotingEnd(timestamp Uint64) Uint64
1 IF timestamp <= BLOCK_TIMESTAMP() || (getVotingStart() != 0 && timestamp <= getVotingStart()) || isModifiable() != 1 THEN GOTO 3
2 RETURN STORE("VotingEnd", timestamp) != 1
3 RETURN 1
End Function
Function setVotesMin(qty Uint64, option Uint64) Uint64 // 0 = no, 1 = yes, 2 = total
1 IF option < 0 || option > 2 || isModifiable() != 1 THEN GOTO 3
2 RETURN STORE(getVotesMinStoreKey(option), qty) != 1
3 RETURN 1
End Function
Function setVotingFee(qty Uint64) Uint64
1 IF qty < 0 || isModifiable() != 1 THEN GOTO 3
2 RETURN STORE("VotingFee", qty) != 1
3 RETURN 1
End Function
Function setDisplayVoters(display Uint64) Uint64
1 IF (display != 0 && display != 1) || isModifiable() != 1 THEN GOTO 3
2 RETURN STORE("DisplayVoters", display) != 1
3 RETURN 1
End Function
Function setRejectAnonymousVote(reject Uint64) Uint64
1 IF (reject != 0 && reject != 1) || isModifiable() != 1 THEN GOTO 3
2 RETURN STORE("RejectAnonymousVote", reject) != 1
3 RETURN 1
End Function
Function setDescription(description String) Uint64
1 IF isModifiable() != 1 THEN GOTO 3
2 RETURN STORE("Description", description) != 1
3 RETURN 1
End Function