-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add view assets functions #262
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
Changes from all commits
f34d071
4a44957
99b1b47
be36a3a
7c7fe07
8b261fd
b27b116
9e1d7eb
27f02ab
2939683
99acad3
359d32c
aa5d0e1
cc99fa1
ce727e7
a74abf2
2aefd8e
552b7ad
342f64d
101ef27
22b517e
78d8a97
28c953f
7bd8bef
6e779b6
871d1f2
99ed6a4
45ea533
cf0c3fe
6eddbd5
83d732c
a5e6e90
9410bfa
01107ef
db8005a
7fb43fd
3e408b8
446ccac
5fabe28
a0a68cb
ab33303
09ff593
406c10b
9185de0
b8c1d65
e6b3360
d191b3f
c58bfaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,28 @@ library IexecLibCore_v5 { | |
string description; | ||
uint256 workClockTimeRef; | ||
} | ||
struct DatasetInfo { | ||
address owner; | ||
string m_datasetName; | ||
bytes m_datasetMultiaddr; | ||
bytes32 m_datasetChecksum; | ||
zguesmi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
struct AppInfo { | ||
address owner; | ||
string m_appName; | ||
string m_appType; | ||
bytes m_appMultiaddr; | ||
bytes32 m_appChecksum; | ||
bytes m_appMREnclave; | ||
} | ||
|
||
struct WorkerpoolInfo { | ||
address owner; | ||
string m_workerpoolDescription; | ||
uint256 m_workerStakeRatioPolicy; | ||
uint256 m_schedulerRewardRatioPolicy; | ||
} | ||
Comment on lines
+19
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another option could be to have those structs directly in the asset contract interface. I’m not sure which solution is better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could be an option but this would imply having v6 and v8 interfaces in asset contract interface There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok to put them inside LibCore since |
||
|
||
/** | ||
* Clerk - Deals | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.0; | ||
interface IApp { | ||
function owner() external view returns (address); | ||
function m_appName() external view returns (string memory); | ||
function m_appType() external view returns (string memory); | ||
function m_appMultiaddr() external view returns (bytes memory); | ||
function m_appChecksum() external view returns (bytes32); | ||
function m_appMREnclave() external view returns (bytes memory); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pragma solidity ^0.8.0; | ||
interface IDataset { | ||
function owner() external view returns (address); | ||
function m_datasetName() external view returns (string memory); | ||
function m_datasetMultiaddr() external view returns (bytes memory); | ||
function m_datasetChecksum() external view returns (bytes32); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,14 +26,23 @@ import { | |
getIexecAccounts, | ||
getTaskId, | ||
} from '../../../utils/poco-tools'; | ||
import { IexecWrapper } from '../../utils/IexecWrapper'; | ||
import { | ||
APP_CHECKSUM, | ||
APP_MR_ENCLAVE, | ||
APP_MULTIADDR, | ||
DATASET_CHECKSUM, | ||
DATASET_MULTIADDR, | ||
IexecWrapper, | ||
} from '../../utils/IexecWrapper'; | ||
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer'; | ||
import { hashDomain, randomAddress } from '../../utils/utils'; | ||
|
||
/** | ||
* Test state view functions. | ||
*/ | ||
|
||
// Asset test data constants | ||
|
||
const appPrice = 1000n; | ||
const datasetPrice = 1_000_000n; | ||
const workerpoolPrice = 1_000_000_000n; | ||
|
@@ -243,6 +252,32 @@ describe('IexecPocoAccessors', async () => { | |
expect(await iexecPoco.callbackgas()).to.equal(100_000n); | ||
}); | ||
|
||
it('viewDataset', async function () { | ||
const datasetInfo = await iexecPoco.viewDataset(datasetAddress); | ||
expect(datasetInfo.owner).to.equal(datasetProvider.address); | ||
expect(datasetInfo.m_datasetName).to.equal('my-dataset'); | ||
expect(datasetInfo.m_datasetMultiaddr).to.equal(DATASET_MULTIADDR); | ||
expect(datasetInfo.m_datasetChecksum).to.equal(DATASET_CHECKSUM); | ||
}); | ||
|
||
it('viewApp', async function () { | ||
const appInfo = await iexecPoco.viewApp(appAddress); | ||
expect(appInfo.owner).to.equal(appProvider.address); | ||
expect(appInfo.m_appName).to.equal('my-app'); | ||
expect(appInfo.m_appType).to.equal('APP_TYPE_0'); | ||
expect(appInfo.m_appMultiaddr).to.equal(APP_MULTIADDR); | ||
expect(appInfo.m_appChecksum).to.equal(APP_CHECKSUM); | ||
expect(appInfo.m_appMREnclave).to.equal(APP_MR_ENCLAVE); | ||
}); | ||
|
||
it('viewWorkerpool', async function () { | ||
const workerpoolInfo = await iexecPoco.viewWorkerpool(workerpoolAddress); | ||
expect(workerpoolInfo.owner).to.equal(scheduler.address); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The owner of the workerpool is the scheduler 🤔 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
expect(workerpoolInfo.m_workerpoolDescription).to.equal('my-workerpool'); | ||
expect(workerpoolInfo.m_workerStakeRatioPolicy).to.equal(30n); | ||
expect(workerpoolInfo.m_schedulerRewardRatioPolicy).to.equal(1n); | ||
}); | ||
|
||
it('contributionDeadlineRatio', async function () { | ||
expect(await iexecPoco.contribution_deadline_ratio()).to.equal(7); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we indicate that this is version 8 in the file name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question, matched what was already done with IWorkpool file can change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep them ISO yes. Otherwise we'll need to modify
IexecPoco1Facet
andIexecPocoBoostFacet
.