PaySwap
한국인
한국인
  • 페이스왑 소개
    • 시작하다
      • 지갑 만들기
      • 토큰 받기
      • 중앙화된 교환 없이 PaySwap 사용
      • PaySwap에 지갑을 연결하세요
      • 네이티브 토큰 판매/구매
    • 도움말을 보려면 여기를 클릭하세요.
      • 오류 문제 해결
      • 승인 거래란 무엇입니까?
      • MetaMask에서 보류 중인 트랜잭션 수정
  • 🐲레비아탄
    • 👚의류, 미용, 화장품 리바이어던
    • 🚰음료 레비아탄
    • 🎥문화 및 엔터테인먼트 리바이어던
    • 🔌에너지 리바이어던
    • 🥕식품 리바이어던
    • 😷헬스케어 레비아탄
    • 🪖법과 질서 리바이어던
    • 🪓광업 리바이어던
    • 😈NSFW 레비아탄
    • 🏠부동산 리바이어던
    • 💻소프트웨어, 통신사 및 기타 Leviathan
    • 🚌교통 리바이어던
    • 🏦머니 뱅크
    • NWO
  • 제품
    • 🌉ARPs
      • 수동 ARP
        • 회사 급여 설정
        • 톤틴 설정
        • 자산으로 주식을 매도
      • 백분율 기반 ARP
        • 함께 청구서를 지불하는 룸메이트
      • 자동 ARP
      • 주조 및 청구 메모
    • 🟪감사자
      • 천연자원 감사
      • SSID 감사
      • 부동산 토큰화
      • 개인 포즈 토큰화
      • 자연 토큰
      • 현상금 사냥꾼
    • 🔮베팅 계약
      • 알파벳 인코딩 없이 베팅
      • 알파벳 인코딩을 사용한 베팅
      • 파트너 베팅 이벤트
    • 💧청구서
      • 구실
      • 부기
      • 은행 계좌
      • 자산으로 주식을 매도
    • 🖼️CanCan
      • 제품/서비스
        • 제품/서비스 나열
        • 제품/서비스 구매
          • 지갑으로 구매하기
          • 스테이크 마켓을 통한 구매
          • 스테이크 시장을 통한 판매
          • Valuepool/DAO를 통한 구매
      • 조항
        • 기사 나열
        • 팁 작가
      • 페이월
        • 페이월 나열
        • 페이월에 항목 추가
        • 페이월에서 항목 제거
        • 페이월과의 파트너십
        • 페이월 구독 구매
        • 페이월 구독 활성화
      • NFTickets
      • 할인 및 캐시백
        • 할인
        • 캐시백
        • 수동 보상
      • 파트너 가치 풀 나열
      • 공지사항
      • 리뷰
      • 동적 가격
      • 파트너십
      • 멤버십
      • 신원 요구 사항
      • 후원
      • 경매 및 입찰
      • 액
      • 투표
    • 🧑‍⚖️dRamps
      • 토큰 시장 추가
      • 추가 토큰 배포 및 추가
      • 토큰 시장 활성화
      • 토큰 시장의 가격 업데이트
      • 자동 램프
        • tFIAT 토큰 발행
        • tFIAT 토큰 소각
      • 수동 램프
        • tFIAT 토큰 발행
        • tFIAT 토큰 소각
      • 스폰서 dRamp
      • 네이티브 토큰 판매/구매
      • dRamps 가치 풀
      • 파트너십
      • 부트스트래핑
      • 토큰 시장 판매
      • 사용 사례
        • 수업료 지불
        • 제품/서비스 비용 지불
        • 송금
        • 외환
        • 블록체인 브릿지
        • 가치 저장
    • 🖼️eCollectibles
      • 기본 민터
      • 맞춤형 조폐국
      • 사전 제작된 NFT 상장
    • 🔄교환
      • 토큰 교환
      • 거래 방법
      • 수수료 및 노선
      • 유동성 풀
      • 유동성 추가/제거 방법
      • 자주하는 질문
    • 🧈미래 담보
    • 🎮계략
      • 게임 객체
      • 게임 장학금
    • 🎟️운
      • 복권 플레이 방법
      • 복권 FAQ
      • 마켓플레이스 복권
      • FT 복권
      • NFT 복권
    • 💳페이카드
      • 마켓플레이스 구매
    • 🐞프로필
      • 소셜 그래프 구축
      • 송금
      • 신용 보고서
      • 보안 및 기타
    • 💹수익 공유
      • 액셀러레이터
      • 기업
      • 기여자
      • 추천
    • 🍯후원자
    • 🍏SSI
      • 데이터 생성
      • SSID 만들기
      • 고유한 프로필 만들기
    • 📈StakeMarket
      • 등록된 제품 구매
      • 입찰 요청
      • 담보대출
      • 스테이크 신청
      • 소송
    • 🖥️TrustBounties
      • FT 바운티
      • NFT 바운티
      • 승인
    • 🌐ValuePools/DAOs
      • NFT 토큰 발행
      • Valuepool 후원
      • Valuepool로 쇼핑하기
      • Valuepool을 통한 대출 및 투자
      • 제안서 작성
    • 👾유언장
      • 유언장 설정
      • 유언장을 보관용으로 사용
    • 🛍️세계
      • 빨간 약 세계
      • 파란 약 세계
      • 녹색 세계
  • 사용 사례
    • CanCan
      • 아이템 마켓플레이스: Amazon
      • 아이템 마켓플레이스: 대여
      • 인재마켓플레이스
      • AirBnB
      • 라이드 헤일링
      • 배달앱
      • Rent The Runway
      • 구독 앱
      • 데이트 앱
      • Friend.tech
      • 원격 건강
      • 제품 리믹스
    • Valuepools
      • BNPL 앱
      • 그룹투자앱
      • 보험 앱
      • 마케팅 앱
      • 저축 앱
    • ARPs
      • Budgetting
      • Group Vacation Planning
      • 대리투자
      • Spend Management
      • Loan Management
      • Rent Management
      • Tipping
      • Play & Earn Loan Management
    • Bills
      • Flexible Loan Management
      • Bill Payment
      • Taxes
      • 대리투자
    • Auditors
      • Address Verification
      • Identity Verification
      • Luxury Item Authentication
      • Awards & Trophees
      • Credit Wothiness
    • Games
      • Play To Earn For Your Game
      • Play To Earn For Tripe A Game
      • Betting
    • Betting
      • Stock Market
      • Sports
      • General
      • Companies
      • Swaps
    • Lottery
      • Data Collection
      • Sale Incentive
    • SSI
      • Supply Chain
      • Medical Records
      • Zero Knowledge Proofs
      • Background Checks
      • 싱글 사인온(SSO)
    • StakeMarket
      • 사전 판매
      • Construction Contract
      • Collateralized Employment Contract
    • TrustBounty
      • 변동성 헤지
  • 거버넌스 및 토큰경제학
  • 문화와 비전
  • 로드맵
  • 개발자
    • Smart Contracts (EVM)
      • PaySwap Exchange
        • v3 contracts
          • PancakeV3Factory
          • SmartRouterV3
            • V3SwapRouter
            • V2SwapRouter
            • StableSwapRouter
          • NonfungiblePositionManager
          • PancakeV3Pool
      • MasterChef
        • MasterChef V3
      • dRamps
        • dRamp Contract
      • Lottery
        • Lottery Contract
  • 팀
  • 문의하기
    • 고객 지원
    • 소셜 계정 및 커뮤니티
