KUB Docs
  • Introduction to KUB
  • Connect to KUB
  • KUB PoS
    • Increase block gas limit to 90M
    • Update GasPrice Instruction
    • Incident from chaophaya hardfork
    • Overview
    • Considerations
    • Validator Node
      • Node Requirements
      • Run Validator Node
      • Validator Staking
      • StakeManager Contract
      • ValidatorShare Contract
      • Slashing
    • Run Full Node
    • Run Archive Node
    • Chaindata Snapshot
    • Migration PoSA to PoS
    • Delegator
      • How to delegate
      • How to claim reward
      • How to unstake
  • Developer Center
    • ✨Getting Started
    • 🏆Project Tiers
    • 👨‍💻Connect Bitkub NEXT to register as a new user
    • ✔️Verify your identity via Bitkub NEXT (KYC or KYB)
    • 💰Subscribe to the KUB Developer Package
    • 🗳️Submit your project
      • 📗Create submit project
      • 📘Manage your project
        • Submit project
        • Create a new project version
        • Status of project version
      • 📙Manage project information
  • KUB SDK
    • NEXT SDK
      • NEXT SDK Code Cookbook
      • KUB SDK Compatible Smart Contract
        • Example Smart Contract for Testing
        • Example KUB SDK Compatible KAP20 Smart Contract
        • Example KUB SDK Compatible KAP721 Smart Contract
  • KUB Playground
    • Quick Start Guide on KUB Playground
  • KUB Layer 2
  • KUB Scan
  • RPC Service
    • JSON-RPC Endpoint
  • IPFS Service
    • IPFS Guideline
  • FAQ
  • Glossary
  • Reference and Service
    • KUB Whitepaper Version 3.3
    • Technical Paper Version 3.2
    • KUB Explorer
    • KUB Faucet
    • KUB Oracle
    • KUB Bridge
    • KKUB OTP
Powered by GitBook
On this page
  • Function approveBySDK
  • Function setApprovalForAllBySDK
  • Function transferFromBySDK

Was this helpful?

  1. Guide for implementing a smart contract

Required KAP721 Functions for SDK system

A contract that can be used with the SDK as KAP721 must have 3 important functions:

Function approveBySDK

function approveBySDK(address _operator, uint256 _tokenId) external override onlyExecutor returns (bool)

This function acts like the function approve(address to, uint256 tokenId) where _operator is the User that the system will act on instead.

Function setApprovalForAllBySDK

function setApprovalForAllBySDK(
    address _owner,
    address _operator,
    bool _approved
  ) external override onlyExecutor returns (bool)

This function acts like the function setApprovalForAll(address operator, bool approved) where _owner is the User the system will execute.

Function transferFromBySDK

function transferFromBySDK(
    address _sender,
    address _recipient,
    uint256 _tokenId
  ) external override onlyExecutor returns (bool)

This acts like function transferFrom(

address from,

address to,

uint256 tokenId)

Where _sender is the user that the system will work on instead, in the contract that BBT distributes as an example, there is no approval check.

Basic functions are the basic functions that the SDK system expects the contract added to the SDK system to have.

The onlyExecutor modifier is responsible for allowing addresses generated by the SDK system to call the function that the modifier is attached to. And to prevent being called by an address that doesn't have permission to use.

Contract KAP721SDK, which Bitkub Chain distributes as a sample, is a standard contract that developers can use. Or modify it to match the Business Usecase of the developer and the Contract that was implemented later from the Contract KAP721 that Implement Interface IKAP20 and others.

Last updated 1 year ago

Was this helpful?