KLAYswap
한국어
한국어
  • 소개
  • 프로토콜 개요
  • 핵심 개념
  • 클레이스왑의 장점
  • 위험 & 보안
  • 개인정보처리방침
  • 보안 감사
  • Tokenomics
    • KSP
      • KSP Tokenomics
      • KSP 분배율 자동화
        • 거버넌스 통과 투표 정책
        • KSP 분배율 반영 정책
      • KSP Allocation
  • Product
    • 스왑
    • 단일 예치
      • 단일예치 상세정책
    • 일반 페어 예치(V2)
    • 집중화 페어 예치(V3)
      • V2 to V3 마이그레이션
        • V2 to V3 마이그레이션 가이드
        • V2 to V3 마이그레이션 상세 정책
      • 집중화 페어 풀(V3) 예치
        • 집중화 페어 예치(V3) 가이드
        • 집중화 페어 예치(V3) 상세 정책
      • V3 to V3 마이그레이션
        • V3 to V3 마이그레이션 가이드
        • V3 to V3 마이그레이션 상세 정책
      • 집중화 페어 예치(V3) 출금
        • 집중화 풀(V3) 출금 가이드
        • 집중화 풀(V3) 출금 상세 정책
    • 플러스 예치
      • 플러스 예치 상세 정책
    • 롱/숏 포지션 예치
      • 롱/숏 포지션 오픈과 종료
        • 롱 포지션 오픈
        • 숏 포지션 오픈
        • 롱 포지션 종료
        • 숏 포지션 종료
      • 포지션 예치 상세 정책
    • KSP 스테이킹 & 보팅
      • 스테이킹, 풀 투표 정책
    • 거버넌스
      • 거버넌스 투표 정책
    • Drops(드랍스)
    • Ecopot(에코팟)
    • 풀에어드랍
    • APR & APY
      • TVL
      • Pool
      • Staking
    • 이자율 모델
  • Developers
    • Contract
      • Factory
      • Exchange
      • PoolVoting
      • VotingKSP
      • Treasury
      • Distribution
      • Governor
      • SinglePool
      • SinglePool Factory
      • PlusPool
      • PlusPool Factory
      • Store
      • Utils
      • Single/Plus Utils
      • Helper
      • EcoPotVoting
      • EcoPot
      • V3
        • V3Factory
        • V3Pool
        • NonfungiblePositionManager
        • NonfungibleTokenPositionDescriptor
        • V3SwapRouter
        • V3Migrator
        • V3Estimator
        • PositionMigrator
        • V3Treasury
        • V3AirdropOperator
        • UniversalRouter
    • Airdrop
      • Airdrop Operator 권한 획득
      • Airdrop 계획 진행
    • EcoPot
      • EcoPot Operator 권한 획득
      • EcoPot 계획 진행
  • HOW-TO GUIDES
    • 클레이스왑 가이드
    • 서비스에 연결하기
      • [클립] PC에서 연결하기
      • [클립] 모바일에서 연결하기
      • [카이카스] PC에서 연결하기
    • 활용할 자산 입금하기
      • 클레이튼 자산 입금하기
      • 이더리움/BSC 자산 입금하기
      • 리플 자산 입금하기
    • 풀에 예치하기
      • [클립] PC에서 단일 예치하기
      • [부리또월렛] 모바일에서 단일 예치하기
      • [클립] PC에서 일반 페어 예치 하기
      • [클립] 모바일에서 일반 페어 예치 하기
      • [카이카스] PC에서 일반 페어 예치하기
      • [클립] PC에서 플러스 페어 예치하기
      • [공통] 활용할 자산 선택하기
    • 풀에서 출금하기
      • [클립] PC에서 단일 예치출금하기
      • [클립] PC에서 플러스 예치 출금하기
    • KSP 스테이킹 & 풀 투표하기
      • [클립] PC에서 KSP 스테이킹 하기
      • [클립] 모바일에서 KSP 스테이킹 하기
      • [카이카스] PC에서 KSP 스테이킹 하기
      • [클립] PC에서 풀 투표 하기
      • [클립] 모바일에서 풀 투표 하기
      • [카이카스] PC에서 풀 투표 하기
    • 보상 수령하기
    • FAQ
      • 클레이스왑은 어떤 서비스인가요?
      • 클레이(KLAY) & 클레이스왑(KSP)은 무엇인가요?
      • 유동성 풀(Liquidity pool)이 무엇인가요?
      • 유동성 풀의 예치방법, 특징이 무엇인가요?
      • 왜 클레이스왑에서 예치해야 하나요?
      • 획득한 보상은 어떻게 활용하나요?
  • KLAYswap
  • Orbit Bridge
  • KLAYswap git
  • Orbit Bridge git
  • KLAYswap audit report
