---
eip: 7580
label: ERC-7580
title: Advertisement Tracking Interface
status: Draft
type: Standards Track
category: ERC
created: 2023-12-13
official: https://eips.ethereum.org/EIPS/eip-7580
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7580.md
canonical: https://eips.huatuo.xyz/ko/eip-7580/
lang: ko
tldr: dapp이 사용자 행동의 시작과 끝을 이벤트로 표시할 수 있게 하는 초안 인터페이스. 온체인 광고나 에어드롭 프로토콜이 이를 추적해 사용자와 dapp 모두에게 보상할 수 있다.
tags: [advertising, tracking, airdrop, interface]
---

# ERC-7580: Advertisement Tracking Interface

> Interfaces for advertisement clients tracking user actions and checking proportional rewards.

**TL;DR:** dapp이 사용자 행동의 시작과 끝을 이벤트로 표시할 수 있게 하는 초안 인터페이스. 온체인 광고나 에어드롭 프로토콜이 이를 추적해 사용자와 dapp 모두에게 보상할 수 있다.

## 어떤 문제를 해결하나요?

프로젝트는 *다른* 프로젝트의 컨트랙트에서 무언가를 한 사용자에게 보상하고 싶을 때가 많습니다. "dapp B에서 스왑하면 프로젝트 A에서 에어드롭을 받는다" 같은 경우입니다. 공정하게 지급하려면 A는 특정 사용자가 B에서 바로 그 행동을 했다는 믿을 만한 신호가 필요하고, B는 트래픽을 보낸 대가로 보상의 일부를 원합니다.

공통 인터페이스가 없으면 캠페인마다 맞춤 연동과 임시방편의 로그 파싱이 필요합니다. ERC-7580은 dapp이 광고 프로토콜에 참여할 수 있고 그 프로토콜들이 행동을 일관된 방식으로 귀속시킬 수 있도록, 최소한의 공유 추적 훅을 제안합니다.

## 어떻게 동작하나요?

이 인터페이스는 두 개의 함수와 이에 대응하는 두 개의 이벤트를 정의합니다.

- `onTrackStart(track_id, contract_address, function_hash)`는 홍보 대상 행동이 시작되기 직전에 호출되며 `onTrackStartRecorded`를 emit합니다.
- `onTrackEnd(track_id, contract_address, function_hash)`는 행동이 끝난 뒤에 호출되며 `onTrackEndRecorded`를 emit합니다.

`track_id`는 캠페인을, `contract_address`는 추적 대상 컨트랙트를, `function_hash`는 추적 대상 함수와 그 파라미터의 해시를 식별합니다. 이 한 쌍의 이벤트가 트랜잭션 안에서 "관심 구간"을 표시합니다.

명세가 의도한 흐름:

1. 프로젝트가 홍보 측으로부터 시드 id를 받습니다.
2. 컨트랙트가 대상 행동 전에 `onTrackStart`를 호출합니다.
3. 행동 후에 `onTrackEnd`를 호출합니다.
4. 홍보 컨트랙트가 기록된 행동을 수집해 사용자와 프로젝트에게 보상을 분배합니다.

보상 로직은 광고 프로토콜이 자유롭게 혁신할 수 있도록 의도적으로 표준에서 제외되었습니다.

## 샘플 코드

홍보 대상 함수를 추적 훅으로 감싼 dapp:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.10;

interface IERC7580 {
    event onTrackStartRecorded(uint256 track_id, address contract_address, bytes32 function_hash);
    event onTrackEndRecorded(uint256 track_id, address contract_address, bytes32 function_hash);
    function onTrackStart(uint256 track_id, address contract_address, bytes32 function_hash) external;
    function onTrackEnd(uint256 track_id, address contract_address, bytes32 function_hash) external;
}

contract PromotedDapp is IERC7580 {
    uint256 public immutable campaignId;

    constructor(uint256 id) { campaignId = id; }

    function onTrackStart(uint256 id, address c, bytes32 h) public {
        emit onTrackStartRecorded(id, c, h);
    }

    function onTrackEnd(uint256 id, address c, bytes32 h) public {
        emit onTrackEndRecorded(id, c, h);
    }

    function mint(uint256 amount) external {
        bytes32 h = keccak256(abi.encode(this.mint.selector, msg.sender, amount));
        onTrackStart(campaignId, address(this), h);
        // ... the promoted action ...
        onTrackEnd(campaignId, address(this), h);
    }
}
```

## 알아둘 점

- 상태는 **Draft**입니다. 인터페이스가 바뀔 수 있으며, 명세는 나중에 함수가 더 추가될 수 있다고 말합니다.
- 명세에 적힌 그대로의 인터페이스는 `onTrackEnd`에 `external`이 빠져 있고 자리 표시용 이름 `IERCXXX`를 아직 사용합니다. 위 샘플은 컴파일되도록 `external`을 추가했습니다.
- Security Considerations 섹션은 아직 TODO입니다. 특히 누구나 공개된 훅을 호출하거나 가짜 시작/종료 이벤트를 emit하는 것을 막는 장치가 없으므로, 보상 프로토콜은 어떤 컨트랙트와 호출자를 신뢰할지 스스로 정해야 합니다.
- `function_hash`를 계산하는 방법은 고정되어 있지 않으므로, 추적하는 쪽과 홍보하는 쪽이 인코딩에 합의해야 합니다.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7580
