-
Notifications
You must be signed in to change notification settings - Fork 2
/
LibMuonFundingRate.sol
34 lines (32 loc) · 1.14 KB
/
LibMuonFundingRate.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: SYMM-Core-Business-Source-License-1.1
// This contract is licensed under the SYMM Core Business Source License 1.1
// Copyright (c) 2023 Symmetry Labs AG
// For more information, see https://docs.symm.io/legal-disclaimer/license
pragma solidity >=0.8.18;
import "../../storages/MuonStorage.sol";
import "../../storages/AccountStorage.sol";
import "./LibMuon.sol";
library LibMuonFundingRate {
function verifyPairUpnl(PairUpnlSig memory upnlSig, address partyB, address partyA) internal view {
MuonStorage.Layout storage muonLayout = MuonStorage.layout();
// == SignatureCheck( ==
require(block.timestamp <= upnlSig.timestamp + muonLayout.upnlValidTime, "LibMuon: Expired signature");
// == ) ==
bytes32 hash = keccak256(
abi.encodePacked(
muonLayout.muonAppId,
upnlSig.reqId,
address(this),
partyB,
partyA,
AccountStorage.layout().partyBNonces[partyB][partyA],
AccountStorage.layout().partyANonces[partyA],
upnlSig.upnlPartyB,
upnlSig.upnlPartyA,
upnlSig.timestamp,
LibMuon.getChainId()
)
);
LibMuon.verifyTSSAndGateway(hash, upnlSig.sigs, upnlSig.gatewaySignature);
}
}