Skip to content

Commit

Permalink
implement logic, update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Nov 29, 2023
1 parent 326a7bd commit 3ef157a
Show file tree
Hide file tree
Showing 42 changed files with 3,283 additions and 3,214 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint

on:
push:
branches:
- main
pull_request: { }
workflow_dispatch: { }

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run forge fmt --check
run: forge fmt --check
20 changes: 20 additions & 0 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Slither
on: [push]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run Slither
uses: crytic/slither-action@v0.3.0
id: slither
with:
sarif: results.sarif
fail-on: none

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ jobs:
run: |
forge test -vvv
id: test

- name: Run Forge coverage
run: |
forge coverage
forge coverage --report lcov
id: coverage
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ forge install
forge build
forge test -vv
forge coverage
forge fmt
```
4 changes: 3 additions & 1 deletion chains/PolygonLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {console} from "forge-std/Test.sol";
import "../script/lib/DeployLib.sol";

library PolygonLib {
address public constant TOKEN_PEARL = 0x7238390d5f6F64e67c3211C343A410E2A3DEc142;

function runDeploy(bool showLog) external {
address governance = 0x520Ab98a23100369E5280d214799b1E1c0123045;
Expand All @@ -23,7 +24,8 @@ library PolygonLib {
vestingClaimant: vestingClaimant,
vestingAmount: vestingAmount,
vestingPeriod: 365 days,
vestingCliff: 180 days
vestingCliff: 180 days,
rewardToken: TOKEN_PEARL
})));

if (showLog) {
Expand Down
4 changes: 3 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ src = "src"
out = "out"
libs = ["lib"]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
[fmt]
int_types = "short"
multiline_func_header = "params_first"
19 changes: 14 additions & 5 deletions script/lib/DeployLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import "../../src/Vesting.sol";
import "../../src/STGN.sol";
import "../../src/ControllableProxy.sol";
import "../../src/VeSTGN.sol";
import "../../src/MultiGauge.sol";

library DeployLib {

struct DeployParams {
address governance;
uint ifoRate;
address[] vestingClaimant;
uint[] vestingAmount;
uint vestingPeriod;
uint vestingCliff;
address rewardToken; // PEARL
}

function deployPlatform(DeployParams memory params) external returns (address controller) {
Expand All @@ -31,20 +32,28 @@ library DeployLib {
}

STGN stgn = new STGN(params.governance, address(ifo), 1e26, 5e25, vesting, params.vestingAmount);
ifo.setup(address(stgn));
ifo.setup(address(_c), address(stgn), params.rewardToken);

for (uint i; i < len; ++i) {
Vesting(vesting[i]).setup(address(stgn), params.vestingPeriod, params.vestingCliff, params.vestingClaimant[i]);
Vesting(vesting[i]).setup(
address(stgn), params.vestingPeriod, params.vestingCliff, params.vestingClaimant[i]
);
}

ControllableProxy proxy = new ControllableProxy();
address impl = address(new VeSTGN());
proxy.initProxy(impl);
VeSTGN ve = VeSTGN(address(proxy));
ve.init(address(stgn), 1e18, address(_c));
// assertEq(IProxyControlled(proxy).implementation(), impl);
// assertEq(IProxyControlled(proxy).implementation(), impl);

proxy = new ControllableProxy();
impl = address(new MultiGauge());
proxy.initProxy(impl);
MultiGauge multigauge = MultiGauge(address(proxy));
multigauge.init(address(_c), address(ve), address(stgn));

_c.setup(address(ifo), address(ve), address(stgn));
_c.setup(address(ifo), address(ve), address(stgn), address(multigauge));

return address(_c);
}
Expand Down
Loading

0 comments on commit 3ef157a

Please sign in to comment.