Skip to content

Instantly share code, notes, and snippets.

@hcheng826
hcheng826 / [email protected]@v4.0.0...access...Ownable.sol
Created August 17, 2024 09:43
Created using tron-ide: Realtime Tron Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at http://tronide.io/#version=soljson_v0.8.6+commit.0e36fba.js&optimize=false&runs=200&gist=
// 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.
*
@hcheng826
hcheng826 / contracts...test.sol
Created March 7, 2024 09:15
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.24+commit.e11b9ed9.js&optimize=false&runs=200&gist=
// 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;
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"))
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");