Powered by GitBook
On this page
  • Contract Roles
  • Global Parameters
  • Token Market Parameters
  • Functions
  • updateAdmin - DevAddr
  • createProtocol - Admin
  • updateProtocol - Admin
  • deleteProtocol - Admin
  • mint - Admin
  • withdraw - Admin
  • updateIndividualProtocol - Anyone
  • burn - Anyone
  • claimPendingRevenue - Anyone
  • unlockBounty - Anyone
  • checkIdentityProof - Anyone
  • updateBounty - Anyone
  • addPartner - Anyone
  • buyAccount - Anyone
  • buyRamp - Anyone
  • updateProfile & updateDevTokenId & updateBadgeId & updateDevFromToken - Anyone

Was this helpful?

  1. 개발자
  2. Smart Contracts (EVM)
  3. dRamps

dRamp Contract

Contract Roles

Role
Description

Admin (onlyAdmin)

An admin of the contract

DevAddr (onlyDev)

The contract owner

Global Parameters

Name
Type
Description

mintFee

uint256

Fee charged by the dRamp for minting tokens

burnFee

uint256

Fee charged by the dRamp for burning tokens

badgeId

uint256

ID of any badge attached to the dRamp

salePrice

uint256

Sale Price of a token market in the dRamp

soldAccounts

uint256

The number of token markets sold by the dRamp

automatic

bool

Automatically burn and mint tokens

_ve

Address

The collection address attached to the dRamp

Token Market Parameters

Name
Type
Description

status

RampStatus { Pending,

Open,

Close

}

