Skip to content

Commit f8ced70

Browse files
committed
Merge branch 'main' into dev
2 parents e967c9c + 48bf15c commit f8ced70

File tree

5 files changed

+55
-61
lines changed

5 files changed

+55
-61
lines changed

gemforge.deployments.json

Lines changed: 40 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,26 @@
653653
"mainnet": {
654654
"chainId": 1,
655655
"contracts": [
656+
{
657+
"name": "TokenizedVaultFacet",
658+
"fullyQualifiedName": "TokenizedVaultFacet.sol:TokenizedVaultFacet",
659+
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
660+
"txHash": "0x74601c9f62e0aae5d35b20f0d43e65d3fce8bd53c643e56be253205abc5f49f9",
661+
"onChain": {
662+
"address": "0xF2a003c4e86d00C90f58150993c92Cf3Cb48684E",
663+
"constructorArgs": []
664+
}
665+
},
666+
{
667+
"name": "TokenizedVaultIOFacet",
668+
"fullyQualifiedName": "TokenizedVaultIOFacet.sol:TokenizedVaultIOFacet",
669+
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
670+
"txHash": "0x30fbfe00293ba0cb84221ab9621e26f876aac76fe637dd824e27d04ec0632c95",
671+
"onChain": {
672+
"address": "0xE62d440d48Cf455BF90e16876604b7Ba46dd934a",
673+
"constructorArgs": []
674+
}
675+
},
656676
{
657677
"name": "ACLFacet",
658678
"fullyQualifiedName": "ACLFacet.sol:ACLFacet",
@@ -743,26 +763,6 @@
743763
"constructorArgs": []
744764
}
745765
},
746-
{
747-
"name": "TokenizedVaultFacet",
748-
"fullyQualifiedName": "TokenizedVaultFacet.sol:TokenizedVaultFacet",
749-
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
750-
"txHash": "0x747794fabd1bcfc9dc8284c32ee24f30316cfedad02953a33a3c9c29c012123b",
751-
"onChain": {
752-
"address": "0x528448A55495639b5cA748F476AA8D0c9403F104",
753-
"constructorArgs": []
754-
}
755-
},
756-
{
757-
"name": "TokenizedVaultIOFacet",
758-
"fullyQualifiedName": "TokenizedVaultIOFacet.sol:TokenizedVaultIOFacet",
759-
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
760-
"txHash": "0x20dd07932efd05730da9a352d494360178c1c0df1433d6319c0d2c1c981127a3",
761-
"onChain": {
762-
"address": "0xdACa799709dA021134c7143C75FC7e3Fa9627427",
763-
"constructorArgs": []
764-
}
765-
},
766766
{
767767
"name": "UserFacet",
768768
"fullyQualifiedName": "UserFacet.sol:UserFacet",
@@ -783,16 +783,6 @@
783783
"constructorArgs": []
784784
}
785785
},
786-
{
787-
"name": "DividendPatchInitDiamond",
788-
"fullyQualifiedName": "DividendPatchInitDiamond.sol:DividendPatchInitDiamond",
789-
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
790-
"txHash": "0x17a152291b7374301cc5e0426c36599e6b2eb23e3cc6e8345aa16cb3d660c826",
791-
"onChain": {
792-
"address": "0x3A72600F8e18AC7aa8c721108421a0Be7B810de6",
793-
"constructorArgs": []
794-
}
795-
},
796786
{
797787
"name": "PhasedDiamondCutFacet",
798788
"fullyQualifiedName": "PhasedDiamondCutFacet.sol:PhasedDiamondCutFacet",
@@ -843,6 +833,26 @@
843833
"base": {
844834
"chainId": 8453,
845835
"contracts": [
836+
{
837+
"name": "TokenizedVaultFacet",
838+
"fullyQualifiedName": "TokenizedVaultFacet.sol:TokenizedVaultFacet",
839+
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
840+
"txHash": "0x194f1bfe4d9c1b84b75a9aa0a7be47a2f66d6b6abee2b9d52f7e6406967eeafc",
841+
"onChain": {
842+
"address": "0xEB0E8aCCe947A7688782305543d15f8Cb42c1041",
843+
"constructorArgs": []
844+
}
845+
},
846+
{
847+
"name": "TokenizedVaultIOFacet",
848+
"fullyQualifiedName": "TokenizedVaultIOFacet.sol:TokenizedVaultIOFacet",
849+
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
850+
"txHash": "0xfebc34d78559828797ed47aeb99bce9a40712b0abb598b8bca9186fa906e6f2b",
851+
"onChain": {
852+
"address": "0xf680AB32DF25618361A7423E59f2B7e6f200d2Fe",
853+
"constructorArgs": []
854+
}
855+
},
846856
{
847857
"name": "ACLFacet",
848858
"fullyQualifiedName": "ACLFacet.sol:ACLFacet",
@@ -933,26 +943,6 @@
933943
"constructorArgs": []
934944
}
935945
},
936-
{
937-
"name": "TokenizedVaultFacet",
938-
"fullyQualifiedName": "TokenizedVaultFacet.sol:TokenizedVaultFacet",
939-
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
940-
"txHash": "0xb8c9ca43dae92b5d36a0b46781b896d7418b9faf73f4c55f8bc421fec1048779",
941-
"onChain": {
942-
"address": "0x0B7ee1A088638DF9bC200d5eE1156ef14bc5aA82",
943-
"constructorArgs": []
944-
}
945-
},
946-
{
947-
"name": "TokenizedVaultIOFacet",
948-
"fullyQualifiedName": "TokenizedVaultIOFacet.sol:TokenizedVaultIOFacet",
949-
"sender": "0xd5c10a9a09B072506C7f062E4f313Af29AdD9904",
950-
"txHash": "0x6967b45c89eab660dea22e961de1b898186de35f8ffc7a58ace6ac6115352653",
951-
"onChain": {
952-
"address": "0x8A07328C06f0cC0eC2A6717bAcE51dABE27567c2",
953-
"constructorArgs": []
954-
}
955-
},
956946
{
957947
"name": "UserFacet",
958948
"fullyQualifiedName": "UserFacet.sol:UserFacet",

src/facets/TokenizedVaultFacet.sol

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,16 @@ contract TokenizedVaultFacet is Modifiers, ReentrancyGuard {
192192
function distributeAccruedInterest(bytes32 _tokenId, uint256 _amount, bytes32 _guid) external assertPrivilege(LibAdmin._getSystemId(), LC.GROUP_SYSTEM_MANAGERS) {
193193
// The _claimRebasingInterest method verifies the token is valid, and that there is available interest.
194194
// No need to do it again.
195-
LibTokenizedVault._claimRebasingInterest(_tokenId, _amount);
195+
LibTokenizedVault._claimRebasedInterest(_tokenId, _amount);
196196
LibTokenizedVault._payDividend(_guid, LibAdmin._getSystemId(), _tokenId, _tokenId, _amount);
197197
}
198198

199-
function claimRebasingInterest(bytes32 _tokenId, uint256 _amount) external assertPrivilege(LibAdmin._getSystemId(), LC.GROUP_SYSTEM_MANAGERS) {
200-
LibTokenizedVault._claimRebasingInterest(_tokenId, _amount);
199+
/**
200+
* @notice Claim the rebasing interest to the system ID
201+
* @param _tokenId Rebasing token ID
202+
* @param _amount Amount to distribute
203+
*/
204+
function claimRebasedInterest(bytes32 _tokenId, uint256 _amount) external assertPrivilege(LibAdmin._getSystemId(), LC.GROUP_SYSTEM_ADMINS) {
205+
LibTokenizedVault._claimRebasedInterest(_tokenId, _amount);
201206
}
202207
}

src/facets/TokenizedVaultIOFacet.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ contract TokenizedVaultIOFacet is Modifiers, ReentrancyGuard {
5353
address _receiver,
5454
address _externalTokenAddress,
5555
uint256 _amount
56-
) external notLocked nonReentrant assertPrivilege(LibObject._getParentFromAddress(msg.sender), LC.GROUP_EXTERNAL_WITHDRAW_FROM_ENTITY) {
56+
) external notLocked nonReentrant assertPrivilege(_entityId, LC.GROUP_EXTERNAL_WITHDRAW_FROM_ENTITY) {
5757
if (!LibACL._hasGroupPrivilege(LibHelpers._getIdForAddress(_receiver), _entityId, LibHelpers._stringToBytes32(LC.GROUP_EXTERNAL_WITHDRAW_FROM_ENTITY)))
5858
revert ExternalWithdrawInvalidReceiver(_receiver);
5959
LibTokenizedVaultIO._externalWithdraw(_entityId, _receiver, _externalTokenAddress, _amount);

src/libs/LibTokenizedVault.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ library LibTokenizedVault {
325325
return total - depositTotal;
326326
}
327327

328-
function _claimRebasingInterest(bytes32 _tokenId, uint256 _amount) internal {
328+
function _claimRebasedInterest(bytes32 _tokenId, uint256 _amount) internal {
329329
AppStorage storage s = LibAppStorage.diamondStorage();
330330

331331
if (s.tokenSupply[_tokenId] == 0) {

test/T02Access.t.sol

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,19 @@ contract T02Access is D03ProtocolDefaults {
149149
changePrank(ea);
150150
writeTokenBalance(ea.addr, naymsAddress, wethAddress, 1 ether);
151151
nayms.externalDeposit(wethAddress, 1 ether); // deposit 100 weth into ea's parent (sm.entityId)
152-
// Withdrawing from the entity sm.entityId
153152
nayms.externalWithdrawFromEntity(sm.entityId, ea.addr, wethAddress, 100);
154153

155154
changePrank(cc);
156155
writeTokenBalance(cc.addr, naymsAddress, wethAddress, 1 ether);
157-
vm.expectRevert(); // Invalid group privilege
158156
nayms.externalWithdrawFromEntity(sm.entityId, cc.addr, wethAddress, 100);
159157

160158
changePrank(sm);
161-
nayms.setEntity(cc.id, sm.entityId); // User's parent must be set to the entity to deposit and withdraw from it
162-
changePrank(cc);
163-
nayms.externalWithdrawFromEntity(sm.entityId, cc.addr, wethAddress, 100);
159+
hCreateEntity(ts.entityId, ts.id, entity, "entity test hash");
160+
changePrank(sa);
161+
hAssignRole(ts.id, ts.entityId, LC.ROLE_ENTITY_ADMIN);
164162

165-
vm.expectRevert(abi.encodeWithSelector(ExternalWithdrawInvalidReceiver.selector, sm.addr));
163+
changePrank(ts);
164+
vm.expectRevert(abi.encodeWithSelector(InvalidGroupPrivilege.selector, ts.id, sm.entityId, "", LC.GROUP_EXTERNAL_WITHDRAW_FROM_ENTITY));
166165
nayms.externalWithdrawFromEntity(sm.entityId, sm.addr, wethAddress, 100); // Invalid receiver sm.addr
167166
}
168167

0 commit comments

Comments
 (0)