@@ -142,7 +142,8 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
142142        validDividendIndex (_dividendIndex)
143143    {
144144        Dividend storage  dividend =  dividends[_dividendIndex];
145-         address [] memory  investors =  ISecurityToken (securityToken).getInvestors ();
145+         uint256  checkpointId =  dividend.checkpointId;
146+         address [] memory  investors =  ISecurityToken (securityToken).getInvestorsAt (checkpointId);
146147        uint256  numberInvestors =  Math.min256 (investors.length , _start.add (_iterations));
147148        for  (uint256  i =  _start; i <  numberInvestors; i++ ) {
148149            address  payee =  investors[i];
@@ -226,6 +227,136 @@ contract DividendCheckpoint is DividendCheckpointStorage, ICheckpoint, Module {
226227     */ 
227228    function withdrawWithholding  (uint256  _dividendIndex ) external ;
228229
230+     /** 
231+      * @notice Get static dividend data 
232+      * @return uint256[] timestamp of dividends creation 
233+      * @return uint256[] timestamp of dividends maturity 
234+      * @return uint256[] timestamp of dividends expiry 
235+      * @return uint256[] amount of dividends 
236+      * @return uint256[] claimed amount of dividends 
237+      * @return bytes32[] name of dividends 
238+      */ 
239+     function getDividendsData  () external  view  returns  (
240+         uint256 [] memory  createds ,
241+         uint256 [] memory  maturitys ,
242+         uint256 [] memory  expirys ,
243+         uint256 [] memory  amounts ,
244+         uint256 [] memory  claimedAmounts ,
245+         bytes32 [] memory  names )
246+     {
247+         createds =  new  uint256 [](dividends.length );
248+         maturitys =  new  uint256 [](dividends.length );
249+         expirys =  new  uint256 [](dividends.length );
250+         amounts =  new  uint256 [](dividends.length );
251+         claimedAmounts =  new  uint256 [](dividends.length );
252+         names =  new  bytes32 [](dividends.length );
253+         for  (uint256  i =  0 ; i <  dividends.length ; i++ ) {
254+             (createds[i], maturitys[i], expirys[i], amounts[i], claimedAmounts[i], names[i]) =  getDividendData (i);
255+         }
256+     }
257+ 
258+     /** 
259+      * @notice Get static dividend data 
260+      * @return uint256 timestamp of dividend creation 
261+      * @return uint256 timestamp of dividend maturity 
262+      * @return uint256 timestamp of dividend expiry 
263+      * @return uint256 amount of dividend 
264+      * @return uint256 claimed amount of dividend 
265+      * @return bytes32 name of dividend 
266+      */ 
267+     function getDividendData  (uint256  _dividendIndex ) public  view  returns  (
268+         uint256  created ,
269+         uint256  maturity ,
270+         uint256  expiry ,
271+         uint256  amount ,
272+         uint256  claimedAmount ,
273+         bytes32  name )
274+     {
275+         created =  dividends[_dividendIndex].created;
276+         maturity =  dividends[_dividendIndex].maturity;
277+         expiry =  dividends[_dividendIndex].expiry;
278+         amount =  dividends[_dividendIndex].amount;
279+         claimedAmount =  dividends[_dividendIndex].claimedAmount;
280+         name =  dividends[_dividendIndex].name;
281+     }
282+ 
283+     /** 
284+      * @notice Retrieves list of investors, their claim status and whether they are excluded 
285+      * @param _dividendIndex Dividend to withdraw from 
286+      * @return address[] list of investors 
287+      * @return bool[] whether investor has claimed 
288+      * @return bool[] whether investor is excluded 
289+      * @return uint256[] amount of withheld tax 
290+      * @return uint256[] investor balance 
291+      * @return uint256[] amount to be claimed including withheld tax 
292+      */ 
293+     function getDividendProgress  (uint256  _dividendIndex ) external  view  returns  (
294+         address [] memory  investors ,
295+         bool [] memory  resultClaimed ,
296+         bool [] memory  resultExcluded ,
297+         uint256 [] memory  resultWithheld ,
298+         uint256 [] memory  resultBalance ,
299+         uint256 [] memory  resultAmount )
300+     {
301+         require (_dividendIndex <  dividends.length , "Invalid dividend " );
302+         //Get list of Investors 
303+         Dividend storage  dividend =  dividends[_dividendIndex];
304+         uint256  checkpointId =  dividend.checkpointId;
305+         investors =  ISecurityToken (securityToken).getInvestorsAt (checkpointId);
306+         resultClaimed =  new  bool [](investors.length );
307+         resultExcluded =  new  bool [](investors.length );
308+         resultWithheld =  new  uint256 [](investors.length );
309+         resultBalance =  new  uint256 [](investors.length );
310+         resultAmount =  new  uint256 [](investors.length );
311+         for  (uint256  i; i <  investors.length ; i++ ) {
312+             resultClaimed[i] =  dividend.claimed[investors[i]];
313+             resultExcluded[i] =  dividend.dividendExcluded[investors[i]];
314+             resultBalance[i] =  ISecurityToken (securityToken).balanceOfAt (investors[i], dividend.checkpointId);
315+             if  (! resultExcluded[i]) {
316+                 resultWithheld[i] =  dividend.withheld[investors[i]];
317+                 resultAmount[i] =  resultBalance[i].mul (dividend.amount).div (dividend.totalSupply);
318+             }
319+         }
320+     }
321+ 
322+     /** 
323+      * @notice Retrieves list of investors, their balances, and their current withholding tax percentage 
324+      * @param _checkpointId Checkpoint Id to query for 
325+      * @return address[] list of investors 
326+      * @return uint256[] investor balances 
327+      * @return uint256[] investor withheld percentages 
328+      */ 
329+     function getCheckpointData  (uint256  _checkpointId ) external  view  returns  (address [] memory  investors , uint256 [] memory  balances , uint256 [] memory  withholdings ) {
330+         require (_checkpointId <=  ISecurityToken (securityToken).currentCheckpointId (), "Invalid checkpoint " );
331+         investors =  ISecurityToken (securityToken).getInvestorsAt (_checkpointId);
332+         balances =  new  uint256 [](investors.length );
333+         withholdings =  new  uint256 [](investors.length );
334+         for  (uint256  i; i <  investors.length ; i++ ) {
335+             balances[i] =  ISecurityToken (securityToken).balanceOfAt (investors[i], _checkpointId);
336+             withholdings[i] =  withholdingTax[investors[i]];
337+         }
338+     }
339+ 
340+     /** 
341+      * @notice Checks whether an address is excluded from claiming a dividend 
342+      * @param _dividendIndex Dividend to withdraw from 
343+      * @return bool whether the address is excluded 
344+      */ 
345+     function isExcluded  (address  _investor , uint256  _dividendIndex ) external  view  returns  (bool ) {
346+         require (_dividendIndex <  dividends.length , "Invalid dividend " );
347+         return  dividends[_dividendIndex].dividendExcluded[_investor];
348+     }
349+ 
350+     /** 
351+      * @notice Checks whether an address has claimed a dividend 
352+      * @param _dividendIndex Dividend to withdraw from 
353+      * @return bool whether the address has claimed 
354+      */ 
355+     function isClaimed  (address  _investor , uint256  _dividendIndex ) external  view  returns  (bool ) {
356+         require (_dividendIndex <  dividends.length , "Invalid dividend " );
357+         return  dividends[_dividendIndex].claimed[_investor];
358+     }
359+ 
229360    /** 
230361     * @notice Return the permissions flag that are associated with this module 
231362     * @return bytes32 array 
0 commit comments