@@ -5,7 +5,7 @@ import "@devprotocol/i-s-tokens/contracts/interfaces/ITokenURIDescriptor.sol";
5
5
import "@devprotocol/i-s-tokens/contracts/interfaces/ISTokensManagerStruct.sol " ;
6
6
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol " ;
7
7
import "./interfaces/IProperty.sol " ;
8
- import "./interfaces/ISwapAndStake .sol " ;
8
+ import "./interfaces/IDynamicTokenSwapAndStake .sol " ;
9
9
10
10
contract MembersCollections is ITokenURIDescriptor , OwnableUpgradeable {
11
11
struct Image {
@@ -14,20 +14,21 @@ contract MembersCollections is ITokenURIDescriptor, OwnableUpgradeable {
14
14
string description;
15
15
// number of slots a image can have
16
16
uint32 slots;
17
- uint256 requiredETHAmount;
18
- uint256 requiredETHFee;
17
+ uint256 requiredTokenAmount;
18
+ uint256 requiredTokenFee;
19
+ address token;
19
20
address gateway;
20
21
}
21
22
22
- ISwapAndStake public swapAndStake;
23
+ IDynamicTokenSwapAndStake public swapAndStake;
23
24
mapping (address => mapping (bytes32 => Image)) public propertyImages;
24
25
mapping (address => mapping (uint256 => uint256 )) public stakedAmountAtMinted;
25
26
mapping (address => mapping (bytes32 => uint32 ))
26
27
public propertyImageClaimedSlots;
27
28
28
29
function initialize (address _contract ) external initializer {
29
30
__Ownable_init ();
30
- swapAndStake = ISwapAndStake (_contract);
31
+ swapAndStake = IDynamicTokenSwapAndStake (_contract);
31
32
}
32
33
33
34
modifier onlyPropertyAuthor (address _property ) {
@@ -37,7 +38,7 @@ contract MembersCollections is ITokenURIDescriptor, OwnableUpgradeable {
37
38
}
38
39
39
40
function setSwapAndStake (address _contract ) external onlyOwner {
40
- swapAndStake = ISwapAndStake (_contract);
41
+ swapAndStake = IDynamicTokenSwapAndStake (_contract);
41
42
}
42
43
43
44
function image (
@@ -115,8 +116,8 @@ contract MembersCollections is ITokenURIDescriptor, OwnableUpgradeable {
115
116
// When key, slots are not defined or 0 slots
116
117
if (
117
118
bytes (img.src).length == 0 &&
118
- img.requiredETHAmount == 0 &&
119
- img.requiredETHFee == 0 &&
119
+ img.requiredTokenAmount == 0 &&
120
+ img.requiredTokenFee == 0 &&
120
121
img.slots == 0
121
122
) {
122
123
return false ;
@@ -127,13 +128,13 @@ contract MembersCollections is ITokenURIDescriptor, OwnableUpgradeable {
127
128
}
128
129
129
130
// Always only allow staking via the SwapAndStake contract.
130
- ISwapAndStake.Amounts memory stakeVia = swapAndStake.gatewayOf (
131
- img.gateway
132
- );
131
+ IDynamicTokenSwapAndStake.Amounts memory stakeVia = swapAndStake
132
+ .gatewayOf (img.gateway);
133
133
134
134
// Validate the staking position.
135
- bool valid = img.requiredETHAmount <= stakeVia.input &&
136
- img.requiredETHFee <= stakeVia.fee;
135
+ bool valid = img.requiredTokenAmount <= stakeVia.input &&
136
+ img.requiredTokenFee <= stakeVia.fee &&
137
+ img.token == stakeVia.token;
137
138
138
139
if (valid) {
139
140
stakedAmountAtMinted[_positions.property][id] = _positions.amount;
0 commit comments