Cranker
Cranker with chainlink automation upkeep
Chainlink Automation provides a decentralized network of automated agents (keepers) that trigger on-chain smart contract executions based on predefined conditions, eliminating manual intervention and operational risks.
Use Cases in Polystream
Epoch Management: Automated triggering of epoch changes to handle yield harvesting, yield optimization, and state updates at consistent intervals.
Reward Distributions: Automating distribution and accounting of accrued yield rewards at each epoch boundary to ensure timely and fair distribution.
How it Works (Technical Flow)
Condition Definition: On-chain conditions (
checkUpkeep
) defined in the smart contract specify precisely when automation triggers should activate.
solidityCopyEditfunction checkUpkeep(bytes calldata) external view returns (bool upkeepNeeded, bytes memory performData) {
upkeepNeeded = (block.timestamp >= lastEpochTime + EPOCH_DURATION);
}
Automated Execution: Once conditions are met, Chainlink Automation calls the
performUpkeep
function on your deployed contract:
solidityCopyEditfunction performUpkeep(bytes calldata) external {
checkAndHarvest(); // Harvest yield and distribute rewards
optimizeYield(); // Automatically selects best yielding protocol
}
$LINK Token Payments: Each automation execution consumes Chainlink's
$LINK
tokens from the project's Automation balance, compensating the keepers for their service.

performUpkeep
executions and $LINK paymentsLast updated