LogoLogo
Cryptum.ioGitHub
  • 🌐Cryptum
    • What is Cryptum
    • DeFi Market
    • Ecosystem
      • Bitcoin
      • Ethereum
      • Polygon
      • Avalanche C-Chain
      • BNB Chain
      • Cardano
      • Celo
      • Hathor
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
      • Hyperledger Besu
  • 👝Products
    • Dashboard Analytics
    • Tokenization
    • Crypto Checkout
      • Overview
      • Getting started
      • Checkout Dashboard
        • Creating your Store
        • Customer Checkout screens
        • Analytics
        • Managing Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
      • Checkout API
        • Authentication
        • Store
        • Orders
          • Handling Orders
    • Wallets
    • DeFi-as-a-Service
    • On & Off Ramp (soon)
    • E-commerce Plugins
      • Wordpress NFT Plugin
        • How to install NFT Plugin
        • Connect your Credentials to NFT Plugin
      • Wordpress Checkout Plugin
        • How to install Checkout Plugin
        • Connect your Credentials to Checkout Plugin
      • Plugins Guides
        • Creating your Store
        • Manage your Wallets
        • Creating Collections and NFTs
        • Linking Products to NFTs
        • Monitoring Orders
        • Monitoring Store (Analytics)
  • 💻Community Edition
    • Overview
    • Architecture
    • Start for free
    • Getting started
    • Dashboard guide
      • 🔑Creating a Project (API Key)
      • 🛠️Start building!
      • 📊Monitoring your Project
      • 📈Monitoring Requests
    • SDK guides
      • Get test currencies
      • Chainlink
        • 📈Price Feeds
        • ⚙️Automation
        • 🎲VRF
        • 🛤️CCIP
        • 🛤️CCIP
        • Project Examples
          • Lottery
          • Send Message CCIP
      • Wallets
      • Balances
      • Prices
      • Tokens
        • EVM Tokens (ERC-20)
        • Solana Tokens (SPL)
        • Cardano Tokens
        • Stellar Tokens
        • XRP Tokens
        • Hathor Tokens
      • NFTs
        • EVM NFTs (Ethereum, Polygon and others)
        • NFTs on Solana
        • NFTs on Hathor Network
      • Queries
        • Wallet information
        • Get transaction by hash
        • Get block information
        • Get transaction receipt by hash
        • Get fees information
        • Get NFT data
        • Get NFT balance
        • Get UTXOs (Unspent transaction outputs)
      • Uniswap
      • Staking
      • Smart Contracts
        • Deploy custom Smart Contracts
        • Loot Box
    • Features and credits
      • Avalanche C Chain
      • Bitcoin
      • BNB Chain
      • Cardano
      • Celo
      • Ethereum
      • Hathor
      • Polygon
      • Solana
      • Stellar
      • XRP Ledger
      • Stratus
    • API guides
      • API Cryptum
      • API Connector
  • 📃GLOSSARY
    • Blockchain terms
    • Cryptum terms
Powered by GitBook
On this page
  1. Community Edition
  2. SDK guides
  3. Chainlink

Automation

PreviousPrice FeedsNextVRF

Last updated 1 year ago

Automate your smart contracts using a secure and hyper-reliable decentralized network that uses the same external network of node operators that secures billions in value. Building on Chainlink Automation will accelerate your innovation, save you time and money, and help you get to market faster so you don't have to deal with the setup cost, ongoing maintenance, and risks associated with a centralized automation stack.

Before you begin

Before you begin, you need to ensure that you have a sufficient LINK balance to register the upkeep. You will also need a compatible automation contract.

Create Automation

Deploy contract responsible for registering and managing new Upkeeps.

const { hash } = await sdk.chainlink.createAutomation({
    protocol: 'POLYGON',
    wallet
})

Get contract address

 const { contractAddress } = await sdk.transaction.getTransactionReceiptByHash({
    protocol: 'POLYGON',
    hash
})

Register Upkeep

Params:

Var type
Var Name
Example value
Description

String

name

"Test upkeep"

Name of upkeep that will be displayed in the UI.

bytes

encryptedEmail

0x

Can leave blank. If registering via UI we will encrypt email and store it here.

address

upkeepContract

Address of your Automation-compatible contract

uint32

gasLimit

500000

The maximum gas limit that will be used for your txns. Rather over-estimate gas since you only pay for what you use, while too low gas might mean your upkeep doesn't perform. Trade-off is higher gas means higher minimum funding requirement.

address

adminAddress

The address that will have admin rights for this upkeep. Use your wallet address, unless you want to make another wallet the admin.

uint8

triggerType

0 or 1

0 is Conditional upkeep, 1 is Log trigger upkeep

bytes

checkData

0x

checkData is a static input that you can specify now which will be sent into your checkUpkeep or checkLog, see interface.

bytes

triggerConfig

0x

The configuration for your upkeep. 0x for conditional upkeeps, or see next section for log triggers.

bytes

offchainConfig

0x

Leave as 0x, placeholder parameter for future.

uint96

amount

1000000000000000000

Ensure this is less than or equal to the allowance just given, and needs to be in WEI.

const { hash } = await  sdk.chainlink.registerUpkeep({
    protocol: 'POLYGON',
    wallet,
    address: contract,
    name: 'Cryptum Sdk',
    encryptedEmail: '0x',
    upkeepContract: '0x', // target contract
    gasLimit: 500000,
    triggerType: 0,
    checkData: '0x',
    triggerConfig: '0x',
    offchainConfig: '0x',
    amount: '10' // lINK
})

List all Upkeeps

Return the IDs of the upkeeps generated for the provided contract.

sdk.chainlink.listUpkeeps({
    protocol: 'POLYGON',
    address: contract
})

Get info Upkeep

Retrieve detailed information about the upkeep using its ID.

sdk.chainlink.getUpkeep({
    protocol: 'POLYGON',
    upkeepID: '26...7074'
})

Balance Upkeep

Get balance e Minimum Balance upkeep by ID.

sdk.chainlink.getBalanceUpkeep({
    protocol: 'POLYGON',
    address,
    upkeepID
})

Add Funds Upkeep

Add funds to the upkeep by ID.

sdk.chainlink.addFundsUpkeep({
    protocol: 'POLYGON',
    wallet,
    amount: '10',
    upkeepID
})

Pause Upkeep

sdk.chainlink.pauseUpkeep({
    protocol: 'POLYGON',
    wallet,
    upkeepID
})

Unpause Upkeep

sdk.chainlink.unpauseUpkeep({
    protocol: 'POLYGON',
    wallet,
    upkeepID
})

Cancel Upkeep

sdk.chainlink.cancelUpkeep({
    protocol: 'POLYGON',
    wallet,
    upkeepID
})

Withdraw Upkeep

To withdraw funds, the Upkeep administrator have to cancel the Upkeep first. There is delay once an Upkeep has been cancelled before funds can be withdrawn. The number of blocks delay varies by network and once the delay has passed, you can Withdraw funds.

sdk.chainlink.withdrawUpkeep({
    protocol: 'POLYGON',
    wallet,
    upkeepID
})

Edit Gas Limit Upkeep

sdk.chainlink.editGasLimitUpkeep({
    protocol: 'POLYGON',
    wallet,
    upkeepID,
    gasLimit: 400000
})
💻
⚙️
Read more about Chainlink Automation
Read more