Records the state of the token market

tokenId

uint256

The attached token ID from the collection attached to the dRamp

bountyId

uint256

The bounty attached to the token market

profileId

uint256

The profile attached to the token market

badgeId

uint256

The badge attached to the token market

minted

uint256

The amount of tokens minted by the token market

burnt

uint256

The amount of tokens burnt by the token market

salePrice

uint256

The sale price of the token market. This parameter is null for token markets that are not for sale

maxParters

uint256

The number of partners authorized on a token market.

cap

uint256

A cap on the tax taken by the dRamp on minting and burning operations. This parameter is null for token markets that don't have a cap on their taxes

Functions

updateAdmin - DevAddr

   function updateAdmin(address _admin, bool _add) external onlyDev {
        isAdmin[_admin] = _add;
    }

The owner can add/remove other administrators to/from the contract

createProtocol - Admin

function createProtocol(address _token, uint _tokenId) external onlyAdmin {
    require(IRamp(helper).dTokenSetContains(_token));
    if(!AllProtocols.contains(_token)) {
        AllProtocols.add(_token);
        protocolInfo[_token].status = RampStatus.Open;
        if (_tokenId > 0) updateTokenId(_token, _tokenId);

        IRamp(helper).emitCreateProtocol(msg.sender, _token);
    }
}

function updateTokenId(address _token, uint _tokenId) public {
    require(ve(_ve).ownerOf(_tokenId) == msg.sender);
    if (AllProtocols.contains(_token)) {
        protocolInfo[_token].tokenId = _tokenId;
    }
}

function getParams() external view returns(uint,uint,uint,uint,uint,uint,bool,address) {
    return (
        badgeId,
        tokenId,
        mintFee,
        burnFee,
        salePrice,
        soldAccounts,
        automatic,
        _ve
    );
}

This function adds a token market on your dRamp enabling it to mint or burn that token. You can only add approved tokens. The list of approved tokens is available on the page previous to this.

You can also attach a token from the collection attached to the dRamp to enable you to regain your admin privileges in the event you lose access to your wallet but still have the token. The collection address is the _ve parameter which is the last value returned by the getParams function

updateProtocol - Admin

function updateProtocol(
    address _token, 
    bool _close, 
    uint _cap,
    uint _salePrice,
    uint _maxParters
) external onlyAdmin {
    if(AllProtocols.contains(_token)) {
        uint _tokenId = protocolInfo[_token].tokenId;
        require(_tokenId == 0 || isAdmin[ve(_ve).ownerOf(_tokenId)]);
        _updateProtocol(_token, _close, _cap, _salePrice, _maxParters);
    }
}

function _updateProtocol(
    address _token, 
    bool _close, 
    uint _cap,
    uint _salePrice,
    uint _maxParters
) internal {
    if (_close) {
        protocolInfo[_token].status = RampStatus.Close;
    } else if (protocolInfo[_token].status == RampStatus.Close) {
        protocolInfo[_token].status = RampStatus.Open;
    }
    if (_cap >= IRamp(helper).minCap(_token)) {
        protocolInfo[_token].cap = _cap;    
    }
    protocolInfo[_token].salePrice = _salePrice;
    protocolInfo[_token].maxParters = _maxParters;
}

This function updates parameters of a token market on your dRamp. You can use the _close parameter to close the token market.

deleteProtocol - Admin

function deleteProtocol(address _token) public onlyAdmin {
    require(protocolInfo[_token].minted == protocolInfo[_token].burnt);
    require(protocolInfo[_token].bountyId == 0);
    delete protocolInfo[_token];
    AllProtocols.remove(_token);
    
    IRamp(helper).emitDeleteProtocol(msg.sender, _token);
}

This function the market associated to the specified token. This is only possible when the token market has burnt as many of the token as it has minted and there is not bounty currently associated with it

mint - Admin

 function mint(address _token, address to, uint _amount, uint _identityTokenId, string memory _sessionId) external {
    checkIdentityProof(to, _identityTokenId);
    require(IAuth(contractAddress).devaddr_() == msg.sender || isAdmin[msg.sender], "R1");
    require(protocolInfo[_token].status == RampStatus.Open, "R2");
    (uint _mintable,, CollateralStatus _status) = IRamp(IContract(contractAddress).rampAds()).mintAvailable(address(this), _token);
    if (_status == CollateralStatus.OverCollateralized) {
        uint _toMint = Math.min(_mintable, _amount);
        uint _fee;
        uint _payswapFee;
        if (protocolInfo[_token].cap > 0) {
            _fee = Math.min(_toMint * mintFee / 10000, protocolInfo[_token].cap);
            _payswapFee = Math.min(_toMint * IRamp(helper).tradingFee() / 10000, protocolInfo[_token].cap);
        } else {
            _fee = _toMint * mintFee / 10000;
            _payswapFee = _toMint * IRamp(helper).tradingFee() / 10000;
        }
        totalRevenue[_token] += _fee;
        _toMint = _toMint - _fee - _payswapFee;
        protocolInfo[_token].minted += _toMint;
        IRamp(helper).mint(_token, to, _toMint, _payswapFee, _identityTokenId, _sessionId);
    }
}

