Skip to content

Commit 8f3ff3f

Browse files
authored
Examples: Rename to use functions (#28)
1 parent 1ad4cac commit 8f3ff3f

49 files changed

Lines changed: 361 additions & 364 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
## Content
2222

23-
This repository provides working examples of tasks that can be automated using Mimic Protocol.
23+
This repository provides working examples of functions that can be automated using Mimic Protocol.
2424

2525
## Setup
2626

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version: 1.0.0
22
name: Simple transfer
3-
description: Automated task to execute transfers of 1 USDC with 0.1 USDC fee
3+
description: Automated function to execute transfers of 1 USDC with 0.1 USDC fee
File renamed without changes.

examples/01-simple-transfer/tests/task.spec.ts renamed to examples/01-simple-transfer/tests/function.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { OpType } from '@mimicprotocol/sdk'
2-
import { Context, runTask, Transfer } from '@mimicprotocol/test-ts'
2+
import { Context, runFunction, Transfer } from '@mimicprotocol/test-ts'
33
import { expect } from 'chai'
44

5-
describe('Task', () => {
6-
const taskDir = './build'
5+
describe('Function', () => {
6+
const functionDir = './build'
77

88
const context: Context = {
99
user: '0x756f45e3fa69347a9a973a725e3c98bc4db0b5a0',
@@ -12,7 +12,7 @@ describe('Task', () => {
1212
}
1313

1414
it('produces the expected intents', async () => {
15-
const result = await runTask(taskDir, context)
15+
const result = await runFunction(functionDir, context)
1616
expect(result.success).to.be.true
1717
expect(result.timestamp).to.be.equal(context.timestamp)
1818

examples/02-simple-transfer-with-inputs/manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 1.0.0
22
name: Simple transfer with inputs
3-
description: Automated task to execute parameterized transfers
3+
description: Automated function to execute parameterized transfers
44
inputs:
55
- chainId: uint32
66
- token: address
File renamed without changes.

examples/02-simple-transfer-with-inputs/tests/task.spec.ts renamed to examples/02-simple-transfer-with-inputs/tests/function.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { fp, OpType, randomEvmAddress } from '@mimicprotocol/sdk'
2-
import { Context, EvmCallQueryMock, runTask, Transfer } from '@mimicprotocol/test-ts'
2+
import { Context, EvmCallQueryMock, runFunction, Transfer } from '@mimicprotocol/test-ts'
33
import { expect } from 'chai'
44
import { Interface } from 'ethers'
55

66
import ERC20Abi from '../abis/ERC20.json'
77

88
const ERC20Interface = new Interface(ERC20Abi)
99

10-
describe('Task', () => {
11-
const taskDir = './build'
10+
describe('Function', () => {
11+
const functionDir = './build'
1212

1313
const context: Context = {
1414
user: randomEvmAddress(),
@@ -36,7 +36,7 @@ describe('Task', () => {
3636
]
3737

3838
it('produces the expected intents', async () => {
39-
const result = await runTask(taskDir, context, { inputs, calls })
39+
const result = await runFunction(functionDir, context, { inputs, calls })
4040
expect(result.success).to.be.true
4141
expect(result.timestamp).to.be.equal(context.timestamp)
4242

examples/03-transfer-balance-threshold/manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 1.0.0
22
name: Transfer based on threshold
3-
description: Automated task to execute parameterized transfers based on balance threshold
3+
description: Automated function to execute parameterized transfers based on balance threshold
44
inputs:
55
- chainId: uint32
66
- token: address
File renamed without changes.

examples/03-transfer-balance-threshold/tests/task.spec.ts renamed to examples/03-transfer-balance-threshold/tests/function.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { fp, OpType, randomEvmAddress } from '@mimicprotocol/sdk'
2-
import { Context, EvmCallQueryMock, runTask, Transfer } from '@mimicprotocol/test-ts'
2+
import { Context, EvmCallQueryMock, runFunction, Transfer } from '@mimicprotocol/test-ts'
33
import { expect } from 'chai'
44
import { Interface } from 'ethers'
55

66
import ERC20Abi from '../abis/ERC20.json'
77

88
const ERC20Interface = new Interface(ERC20Abi)
99

10-
describe('Task', () => {
11-
const taskDir = './build'
10+
describe('Function', () => {
11+
const functionDir = './build'
1212

1313
const context: Context = {
1414
user: randomEvmAddress(),
@@ -50,7 +50,7 @@ describe('Task', () => {
5050
const calls = buildCalls(balance)
5151

5252
it('produces the expected intents', async () => {
53-
const result = await runTask(taskDir, context, { inputs, calls })
53+
const result = await runFunction(functionDir, context, { inputs, calls })
5454
expect(result.success).to.be.true
5555
expect(result.timestamp).to.be.equal(context.timestamp)
5656

@@ -77,7 +77,7 @@ describe('Task', () => {
7777
const calls = buildCalls(balance)
7878

7979
it('does not produce any intent', async () => {
80-
const result = await runTask(taskDir, context, { inputs, calls })
80+
const result = await runFunction(functionDir, context, { inputs, calls })
8181
expect(result.success).to.be.true
8282
expect(result.intents).to.be.empty
8383
})

0 commit comments

Comments
 (0)