New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@intercoin/contest

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intercoin/contest

Helps people contribute money to a project, and choose judges to distribute it for various solutions.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

ContestContract

Helps people contribute money to a project, and choose judges to distribute it for various solutions.

Deploy

when deploy it is need to pass parameters in to init method Params:

nametypedescription
stagesCountuint256count of stages for Contest
stagesMinAmountuint256array of minimum amount that need to reach at each stage. length array should be the same as stagesCount
contestPeriodInSecondsuint256duration in seconds for contest period(exclude before reach minimum amount)
votePeriodInSecondsuint256duration in seconds for voting period
revokePeriodInSecondsuint256duration in seconds for revoking period
percentForWinnersuint256[]array of values in percentages of overall amount that will gain winners
judgesaddress[]array of judges' addresses. if empty than everyone can vote

Settings

nametypevaluedescription
revokeFeeuint25610e410% mul at 1e6. penalty for revoke tokens

Overview

once installed will be use methods:

method namecalled bycontractdescription
isContestOnlineanyonebothsChecking online Contest
pledgeanyoneConstest.sol onlycan be used to send external token into the contract, and issue internal token balance
pledgeETHanyoneConstestETHOnly.sol onlycan be used to send ETH into the contract, and issue internal token balance
delegateanyone outside the contestant listbothsuser can delegate own vote
voteanyone on the judge list
(if judgelist empty anyone outside the contestant list)
bothsvote for contestant
claimanyone on the contestant listbothsclaim funds
enteranyonebothssender is become a contestant
leaveanyone on the contestant listbothssender leave from contest
revokeanyone outside the contestant listbothsrevoke own vote or delegation

Methods

isContestOnline

Checking online Contest Params:

nametypedescription
stageIDuint256Stage number

pledge

can be used only with Constest.sol to send external token into the contract, and issue internal token balance Params:

nametypedescription
amountuint256amount to pledge
stageIDuint256Stage number

pledgeETH

can be used only with ConstestETHOnly.sol to send ETH into the contract, and issue internal token balance Note that ETH need to send with transaction/ not directly to contract via native recieve() Params:

nametypedescription
amountuint256amount to pledge
stageIDuint256Stage number

delegate

Params:

nametypedescription
judgeaddressaddress of judge which user want to delegate own vote
stageIDuint256Stage number

vote

Params:

nametypedescription
contestantAddressaddressaddress of contestant which user want to vote
stageIDuint256Stage number

claim

Params:

nametypedescription
stageIDuint256Stage number

enter

Params:

nametypedescription
stageIDuint256Stage number

leave

Params:

nametypedescription
stageIDuint256Stage number

revoke

Params:

nametypedescription
stageIDuint256Stage number

Lifecycle of Contest

  • creation Contest. emitting event ContestStart. Starting Contest Period with StageID = 0
    • anyone can enter to contest calling method enter() and become contestant
    • anyone can leave to contest calling method leave() and remove itself from contestant list
    • anyone can pledge smth to contest calling method pledge() if didn't not become contestant earlier
  • as soon as pledging by people become more than "stagesMinAmount" Contest Period will be extended for contestPeriodInSeconds seconds. and stop there
    • emitting StageStartAnnounced
  • starting Voting period for votePeriodInSeconds seconds.
    • judge can vote for contestants
    • if judgeList was empty then anyone who pledged before can vote
    • anyone who pledged before can revoke own tokens with gradually increased penalty from 0 to revokeFee
  • starting Revoking period for revokePeriodInSeconds seconds.
    • anyone who pledged before can revoke own tokens with revokeFee penalty
  • Stage completed.(after any request with stageID).
    • emitting ContestWinnerAnnounced
    • if winners exists, then
      • reward winners
      • reward losers (if left smth from winners) they will get equally
    • if winners does not exists, then all who pledged will get equally
    • next stage will begin if current stage < stagesCount

FAQs

Package last updated on 19 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts