Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit 21b551c

Browse files
bweickasoong
authored andcommitted
Renamed contracts and variables.
1 parent af0d279 commit 21b551c

File tree

7 files changed

+25
-29
lines changed

7 files changed

+25
-29
lines changed

contracts/core/SetToken.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pragma solidity 0.4.24;
1818

1919

2020
import { DetailedERC20 } from "zeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol";
21-
import { ERC20 } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
2221
import { StandardToken } from "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
2322
import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";
2423
import { ISetFactory } from "./interfaces/ISetFactory.sol";

contracts/core/TransferProxy.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pragma solidity 0.4.24;
1919

2020
import { Authorizable } from "../lib/Authorizable.sol";
2121
import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";
22-
import { TokenInteract } from "./lib/TokenInteract.sol";
22+
import { ERC20Wrapper } from "./lib/ERC20Wrapper.sol";
2323

2424

2525
/**
@@ -80,22 +80,22 @@ contract TransferProxy is
8080
onlyAuthorized
8181
{
8282
// Retrieve current balance of token for the vault
83-
uint existingVaultBalance = TokenInteract.balanceOf(
83+
uint existingVaultBalance = ERC20Wrapper.balanceOf(
8484
_tokenAddress,
8585
vaultAddress
8686
);
8787

8888
// Call specified ERC20 contract to transfer tokens from user to Vault (via proxy).
8989

90-
TokenInteract.transferFrom(
90+
ERC20Wrapper.transferFrom(
9191
_tokenAddress,
9292
_from,
9393
vaultAddress,
9494
_quantity
9595
);
9696

9797
// Verify transfer quantity is reflected in balance
98-
uint newVaultBalance = TokenInteract.balanceOf(
98+
uint newVaultBalance = ERC20Wrapper.balanceOf(
9999
_tokenAddress,
100100
vaultAddress
101101
);

contracts/core/Vault.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ pragma solidity 0.4.24;
1818

1919

2020
import { Authorizable } from "../lib/Authorizable.sol";
21-
import { ERC20 } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
2221
import { SafeMath } from "zeppelin-solidity/contracts/math/SafeMath.sol";
23-
import { TokenInteract } from "./lib/TokenInteract.sol";
22+
import { ERC20Wrapper } from "./lib/ERC20Wrapper.sol";
2423

2524

2625
/**
@@ -93,20 +92,20 @@ contract Vault is
9392
isValidDestination(_to)
9493
{
9594
// Retrieve current balance of token for the vault
96-
uint existingVaultBalance = TokenInteract.balanceOf(
95+
uint existingVaultBalance = ERC20Wrapper.balanceOf(
9796
_tokenAddress,
9897
this
9998
);
10099

101100
// Call specified ERC20 token contract to transfer tokens from Vault to user
102-
TokenInteract.transfer(
101+
ERC20Wrapper.transfer(
103102
_tokenAddress,
104103
_to,
105104
_quantity
106105
);
107106

108107
// Verify transfer quantity is reflected in balance
109-
uint newVaultBalance = TokenInteract.balanceOf(
108+
uint newVaultBalance = ERC20Wrapper.balanceOf(
110109
_tokenAddress,
111110
this
112111
);

contracts/core/lib/TokenInteract.sol renamed to contracts/core/lib/ERC20Wrapper.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2018 Set Labs Inc.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -13,7 +16,7 @@
1316

1417
pragma solidity 0.4.24;
1518

16-
import { GeneralERC20 } from "../../lib/GeneralERC20.sol";
19+
import { IERC20 } from "../../lib/IERC20.sol";
1720

1821

1922
/**
@@ -23,12 +26,11 @@ import { GeneralERC20 } from "../../lib/GeneralERC20.sol";
2326
* This library contains functions for interacting wtih ERC20 tokens, even those not fully compliant.
2427
* For all functions we will only accept tokens that return a null or true value, any other values will
2528
* cause the operation to revert.
26-
*
27-
* Inspired by dYdX Trading Inc's TokenInteract contract.
2829
*/
29-
library TokenInteract {
30+
library ERC20Wrapper {
3031

3132
// ============ Constants ============
33+
3234
string constant INVALID_RETURN_VALUE_TRANSFER = "Transferred token does not return null or true on successful trasnfer.";
3335
string constant INVALID_RETURN_VALUE_TRANSFERFROM = "Transferred token does not return null or true on successful transferFrom.";
3436

@@ -42,7 +44,7 @@ library TokenInteract {
4244
view
4345
returns (uint256)
4446
{
45-
return GeneralERC20(_tokenAddress).balanceOf(_ownerAddress);
47+
return IERC20(_tokenAddress).balanceOf(_ownerAddress);
4648
}
4749

4850
function transfer(
@@ -52,8 +54,7 @@ library TokenInteract {
5254
)
5355
internal
5456
{
55-
56-
GeneralERC20(_tokenAddress).transfer(_to, _quantity);
57+
IERC20(_tokenAddress).transfer(_to, _quantity);
5758

5859
require(
5960
checkSuccess(),
@@ -69,8 +70,7 @@ library TokenInteract {
6970
)
7071
internal
7172
{
72-
73-
GeneralERC20(_tokenAddress).transferFrom(_from, _to, _quantity);
73+
IERC20(_tokenAddress).transferFrom(_from, _to, _quantity);
7474

7575
require(
7676
checkSuccess(),
@@ -90,7 +90,7 @@ library TokenInteract {
9090
pure
9191
returns (bool)
9292
{
93-
//default to failure
93+
// default to failure
9494
uint256 returnValue = 0;
9595

9696
assembly {
@@ -118,4 +118,4 @@ library TokenInteract {
118118
// check if returned value is one or nothing
119119
return returnValue == 1;
120120
}
121-
}
121+
}

contracts/lib/Authorizable.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol";
2626
* The Authorizable contract is an inherited contract that sets permissions on certain function calls
2727
* through the onlyAuthorized modifier. Permissions can be managed only by the Owner of the contract.
2828
*/
29-
3029
contract Authorizable is
3130
Ownable
3231
{

contracts/lib/GeneralERC20.sol renamed to contracts/lib/IERC20.sol

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
Copyright 2018 Set Labs Inc.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
45
you may not use this file except in compliance with the License.
56
You may obtain a copy of the License at
7+
68
http://www.apache.org/licenses/LICENSE-2.0
9+
710
Unless required by applicable law or agreed to in writing, software
811
distributed under the License is distributed on an "AS IS" BASIS,
912
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,11 +23,8 @@ pragma solidity 0.4.24;
2023
*
2124
* Interface for using ERC20 Tokens. This interface is needed to interact with tokens that are not
2225
* fully ERC20 compliant and return something other than true on successful transfers.
23-
*
24-
* Inspired by dYdX Trading Inc's TokenInteract contract.
2526
*/
26-
interface GeneralERC20 {
27-
27+
interface IERC20 {
2828
function balanceOf(
2929
address _owner
3030
)
@@ -38,11 +38,10 @@ interface GeneralERC20 {
3838
)
3939
external;
4040

41-
4241
function transferFrom(
4342
address _from,
4443
address _to,
4544
uint256 _quantity
4645
)
4746
external;
48-
}
47+
}

contracts/test/MockTokenInvalidReturn.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,4 @@ contract MockTokenInvalidReturn {
188188
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
189189
return 4;
190190
}
191-
}
191+
}

0 commit comments

Comments
 (0)