Powered by GitBook
On this page
  • 1. Contract Deploy
  • 2. Contract Submission
  • 3. ValidOperator Request

Was this helpful?

  1. Developers
  2. EcoPot

EcoPot Operator 권한 획득

PreviousEcoPotNextEcoPot 계획 진행

Last updated 3 years ago

Was this helpful?

1. Contract Deploy

  • EcoPot 진행할 Token과 Project Name 생성시 정해지며 수정이 불가능합니다.

  • Contract가 Public 환경에 배포되었는지 확인해주세요.

  • Owner 계정의 보안에 유의해주세요.

  • Klaytn 의 Smart contract deploy 는 를 참고해주세요.

pragma solidity 0.5.6;

interface IKIP7 {
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
    function decimals() external view returns (uint8);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}

interface EcoPotLike {
    function totalAmount() external view returns (uint);
    function amountPerBlock() external view returns (uint);
    function distributableBlock() external view returns (uint);
    function estimateEndBlock() external view returns (uint);
    function operator() external view returns (address);
    function getDistributedCurrent() external view returns (uint);
    function isInitialized() external view returns (bool);
    function isAvailable() external view returns (bool);

    function initialize(uint, uint, uint) external payable;
    function depositKlay() external payable;
    function depositToken(uint) external;
    function refixAmountPerBlock(uint) external;
}

interface EcoPotVotingLike {
    function ecoPotExist(address) external view returns (bool);
}

