-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
925 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MAINNET_RPC_URL = https://rpc.ankr.com/eth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
lib | ||
out | ||
cache |
Submodule openzeppelin-contracts
added at
01ef44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ | ||
contracts/=src/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
|
||
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_; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} | ||
} |
Oops, something went wrong.