https://en.wikipedia.org/wiki/Median_mechanism
Keep a min heap and a max heap in two solidity arrays.
If a new vote is greater than root of the min heap, insert it there, otherwise insert it in the max heap.
| import { Parser as parser } from 'expr-eval'; | |
| import _ from 'lodash'; | |
| let verifications = [ | |
| { | |
| "name": "Aura", | |
| "user": "abc", | |
| "block": 33340560, | |
| "timestamp": 1756518949006, | |
| "domains": [ |
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.0; | |
| // Import OpenZeppelin's Ownable and ERC-20 libraries | |
| import "@openzeppelin/contracts/access/Ownable.sol"; | |
| import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; | |
| import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
| // Import the Uniswap V4 Position Manager Interface | |
| import "./IPositionManager.sol"; |
| function shortNum(n, p=3, e=p-3) { | |
| if (n === 0) return '0'; | |
| let ans; | |
| const absn = Math.abs(n); | |
| if (absn < Math.pow(10, -1 * p) || absn >= 10 ** 18 ){ | |
| ans = Number.parseFloat(n).toExponential(Math.max(e, 0)); | |
| } | |
| else if (absn < 1){ |
| @state() | |
| private _isDarkMode = this._getInitialTheme(); | |
| private _getInitialTheme(): boolean { | |
| const storedTheme = localStorage.getItem('theme'); | |
| if (storedTheme) { | |
| return storedTheme === 'dark'; | |
| } else { | |
| return window.matchMedia('(prefers-color-scheme: dark)').matches; | |
| } |
https://en.wikipedia.org/wiki/Median_mechanism
Keep a min heap and a max heap in two solidity arrays.
If a new vote is greater than root of the min heap, insert it there, otherwise insert it in the max heap.
| This post links my 3Box profile to my Github account! Web3 social profiles by 3Box. | |
| ✅ did:3:bafyreigz63l2hwf3x37f27sp3ytordn2syx2ggclm6pt4jqb7rcho3iyfq ✅ | |
| Create your profile today to start building social connection and trust online at https://3Box.io/ |
I hereby claim:
To claim this, I am signing this object:
Coinsensus is a token that's regularly minted and distributed according to near-consensus of a voting group with a growing or fluctuating membership.
Others may contribute to the mission of an instance of the token by donating other tokens, including ether.
Holders of the token may receive dividends from the donated tokens.
Near-consensus is required among those that vote each round, but there's no requirement of quorum.
| <?xml version='1.0' encoding='UTF-8'?> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <include>myImage</include> | |
| </head> | |
| <body> | |
| <myImage> | |
| <base>..</base> | |
| </myImage> | |
| </body> |
| <p>Hello, World!</p> |