Skip to content

Commit

Permalink
🚀 initial deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
zakrad committed Feb 5, 2024
1 parent 479131d commit 850aa88
Show file tree
Hide file tree
Showing 17 changed files with 925 additions and 49 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINNET_RPC_URL = https://rpc.ankr.com/eth
34 changes: 24 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
name: test

on: workflow_dispatch

env:
FOUNDRY_PROFILE: ci

name: Test workflow
on: push
jobs:
check:
lint:
name: Lint sources
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node-version: [18.x]

name: Foundry project
steps:
- name: Checkout
uses: "actions/checkout@master"
- name: Set Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Create a fake .secret file
run: echo "primary twist rack vendor diagram image used route theme frown either will" > .secret
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint sources
run: yarn run lint
check:
runs-on: ubuntu-latest
env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}

steps:
- uses: actions/checkout@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
cache/
out/

#node_modules
node_modules

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
}
]
}
42 changes: 42 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["warn", "0.8.20"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"reentrancy": "error",
"state-visibility": "error",
"quotes": ["error", "double"],
"const-name-snakecase": "error",
"contract-name-camelcase": "error",
"event-name-camelcase": "error",
"func-name-mixedcase": "error",
"func-param-name-mixedcase": "error",
"modifier-name-mixedcase": "error",
"private-vars-leading-underscore": ["off", { "strict": true }],
"use-forbidden-name": "error",
"var-name-mixedcase": "error",
"imports-on-top": "error",
"ordering": "error",
"visibility-modifier-order": "error",
"code-complexity": ["error", 7],
"function-max-lines": ["error", 80],
"max-line-length": ["warn", 120],
"max-states-count": ["error", 15],
"no-empty-blocks": "warn",
"no-unused-vars": "error",
"payable-fallback": "off",
"constructor-syntax": "error",
"explicit-types": "error",
"no-unused-import": "warn",
"one-contract-per-file": "warn",
"not-rely-on-time": "off",
"reason-string": "error",
"no-inline-assembly": "off",
"avoid-low-level-calls": "off",
"custom-errors": "off",
"no-complex-fallback": "off",
"no-global-import": "off",
"avoid-tx-origin": "off"
},
"plugins": ["prettier"]
}
4 changes: 4 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
lib
out
cache
2 changes: 1 addition & 1 deletion lib/forge-std
Submodule forge-std updated 1 files
+1 −1 scripts/vm.py
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 01ef44
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "staking-sc",
"version": "1.0.0",
"description": "**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**",
"main": "index.js",
"directories": {
"lib": "lib",
"test": "test"
},
"scripts": {
"test": "forge test",
"lint:sol": "npx solhint 'src/**/*.sol'",
"lint:sol-fix": "npx prettier 'src/**/*.sol' --write && npx solhint 'src/**/*.sol' --fix",
"lint": "npm run lint:sol",
"lint:fix": "npm run lint:sol-fix"
},
"devDependencies": {
"prettier": "^2.8.8",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^4.0.0",
"solhint-plugin-prettier": "^0.1.0"
},
"author": "polytrade.finance",
"license": "MIT"
}
2 changes: 2 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
contracts/=src/
14 changes: 0 additions & 14 deletions src/Counter.sol

This file was deleted.

32 changes: 32 additions & 0 deletions src/Staking.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IStaking} from "contracts/interface/IStaking.sol";

Check warning on line 5 in src/Staking.sol

View workflow job for this annotation

GitHub Actions / Lint sources (18.x)

imported name IStaking is not used

contract Staking {
using SafeERC20 for IERC20;

struct StakerInfo {
uint256 stakedAmount;
uint256 debtReward;
uint256 accumulatedRewards;
uint256 lastUpdate;
}

IERC20 public stakingToken;
IERC20 public rewardToken;
uint256 public ratePerSecond;

mapping(address => StakerInfo) public stakerInfo;

constructor(
address stakingToken_,
address rewardToken_,
uint256 ratePerSecond_
) {
stakingToken = IERC20(stakingToken_);
rewardToken = IERC20(rewardToken_);
ratePerSecond = ratePerSecond_;
}
}
4 changes: 4 additions & 0 deletions src/interface/IStaking.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IStaking {}

Check warning on line 4 in src/interface/IStaking.sol

View workflow job for this annotation

GitHub Actions / Lint sources (18.x)

Code contains empty blocks
24 changes: 0 additions & 24 deletions test/Counter.t.sol

This file was deleted.

11 changes: 11 additions & 0 deletions test/Staking.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Test, console2} from "forge-std/Test.sol";
import {Staking} from "contracts/Staking.sol";

contract StakingTest {

function setUp() public {
}
}
Loading

0 comments on commit 850aa88

Please sign in to comment.