# EcoPotVoting

This contract is creating and managing of the EcoPot project and exercising voting rights for the EcoPot project. KSP staking users vote for the EcoPot project they want and receive tokens according to their stake.

## Address

* Cypress : [0x2ce59e21364DcA92c90970AD15442146D638997f](https://scope.klaytn.com/account/0x2ce59e21364DcA92c90970AD15442146D638997f?tabId=txList)

{% tabs %}
{% tab title="Event" %}
**CreateEcoPot**

```solidity
event CreateEcoPot(address operator, address ecoPot, address token, string name);
```

* Event log of EcoPot created&#x20;
* Parameters
  * `operator` : EcoPotOperator address
  * `ecoPot` : EcoPot address
  * `token` : Token address received by user &#x20;
  * `name` : EcoPot Project name

**RemoveEcoPot**

```solidity
event RemoveEcoPot(address ecoPot);
```

* Event that occurs when EcoPot is removed

**ChangeEcoPotAvailable**

```solidity
event ChangeEcoPotAvailable(address ecoPot, bool b);
```

* Event that occurs when the status is changed

**AddVoting**

```solidity
event AddVoting(address user, address ecopot, uint amount);
```

* Event log of voting vKSP for EcoPot&#x20;
* Parameters
  * user : User address
  * ecopot : EcoPot address
  * amount : Vote vKSP amount

**RemoveVoting**

```solidity
event RemoveVoting(address user, address ecopot, uint amount);
```

* Event log of remove voting vKSP for EcoPot&#x20;
* Parameters
  * user : User address
  * ecopot : EcoPot address
  * amount : Unote vKSP amount

{% endtab %}

{% tab title="Read-Only Functions" %}

## Read-Only Functions

**ecoPotCount**

* Number of EcoPot

**MAX\_VOTING*****\_*****POT\_COUNT**

* Maximum number of EcoPots where users can vote&#x20;

**ecoPotList**

* mapping(uint => address)
* EcoPot addresses

**ecoPotExist**

* mapping(address => bool)
* Return if the address is EcoPot address

**potTotalVotedAmount**

* Total voted number of EcoPot

**userVotingPotCount**

* mapping(address => uint)
* Number of votes each user voted for EcoPot

**userVotingPotAddress**

```solidity
function userVotingPotAddress(address user, uint256 ecoPotIndex) public view returns (address) 
```

* EcoPot addresses voted by each user

**userVotingPotAmount**

```solidity
function userVotingPotAmount(address user, uint256 ecoPotIndex) public view returns (uint256) 
```

* EcoPot voted amount by each user

{% endtab %}

{% tab title="State-Changing Functions" %}

## **State-Changing Functions**

addVoting

```solidity
function addVoting(address ecoPot, uint amount) public
```

* Method to voting vKSP for EcoPot&#x20;
* The amount can be entered in integer units&#x20;

removeVoting

```solidity
function removeVoting(address ecoPot, uint amount) public
```

* Method to remove voting vKSP for Ecopot
* The amount can be entered in integer units within the voting limit

removeAllVoting

```solidity
function removeAllVoting() public
```

* Method of remove total vote Ecopot

claimReward

```solidity
function claimReward(address ecopot) public 
```

* Method of vote Ecopot’s reward &#x20;

claimRewardAll

```solidity
function claimRewardAll() public
```

* Method of all vote Ecopot’s reward&#x20;
  {% endtab %}
  {% endtabs %}
