Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #167 from maticnetwork/lint-fix_
Browse files Browse the repository at this point in the history
fix lint :D
  • Loading branch information
0xAshish authored Feb 7, 2020
2 parents 272a62b + cbbbadf commit 19163dd
Show file tree
Hide file tree
Showing 63 changed files with 6,211 additions and 4,992 deletions.
31 changes: 15 additions & 16 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
pragma solidity ^0.5.2;


contract Migrations {
address public owner;
uint public last_completed_migration;
address public owner;
uint256 public last_completed_migration;

modifier restricted() {
if (msg.sender == owner) _;
}
modifier restricted() {
if (msg.sender == owner) _;
}

constructor () public {
owner = msg.sender;
}
constructor() public {
owner = msg.sender;
}

function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
function setCompleted(uint256 completed) public restricted {
last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
139 changes: 75 additions & 64 deletions contracts/child/BaseERC20.sol
Original file line number Diff line number Diff line change
@@ -1,79 +1,90 @@
pragma solidity ^0.5.2;

import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import {ERC20} from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

import "./ChildToken.sol";


contract BaseERC20 is ChildToken {
event Deposit(
address indexed token,
address indexed from,
uint256 amount,
uint256 input1,
uint256 output1
);

event Deposit(
address indexed token,
address indexed from,
uint256 amount,
uint256 input1,
uint256 output1
);

event Withdraw(
address indexed token,
address indexed from,
uint256 amount,
uint256 input1,
uint256 output1
);
event Withdraw(
address indexed token,
address indexed from,
uint256 amount,
uint256 input1,
uint256 output1
);

event LogTransfer(
address indexed token,
address indexed from,
address indexed to,
uint256 amount,
uint256 input1,
uint256 input2,
uint256 output1,
uint256 output2
);
event LogTransfer(
address indexed token,
address indexed from,
address indexed to,
uint256 amount,
uint256 input1,
uint256 input2,
uint256 output1,
uint256 output2
);

constructor() public {}
constructor() public {}

function transferWithSig(bytes calldata sig, uint256 amount, bytes32 data, uint256 expiration, address to) external returns (address from) {
require(amount > 0);
require(expiration == 0 || block.number <= expiration, "Signature is expired");
function transferWithSig(
bytes calldata sig,
uint256 amount,
bytes32 data,
uint256 expiration,
address to
) external returns (address from) {
require(amount > 0);
require(
expiration == 0 || block.number <= expiration,
"Signature is expired"
);

bytes32 dataHash = getTokenTransferOrderHash(
msg.sender,
amount,
data,
expiration
);
require(disabledHashes[dataHash] == false, "Sig deactivated");
disabledHashes[dataHash] = true;
bytes32 dataHash = getTokenTransferOrderHash(
msg.sender,
amount,
data,
expiration
);
require(disabledHashes[dataHash] == false, "Sig deactivated");
disabledHashes[dataHash] = true;

from = ecrecovery(dataHash, sig);
_transferFrom(from, address(uint160(to)), amount);
}
from = ecrecovery(dataHash, sig);
_transferFrom(from, address(uint160(to)), amount);
}

function balanceOf(address account) external view returns (uint256);
function _transfer(address sender, address recipient, uint256 amount) internal;
function balanceOf(address account) external view returns (uint256);
function _transfer(address sender, address recipient, uint256 amount)
internal;

/// @param from Address from where tokens are withdrawn.
/// @param to Address to where tokens are sent.
/// @param value Number of tokens to transfer.
/// @return Returns success of function call.
function _transferFrom(address from, address to, uint256 value) internal returns (bool) {
uint256 input1 = this.balanceOf(from);
uint256 input2 = this.balanceOf(to);
_transfer(from, to, value);
emit LogTransfer(
token,
from,
to,
value,
input1,
input2,
this.balanceOf(from),
this.balanceOf(to)
);
return true;
}
/// @param from Address from where tokens are withdrawn.
/// @param to Address to where tokens are sent.
/// @param value Number of tokens to transfer.
/// @return Returns success of function call.
function _transferFrom(address from, address to, uint256 value)
internal
returns (bool)
{
uint256 input1 = this.balanceOf(from);
uint256 input2 = this.balanceOf(to);
_transfer(from, to, value);
emit LogTransfer(
token,
from,
to,
value,
input1,
input2,
this.balanceOf(from),
this.balanceOf(to)
);
return true;
}
}
Loading

0 comments on commit 19163dd

Please sign in to comment.