This function enables users to mint tokens from a token market. It's only callable by the dRamp's Admin or Payswap's Admin. The

withdraw - Admin

function withdraw(address _token, uint amount) external onlyAdmin {
    IERC20(_token).safeTransfer(msg.sender, amount);
}

This withdraws available tokens from the dRamp.

updateIndividualProtocol - Anyone

function updateIndividualProtocol(
    address _token, 
    bool _close, 
    uint _cap,
    uint _salePrice,
    uint _maxParters
) external {
    if(AllProtocols.contains(_token)) {
        require(ve(_ve).ownerOf(protocolInfo[_token].tokenId) == msg.sender);
        require(!isAdmin[msg.sender]);
        _updateProtocol(_token, _close, _cap, _salePrice, _maxParters);
    }
}

function _updateProtocol(
    address _token, 
    bool _close, 
    uint _cap,
    uint _salePrice,
    uint _maxParters
) internal {
    if (_close) {
        protocolInfo[_token].status = RampStatus.Close;
    } else if (protocolInfo[_token].status == RampStatus.Close) {
        protocolInfo[_token].status = RampStatus.Open;
    }
    if (_cap >= IRamp(helper).minCap(_token)) {
        protocolInfo[_token].cap = _cap;    
    }
    protocolInfo[_token].salePrice = _salePrice;
    protocolInfo[_token].maxParters = _maxParters;
}

This function updates parameters of a token market on a dRamp but can be called by anyone who owns to associated token id. You can use the _close parameter to close the token market.

burn - Anyone

function burn(address _token, uint _amount, uint _identityTokenId) external {
    checkIdentityProof(msg.sender, _identityTokenId);
    uint _toBurn = Math.min(
        _amount, 
        protocolInfo[_token].minted - protocolInfo[_token].burnt
    );
    uint _fee;
    uint _payswapFee;
    if (protocolInfo[_token].cap > 0) {
        _fee = Math.min(_toBurn * burnFee / 10000, protocolInfo[_token].cap);
        _payswapFee = Math.min(IRamp(helper).tradingFee() * _toBurn / 10000, protocolInfo[_token].cap);
    } else {
        _fee = _toBurn * burnFee / 10000;
        _payswapFee = IRamp(helper).tradingFee() * _toBurn / 10000;
    }
    _toBurn = _toBurn - _fee - _payswapFee;
    totalRevenue[_token] += _fee;
    IRamp(helper).burn(_token, msg.sender, _toBurn, _fee, _payswapFee);
    protocolInfo[_token].burnt += _toBurn;
}

This function enables users to burn tokens from a token market

claimPendingRevenue - Anyone

function claimPendingRevenue(address _token, uint _partnerBountyId) external {
    require(!isAdmin[msg.sender] && protocolPartners[_token].contains(_partnerBountyId));
    uint _toPay = IRamp(helper).claimPendingRevenue(_token, msg.sender, _partnerBountyId);
    protocolInfo[_token].minted += _toPay;
    paidRevenue[_token][_partnerBountyId] += _toPay;
    IERC20(_token).safeTransfer(msg.sender, _toPay);
}

This function enables token market partners to claim their pending revenue on the token market

unlockBounty - Anyone

function unlockBounty(address _token, uint _bountyId) external {
    require(protocolInfo[_token].minted == protocolInfo[_token].burnt);
    if(isAdmin[msg.sender]) {
        IRamp(helper).endBounty(protocolInfo[_token].bountyId);
        protocolInfo[_token].bountyId = 0;
    } else if (protocolPartners[_token].contains(_bountyId)) {
        IRamp(helper).endBounty(_bountyId);
        protocolPartners[_token].remove(_bountyId);
    }
}

This function deattaches a bounty from a token market

checkIdentityProof - Anyone

