This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The 'credits' program. | |
program my_credits.aleo { | |
record credits { | |
owner: address, | |
gates: u64 | |
} | |
transition mint(receiver: address, amount: u64) -> credits { | |
return credits { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
function _acceptResource(uint256 tokenId, uint256 index) internal { | |
if (index >= _pendingResources[tokenId].length) | |
revert RMRKIndexOutOfRange(); | |
uint64 resourceId = _pendingResources[tokenId][index]; | |
_pendingResources[tokenId].removeItemByIndex(index); | |
uint64 overwrite = _resourceOverwrites[tokenId][resourceId]; | |
if (overwrite != uint64(0)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
function _addResourceToToken( | |
uint256 tokenId, | |
uint64 resourceId, | |
uint64 overwrites | |
) internal { | |
if (_tokenResources[tokenId][resourceId]) | |
revert RMRKResourceAlreadyExists(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
function addResourceEntry(string memory metadataURI) | |
external | |
onlyOwnerOrContributor | |
{ | |
unchecked { | |
_totalResources += 1; | |
} | |
_addResourceEntry(uint64(_totalResources), metadataURI); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
function addChild(uint256 parentTokenId, uint256 childTokenId) | |
public | |
virtual | |
{ | |
_requireMinted(parentTokenId); | |
if (!_msgSender().isContract()) revert RMRKIsNotContract(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
function _sendToNFT( | |
uint256 tokenId, | |
uint256 destinationId, | |
address from, | |
address to | |
) private { | |
IRMRKNesting destContract = IRMRKNesting(to); | |
destContract.addChild(destinationId, tokenId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
uint256 private constant _MAX_LEVELS_TO_CHECK_FOR_INHERITANCE_LOOP = 100; | |
function _checkForInheritanceLoop( | |
uint256 currentId, | |
address targetContract, | |
uint256 targetId | |
) private view { | |
for (uint256 i; i < _MAX_LEVELS_TO_CHECK_FOR_INHERITANCE_LOOP; ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
function _nestTransfer( | |
address from, | |
address to, | |
uint256 tokenId, | |
uint256 destinationId | |
) internal virtual { | |
(address immediateOwner, , ) = rmrkOwnerOf(tokenId); | |
if (immediateOwner != from) revert ERC721TransferFromIncorrectOwner(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.21 <0.7.0; | |
function repay(address _reserve, uint256 _amount) | |
external | |
onlyAmountGreaterThanZero(_amount) | |
{ | |
(, uint256 currentBorrowBalance, , , ) = dataProvider.getUserReserveData( | |
_reserve, | |
msg.sender | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.21 <0.7.0; | |
function redeem( | |
address _reserve, | |
address payable _user, | |
uint256 _amount | |
) external onlyActiveReserve(_reserve) onlyAmountGreaterThanZero(_amount) { | |
( | |
, | |
, |
NewerOlder