library changes
This commit is contained in:
parent
747c77625d
commit
3eb584ff3b
@ -1,4 +1,4 @@
|
||||
# Proposal 42
|
||||
# Proposal 43
|
||||
|
||||
Unregister cheating relayer and withdraw his balance to Governance
|
||||
|
||||
|
@ -10,50 +10,12 @@ pragma solidity ^0.8.7;
|
||||
library Base58 {
|
||||
bytes constant ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
|
||||
/**
|
||||
* @notice encode is used to encode the given bytes in base58 standard.
|
||||
* @param data_ raw data, passed in as bytes.
|
||||
* @return base58 encoded data_, returned as bytes.
|
||||
*/
|
||||
function encode(bytes memory data_) public pure returns (bytes memory) {
|
||||
unchecked {
|
||||
uint256 size = data_.length;
|
||||
uint256 zeroCount;
|
||||
while (zeroCount < size && data_[zeroCount] == 0) {
|
||||
zeroCount++;
|
||||
}
|
||||
size = zeroCount + ((size - zeroCount) * 8351) / 6115 + 1;
|
||||
bytes memory slot = new bytes(size);
|
||||
uint32 carry;
|
||||
int256 m;
|
||||
int256 high = int256(size) - 1;
|
||||
for (uint256 i = 0; i < data_.length; i++) {
|
||||
m = int256(size - 1);
|
||||
for (carry = uint8(data_[i]); m > high || carry != 0; m--) {
|
||||
carry = carry + 256 * uint8(slot[uint256(m)]);
|
||||
slot[uint256(m)] = bytes1(uint8(carry % 58));
|
||||
carry /= 58;
|
||||
}
|
||||
high = m;
|
||||
}
|
||||
uint256 n;
|
||||
for (n = zeroCount; n < size && slot[n] == 0; n++) {}
|
||||
size = slot.length - (n - zeroCount);
|
||||
bytes memory out = new bytes(size);
|
||||
for (uint256 i = 0; i < size; i++) {
|
||||
uint256 j = i + n - zeroCount;
|
||||
out[i] = ALPHABET[uint8(slot[j])];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice decode is used to decode the given string in base58 standard.
|
||||
* @param data_ data encoded with base58, passed in as bytes.
|
||||
* @return raw data, returned as bytes.
|
||||
*/
|
||||
function decode(bytes memory data_) public pure returns (bytes memory) {
|
||||
function decode(bytes memory data_) internal pure returns (bytes memory) {
|
||||
unchecked {
|
||||
uint256 zero = 49;
|
||||
uint256 b58sz = data_.length;
|
||||
@ -102,30 +64,12 @@ library Base58 {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice encodeToString is used to encode the given byte in base58 standard.
|
||||
* @param data_ raw data, passed in as bytes.
|
||||
* @return base58 encoded data_, returned as a string.
|
||||
*/
|
||||
function encodeToString(bytes memory data_) public pure returns (string memory) {
|
||||
return string(encode(data_));
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice encodeFromString is used to encode the given string in base58 standard.
|
||||
* @param data_ raw data, passed in as a string.
|
||||
* @return base58 encoded data_, returned as bytes.
|
||||
*/
|
||||
function encodeFromString(string memory data_) public pure returns (bytes memory) {
|
||||
return encode(bytes(data_));
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice decode is used to decode the given string in base58 standard.
|
||||
* @param data_ data encoded with base58, passed in as string.
|
||||
* @return raw data, returned as bytes.
|
||||
*/
|
||||
function decodeFromString(string memory data_) public pure returns (bytes memory) {
|
||||
function decodeFromString(string memory data_) internal pure returns (bytes memory) {
|
||||
return decode(bytes(data_));
|
||||
}
|
||||
|
||||
@ -136,7 +80,7 @@ library Base58 {
|
||||
* @param end_ end index.
|
||||
* @return slice data
|
||||
*/
|
||||
function slice(bytes memory data_, uint256 start_, uint256 end_) public pure returns (bytes memory) {
|
||||
function slice(bytes memory data_, uint256 start_, uint256 end_) private pure returns (bytes memory) {
|
||||
unchecked {
|
||||
bytes memory ret = new bytes(end_ - start_);
|
||||
for (uint256 i = 0; i < end_ - start_; i++) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
require("@nomicfoundation/hardhat-toolbox");
|
||||
require("hardhat-gas-reporter");
|
||||
require("dotenv").config();
|
||||
|
||||
/** @type import('hardhat/config').HardhatUserConfig */
|
||||
@ -24,9 +25,9 @@ module.exports = {
|
||||
},
|
||||
hardhat: {
|
||||
forking: {
|
||||
url: "https://eth.llamarpc.com",
|
||||
url: "https://rpc.mevblocker.io/fast",
|
||||
enabled: true,
|
||||
blockNumber: 18820230,
|
||||
blockNumber: 18836511,
|
||||
accounts: [process.env.REAL_PK],
|
||||
},
|
||||
chainId: 1,
|
||||
@ -41,4 +42,7 @@ module.exports = {
|
||||
etherscan: {
|
||||
apiKey: process.env.ETHERSCAN_KEY,
|
||||
},
|
||||
gasReporter: {
|
||||
enabled: false
|
||||
}
|
||||
};
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "proposal-42",
|
||||
"name": "proposal-43",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "proposal-42",
|
||||
"name": "proposal-43",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "proposal-42",
|
||||
"name": "proposal-43",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "hardhat.config.js",
|
||||
|
@ -36,7 +36,7 @@ async function deployAndExecuteProposal() {
|
||||
const proposal = await proposalFactory.deploy();
|
||||
const deployedProposalAddr = await proposal.getAddress();
|
||||
|
||||
const bigStakerAddr = "0xE4143f6377AEcd7193b9731d1C28815b57C4f5Ab";
|
||||
const bigStakerAddr = "0xAd0dC9b5bf4308Cc26C1d44E1BEB2d30c43Bca1b";
|
||||
await getManyEth(bigStakerAddr);
|
||||
const stakerSigner = await ethers.getImpersonatedSigner(bigStakerAddr);
|
||||
const governanceContract = await ethers.getContractAt(
|
||||
@ -52,7 +52,7 @@ async function deployAndExecuteProposal() {
|
||||
await governanceContract.execute(proposalId);
|
||||
await time.increase(60 * 60 * 24 * 4);
|
||||
|
||||
return await getRelayerRegistry();
|
||||
return governanceContract;
|
||||
}
|
||||
|
||||
describe("Proposal results check", function () {
|
||||
|
Loading…
Reference in New Issue
Block a user