# Distribution

풀에 적용된 Airdrop 계획 컨트랙트입니다. 한 개의 유동성 풀과 한 개의 토큰을 타겟으로 할 수 있습니다. \
해당 컨트랙트는 권한이 있는 Operator가  Treasury 를 통해 계약을 집행하게 됩니다.&#x20;

## Code

Github Link: (Will be updated after official launch)

## Address

* Contract adress after production is deployed (scope link)&#x20;

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

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

## Events

**Initialized**

```solidity
event Initialized(address token, uint amountPerBlock, uint distributableBlock, address[] targets, uint[] rates);
```

* 에어드랍 계획 수립 이벤트
* Parameters
  * `token` : KIP7 기반 토큰&#x20;
  * `amountPerBlock` : Block 당 분배할 토큰 수량
  * `distributableBlock` : 분배 시작할 Block Number
  * `targets` : 분배할 유동성 풀 주소 배열
  * `rates` : 유동성 풀 분배율 배열

**Deposit**

```solidity
event Deposit(uint amount, uint totalAmount);
```

* 토큰 예치 이벤트
* Parameters
  * `amount` : 예치 토큰 수량
  * `totalAmount` : 총 예치 토큰 수

**RefixBlockAmount**

```solidity
event RefixBlockAmount(uint amountPerBlock);
```

* 분배 수량 변경 이벤트

**RefixDistributionRate**

```solidity
event RefixDistributionRate(address[] targets, uint[] rates);
```

* 유동성 풀 별 분배율 설정 이벤트

**ChangeDistributionRate**

```solidity
event ChangeDistributionRate(address target, uint rate);
```

* 유동성 풀 분배율 설정 이벤트

**Distribute**

```solidity
event Distribute(address user, address target, uint amount, uint currentIndex, uint userRewardSum);
```

* 에어드랍 분배 이벤트
* Parameters
  * user : 참여자 수령 지갑 주소
  * target : 유동성 풀 주소
  * amount : 분배된 토큰 수량
  * currentIndex : 분배된 시점
  * userRewardSum : 참여자 총 수령 토큰 수량

{% endtab %}

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

## Read-Only Functions

**blockAmount**

* 블럭 당 분배할 토큰 수량

**distributableBlock**

* 분배 시작될 Block Number

**distributedAmount**

* 분배량, 분배율이 수정되었을 경우, 마지막 분배된 총 토큰 수량

**distribution**

* 분배된 총 토큰 수량

**distributionRate**

* 유동성 풀 별 에어드랍 분배율

**estimateEndBlock**

* 에어드랍 종료 예정 Block Number

**operator**

* Operator 주소

**targetCount**

* 에어드랍 타겟 유동성 풀 개수&#x20;

**targetEntries**

* mapping(uint => address)
* 에어드랍 타겟 유동성 풀 주소

**token**

* KIP7 기반 분배 토큰 주소&#x20;

**totalAmount**

* 총 에어드랍  토큰 수량

**userRewardSum**

```
function userRewardSum(address target, address user) public view returns (uint) 
```

* 참여자 총 에어드랍 지급 토큰 &#x20;
* Parameter
  * `target` : 타겟 유동성 풀 주소
  * `user` : 참여자 지갑 주소
    {% endtab %}
    {% endtabs %}
