Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat/housekeeping #22

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fdafc7e
rm: old files
ethyla Nov 14, 2024
f76208a
chore: update settings
ethyla Nov 14, 2024
e308d88
fix: readme
ethyla Nov 14, 2024
c20d2b8
fix: cleanup drain
ethyla Nov 14, 2024
35bd71e
feat: finish clean slash removal
ethyla Nov 14, 2024
7f75db9
feat: remove auction mechanism
ethyla Nov 14, 2024
3e68b32
feat: unify pol/matic tests
ethyla Nov 14, 2024
8ff21ac
feat: cache pol token on new deploy
ethyla Nov 14, 2024
c7c389a
feat: remove old init functions
ethyla Nov 14, 2024
ebdbcb2
rm: nvmrc
ethyla Nov 14, 2024
411fe70
fix: gitignore
ethyla Nov 14, 2024
37c3cfb
rm: outdated solium
ethyla Nov 14, 2024
3ecbb8c
rm: prettier solidity
ethyla Nov 15, 2024
1a56d39
upd: formatter settings
ethyla Nov 15, 2024
b9b9ea0
feat: add solhint
ethyla Nov 15, 2024
30e667e
rm: rewards adjustment script
ethyla Nov 15, 2024
4a6cc69
rm: doc book generation
ethyla Nov 15, 2024
11f7370
rm: unused contract
ethyla Nov 15, 2024
71515db
fix: drain current balance
ethyla Nov 15, 2024
90c30b9
fix: deduplicate VS setup
ethyla Nov 15, 2024
541d3c0
fix: fork test input
ethyla Nov 19, 2024
4364842
rm: outdated predicates
ethyla Nov 20, 2024
16232cf
feat: add oz contracts from dep
ethyla Nov 20, 2024
59d2e7b
feat: adjust oz imports
ethyla Nov 20, 2024
88276f7
chore: remove npm oz dep
ethyla Nov 20, 2024
74de41c
feat: use same import style everywhere
ethyla Nov 20, 2024
183bc02
chore: remove solady submodule
ethyla Nov 20, 2024
2b5488a
feat: clean up package.json
ethyla Nov 21, 2024
daa65db
feat: satisfy some compiler warnings
ethyla Nov 22, 2024
31709c8
feat: make solhint 10% happier
ethyla Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
INFURA_TOKEN="909b972ab2ff3afb8b0f8f6a9667test"
BOR_CHAIN_URL="http://localhost:9545"
ENV="local"
MNEMONIC_DEV="poly radar mass judge dismiss just intact mind resemble fringe diary casino"
MNEMONIC_DEV="poly radar mass judge dismiss just intact mind resemble fringe diary casino"
ALCHEMY_KEY=""
ETHERSCAN_API_KEY=""
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules
artifacts
out
contractAddresses.json
.vscode


# ignore generated files
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

9 changes: 0 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
exclude: "^docs/autogen"
- repo: local
hooks:
- id: format
Expand All @@ -15,16 +14,8 @@ repos:
entry: forge fmt
exclude: "^lib/"
pass_filenames: true
- id: doc
name: Generate documentation
description: Generate docs with `forge doc`
language: system
# generates docs and unstages files if only the commit hash changed within the file, this way only when the documentation is updated, the documentation needs to be regenerated and only the changed files are pushed
entry: "scripts/util/doc_gen.sh"
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
name: Format non solidity files with prettier
exclude: "^docs/autogen"
11 changes: 0 additions & 11 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "always"
}
},
{
"files": "*.js",
"options": {
Expand Down
8 changes: 8 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": "off",
"max-states-count": "off",
"reason-string": "off"
}
}
1 change: 0 additions & 1 deletion .soliumignore

This file was deleted.

28 changes: 0 additions & 28 deletions .soliumrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ npm run bor:clean
Run Hardhat test

```
npm test:hardhat
npm run test:hardhat
```

### Coverage
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

