Events and Function chaining
Emit a custom event
import { Address, Bytes, ChainId, Ethereum, EvmCallBuilder, evm, EvmEncodeParam, TokenAmount } from '@mimicprotocol/lib-ts'
export default function main(): void {
const topic = evm.keccak('First function')
const data = evm.encode([EvmEncodeParam.fromValue('address', '0xSomeAddress')])
const fee = TokenAmount.fromStringDecimal(Ethereum.USDC, '1')
EvmCallBuilder.forChain(ChainId.ETHEREUM)
.addCall(Address.fromString('0xContractAddress'), callData)
.addEvent(Bytes.fromHexString(topic), Bytes.fromHexString(data))
.addUser('0xSmartAccountAddress')
.send(fee)
}Trigger a function from a custom event
Read event data
Use case
Last updated