function checkIdentityProof(address _owner, uint _identityTokenId) public {
    if (collectionId > 0) {
        IMarketPlace(IContract(contractAddress).marketHelpers2())
        .checkUserIdentityProof(collectionId, _identityTokenId, _owner);
    }
}

This function checks that an identity token passes membership identity requirements on the associated channel/collection

updateBounty - Anyone

function updateBounty(address _token, uint _bountyId) external {
    IRamp(helper).checkBounty(msg.sender, _bountyId);
    require(isAdmin[msg.sender]);
    require(protocolInfo[_token].bountyId == 0);
    protocolInfo[_token].bountyId = _bountyId;
}

This function enables users to attach a bounty to a token market

addPartner - Anyone

function addPartner(address _token, uint _bountyId) external {
    address rampAds = IContract(contractAddress).rampAds();
    (,,CollateralStatus _status) = IRamp(rampAds).mintAvailable(address(this), _token);
    if (_status == CollateralStatus.UnderCollateralized ||
        protocolInfo[_token].maxParters > protocolPartners[_token].length()
    ) {
        IRamp(helper).checkBounty(msg.sender, _bountyId);
        require(!isAdmin[msg.sender]);
        require(protocolPartners[_token].length() < IContract(contractAddress).maximumSize());
        protocolPartners[_token].add(_bountyId);
        uint _share = ITrustBounty(IContract(contractAddress).trustBounty()).getBalance(_bountyId) * 10000 / IRamp(helper).getTotalBalance(address(this), _token);
        // do not account for past revenue for new partners
        paidRevenue[_token][_bountyId] += _share * totalRevenue[_token]/ 10000;
    }
}

This function enables users to partner with a token market and help it become overcollateralized which is necessary for it to become elligible to mint tokens

buyAccount - Anyone

function buyAccount(address _token, uint _tokenId, uint _bountyId) external {
    require(protocolInfo[_token].salePrice > 0);
    require(ve(_ve).ownerOf(_tokenId) == msg.sender);
    
    IERC20(ve(_ve).token()).safeTransferFrom(msg.sender, address(this), protocolInfo[_token].salePrice);
    protocolInfo[_token].salePrice = 0;
    soldAccounts += 1;
    _updateBounty(_token, _bountyId);
    updateTokenId(_token, _tokenId);
}

This function enables users to purchase a token market

buyRamp - Anyone

function buyRamp(address __ve, uint _tokenId, uint[] memory _bountyIds) external {
    require(salePrice > 0 && ve(_ve).ownerOf(_tokenId) == msg.sender);
    require(AllProtocols.length() - soldAccounts == _bountyIds.length);
    
    IERC20(ve(_ve).token()).safeTransferFrom(msg.sender, address(this), salePrice);
    for(uint i = 0; i < AllProtocols.length(); i++) {
        uint __tokenId = protocolInfo[AllProtocols.at(i)].tokenId;
        if (isAdmin[ve(_ve).ownerOf(__tokenId)]) {
            _updateBounty(AllProtocols.at(i), _bountyIds[i]);
        }
    }
    isAdmin[msg.sender] = true;
    isAdmin[devaddr_] = false;
    devaddr_ = msg.sender;
    updateDevTokenId(__ve, _tokenId);
}

This function enables users to purchase an entire dRamp. It requires its salePrice to be above 0 though.

updateProfile & updateDevTokenId & updateBadgeId & updateDevFromToken - Anyone

function updateProfile(address _token, uint _profileId) external {
  require(IProfile(IContract(contractAddress).profile()).addressToProfileId(msg.sender) == _profileId);
  require(isAdmin[msg.sender]);
  protocolInfo[_token].profileId = _profileId;
}

function updateDevTokenId(address __ve, uint _tokenId) public {
    require(ve(__ve).ownerOf(_tokenId) == msg.sender);
    require(isAdmin[msg.sender]);
    _ve = __ve;
    tokenId = _tokenId;
}

function updateBadgeId(address _token, uint _badgeId) external {
    require(ve(IRamp(helper).badgeNFT()).ownerOf(_badgeId) == msg.sender);
    require(isAdmin[msg.sender]);
    protocolInfo[_token].badgeId = _badgeId;
}

function updateDevFromToken(uint _tokenId) external {
    require(ve(_ve).ownerOf(_tokenId) == msg.sender);
    require(tokenId == _tokenId);
    isAdmin[devaddr_] = false;
    devaddr_ = msg.sender;
    isAdmin[msg.sender] = true;
}

If the Owner needs to change the ownership of the contract, they can call this function.

PreviousdRampsNextLottery

Last updated 1 year ago

Was this helpful?