Skip to content

Commit 7d71bca

Browse files
committed
refactor(app/bounty): contract address bound createTask
1 parent 86dcbab commit 7d71bca

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/app/creator/build/[type]/AppliedModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export function AppliedModal({ open, closeModal, bounty, applyCallback }) {
142142

143143
const write = async () => {
144144
try {
145-
const { hash } = await createTask(bountyContract, [
145+
const { hash } = await createTask([
146146
bounty.task,
147147
currUser?.user_wallet,
148148
payToken.address,

src/domain/bounty/repository.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ import { createContractActions } from '@/utils/contract';
2323
import httpClient from '@/utils/http';
2424
import { parseTokenUnits } from '@/utils/web3';
2525

26+
import type { Address } from '@wagmi/core';
27+
2628
import { getContractAddress } from './helper';
2729
import bountyAbi from './helper/abi';
2830

29-
const { writeActions: { createTask, withdraw: withdrawFromAbi } } = createContractActions(bountyAbi);
31+
const { writeActions: { createTask: createTaskFromAbi, withdraw: withdrawFromAbi } } = createContractActions(bountyAbi);
3032

31-
function resolveSkipped(page, size = PAGE_SIZE) {
33+
function resolveSkipped(page: number | string, size: number = PAGE_SIZE) {
3234
let resolved = Number(page);
3335

3436
if (!isInteger(resolved) || resolved < 1) {
@@ -87,6 +89,10 @@ async function requestTermination(id, data) {
8789
return httpClient.post(`/build/creator/bounties/${id}/status/termination/propose`, data);
8890
}
8991

92+
async function createTask(args: [bigint, Address, Address, bigint]) {
93+
return createTaskFromAbi(getContractAddress(), args);
94+
}
95+
9096
async function withdraw(walletClient, chainId, taskId, amount, deadline, signature) {
9197
try {
9298
const { hash } = await withdrawFromAbi(getContractAddress(chainId), [

src/domain/bounty/widgets/process-list/AppliedModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function AppliedModal({ open, closeModal, bounty, revalidatePathAction }) {
7676

7777
const write = useCallback(async() => {
7878
try {
79-
const { hash } = await createTask(bountyContract, [
79+
const { hash } = await createTask([
8080
bounty.task,
8181
currUser?.user_wallet,
8282
payToken.address,

0 commit comments

Comments
 (0)