33
44pragma solidity ^ 0.8.0 ;
55
6- import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol " ;
6+ import {PocoStorageLib, IRegistry } from "../libs/PocoStorageLib.v8.sol " ;
77import {FacetBase} from "./FacetBase.v8.sol " ;
88import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol " ;
99import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol " ;
@@ -25,6 +25,7 @@ contract IexecPocoAccessorsFacet is
2525 using IexecLibOrders_v5 for IexecLibOrders_v5.WorkerpoolOrder;
2626 using IexecLibOrders_v5 for IexecLibOrders_v5.RequestOrder;
2727
28+ // ========= Deal and Task Accessors =========
2829 /**
2930 * Get a deal created by PoCo classic facet.
3031 * @param id The ID of the deal.
@@ -73,4 +74,164 @@ contract IexecPocoAccessorsFacet is
7374 _toTypedDataHash (requestOrder.hash ())
7475 );
7576 }
77+
78+ function viewConsumed (bytes32 _id ) external view returns (uint256 consumed ) {
79+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
80+ return $.m_consumed[_id];
81+ }
82+
83+ function viewPresigned (bytes32 _id ) external view returns (address signer ) {
84+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
85+ return $.m_presigned[_id];
86+ }
87+
88+ function viewContribution (
89+ bytes32 _taskid ,
90+ address _worker
91+ ) external view returns (IexecLibCore_v5.Contribution memory ) {
92+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
93+ return $.m_contributions[_taskid][_worker];
94+ }
95+
96+ function viewScore (address _worker ) external view returns (uint256 ) {
97+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
98+ return $.m_workerScores[_worker];
99+ }
100+
101+ function resultFor (bytes32 id ) external view returns (bytes memory ) {
102+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
103+ IexecLibCore_v5.Task storage task = $.m_tasks[id];
104+ require (task.status == IexecLibCore_v5.TaskStatusEnum.COMPLETED, "task-pending " );
105+ return task.resultsCallback; // Expansion - result separation
106+ }
107+
108+ // ========= SRLC Token and Account Accessors =========
109+
110+ function name () external view returns (string memory ) {
111+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
112+ return $.m_name;
113+ }
114+
115+ function symbol () external view returns (string memory ) {
116+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
117+ return $.m_symbol;
118+ }
119+
120+ function decimals () external view returns (uint8 ) {
121+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
122+ return $.m_decimals;
123+ }
124+
125+ function totalSupply () external view returns (uint256 ) {
126+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
127+ return $.m_totalSupply;
128+ }
129+
130+ function balanceOf (address account ) external view returns (uint256 ) {
131+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
132+ return $.m_balances[account];
133+ }
134+
135+ function frozenOf (address account ) external view returns (uint256 ) {
136+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
137+ return $.m_frozens[account];
138+ }
139+
140+ function allowance (address account , address spender ) external view returns (uint256 ) {
141+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
142+ return $.m_allowances[account][spender];
143+ }
144+
145+ function viewAccount (address account ) external view returns (IexecLibCore_v5.Account memory ) {
146+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
147+ return IexecLibCore_v5.Account ($.m_balances[account], $.m_frozens[account]);
148+ }
149+
150+ function token () external view returns (address ) {
151+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
152+ return address ($.m_baseToken);
153+ }
154+
155+ // ========= Category Accessors =========
156+
157+ function viewCategory (
158+ uint256 _catid
159+ ) external view returns (IexecLibCore_v5.Category memory category ) {
160+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
161+ if (_catid >= $.m_categories.length ) {
162+ revert (); // Intentionally revert without reason instead of panic for retro-compatibility with the old interface
163+ }
164+ return $.m_categories[_catid];
165+ }
166+
167+ function countCategory () external view returns (uint256 count ) {
168+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
169+ return $.m_categories.length ;
170+ }
171+
172+ // ========= Registry Accessors =========
173+
174+ function appregistry () external view returns (IRegistry) {
175+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
176+ return $.m_appregistry;
177+ }
178+
179+ function datasetregistry () external view returns (IRegistry) {
180+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
181+ return $.m_datasetregistry;
182+ }
183+
184+ function workerpoolregistry () external view returns (IRegistry) {
185+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
186+ return $.m_workerpoolregistry;
187+ }
188+
189+ function teebroker () external view returns (address ) {
190+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
191+ return $.m_teebroker;
192+ }
193+
194+ function callbackgas () external view returns (uint256 ) {
195+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
196+ return $.m_callbackgas;
197+ }
198+
199+ // ========= Constants Accessors =========
200+
201+ function contribution_deadline_ratio () external pure returns (uint256 ) {
202+ return CONTRIBUTION_DEADLINE_RATIO;
203+ }
204+
205+ function reveal_deadline_ratio () external pure returns (uint256 ) {
206+ return REVEAL_DEADLINE_RATIO;
207+ }
208+
209+ function final_deadline_ratio () external pure returns (uint256 ) {
210+ return FINAL_DEADLINE_RATIO;
211+ }
212+
213+ function workerpool_stake_ratio () external pure returns (uint256 ) {
214+ return WORKERPOOL_STAKE_RATIO;
215+ }
216+
217+ function kitty_ratio () external pure returns (uint256 ) {
218+ return KITTY_RATIO;
219+ }
220+
221+ function kitty_min () external pure returns (uint256 ) {
222+ return KITTY_MIN;
223+ }
224+
225+ function kitty_address () external pure returns (address ) {
226+ return KITTY_ADDRESS;
227+ }
228+
229+ function groupmember_purpose () external pure returns (uint256 ) {
230+ return GROUPMEMBER_PURPOSE;
231+ }
232+
233+ function eip712domain_separator () external view returns (bytes32 ) {
234+ PocoStorageLib.PocoStorage storage $ = PocoStorageLib.getPocoStorage ();
235+ return $.m_eip712DomainSeparator;
236+ }
76237}
0 commit comments