112 changes: 0 additions & 112 deletions broadcast/UpgradeStakeManager_Sepolia.s.sol/11155111/run-latest.json

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions contracts/common/misc/ContractReceiver.sol

This file was deleted.

21 changes: 5 additions & 16 deletions contracts/common/misc/DrainStakeManager.sol
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
pragma solidity ^0.5.2;

import { StakeManagerStorage } from "../../staking/stakeManager/StakeManagerStorage.sol";
import { StakeManagerStorageExtension } from "../../staking/stakeManager/StakeManagerStorageExtension.sol";
import { GovernanceLockable } from "../mixin/GovernanceLockable.sol";
import {IValidatorShare} from "../../staking/validatorShare/IValidatorShare.sol";
import {Initializable} from "../../common/mixin/Initializable.sol";

// Inheriting from Initializable as well to keep the storage layout same
contract DrainStakeManager is StakeManagerStorage, Initializable {
contract DrainStakeManager is StakeManagerStorage, Initializable, StakeManagerStorageExtension {
constructor() public GovernanceLockable(address(0x0)) {}

function drain(address destination, uint amount) external onlyOwner {
require(token.transfer(destination, amount), "Drain failed");
}

function drainValidatorShares(
uint256 validatorId,
address _token,
address payable destination,
uint256 amount
) external onlyOwner {
address contractAddr = validators[validatorId].contractAddress;
require(contractAddr != address(0x0), "unknown validator or no delegation enabled");
IValidatorShare validatorShare = IValidatorShare(contractAddr);
validatorShare.drain(_token, destination, amount);
function drain(address destination) external onlyOwner {
require(token.transfer(destination, token.balanceOf(address(this))), "Drain failed");
require(tokenMatic.transfer(destination, tokenMatic.balanceOf(address(this))), "Drain failed");
}

// Overriding isOwner from Ownable.sol because owner() and transferOwnership() have been overridden by UpgradableProxy
Expand Down
2 changes: 0 additions & 2 deletions contracts/root/IRootChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ pragma solidity ^0.5.2;


interface IRootChain {
function slash() external;

function submitHeaderBlock(bytes calldata data, bytes calldata sigs)
external;

Expand Down
4 changes: 0 additions & 4 deletions contracts/root/RootChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ contract RootChain is RootChainStorage, IRootChain {
return headerBlocks[currentHeaderBlock()].end;
}

function slash() external {
//TODO: future implementation
}

function currentHeaderBlock() public view returns (uint256) {
return _nextHeaderBlock.sub(MAX_DEPOSITS);
}
Expand Down
15 changes: 0 additions & 15 deletions contracts/staking/slashing/ISlashingManager.sol

This file was deleted.

138 changes: 0 additions & 138 deletions contracts/staking/slashing/SlashingManager.sol

This file was deleted.

21 changes: 0 additions & 21 deletions contracts/staking/stakeManager/IStakeManager.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
pragma solidity 0.5.17;

contract IStakeManager {
// validator replacement
function startAuction(
uint256 validatorId,
uint256 amount,
bool acceptDelegation,
bytes calldata signerPubkey
) external;

function confirmAuctionBid(uint256 validatorId, uint256 heimdallFee) external;

function transferFunds(
uint256 validatorId,
uint256 amount,
Expand Down Expand Up @@ -69,8 +59,6 @@ contract IStakeManager {

function ownerOf(uint256 tokenId) public view returns (address);

function slash(bytes calldata slashingInfoList) external returns (uint256);

function validatorStake(uint256 validatorId) public view returns (uint256);

function epoch() public view returns (uint256);
Expand All @@ -86,13 +74,4 @@ contract IStakeManager {
function withdrawDelegatorsReward(uint256 validatorId) public returns(uint256);

function delegatorsReward(uint256 validatorId) public view returns(uint256);

function dethroneAndStake(
address auctionUser,
uint256 heimdallFee,
uint256 validatorId,
uint256 auctionAmount,
bool acceptDelegation,
bytes calldata signerPubkey
) external;
}
Loading
Loading