Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

383 uncompleted service #201

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions contracts/TalentLayerEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ contract TalentLayerEscrow is
/**
* @notice Emitted after the total amount of a transaction has been paid. At this moment the service is considered finished.
* @param _serviceId The service ID
* @param _transactionId The id of the transaction.
*/
event PaymentCompleted(uint256 _serviceId);
event PaymentCompleted(uint256 _serviceId, uint256 _transactionId);

/**
* @notice Emitted after the protocol fee was updated
Expand Down Expand Up @@ -993,7 +994,7 @@ contract TalentLayerEscrow is

if (transaction.amount == 0) {
talentLayerServiceContract.afterFullPayment(transaction.serviceId, transaction.releasedAmount);
emit PaymentCompleted(transaction.serviceId);
emit PaymentCompleted(transaction.serviceId, transaction.id);
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/playground/3-make-proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function main() {

/* --------- Proposal creation --------- */

// Bob create a proposal #2 for Alice's service #1 on Dave's platform #1 (id : 1-2 in GraphQL)
// Bob creates a proposal #2 for Alice's service #1 on Dave's platform #1 (id : 1-2 in GraphQL)

const signatureBobProposal = await getSignatureForProposal(dave, bobTlId, 1, bobUri)

Expand Down
15 changes: 5 additions & 10 deletions scripts/playground/7-payETH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DeploymentProperty, getDeploymentProperty } from '../../.deployment/dep
import hre = require('hardhat')

const aliceTlId = 1
const carolTlId = 3

/*
In this script Alice releases 3/4 of the escrow & Carol reimburses the remaining 1/4 to Alice
Expand All @@ -11,11 +12,6 @@ async function main() {
const network = hre.network.name
console.log(network)

const talentLayerService = await ethers.getContractAt(
'TalentLayerService',
getDeploymentProperty(network, DeploymentProperty.TalentLayerService),
)

const [alice, bob, carol, dave] = await ethers.getSigners()

const talentLayerEscrow = await ethers.getContractAt(
Expand All @@ -25,16 +21,15 @@ async function main() {

const rateAmount = ethers.utils.parseUnits('0.002', 18)

// Alice releases an amount too low for the service to be considered finished
const firstRelease = await talentLayerEscrow
.connect(alice)
.release(aliceTlId, 0, rateAmount.div(2))
.release(aliceTlId, 1, rateAmount.mul(20).div(100))
await firstRelease.wait()
const secondRelease = await talentLayerEscrow
.connect(alice)
.release(aliceTlId, 0, rateAmount.div(2))
.connect(carol)
.reimburse(carolTlId, 1, rateAmount.mul(80).div(100))
await secondRelease.wait()
// const reimburse = await talentLayerEscrow.connect(carol).reimburse(0, rateAmount.div(4))
// reimburse.wait()
}

// We recommend this pattern to be able to use async/await everywhere
Expand Down
2 changes: 1 addition & 1 deletion scripts/playground/7-payToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function main() {
)
const rateAmount = ethers.utils.parseUnits('0.003', 18)

const release = await talentLayerEscrow.connect(alice).release(aliceTlId, 1, rateAmount)
const release = await talentLayerEscrow.connect(alice).release(aliceTlId, 2, rateAmount)
await release.wait()
}

Expand Down
4 changes: 2 additions & 2 deletions test/batch/fullWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ describe('TalentLayer protocol global testing', function () {
serviceId,
transactionDetailsBefore.proposalId,
)
await expect(transaction).to.emit(talentLayerEscrow, 'PaymentCompleted').withArgs(serviceId)
await expect(transaction).to.emit(talentLayerEscrow, 'PaymentCompleted').withArgs(serviceId, transactionId)

// Check transaction data has been updated correctly
const transactionDetailsAfter = await talentLayerEscrow
Expand Down Expand Up @@ -1901,7 +1901,7 @@ describe('TalentLayer protocol global testing', function () {
[talentLayerEscrow.address, alice, bob],
[-totalAmount / 4, totalAmount / 4, 0],
)
await expect(transaction).to.emit(talentLayerEscrow, 'PaymentCompleted').withArgs(serviceId)
await expect(transaction).to.emit(talentLayerEscrow, 'PaymentCompleted').withArgs(serviceId, transactionId)
})

it('Alice can not release escrow because there is none left.', async function () {
Expand Down
Loading