Releases: lukso-network/lsp-smart-contracts
v0.10.3
What does this PR introduce?
This PR prepare for a patch release of the smart contracts package that include a bug fix for importing values from the constants.es.js
or constants.cjs.js
. See #633 for details.
- Bump version in
package.json
from0.10.2
to0.10.3
. - Add details of release and commits references in
CHANGELOG.md
.
Bug Fixes
- Repair problem in package.json where require/import was swapped. Add in export of package.json (4e38d39)
v0.10.2
What does this release introduce?
⚠️ Important Changes
The following contract and constants have been removed in this patch release:
-
EIP191Signer.sol
: deprecated and removed. Its usage has been replaced by the functiontoDataWithIntendedValidatorHash(...)
from the latest OpenZeppelin library (#622) (235048d) -
the
bytes4
selector of theexecute(bytes)
andexecuteRelayCall(bytes,uint256,uint256,bytes)
functions (+ their batch versions) have been removed fromLSP6Constants.sol
. Since the LSP6 interface do not use function overloading anymore, the selectors can be accessed in Solidity with the.selector
syntax. (0c2e9c0)
Changes
The contract artifacts are now built using the solidity compiler 0.8.17 (compared to 0.8.15 before). This should result in a more optimised bytecode, with more security related to two important bugs fixed in solc 0.8.16 and 0.8.17
The smart contracts dependencies used have also been upgraded to the following versions:
@erc725/smart-contracts:
5.0.0->
5.1.0`@openzeppelin/contracts
and@openzeppelin/contracts-upgradable
:4.8.1
->4.9.2
Finally, this release includes a small bug fix related to variable shadowing in the LSP0 and LSP9 implementation. The variable shadowing occurred between the parameter of the transferOwnership(_pendingOwner)
function and the _pendingOwner
state variable inherited via LSP14 (7d1b5b8).
Contributors
Many thanks to the following authors who contributed to this release.
v0.10.1
What's changed?
This release fixes a bug about importing the values defined in the constants.ts
file inside Hardhat Typescript project.
Projects using Hardhat + Typescript setup can import these values using the following syntax:
import { INTERFACE_IDS } from "@lukso/lsp-smart-contracts/dist/constants.cjs.js";
// This will raise an error if you have ES Lint enabled,
// but will allow you to import the constants in a Hardhat + Typescript based project.
const LSP0InterfaceId = INTERFACE_IDS.LSP0ERC725Account;
Thank you to @richtera for his contribution in fixing this issue! 🎉 🚀
Bug Fixes
- Allow direct import of files in ./dist/*. (de3625f)
v0.10.0
0.10.0 (2023-05-19)
This is a summary of the 0.10.0 release.
➡️ see the following HackMD file for more details + code examples about the 0.10.0 release.
⚠ BREAKING CHANGES
-
Remove function overloading in ERC725 (affecting LSP0,LSP9) and LSP6 (#575)
Resulting in a change of interfaceId of ERC725X and ERC725Y and LSP0 and LSP9 and LSP6
- ERC725X from
0x570ef073
to0x7545acac
- ERC725Y from
0x714df77c
to0x629aa694
- LSP0 from
0x0f15a0af
to0x3e89ad98
- LSP6 from
0xfb437414
to0x06561226
(Changed later to0x38bb3cdb
when added validity timestamp feature) - LSP9 from
0x06561226
to0x28af17e6
- ERC725X from
-
Add validity timestamp for LSP6 signatures (#581)
Resulting in a change of interfaceId from0x06561226
to0x38bb3cdb
Features
- Add
increaseAllowance
anddecreaseAllowance
functions in LSP7 as non-standard functions (#592)
Bug Fixes
- Add check for empty array parameters in batch
ERC725X.executeBatch(uint256[],address[],uint256[],bytes[])
/ERC725Y.setDataBatch(bytes32[],bytes[])
(#204) - Add check to avoid renounceOwnership in 1 step on network start (#562)
- Fix wrong parameter in VerifiedCall event in LSP6 (#570)
- Fix not checking for the REENTRANCY Permission in case of chained calls (#576)
- Fix reverting in the UniversalReceiverDelegates contracts in case of minting in the constructor (#579)
- Fix inheritance in LSP7Burnable extension (#591)
- Emit event before external calls in the compatible version of the LSP7/8 tokens (#590)
Refactor
- Change the visibility of tokens variable to
private
to enforce access through standard functions (#584)
v0.8.2
v0.9.0
This is a summary of the 0.9.0 release.
➡️ see the following HackMD file for more details + code examples about the 0.9.0 release.
⚠ BREAKING CHANGES
- Add LSP20 Call Verification to LSP0-ERC725Account (#511)
- add call type permissions (
dsct
) per Allowed Calls (#506) - require
SUPER_TRANSFERVALUE
permission for deploying contracts with value (#505) - change name of LSP6 event from
Executed
toCallVerified
(#511) - replace tuple value for LSP5/10 from
bytes8
->uint128
(#486) - change LSP5/6/10 Array length from
uint256
touint128
(#482) - Add
batchCalls(bytes[])
function in LSP0 and LSP9 (#476) - change
CHANGEPERMISSIONS
toEDITPERMISSIONS
(#481)
Features
- Add LSP20 Call Verification to LSP0-ERC725Account (#511) (f0d1eb3), closes #488 #498
- add call type permissions (
dsct
) per Allowed Calls (#506) (e4ddb8b) - mark
generateSalt
function aspublic
in the LSP16 Universal Factory (#499) (f05d1aa) - Add batchCalls function in LSP0 and LSP9 (#476) (d360371)
Bug Fixes
- add check to ensure
data
's offset is not pointing to itself (#489) (733173e) - export artifacts (#487) (e8fc0b5)
- require
SUPER_TRANSFERVALUE
permission for deploying contracts with value (#505) (3efde24)
build
v0.8.1
v0.8.0
This is a summary of the 0.8.0 release.
➡️ see the following HackMD file for more details + code examples about the 0.8.0 release.
This release introduces several breaking changes, bug fixes and optimisations.
Most of the revert reason strings have been replaced by custom Solidity error
to optimise the deployment cost of the contracts 🚀.
Summary & Short Links
⚠ BREAKING CHANGES
📄 Related to the Smart Contracts
-
🏗️ version 0.8.0 of the
@lukso/lsp-smart-contracts
includes the breaking changes from v4.1.0 of the@erc725/smart-contracts
dependency. -
🏗️ The minimum
solc
compiler required to compile the@lukso/lsp-smart-contracts
is now0.8.4
, since most contracts use customerror
. -
🧬 The ERC165 interface IDs of the following contracts have changed.
Contract | Interface ID in 0.7.0 | Interface ID in 0.8.0 |
---|---|---|
LSP0ERC725Account |
0xeb6be62e |
0x66767497 |
LSP1UniversalReceiverDelegate |
0xa245bbda |
🗑️ deprecated |
LSP6KeyManager |
0xc403d48f |
0xfb437414 |
LSP7DigitalAsset |
0x5fcaac27 |
0xda1f85e4 |
LSP8IdentifiableDigitalAsset |
0x49399145 |
0x622e7a01 |
LSP9Vault |
0xfd4d5c50 |
0x7050cee9 |
Related to the constants from the package (constant.js
)
- the
const
variableERC725YKeys
has been renamed:- before (0.7.0) -->
ERC725YKeys
❌ - now (0.8.0) -->
ERC725YDataKeys
✅
- before (0.7.0) -->
- The value of the constant
ALL_PERMISSIONS
has been changed.- before (0.7.0) -->
0x0000000000000000000000000000000000000000000000000000000000007fbf
❌ - now (0.8.0) -->
0x00000000000000000000000000000000000000000000000000000000003f3f7f
✅
- before (0.7.0) -->
Universal Profile related contracts
👤 LSP0ERC725Account
⚠️ BREAKING! ERC165 interface ID changed from0xeb6be62e
--> to0x66767497
⚠️ BREAKING!: supports 2 x new interfaces when callingsupportsInterface(...)
: LSP14 + LSP17.⚠️ BREAKING!: some parameters were switched in theUniversalReceiver
event:returnedValue
is now the 5th param (4th before) andreceivedData
is the 4th param (5th before).returnedValue
param is notindexed
anymore.value
param is now indexed.
⚠️ BREAKING!: addedsalt
parameter in theContractCreated
event.⚠️ BREAKING!: the behaviour of theuniversalReceiver(...)
function in the UP has changed as follow:- before (0.7.0) --> called the
universalReceiverDelegate(...)
function of the LSP1Delegate contract. - now (0.8.0) --> call the `
- calls the
universalReceiver(...)
function of the LSP1Delegate + Mapped LSP1Delegate for the typeId. - the
msg.sender
andmsg.value
are appended at the end of the calldata sent to the LSP1Delegate + Mapped LSP1Delegate for the typeId.
- calls the
- before (0.7.0) --> called the
⚠️ BREAKING!: now uses LSP14 for ownership management.- ⭐ Feat: now supports LSP17 extension contracts via the
fallback
function. - ⭐ Feat: all the
payable
functions (execute(...)
single & batch +universalReceiver(...)
) emit theValueReceived
event when some native tokens are sent while calling these functions. - ⭐ Feat:
universalReceiver(...)
function now also calls theMappedUniversalReceiverDelegate
for a typeIds if an address is set in the storage for this specific typeId under the contract storage.
📣 LSP1UniversalReceiverDelegate
Important: if you are deploying a combination of LSP6 + LSP0 + LSP1, meaning:
- a Universal Profile (or any ERC725Account) +
- with a Universal Receiver Delegate set in storage +
- a Key Manager as an owner,.
the LSP1UniversalReceiverDelegate will need the permissions
SETDATA
(orSUPERSETDATA
) +REENTRANCY
to be able to react and update the UP's storage. (in 0.7.0, the Universal Receiver Delegate just needed the permissionSETDATA
).
- 🗑️ Deprecated:
ILSP1UniversalReceiverDelegate
interface + its ERC165 interface ID0xa245bbda
are now deprecated. ⚠️ BREAKING!: the functionuniversalReceiverDelegate
(0.7.0) is now replaced by the functionuniversalReceiver
.LSP1UniversalReceiverDelegate
contract
🔐 LSP6KeyManager
⚠️ BREAKING!: ERC165 interface ID changed from0xc403d48f
--> to0xfb437414
⚠️ BREAKING!: 6 x new permissions + new order (see details below).⚠️ BREAKING!: new format for signing relayed transaction viaexecuteRelayCall(...)
(see details below).⚠️ BREAKING!: 5 of the Data Keys defined in the LSP6 standards have been deprecated and superseded by new ones (see details below).⚠️ BREAKING!:Executed
event: the parameters changed order and are bothindexed
.- before (0.7.0) -->
Executed(uint256 indexed value, bytes4 selector)
- now (0.8.0) -->
Executed(bytes4 indexed selector, uint256 indexed value)
- before (0.7.0) -->
- ⭐ Feat: new batch functions for
execute(bytes[])
andexecuteRelayCall(bytes[],uint256[],bytes[])
- ⭐ Feat: now possible to set the
bytes32(0)
data key on the linked account via the Key Manager.
New Permissions + Change in the permissions order
The order of the LSP6 permissions has been changed. You can see the new order in the constants.js
file.
Additionally, the following changes and new permissions were introduced:
ADDPERMISSIONS
: renamedADDCONTROLLER
SUPER
permissions are now placed next to their non-super equivalent in the order.- new permissions:
ADD
/CHANGEEXTENSIONS
ADD
/CHANGEUNIVERSALRECEIVERDELEGATE
REENTRANCY
DECRYPT
Superseded LSP6 Data Keys
Previously (0.7.0) | Replaced by (0.8.0) |
---|---|
AddressPermissions:AllowedERC725YKeys |
AddressPermissions:AllowedERC725YDataKeys |
AddressPermissions:AllowedAddresses |
AddressPermissions:AllowedCalls |
AddressPermissions:AllowedStandards |
|
AddressPermissions:AllowedFunctions |
One of the main changes regarding these data keys is that:
- before (0.7.0) --> if nothing is stored under these data keys, it would whitelist any ERC725Y Data Keys or Calls.
- now (0.8.0) --> if nothing is stored under these data keys, no ERC725Y Data Keys or Calls are allowed.
Meaning that since 0.8.0, a controller with the permission SETDATA
or CALL
also needs to have some allowed ERC725Y data keys or calls set, so that it can set data on the Universal Profile's storage or make calls on behalf of the UP.
New signature format for executeRelayCall(...)
Since 0.8.0, relayed transactions must be signed using version 0 of EIP191. The data to sign must be the keccak256 hash digest of the following elements concatenated together.
0x19 <0x00> <KeyManager address> <LSP6_VERSION> <chainId> <nonce> <value> <payload>
Where:
0x19
: byte intended to ensure that thesigned_data
is not valid RLP.0x00
: version 0 of the EIP191.KeyManager address
: The address of the Key Manager executing the payload.LSP6_VERSION
: Version relative to the LSP6KeyManager defined as auint256
equal to 6.chainId
: The chainId of the blockchain where the Key Manager is deployed, as auint256
.nonce
: The nonce to sign the payload with, as auint256
.value
: The amount of native token to transfer to the ERC725 Account linked to the Key Manager alongside the call.payload
: The payload to be executed.
➕ New Contracts
⚠️ BREAKING!: theClaimOwnership
contract was renamed and replaced byLSP14Ownable2Step
.- ⭐ Feat:
LSP11BasicSocialRecovery
- ⭐ Feat:
LSP16UniversalFactory
- ⭐ Feat:
LSP17Extension
+LSP17Extendable
</a...
v0.7.0
This release introduces multiple breaking changes, features and bug fixes described below.
⚠️ BREAKING CHANGES
-
The contracts
LSP7DigitalAssetInit
andLSP8IdentifiableDigitalAssetInit
have been removed. -
The contracts
LSP7DigitalAsset
andLSP8IdentifiableDigitalAsset
are nowabstract
and not deployable anymore, since they do not contain a tokens supply mechanism by default (making them not usable if deployed). Consider creating your own implementation via inheritance or use the preset contractsLSP7Mintable
/LSP8Mintable
. -
The second parameter
dataValue
in theDataChanged
event was re-introduced in the@erc725/smart-contracts
package. However, the contracts from LSP0ERC725Account, LSP4DigitalAssetMetadata and LSP9Vault emit only the first 256 bytes of thedataValue
parameter in the event. -
The new permission
ENCRYPT
related to LSP6 is available inLSP6Constants.sol
andconstants.js
. It is introduced after the permissionSIGN
and before theSUPER
permissions. This make all the permissions shift by 1 bit. Please make sure that you update your permissions in your application according to the new order. -
In LSP7, the function
isOperatorFor(...)
was renamedauthorizedAmountFor(...)
.
The interface IDs of the following contracts have changed:
- LSP0ERC725Account:
0x9a3bfe88
->0xeb6be62e
- LSP7DigitalAsset:
0xe33f65c3
->0x5fcaac27
- LSP9Vault:
0x8c1d44f6
->0xfd4d5c50
- ClaimOwnership:
0xd225f160
->0xa375e9c6
🌟 Features
-
renounceOwnership(...)
in LSP0 and LSP9 now work as a 2-step process. The first step is to initiate the process of renouncing ownership. The second step is to confirm. -
The function
transferOwnership(...)
in LSP9 now includes a hook that attempt to call theuniversalReceiver(...)
function of thenewOwner
of the Vault (if thenewOwner
is a contract that implement the LSP1 standard). -
The
LSP8CompatibleERC721
contract now includes the functionsetApprovalForAll(...)
from ERC721.
🐛 Bug Fixes
- the contracts
LSP7CompatibleERC20Init
andLSP8CompatibeERC721Init
includes aconstructor
that lock the base contracts immediately on deployment. - The
LSP1UniversalReceiverDelegate
does not return ifcode.length
of the caller is empty, to allow calls from constructor of an LSP9Vault. - add more check in
claimOwnership(...)
to disallow the contract itself to claim ownership through its own address via a recursive call.
For the bug fixes related to the Tokens contracts (LSP7 + LSP8)
- in LSP8, if calling
authorizeOperator(...)
with operator address already authorized, the call will revert. - in LSP8, revoke when trying to call
revokeOperator(...)
with the address of a non-existing operator. - disallow the
from
andto
address to be the same address when doing atransfer(...)
, to avoid reducing the operator allowance (LSP7) or clearing the operator list (LSP8) as no token have been moved.
Release Details
⚠ BREAKING CHANGES
- remove
LSP7Init
andLSP8Init
+ make barebone LSP7/8 contracts non deployable (#296) (4dec2f1) - Update ClaimOwnership, LSP0 and LSP9 InterfaceId (#298) (24a281c)
- [LSP0, LSP4, LSP9] emit only the first 256 bytes of the value in the
DataChanged
event (#301) (f92f996) - use
uint8
instead ofuint256
in LSP7 decimals (#292) (cc23ff5) - add new permission ENCRYPT in
constants.js
(#289) - Change
isOperatorFor(..)
toauthorizedAmountFor(..)
in LSP7 (#279) (afc5895)
Features
- [QSP - Best Practices] Use
_uncheckedIncrement(..)
for saving gas when iterating loops (#273) (4632f9c) - [QSP-12] Add two step process for
renounceOwnership(...)
inClaimOwnership
contract (#282) (b816f38) - Add a hook that notifies the vault pending owner (#295) (bb9d579)
- add GasLib library with unchecked increment (#297) (1a7757f)
- add new permission ENCRYPT in
constants.js
(#289) (259c55e)
Bug Fixes
- [QSP - Best Practices] Add ReentrancyGuard for Mintable token presets (#280) (a8445cb)
- [QSP - Best Practices] clean TODO comments + add extra permission checks and support in LSP6 (#272) (f5c6e3a)
- [QSP - Best Practices] refactor
deployCreate2Proxy(..)
to revert instead of refund caller (#276) (cc99840) - [QSP-10] Revert when authorizing existing operators in LSP8 (#270) (f7b0c36)
- [QSP-14] Revert when revoking non-existing operators (#271) (a5d72cf)
- [QSP-3] Operator Could Clear Operator List in LSP8 (#266) (d608479)
- [QSP-4] add requirements checks on
LSP4DigitalAssetMetadata
deployment + add tests for internal_burn(...)
function in LSP8 (#268) (b576750) - [QSP-5] Missing _disableInitializers for some Contracts (#265) (097c266)
- [QSP-6] fix incorrect index check for
_countTrailingZeroBytes(...)
inLSP6KeyManagerCore.sol
(#264) (41407aa) - add
setApprovalForAll(...)
inLSP8CompatibleERC721
(#239) (945c776) - Add Checks to ensure contract cannot be self owned with ClaimOwnership (#288) (31a304e)
- Fix LSP8Constants errors (#255) (c8e1533)
- Hide linter warnings (#250) (b0dc655)
- prevent operator allowance to decrease if
from
andto
are the same address (#291) (200a21f) - remove code length check in UniversalReceiverDelegate (#267) (5a92642)
- replace variable silinter with
solhint-disable
(#285) (07c6fa1)
v0.6.2
What does this release introduce?
see the release changelog for more details
BREAKING CHANGES
-
The LSP7 and LSP8 contracts compatible contracts with ERC20 / ERC721 have been renamed:
LSP7CompatibilityForERC20
>LSP7CompatibleERC20
LSP8CompatibilityForERC721
>LSP7CompatibleERC721
-
the ERC165 interface ID of
ClaimOwnership
contract module has been changed from0xad7dd9b0
>0xd225f160
. The interface ofClaimOwnership
now includes the functionowner()
andtransferOwnership(address)
in addition topendingOwner()
andclaimOwnership()
.
✨ Features
-
The
constructor
/initializer
of LSP0 and Universal Profile contracts is nowpayable
. This enables the contracts to be funded with some native tokens immediately when deploying, instead of funding the contract through 2 transactions. -
The package now includes two additional preset contracts
LSP7CompatibleERC20Mintable
andLSP8CompatibleERC721Mintable
, read to be deployed and used. -
The
fallback()
function in LSP0 and LSP9 is nowvirtual
, enabling it to be overridden in implementations for custom logic. -
revert reason strings have now mainly be replaced by custom Solidity errors. You can find the following new custom errors in
LSP2Errors.sol
,LSP4Errors.sol
,LSP5Utils
andLSP6Errors.sol
.
🐛 Bug Fixes
-
⛔ A
constructor
has been added to theInit
version of the following contracts has been added to lock the base implementation contracts immediately on deployment:- LSP0:
LSP0ERC725AccountInit
, - LSP3:
UniversalProfileInit
, - LSP6:
LSP6KeyManagerInit
, - LSP7:
LSP7DigitalAssetInit
,LSP7MintableInit
andLSP7CompatibleERC20Init
- LSP8:
LSP8IdentifiableDigitalAssetInit
,LSP8MintableInit
,LSP8CompatibleERC721Init
- LSP9:
LSP9VaultInit
- LSP0:
-
⛔ a bug was discovered in the LSP6 Key Manager that did enable to reset a list of allowed addresses, functions, standards or ERC725Y keys from an abi-encoded array to
0x
(moving from some values restricted to everything allowed). The transaction would fail. -
⛔ fixed underflow error in LSP6 Key Manager for allowed ERC725Y keys, when the allowed data key being checked was
bytes32(0)
or0x00000000...00000000
(32 x00
bytes). -
⚠️ fixed backward-compatibility issues with ERC20 inLSP7CompatibleERC20Core
: the functionsapprove
,transfer
andtransferFrom
were not returning anything. They now return a booleantrue
on successful transfer. -
⚠️ an extra was added when deploying the LSP6 Key Manager to ensure it cannot be linked toaddress(0)
.
🏗️ Build
The version of @erc725/smart-contracts
dependency was increased from 3.1.1
> 3.1.2
Contributors for this release
@CJ42 @YamenMerhi @Hugoo @dzbo @frozeman @JeneaVranceanu @OnahProsperity
Release Details
⚠ BREAKING CHANGES
- rename
LSP7CompatibilityForERC20
>LSP7CompatibleERC20
(#208) - rename
LSP8CompatibilityForERC721
>LSP7CompatibleERC721
(#218) - lock LSP0 and LSP3 base contracts on deployment (#204)
- lock LSP6 base contract on deployment (#203)
- lock LSP7 base contracts on deployment (
LSP7DigitalAssetInit
,LSP7MintableInit
andLSP7CompatibleERC20Init
) + improve heading comments (#206) - lock LSP8 base contracts on deployment (
LSP8IdentifiableDigitalAssetInit
,LSP8MintableInit
,LSP8CompatibleERC721Init
) - lock LSP9 base contracts on deployment + improve variable names (#212)
- add return statement to
LSP7CompatibleERC20
functionsapprove
,transfer
andtransferFrom
for ERC20 backward compatibility - changed
ClaimOwnership
interface ID (#214)
Features
- add payable on up
constructor
/initializer(...)
(#219) (2f8adbd) - rename
LSP7CompatibilityForERC20
toLSP7CompatibleERC20
+ add mintable preset contracts (#208) (fc7b0df) - rename
LSP8CompatibilityForERC721
toLSP8CompatibleERC721
+ add mintable preset contracts (#218) (53e33cc)
Bug Fixes
-
add return statement to LSP7Compat functions for ERC20 backward compatibility (ae2a572)
-
assets inheritance + lock
LSP8MintableInit
base contract on deployment (#217) (275cc3a) -
edit old
Executed
event signatures inconstants.js
(#209) (a21a06d) -
enable to clear array for allowed data key permissions (#224) (a039e86)
-
lock base
LSP7CompatibleERC20Init
contract on deployment (6dbb24a) -
lock LSP0 and LSP3 base contracts on deployment (#204) (bbdd1d4)
-
lock LSP7 base contracts on deployment + improve heading comments (#206) (b029430)
-
lock LSP9 base contracts on deployment + improve variable names (#212) (96cb9b7)
-
use safer code for LSP6 - Key Manager contracts and improve styles (#203) (4e0a59b)