Fee collection

The goal of this task is to move tokens from an external source to the settler itself.

Task

import { environment } from '@mimicprotocol/lib-ts'

import { ExternalSource, inputs } from './types'

export default function main() {
  const tokens = environment.getRelevantTokens(inputs.source, inputs.chainId)
	
  for (const token of tokens) {
    new ExternalSource(inputs.chainId, inputs.target)
      .claim(token.address, token.balance, inputs.recipient)
      .addFee(inputs.feeToken, inputs.feeAmount)
      .send()
    console.log('Claimed: ' + token.toString())
  }
}

Manifest

version: 1.0.0
name: Collect Task
description: Collects all tokens from an external source to a recipient
inputs:
  - chainId: uint32
  - target: address
  - source: address
  - recipient: address  
  - feeToken: address
  - feeAmount: uint256
abis:
  - ExternalSource: './abis/ExternalSource.json'

Last updated