Skip to content

Commit

Permalink
Merge branch 'dev' into feat/safety-features
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybuidl committed Mar 5, 2024
2 parents e4c1b8d + 6b3deb5 commit cb65a67
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
8 changes: 4 additions & 4 deletions contracts/src/arbitration/arbitrables/ArbitrableExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ contract ArbitrableExample is IArbitrableV2 {
}

/// @dev To be called by the arbitrator of the dispute, to declare the winning ruling.
/// @param _externalDisputeID ID of the dispute in arbitrator contract.
/// @param _arbitratorDisputeID ID of the dispute in arbitrator contract.
/// @param _ruling The ruling choice of the arbitration.
function rule(uint256 _externalDisputeID, uint256 _ruling) external override {
uint256 localDisputeID = externalIDtoLocalID[_externalDisputeID];
function rule(uint256 _arbitratorDisputeID, uint256 _ruling) external override {
uint256 localDisputeID = externalIDtoLocalID[_arbitratorDisputeID];
DisputeStruct storage dispute = disputes[localDisputeID];
require(msg.sender == address(arbitrator), "Only the arbitrator can execute this.");
require(_ruling <= dispute.numberOfRulingOptions, "Invalid ruling.");
Expand All @@ -149,6 +149,6 @@ contract ArbitrableExample is IArbitrableV2 {
dispute.isRuled = true;
dispute.ruling = _ruling;

emit Ruling(IArbitratorV2(msg.sender), _externalDisputeID, dispute.ruling);
emit Ruling(IArbitratorV2(msg.sender), _arbitratorDisputeID, dispute.ruling);
}
}
8 changes: 4 additions & 4 deletions contracts/src/arbitration/arbitrables/DisputeResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ contract DisputeResolver is IArbitrableV2 {
}

/// @dev To be called by the arbitrator of the dispute, to declare the winning ruling.
/// @param _externalDisputeID ID of the dispute in arbitrator contract.
/// @param _arbitratorDisputeID ID of the dispute in arbitrator contract.
/// @param _ruling The ruling choice of the arbitration.
function rule(uint256 _externalDisputeID, uint256 _ruling) external override {
uint256 localDisputeID = arbitratorDisputeIDToLocalID[_externalDisputeID];
function rule(uint256 _arbitratorDisputeID, uint256 _ruling) external override {
uint256 localDisputeID = arbitratorDisputeIDToLocalID[_arbitratorDisputeID];
DisputeStruct storage dispute = disputes[localDisputeID];
require(msg.sender == address(arbitrator), "Only the arbitrator can execute this.");
require(_ruling <= dispute.numberOfRulingOptions, "Invalid ruling.");
Expand All @@ -121,7 +121,7 @@ contract DisputeResolver is IArbitrableV2 {
dispute.isRuled = true;
dispute.ruling = _ruling;

emit Ruling(IArbitratorV2(msg.sender), _externalDisputeID, dispute.ruling);
emit Ruling(IArbitratorV2(msg.sender), _arbitratorDisputeID, dispute.ruling);
}

// ************************************* //
Expand Down
25 changes: 11 additions & 14 deletions contracts/src/kleros-v1/kleros-liquid-xdai/WrappedPinakion.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
pragma solidity 0.8.18;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../interfaces/ITokenController.sol";
import "./interfaces/ITokenBridge.sol";
import "./interfaces/IERC677.sol";

contract WrappedPinakion is Initializable {
using SafeMath for uint256;

// ************************************* //
// * Events * //
// ************************************* //
Expand Down Expand Up @@ -158,8 +155,8 @@ contract WrappedPinakion is Initializable {
"Token controller rejects transfer."
);
}
balances[msg.sender] = balances[msg.sender].sub(_amount); // ERC20: transfer amount exceeds balance
balances[_recipient] = balances[_recipient].add(_amount);
balances[msg.sender] = balances[msg.sender] - _amount; // ERC20: transfer amount exceeds balance
balances[_recipient] = balances[_recipient] + _amount;
emit Transfer(msg.sender, _recipient, _amount);
return true;
}
Expand All @@ -183,11 +180,11 @@ contract WrappedPinakion is Initializable {
// controller of this contract, which in most situations should be
// another open source smart contract or 0x0.
if (msg.sender != controller) {
allowance[_sender][msg.sender] = allowance[_sender][msg.sender].sub(_amount); // ERC20: transfer amount exceeds allowance.
allowance[_sender][msg.sender] = allowance[_sender][msg.sender] - _amount; // ERC20: transfer amount exceeds allowance.
}

balances[_sender] = balances[_sender].sub(_amount); // ERC20: transfer amount exceeds balance
balances[_recipient] = balances[_recipient].add(_amount);
balances[_sender] = balances[_sender] - _amount; // ERC20: transfer amount exceeds balance
balances[_recipient] = balances[_recipient] + _amount;
emit Transfer(_sender, _recipient, _amount);
return true;
}
Expand Down Expand Up @@ -215,7 +212,7 @@ contract WrappedPinakion is Initializable {
/// @param _addedValue The amount of extra base units the entity will be allowed to spend.
/// @return True on success.
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
uint256 newAllowance = allowance[msg.sender][_spender].add(_addedValue);
uint256 newAllowance = allowance[msg.sender][_spender] + _addedValue;
// Alerts the token controller of the approve function call
if (isContract(controller)) {
require(
Expand All @@ -234,7 +231,7 @@ contract WrappedPinakion is Initializable {
/// @param _subtractedValue The reduction of spending allocation in base units.
/// @return True on success.
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) {
uint256 newAllowance = allowance[msg.sender][_spender].sub(_subtractedValue); // ERC20: decreased allowance below zero
uint256 newAllowance = allowance[msg.sender][_spender] - _subtractedValue; // ERC20: decreased allowance below zero
// Alerts the token controller of the approve function call
if (isContract(controller)) {
require(
Expand All @@ -258,8 +255,8 @@ contract WrappedPinakion is Initializable {
/// @param _recipient The address which will receive the minted tokens.
/// @param _amount The amount that will be created.
function _mint(address _recipient, uint256 _amount) internal {
totalSupply = totalSupply.add(_amount);
balances[_recipient] = balances[_recipient].add(_amount);
totalSupply = totalSupply + _amount;
balances[_recipient] = balances[_recipient] + _amount;
emit Transfer(address(0x0), _recipient, _amount);
}

Expand All @@ -272,8 +269,8 @@ contract WrappedPinakion is Initializable {
"Token controller rejects transfer."
);
}
balances[msg.sender] = balances[msg.sender].sub(_amount); // ERC20: burn amount exceeds balance
totalSupply = totalSupply.sub(_amount);
balances[msg.sender] = balances[msg.sender] - _amount; // ERC20: burn amount exceeds balance
totalSupply = totalSupply - _amount;
emit Transfer(msg.sender, address(0x0), _amount);
}

Expand Down

0 comments on commit cb65a67

Please sign in to comment.