Skip to content

Conversation

b00ste
Copy link
Member

@b00ste b00ste commented May 22, 2025

What does this PR introduce?

PR Checklist

  • Wrote Tests
  • Wrote & Generated Documentation (readme/natspec/dodoc)
  • Ran npm run lint && npm run lint:solidity (solhint)
  • Ran npm run format (prettier)
  • Ran npm run build
  • Ran npm run test

@b00ste b00ste marked this pull request as draft May 22, 2025 14:08
@b00ste b00ste force-pushed the customizeable-tokens branch 2 times, most recently from 9034a3c to 71f51dc Compare May 26, 2025 18:19
@b00ste b00ste force-pushed the customizeable-tokens branch 16 times, most recently from a7407c0 to 53e8785 Compare June 16, 2025 07:26
@CJ42
Copy link
Member

CJ42 commented Jun 16, 2025

@b00ste we also need to allow developers to import these new extensions from the @lukso/lsp-smart-contracts package, so like this for instance:

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;
import "@lukso/lsp7-contracts/contracts/extensions/LSP7Burnable.sol";

Copy link
Member

@CJ42 CJ42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added first round of review. It is already much better with the contracts broken down in multiple inheritance. Also great Natspec comments overall and well documented 👏🏻

@@ -5,7 +5,7 @@ libs = ['node_modules','lib']
gas_reports = ["LSP6ExecuteRestrictedController", "LSP6ExecuteUnrestrictedController", "LSP6SetDataRestrictedController", "LSP6SetDataUnrestrictedController"]
cache_path = 'forge-cache'
test = 'tests/foundry'
solc = "0.8.17"
solc = "0.8.22"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we are using the feature from 0.8.22 `(to access events inside contracts), it will not compile with Hardhat for these new token extensions no? (Since Hardhat defines 0.8.17 version

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think if you're using hardhat compile, it will use the version defined in hardhat config

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right indeed.
Then we need in the Foundry tests to increase the pragma to ^0.8.22

image

pragma solidity ^0.8.4;

/// @title ILSP7Allowlist
/// @dev Interface for managing an allowlist of addresses that can bypass certain restrictions in an LSP7 token contract.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is meant by "bypass" certain restrictions here? Maybe we could put some examples?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is an example below. Could we put other examples to illustrate more the use case of this token extension?

}

/// @inheritdoc ILSP7Mintable
function mint(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would discuss this public function, as there could be any public function for minting. Maybe we should just keep the public mint(...) function only for the preset and keep only the internal _mint(...) function inside this token extension contract?

uint256 transferLockStart_,
uint256 transferLockEnd_
) {
if (transferLockEnd_ < transferLockStart_) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the behaviour if transferLockEnd_ and transferLockStart_ are the same value being set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be no transfer lock period

@b00ste b00ste force-pushed the customizeable-tokens branch from 53e8785 to 0b03da2 Compare June 16, 2025 15:59
@aurelianoa
Copy link

Just came across with this and i like the idea of a customizable token. I will propose ways to work with the allow list (merkle tree or signature method) and batch add/removes

@b00ste b00ste force-pushed the customizeable-tokens branch from c4af453 to e61fd62 Compare June 23, 2025 08:17
@@ -0,0 +1,279 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to specify ^0.8.22 for all the test files that use the feature from 0.8.22 to access events defined in interfaces.

Suggested change
pragma solidity ^0.8.4;
pragma solidity ^0.8.22;

image

@@ -5,7 +5,7 @@ libs = ['node_modules','lib']
gas_reports = ["LSP6ExecuteRestrictedController", "LSP6ExecuteUnrestrictedController", "LSP6SetDataRestrictedController", "LSP6SetDataUnrestrictedController"]
cache_path = 'forge-cache'
test = 'tests/foundry'
solc = "0.8.17"
solc = "0.8.22"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right indeed.
Then we need in the Foundry tests to increase the pragma to ^0.8.22

image

) internal virtual {
// Allow burning
if (to == address(0)) return;
if (balanceOf(to) + amount <= tokenBalanceCap()) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for the early return statement. Let's then add some extra parameters to the custom error to improve logging

/// @param from The address sending the tokens (ignored in this implementation).
/// @param to The address receiving the tokens.
/// @param amount The amount of tokens being transferred.
/// @param force Whether to force the transfer (ignored in this implementation).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw i didn't comment out the params because natspec errors out with them commented

Yes good point for the Natspec compiler error 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants