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
  • 1. No modifications are needed
  • a. Functions with access control modifier that can register executors.
  • b. Functions that can be called by anyone
  • 2. Modifications needed
  • a. Functions you want to send transactions on behalf of users
  • External tokens
  • Diamon router/pairs

Was this helpful?

  1. Guide for implementing a smart contract

How to implement logic contract

Last updated 1 year ago

Was this helpful?

1. No modifications are needed

a. Functions with access control modifier that can register executors.

b. Functions that can be called by anyone

i. Functions that can be called by anyone with a signature like function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)

ii. Functions that can really be called by anyone (public functions without access control)

2. Modifications needed

a. Functions you want to send transactions on behalf of users

i. Create another function with the same purpose that can be called by executors on behalf of your users. You may have your users create their signatures for you and then send the signatures along with the transactions, or you may only send the addresses of the users. How you implement your logic depends on your team, the main point is to create a function that can be called by the executors that can function like your original function without having the users send transactions by themselves.

External tokens

  1. Adding SDK related functions and access control

  2. Adding your tokens as logic contracts and call your ERC20-721-non-related functions on your tokens (2.a.i)

Diamon router/pairs

  1. External logic contracts -> Diamon router

  2. External logic contracts -> Diamon pair

  3. Users with sdk -> Diamon router (swap)

  4. Users with sdk -> Diamon router (add liquidity)

  5. Users with sdk -> Diamon pairs (swap)

  6. Users with sdk -> Diamon pairs (add liquidity)

Newly created tokens, KAP20 and KAP721 for SDK

https://bscscan.com/address/0x0eD7e52944161450477ee417DE9Cd3a859b14fD0#code