This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
125 changed files
with
13,437 additions
and
1,157 deletions.
There are no files selected for viewing
5,602 changes: 5,602 additions & 0 deletions
5,602
packages/actus-solidity/actus-resources/tests/actus-tests-CERTF.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/actus-solidity/contracts/Core/Utils/EventUtils.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// "SPDX-License-Identifier: Apache-2.0" | ||
pragma solidity ^0.6.10; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "../ACTUSTypes.sol"; | ||
|
||
/** | ||
* @title EventUtils | ||
* @notice Methods for encoding decoding events | ||
*/ | ||
contract EventUtils { | ||
|
||
function encodeEvent(EventType eventType, uint256 scheduleTime) | ||
public | ||
pure | ||
returns (bytes32) | ||
{ | ||
return ( | ||
bytes32(uint256(uint8(eventType))) << 248 | | ||
bytes32(scheduleTime) | ||
); | ||
} | ||
|
||
function decodeEvent(bytes32 _event) | ||
public | ||
pure | ||
returns (EventType, uint256) | ||
{ | ||
EventType eventType = EventType(uint8(uint256(_event >> 248))); | ||
uint256 scheduleTime = uint256(uint64(uint256(_event))); | ||
|
||
return (eventType, scheduleTime); | ||
} | ||
|
||
/** | ||
* @notice Returns the epoch offset for a given event type to determine the | ||
* correct order of events if multiple events have the same timestamp | ||
*/ | ||
function getEpochOffset(EventType eventType) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return uint256(eventType); | ||
} | ||
} |
Oops, something went wrong.