Skip to content

Commit b61a962

Browse files
authored
make createERC20Wrapper returns the superToken (#313)
1 parent 730cbf9 commit b61a962

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperTokenFactory.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ interface ISuperTokenFactory {
5151
string calldata name,
5252
string calldata symbol
5353
)
54-
external;
54+
external
55+
returns (ISuperToken superToken);
5556

5657
/**
5758
* @dev Create new super token wrapper for the underlying ERC20 token with extra token info
@@ -69,7 +70,8 @@ interface ISuperTokenFactory {
6970
string calldata name,
7071
string calldata symbol
7172
)
72-
external;
73+
external
74+
returns (ISuperToken superToken);
7375

7476
function initializeCustomSuperToken(
7577
address customSuperTokenProxy

packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,32 +90,32 @@ abstract contract SuperTokenFactoryBase is
9090
string calldata symbol
9191
)
9292
public override
93+
returns (ISuperToken superToken)
9394
{
9495
require(address(underlyingToken) != address(0), "SuperTokenFactory: zero address");
9596

96-
ISuperToken token;
9797
if (upgradability == Upgradability.NON_UPGRADABLE) {
98-
token = ISuperToken(this.createSuperTokenLogic(_host));
98+
superToken = ISuperToken(this.createSuperTokenLogic(_host));
9999
} else if (upgradability == Upgradability.SEMI_UPGRADABLE) {
100100
UUPSProxy proxy = new UUPSProxy();
101101
// initialize the wrapper
102102
proxy.initializeProxy(address(_superTokenLogic));
103-
token = ISuperToken(address(proxy));
103+
superToken = ISuperToken(address(proxy));
104104
} else /* if (type == Upgradability.FULL_UPGRADABE) */ {
105105
FullUpgradableSuperTokenProxy proxy = new FullUpgradableSuperTokenProxy();
106106
proxy.initialize();
107-
token = ISuperToken(address(proxy));
107+
superToken = ISuperToken(address(proxy));
108108
}
109109

110110
// initialize the token
111-
token.initialize(
111+
superToken.initialize(
112112
underlyingToken,
113113
underlyingDecimals,
114114
name,
115115
symbol
116116
);
117117

118-
emit SuperTokenCreated(token);
118+
emit SuperTokenCreated(superToken);
119119
}
120120

121121
function createERC20Wrapper(
@@ -125,8 +125,9 @@ abstract contract SuperTokenFactoryBase is
125125
string calldata symbol
126126
)
127127
external override
128+
returns (ISuperToken superToken)
128129
{
129-
createERC20Wrapper(
130+
return createERC20Wrapper(
130131
underlyingToken,
131132
underlyingToken.decimals(),
132133
upgradability,

0 commit comments

Comments
 (0)