contract EcoPotOperator {
    address constant public ecoPotVoting = 0x2ce59e21364DcA92c90970AD15442146D638997f;
    address constant public ksp = 0xC6a2Ad8cC6e4A7E08FC37cC5954be07d499E7654;

    address public owner;
    address public nextOwner;

    address public ecoPot;
    address public token;
    string public name;

    constructor(address _token, string memory _name) public {
        owner = msg.sender;

        token = _token;
        if(token != address(0)) require(IKIP7(token).decimals() != 0);
        name = _name;
    }

    function version() external pure returns (string memory) {
        return "EcoPotOperator20220221A";
    }

    // valid fallback
    function () payable external { }

    // ======================= owner method ===========================

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    function changeNextOwner(address _nextOwner) public onlyOwner {
        nextOwner = _nextOwner;
    }

    function changeOwner() public {
        require(msg.sender == nextOwner);

        owner = nextOwner;
        nextOwner = address(0);
    }

    //withdraw tokens remaining in the operator contract
    function withdraw(address tokenAddr) public onlyOwner {
        uint balance = 0;
        if(tokenAddr == address(0)){
            balance = (address(this)).balance;
            if(balance > 0){
                (bool res, ) = owner.call.value(balance)("");
                require(res);
            }
        }
        else{
            balance = IKIP7(tokenAddr).balanceOf(address(this));
            if(balance > 0){
                require(IKIP7(tokenAddr).transfer(owner, balance));
            }
        }
    }

    modifier onlyEcoPotVoting {
        require(msg.sender == ecoPotVoting);
        _;
    }

    function setEcoPot(address _ecoPot) public onlyEcoPotVoting {
        require(ecoPot == address(0));
        ecoPot = _ecoPot;
    }

    // ====================== Stat ====================================

    function getEcoPotStat() public view returns (
        address ecoPotContract, // airdrop distribution contract address
        uint totalAmount, // Total amount of tokens to be distributed
        uint blockAmount, // Amount of tokens to be distributed per block
        uint distributableBlock, // Block number to airdrop start
        uint endBlock, // Block number to airdrop end
        uint distributed,  // Amount of tokens distributed
        uint remain // amount remaining in the contract
    ){
        ecoPotContract = ecoPot;

        EcoPotLike pot = EcoPotLike(ecoPot);

        totalAmount = pot.totalAmount();
        blockAmount = pot.amountPerBlock();
        distributableBlock = pot.distributableBlock();
        endBlock = pot.estimateEndBlock();
        distributed = pot.getDistributedCurrent();
        if(token == address(0)){
            remain = (ecoPot).balance;
        }
        else{
            remain = IKIP7(token).balanceOf(ecoPot);
        }
    }

    // For Drops AirdropPool
    function getAirdropStat() public view returns (
        address ecoPotContract, // airdrop distribution contract address
        uint totalAmount, // Total amount of tokens to be distributed
        uint blockAmount, // Amount of tokens to be distributed per block
        uint distributableBlock, // Block number to airdrop start
        uint endBlock, // Block number to airdrop end
        uint distributed,  // Amount of tokens distributed
        uint remain, // amount remaining in the contract
        uint emptyUint, // return for airdropPool
        address[] memory emptyAddressArr, // return for airdropPool
        uint[] memory emptyUintArr // return for airdropPool
    ){
        ecoPotContract = ecoPot;

        EcoPotLike pot = EcoPotLike(ecoPot);

        totalAmount = pot.totalAmount();
        blockAmount = pot.amountPerBlock();
        distributableBlock = pot.distributableBlock();
        endBlock = pot.estimateEndBlock();
        distributed = pot.getDistributedCurrent();
        if(token == address(0)){
            remain = (ecoPot).balance;
        }
        else{
            remain = IKIP7(token).balanceOf(ecoPot);
        }

        emptyUint = 0;
        emptyAddressArr = new address[](0);
        emptyUintArr = new uint[](0);
    }

    // ===================== Airdrop method ===========================
    ///@param totalAmount : Total amount of tokens to be distributed
    ///@param blockAmount : Amount of tokens to be distributed per block
    ///@param startBlock  : Block number to airdrop start
    function initialize(uint totalAmount, uint blockAmount, uint startBlock) public payable onlyOwner {
        require(totalAmount != 0);
        require(blockAmount != 0);
        require(startBlock >= block.number);

        EcoPotLike pot = EcoPotLike(ecoPot);
        require(pot.operator() == address(this));
        require(!pot.isInitialized());

        if(token == address(0)){
            require((address(this)).balance >= totalAmount);
            pot.initialize.value(totalAmount)(totalAmount, blockAmount, startBlock);
        }
        else {
            require(IKIP7(token).transferFrom(owner, address(this), totalAmount));
            require(IKIP7(token).approve(ecoPot, totalAmount));
            pot.initialize(totalAmount, blockAmount, startBlock);
        }
    }

    // Airdrop token deposit
    ///@param amount : Amount of airdrop token to deposit
    function deposit(uint amount) public onlyOwner {
        EcoPotLike pot = EcoPotLike(ecoPot);

        require(pot.operator() == address(this));
        require(pot.isAvailable());
        require(amount != 0);

        if(token == address(0)){
            require((address(this)).balance >= amount);
            pot.depositKlay.value(amount)();
        }
        else{
            require(IKIP7(token).balanceOf(address(this)) >= amount);
            require(IKIP7(token).approve(ecoPot, amount));
            pot.depositToken(amount);
        }
    }

    // Airdrop amount per block modification function
    // The function is applied immediately from the called block
    ///@param blockAmount : airdrop block amount to change
    function refixBlockAmount(uint blockAmount) public onlyOwner {
        EcoPotLike pot = EcoPotLike(ecoPot);

        require(pot.operator() == address(this));
        require(pot.isAvailable());
        require(blockAmount != 0);

        pot.refixAmountPerBlock(blockAmount);
    }
}

2. Contract Submission

3. ValidOperator Request

  • Operator 등록요청 (support@klayswap.com)

  • Public EcoPotOperator Code로 배포된 contract 확인 과정 후 Valid Operator 설정

여기
Klaytnscope Contract Submission