This file contains hidden or 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
| #!/usr/bin/env python3 | |
| """ | |
| Script to compute TWAP (Time Weighted Average Price) from Pyth Network price data. | |
| Queries prices for Nov 7 0:00 UTC and 29 days before it, then calculates simple average. | |
| """ | |
| import urllib.request | |
| import urllib.parse | |
| import urllib.error | |
| import json |
This file contains hidden or 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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.0; | |
| import "../utils/Context.sol"; | |
| /** | |
| * @dev Contract module which provides a basic access control mechanism, where | |
| * there is an account (an owner) that can be granted exclusive access to | |
| * specific functions. | |
| * |
This file contains hidden or 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
| // SPDX-License-Identifier: GPL-3.0 | |
| pragma solidity ^0.8.17; | |
| import "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; | |
| contract Test is EIP712 { | |
| constructor() EIP712("native pool", "1") {} | |
| bytes32 private constant ORDER_SIGNATURE_HASH = 0xcdd3cf1659a8da07564b163a4df90f66944547e93f0bb61ba676c459a2db4e20; |
This file contains hidden or 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
| const ethers = require("ethers"); | |
| exports.y_sum_s = [ | |
| 2, 105, 56, 31, 30, 34, 155, 165, 65, 238, 163, 12, 224, 138, 193, 138, 163, | |
| 33, 108, 184, 199, 29, 146, 179, 134, 203, 218, 180, 48, 140, 69, 88, 38, | |
| ]; | |
| console.log( | |
| "address: ", | |
| ethers.utils.computeAddress("0x" + Buffer.from(y_sum_s).toString("hex")) |
This file contains hidden or 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
| let elliptic = require("elliptic"); | |
| let sha3 = require("js-sha3"); | |
| let ec = new elliptic.ec("secp256k1"); | |
| const y_sum_s = [ | |
| 2, 105, 56, 31, 30, 34, 155, 165, 65, 238, 163, 12, 224, 138, 193, 138, 163, | |
| 33, 108, 184, 199, 29, 146, 179, 134, 203, 218, 180, 48, 140, 69, 88, 38, | |
| ]; | |
| const compressed = Buffer.from(y_sum).toString("hex"); |