Polystream
  • Overview
  • Getting Started
    • The Crypto Problem
  • Polystream
    • Polystream Vaults
    • ERC4337 Smart Account Wallets
    • Crypto-Fiat Ramp
    • Rewards
    • AI Agents
    • Foundry
  • Smart Contracts
    • Adapter
    • Core
    • Strategy
    • Polystream Contract Address
  • Project Architecture
    • Sequence Diagram
    • Cranker
  • Developer Contributions
  • Others
    • Socials
    • Feedback
Powered by GitBook
On this page
  1. Project Architecture

Cranker

Cranker with chainlink automation upkeep

PreviousSequence DiagramNextDeveloper Contributions

Last updated 2 months ago

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)

  1. 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);
}
  1. 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
}
  1. $LINK Token Payments: Each automation execution consumes Chainlink's $LINK tokens from the project's Automation balance, compensating the keepers for their service.

Chainlink Automation dashboard showing periodic performUpkeep executions and $LINK payments