Skip to content

Commit 3b0ca75

Browse files
committed
Rename interfaces and flatten contracts
1 parent 0c557cc commit 3b0ca75

24 files changed

+2585
-110
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Security audit for [0.4 version of the contracts](./contracts/v0.4/) is availabl
1111
## Details
1212

1313
- Deployments:
14-
- Ethereum Mainnet [LinkToken 0.4](./flat/v0.4/LinkToken.sol): [0x514910771AF9Ca656af840dff83E8264EcF986CA](https://etherscan.io/address/0x514910771af9ca656af840dff83e8264ecf986ca)
14+
- Ethereum Mainnet [LinkToken 0.4](./contracts-flat/v0.4/LinkToken.sol): [0x514910771AF9Ca656af840dff83E8264EcF986CA](https://etherscan.io/address/0x514910771af9ca656af840dff83e8264ecf986ca)
1515
- Decimals: 18
1616
- Name: ChainLink Token
1717
- Symbol: LINK
File renamed without changes.

flat/v0.6/ERC677Token.sol renamed to contracts-flat/v0.6/ERC677.sol

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Sources flattened with hardhat v2.1.2 https://hardhat.org
1+
// Sources flattened with hardhat v2.2.1 https://hardhat.org
22

3-
// File @openzeppelin/contracts/utils/Context.sol@v3.4.1
3+
// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/utils/Context.sol
44

55
// SPDX-License-Identifier: MIT
66

@@ -28,7 +28,7 @@ abstract contract Context {
2828
}
2929

3030

31-
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1
31+
// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
3232

3333
// SPDX-License-Identifier: MIT
3434

@@ -109,7 +109,7 @@ interface IERC20 {
109109
}
110110

111111

112-
// File @openzeppelin/contracts/math/SafeMath.sol@v3.4.1
112+
// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol
113113

114114
// SPDX-License-Identifier: MIT
115115

@@ -327,7 +327,7 @@ library SafeMath {
327327
}
328328

329329

330-
// File @openzeppelin/contracts/token/ERC20/ERC20.sol@v3.4.1
330+
// File vendor/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol
331331

332332
// SPDX-License-Identifier: MIT
333333

@@ -635,73 +635,99 @@ contract ERC20 is Context, IERC20 {
635635
}
636636

637637

638-
// File contracts/v0.6/token/ERC677.sol
638+
// File contracts/v0.6/token/IERC677.sol
639639

640640
// SPDX-License-Identifier: MIT
641641
pragma solidity >0.6.0 <0.8.0;
642642

643-
interface ERC677 is IERC20 {
644-
function transferAndCall(address to, uint value, bytes memory data) external returns (bool success);
645-
646-
event Transfer(address indexed from, address indexed to, uint value, bytes data);
643+
interface IERC677 is IERC20 {
644+
function transferAndCall(
645+
address to,
646+
uint value,
647+
bytes memory data
648+
)
649+
external
650+
returns (bool success);
651+
652+
event Transfer(
653+
address indexed from,
654+
address indexed to,
655+
uint value,
656+
bytes data
657+
);
647658
}
648659

649660

650-
// File contracts/v0.6/token/ERC677Receiver.sol
661+
// File contracts/v0.6/token/IERC677Receiver.sol
651662

652663
// SPDX-License-Identifier: MIT
653664
pragma solidity >0.6.0 <0.8.0;
654665

655-
interface ERC677Receiver {
656-
function onTokenTransfer(address _sender, uint _value, bytes memory _data) external;
666+
interface IERC677Receiver {
667+
function onTokenTransfer(
668+
address sender,
669+
uint value,
670+
bytes memory data
671+
)
672+
external;
657673
}
658674

659675

660-
// File contracts/v0.6/ERC677Token.sol
676+
// File contracts/v0.6/ERC677.sol
661677

662678
// SPDX-License-Identifier: MIT
663679
pragma solidity >0.6.0 <0.8.0;
664680

665681

666682

667-
abstract contract ERC677Token is ERC20, ERC677 {
683+
abstract contract ERC677 is IERC677, ERC20 {
668684
/**
669685
* @dev transfer token to a contract address with additional data if the recipient is a contact.
670-
* @param _to The address to transfer to.
671-
* @param _value The amount to be transferred.
672-
* @param _data The extra data to be passed to the receiving contract.
686+
* @param to The address to transfer to.
687+
* @param value The amount to be transferred.
688+
* @param data The extra data to be passed to the receiving contract.
673689
*/
674-
function transferAndCall(address _to, uint _value, bytes memory _data)
690+
function transferAndCall(
691+
address to,
692+
uint value,
693+
bytes memory data
694+
)
675695
public
676696
override
677697
virtual
678698
returns (bool success)
679699
{
680-
super.transfer(_to, _value);
681-
emit Transfer(msg.sender, _to, _value, _data);
682-
if (isContract(_to)) {
683-
contractFallback(_to, _value, _data);
700+
super.transfer(to, value);
701+
emit Transfer(msg.sender, to, value, data);
702+
if (isContract(to)) {
703+
contractFallback(to, value, data);
684704
}
685705
return true;
686706
}
687707

688708

689709
// PRIVATE
690710

691-
function contractFallback(address _to, uint _value, bytes memory _data)
711+
function contractFallback(
712+
address to,
713+
uint value,
714+
bytes memory data
715+
)
692716
private
693717
{
694-
ERC677Receiver receiver = ERC677Receiver(_to);
695-
receiver.onTokenTransfer(msg.sender, _value, _data);
718+
IERC677Receiver receiver = IERC677Receiver(to);
719+
receiver.onTokenTransfer(msg.sender, value, data);
696720
}
697721

698-
function isContract(address _addr)
722+
function isContract(
723+
address addr
724+
)
699725
private
700726
view
701727
returns (bool hasCode)
702728
{
703729
uint length;
704-
assembly { length := extcodesize(_addr) }
730+
assembly { length := extcodesize(addr) }
705731
return length > 0;
706732
}
707733
}

0 commit comments

Comments
 (0)