# Governor

이 컨트랙트는 클레이스왑의 투표 등록, 투표 집계, 집행을 관리하는 관리자 기능을 합니다. 또한 클레이스왑의 중요 파라미터들과 제안 등록, 투표 집행을 수행합니다.&#x20;

## Address

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

## Events, Read-Only Functions, and State-Changing Functions

{% tabs %}
{% tab title="Events" %}

## Events

**ProposalCreated**

```solidity
event ProposalCreated(uint id, address proposer, address target, string signature, bytes callData, uint startBlock, uint endBlock, string description);
```

* 제안 생성시 발생하는 이벤트
* Parameters
  * id : 제안 ID
  * proposer : 제안자 지갑 주소
  * target : 실행 컨트랙트 주소
  * signature : 실행할 함수 식별 정보
  * callData : 실행할 함수 내용
  * startBlock : 시작 블럭 번호
  * endBlock : 종료 블럭 번호
  * description : 제안 상세 내용

**VoteCast**

```solidity
event VoteCast(address voter, uint proposalId, bool support, uint votes, uint againstVotes, uint forVotes, uint quorumVotes, string reason);
```

* 투표시 발생하는 이벤트
* Parameters
  * voter : 투표자 지갑 주소
  * proposalId : 제안 ID
  * support : 찬반
  * votes : 투표 수량
  * againstVotes :  총 반대 투표 수량
  * forVotes : 총 찬성 투표 수량
  * quorumVotes : 의사정족수
  * reason : 투표 사유

**ProposalCanceled**

```solidity
event ProposalCanceled(uint id);
```

* 투표 취소시 발생하는 이벤트

**ProposalQueued**

```solidity
event ProposalQueued(uint id, uint eta, uint tid);
```

* 제안이 대기열에 들어갔을때 발생하는 이벤트

**ProposalExecuted**

```solidity
event ProposalExecuted(uint id, bool succeeded);
```

* 제안이 실행됐을때 발생하는 이벤트

**ProposalFeeSet**

```solidity
event ProposalFeeSet(uint oldProposalFee, uint proposalFee);
```

* 제안등록비용 변경시 발생되는 이벤트

{% endtab %}

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

## State-Changing Functions

#### propose

```solidity
function propose(address target, string memory signature, bytes memory callData, string memory description) public returns (uint)
```

* 새 안건을 생성하는 함수
* 최소 스테이킹 수량을 넘은 지갑만 안건   생성가능
* `target` : 안건이 실행할 컨트랙트 주소
* `signature` : 실행할 안건함수의 signautre
* `callData` : 실행할 안건의 callData
* `description` : 안건에 대한 설명

#### castVote

```solidity
function castVote(uint proposalId, bool support) external 
```

* 투표를 실행하는 함수
* `proposalId` : 투표를 실행할 안건의 id
* `support` : 찬반 여부 (찬성 = true, 반대 = false)
  {% endtab %}
  {% endtabs %}
