⚙️Automation

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.

Read more about Chainlink Automation

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. Read more

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:

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
})

Last updated