Skip to content

Commit

Permalink
Merge branch 'main' into rewards-withdrawn
Browse files Browse the repository at this point in the history
  • Loading branch information
manumonti committed Aug 26, 2024
2 parents 0eaea35 + 346f364 commit d2a09c6
Show file tree
Hide file tree
Showing 76 changed files with 8,669 additions and 6,474 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ jobs:
with:
cache: "pip"
python-version: "3.11"
- run: pip install . -r requirements.txt
- run: pip install -e . -r requirements.txt

- name: Run Ape Tests
run: ape test

- name: Run Deployment Test
run: ape run ci deploy_child

- name: Run Registry Scripts to list contracts
run: |
ape run list_contracts --domain lynx
ape run list_contracts --domain tapir
ape run list_contracts --domain mainnet
- name: Build npm package
run: npm run build

Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
**/contracts/contracts/NuCypherToken.sol
**/contracts/test/proxy/
**/contracts/test/StakingEscrowTestSet.sol
**/.cache
**/.cache
Pipfile.lock
1 change: 0 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"check-send-result": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"multiple-sends": "error",
"no-complex-fallback": "error",
"no-inline-assembly": "off",
"no-unused-import": "error",
"not-rely-on-block-hash": "error",
Expand Down
2,348 changes: 1,173 additions & 1,175 deletions Pipfile.lock

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions ape-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,10 @@ dependencies:
solidity:
version: 0.8.23
evm_version: paris
import_remapping:
- "@openzeppelin/contracts=openzeppelin/v5.0.0"
- "@openzeppelin-upgradeable/contracts=openzeppelin-upgradeable/v5.0.0"
- "@fx-portal/contracts=fx-portal/v1.0.5"
- "@threshold/contracts=threshold/v1.2.1"


ethereum:
mainnet:
transaction_acceptance_timeout: 600 # 10 minutes

transaction_acceptance_timeout: 600 # 10 minutes

test:
mnemonic: test test test test test test test test test test test junk
Expand Down
20 changes: 15 additions & 5 deletions contracts/contracts/TACoApplication.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,15 @@ contract TACoApplication is

uint256 public constant REWARD_PER_TOKEN_MULTIPLIER = 10 ** 3;
uint256 internal constant FLOATING_POINT_DIVISOR = REWARD_PER_TOKEN_MULTIPLIER * 10 ** 18;
uint256 public constant PENALTY_BASE = 10000;
uint192 public constant PENALTY_BASE = 10000;

uint96 public immutable minimumAuthorization;
uint256 public immutable minOperatorSeconds;
uint256 public immutable rewardDuration;
uint256 public immutable deauthorizationDuration;
uint192 public immutable penaltyDefault;
uint256 public immutable penaltyDuration;
uint192 public immutable penaltyIncrement;

uint64 public immutable commitmentDurationOption1;
uint64 public immutable commitmentDurationOption2;
Expand Down Expand Up @@ -244,6 +245,7 @@ contract TACoApplication is
* @param _commitmentDeadline Last date to make a commitment
* @param _penaltyDefault Default penalty percentage (as a value out of 10000)
* @param _penaltyDuration Duration of penalty
* @param _penaltyIncrement Increment of penalty if violation occurs during an existing penalty period
*/
constructor(
IERC20 _token,
Expand All @@ -255,7 +257,8 @@ contract TACoApplication is
uint64[] memory _commitmentDurationOptions,
uint64 _commitmentDeadline,
uint192 _penaltyDefault,
uint256 _penaltyDuration
uint256 _penaltyDuration,
uint192 _penaltyIncrement
) {
uint256 totalSupply = _token.totalSupply();
require(
Expand All @@ -265,8 +268,9 @@ contract TACoApplication is
_commitmentDurationOptions.length >= 1 &&
_commitmentDurationOptions.length <= 4 &&
_penaltyDefault > 0 &&
_penaltyDefault < PENALTY_BASE &&
_penaltyDuration > 0,
_penaltyDefault <= PENALTY_BASE &&
_penaltyDuration > 0 &&
_penaltyDefault + _penaltyIncrement <= PENALTY_BASE,
"Wrong input parameters"
);
// This require is only to check potential overflow for 10% reward
Expand Down Expand Up @@ -295,6 +299,7 @@ contract TACoApplication is
commitmentDeadline = _commitmentDeadline;
penaltyDefault = _penaltyDefault;
penaltyDuration = _penaltyDuration;
penaltyIncrement = _penaltyIncrement;
_disableInitializers();
}

Expand Down Expand Up @@ -1074,7 +1079,12 @@ contract TACoApplication is
StakingProviderInfo storage info = stakingProviderInfo[_stakingProvider];
uint96 before = effectiveAuthorized(info.authorized, info.penaltyPercent);
info.endPenalty = uint64(block.timestamp + penaltyDuration);
info.penaltyPercent = penaltyDefault;
info.penaltyPercent = info.penaltyPercent == 0
? penaltyDefault
: info.penaltyPercent + penaltyIncrement;
if (info.penaltyPercent > PENALTY_BASE) {
info.penaltyPercent = PENALTY_BASE;
}
if (info.operatorConfirmed) {
authorizedOverall -= before - effectiveAuthorized(info.authorized, info.penaltyPercent);
}
Expand Down
163 changes: 0 additions & 163 deletions contracts/contracts/coordination/BetaProgramInitiator.sol

This file was deleted.

Loading

0 comments on commit d2a09c6

Please sign in to comment.