From 004bd3dc7e2ca20b5acf58d440b4c7593a33b142 Mon Sep 17 00:00:00 2001 From: 1 Date: Sat, 13 May 2023 20:17:26 +0200 Subject: [PATCH 1/8] update for latest ll and tsol --- README.md | 24 +- contracts/TIP4_1/TIP4_1Collection.sol | 110 ----- contracts/TIP4_1/TIP4_1Nft.sol | 332 -------------- .../TIP4_1/interfaces/INftChangeManager.sol | 19 - .../TIP4_1/interfaces/INftChangeOwner.sol | 25 -- contracts/TIP4_1/interfaces/INftTransfer.sol | 27 -- .../TIP4_1/interfaces/ITIP4_1Collection.sol | 38 -- contracts/TIP4_1/interfaces/ITIP4_1NFT.sol | 67 --- contracts/TIP4_2/TIP4_2Collection.sol | 52 --- contracts/TIP4_2/TIP4_2Nft.sol | 37 -- .../interfaces/ITIP4_2JSON_Metadata.sol | 9 - contracts/TIP4_3/Index.sol | 64 --- contracts/TIP4_3/IndexBasis.sol | 37 -- contracts/TIP4_3/TIP4_3Collection.sol | 137 ------ contracts/TIP4_3/TIP4_3Nft.sol | 132 ------ contracts/TIP4_3/interfaces/IIndex.sol | 10 - contracts/TIP4_3/interfaces/IIndexBasis.sol | 6 - .../TIP4_3/interfaces/ITIP4_3Collection.sol | 9 - contracts/TIP4_3/interfaces/ITIP4_3NFT.sol | 7 - contracts/TIP6/ITIP6.sol | 10 - contracts/TIP6/TIP6.sol | 17 - contracts/access/OwnableExternal.sol | 36 -- contracts/access/OwnableInternal.sol | 37 -- package-lock.json | 419 +++++++++++++++--- package.json | 16 +- test/build/OwnableExternalContract.base64 | 2 +- test/build/OwnableExternalContract.tvc | Bin 694 -> 694 bytes test/build/OwnableInternalContract.abi.json | 2 +- test/build/OwnableInternalContract.base64 | 2 +- test/build/OwnableInternalContract.tvc | Bin 656 -> 656 bytes test/build/TIP4_1CollectionCon.base64 | 2 +- test/build/TIP4_1CollectionCon.tvc | Bin 1796 -> 1796 bytes test/build/TIP4_1NftCon.base64 | 2 +- test/build/TIP4_1NftCon.tvc | Bin 2017 -> 2017 bytes test/build/TIP4_2CollectionCon.base64 | 2 +- test/build/TIP4_2CollectionCon.tvc | Bin 1936 -> 1935 bytes test/build/TIP4_2NftCon.base64 | 2 +- test/build/TIP4_2NftCon.tvc | Bin 2191 -> 2191 bytes test/build/TIP4_3CollectionCon.base64 | 2 +- test/build/TIP4_3CollectionCon.tvc | Bin 2818 -> 2816 bytes test/build/TIP4_3NftCon.base64 | 2 +- test/build/TIP4_3NftCon.tvc | Bin 3015 -> 3015 bytes test/build/TIP6Con.base64 | 2 +- test/build/TIP6Con.tvc | Bin 557 -> 557 bytes test/build/Wallet.base64 | 2 +- test/build/Wallet.tvc | Bin 638 -> 638 bytes test/build/factorySource.ts | 2 +- test/contracts/TIP4_1/TIP4_1CollectionCon.sol | 53 --- test/contracts/TIP4_1/TIP4_1NftCon.sol | 23 - test/contracts/TIP4_2/TIP4_2CollectionCon.sol | 63 --- test/contracts/TIP4_2/TIP4_2NftCon.sol | 29 -- test/contracts/TIP4_3/TIP4_3CollectionCon.sol | 70 --- test/contracts/TIP4_3/TIP4_3NftCon.sol | 68 --- test/contracts/TIP6/TIP6Con.sol | 17 - test/contracts/Wallet.sol | 43 -- .../access/OwnableExternalContract.sol | 19 - .../access/OwnableInternalContract.sol | 19 - test/giverSettings/index.ts | 144 ------ test/locklift.config.ts | 12 +- test/test/ownable-internal-test.ts | 8 +- 60 files changed, 406 insertions(+), 1863 deletions(-) delete mode 100644 contracts/TIP4_1/TIP4_1Collection.sol delete mode 100644 contracts/TIP4_1/TIP4_1Nft.sol delete mode 100644 contracts/TIP4_1/interfaces/INftChangeManager.sol delete mode 100644 contracts/TIP4_1/interfaces/INftChangeOwner.sol delete mode 100644 contracts/TIP4_1/interfaces/INftTransfer.sol delete mode 100644 contracts/TIP4_1/interfaces/ITIP4_1Collection.sol delete mode 100644 contracts/TIP4_1/interfaces/ITIP4_1NFT.sol delete mode 100644 contracts/TIP4_2/TIP4_2Collection.sol delete mode 100644 contracts/TIP4_2/TIP4_2Nft.sol delete mode 100644 contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.sol delete mode 100644 contracts/TIP4_3/Index.sol delete mode 100644 contracts/TIP4_3/IndexBasis.sol delete mode 100644 contracts/TIP4_3/TIP4_3Collection.sol delete mode 100644 contracts/TIP4_3/TIP4_3Nft.sol delete mode 100644 contracts/TIP4_3/interfaces/IIndex.sol delete mode 100644 contracts/TIP4_3/interfaces/IIndexBasis.sol delete mode 100644 contracts/TIP4_3/interfaces/ITIP4_3Collection.sol delete mode 100644 contracts/TIP4_3/interfaces/ITIP4_3NFT.sol delete mode 100644 contracts/TIP6/ITIP6.sol delete mode 100644 contracts/TIP6/TIP6.sol delete mode 100644 contracts/access/OwnableExternal.sol delete mode 100644 contracts/access/OwnableInternal.sol delete mode 100644 test/contracts/TIP4_1/TIP4_1CollectionCon.sol delete mode 100644 test/contracts/TIP4_1/TIP4_1NftCon.sol delete mode 100644 test/contracts/TIP4_2/TIP4_2CollectionCon.sol delete mode 100644 test/contracts/TIP4_2/TIP4_2NftCon.sol delete mode 100644 test/contracts/TIP4_3/TIP4_3CollectionCon.sol delete mode 100644 test/contracts/TIP4_3/TIP4_3NftCon.sol delete mode 100644 test/contracts/TIP6/TIP6Con.sol delete mode 100644 test/contracts/Wallet.sol delete mode 100644 test/contracts/access/OwnableExternalContract.sol delete mode 100644 test/contracts/access/OwnableInternalContract.sol delete mode 100644 test/giverSettings/index.ts diff --git a/README.md b/README.md index 8bb3fa7..89c6b49 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,17 @@ # How to use library -1. Create ```Nft.sol``` file and fill it. +1. Create ```Nft.tsol``` file and fill it. ```solidity -pragma ton-solidity = 0.58.1; +pragma ton-solidity = 0.62.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; -import '@itgold/everscale-tip/contracts/TIP4_1/TIP4_1Nft.sol'; +import '@itgold/everscale-tip/contracts/TIP4_1/TIP4_1Nft.tsol'; contract Nft is TIP4_1Nft { @@ -45,19 +45,19 @@ contract Nft is TIP4_1Nft { } ``` -2. Create ```Collection.sol``` file and fill it. +2. Create ```Collection.tsol``` file and fill it. ```solidity -pragma ton-solidity = 0.58.1; +pragma ton-solidity = 0.62.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; -import '@itgold/everscale-tip/contracts/TIP4_1/TIP4_1Collection.sol'; -import '@itgold/everscale-tip/contracts/access/OwnableExternal.sol'; -import './Nft.sol'; +import '@itgold/everscale-tip/contracts/TIP4_1/TIP4_1Collection.tsol'; +import '@itgold/everscale-tip/contracts/access/OwnableExternal.tsol'; +import './Nft.tsol'; contract Collection is TIP4_1Collection, OwnableExternal { @@ -138,10 +138,10 @@ contract Collection is TIP4_1Collection, OwnableExternal { # Build project -1. build ```Nft.sol``` file to use [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) - 1. ```solc Nft.sol --include-path node_modules``` -1. build ```Collection.sol``` file to use [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) - 1. ```solc Collection.sol --include-path node_modules``` +1. build ```Nft.tsol``` file to use [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) + 1. ```solc Nft.tsol --include-path node_modules``` +1. build ```Collection.tsol``` file to use [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) + 1. ```solc Collection.tsol --include-path node_modules``` 1. compile ```Nft.code``` file to use [TVM linker](https://github.com/tonlabs/TVM-linker/releases/tag/0.14.2) 1. ```tvm_linker compile --abi-json Nft.abi.json Nft.code --lib stdlib_sol.tvm -o Nft.tvc``` 1. compile ```Collection.code``` file to use [TVM linker](https://github.com/tonlabs/TVM-linker/releases/tag/0.14.2) diff --git a/contracts/TIP4_1/TIP4_1Collection.sol b/contracts/TIP4_1/TIP4_1Collection.sol deleted file mode 100644 index aa43d38..0000000 --- a/contracts/TIP4_1/TIP4_1Collection.sol +++ /dev/null @@ -1,110 +0,0 @@ -/// We recommend using the compiler version 0.58.1. -/// You can use other versions, but we do not guarantee compatibility of the compiler version. -pragma ton-solidity >= 0.58.1; - - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import '../TIP6/TIP6.sol'; -import './interfaces/ITIP4_1Collection.sol'; -import './TIP4_1Nft.sol'; - - -/// @title One of the required contracts of an TIP4-1(Non-Fungible Token Standard) compliant technology. -/// You can read more about the technology here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/1.md) -/// For detect what interfaces a smart contract implements used TIP-6.1 standard. ... -/// ... Read more here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-6/1.md) -contract TIP4_1Collection is ITIP4_1Collection, TIP6 { - - /// Code of the TIP4_1Nft conract or of the custom Nft contract based on the TIP4_1Nft - TvmCell _codeNft; - - /// Number of minted tokens - uint128 _totalSupply; - - constructor(TvmCell codeNft) public { - tvm.accept(); - - _codeNft = codeNft; - - _supportedInterfaces[ bytes4(tvm.functionId(ITIP6.supportsInterface)) ] = true; - _supportedInterfaces[ - bytes4(tvm.functionId(ITIP4_1Collection.totalSupply)) ^ - bytes4(tvm.functionId(ITIP4_1Collection.nftCode)) ^ - bytes4(tvm.functionId(ITIP4_1Collection.nftCodeHash)) ^ - bytes4(tvm.functionId(ITIP4_1Collection.nftAddress)) - ] = true; - } - - /// @notice Count active NFTs for this collection - /// @return count A count of active NFTs minted by this contract except for burned NFTs - function totalSupply() external view virtual override responsible returns (uint128 count) { - return {value: 0, flag: 64, bounce: false} (_totalSupply); - } - - /// @notice Returns the NFT code - /// @return code Returns the NFT code as TvmCell - function nftCode() external view virtual override responsible returns (TvmCell code) { - return {value: 0, flag: 64, bounce: false} (_buildNftCode(address(this))); - } - - /// @notice Returns the NFT code hash - /// @return codeHash Returns the NFT code hash - function nftCodeHash() external view virtual override responsible returns (uint256 codeHash) { - return {value: 0, flag: 64, bounce: false} (tvm.hash(_buildNftCode(address(this)))); - } - - /// @notice Computes NFT address by unique NFT id - /// @dev Return unique address for all Ids. You find nothing by address for not a valid NFT. - /// @param id Unique NFT id - /// @return nft Returns address of NFT contract - function nftAddress(uint256 id) external view virtual override responsible returns (address nft) { - return {value: 0, flag: 64, bounce: false} (_resolveNft(id)); - } - - /// @notice Resolve nft address used addrRoot & nft id - /// @param id Unique nft number - function _resolveNft( - uint256 id - ) internal virtual view returns (address nft) { - TvmCell code = _buildNftCode(address(this)); - TvmCell state = _buildNftState(code, id); - uint256 hashState = tvm.hash(state); - nft = address.makeAddrStd(address(this).wid, hashState); - } - - /// @notice build nft code used TvmCell nft code & salt (address collection) ... - /// ... to create unique nft address BC nft code & id can be repeated - /// @param collection - collection address - /// @return TvmCell nftCode - /// about salt read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmcodesalt) - function _buildNftCode(address collection) internal virtual view returns (TvmCell) { - TvmBuilder salt; - salt.store(collection); - return tvm.setCodeSalt(_codeNft, salt.toCell()); - } - - /// @notice Generates a StateInit from code and data - /// @param code TvmCell code - generated via the _buildNftCode method - /// @param id Unique nft number - /// @return TvmCell object - stateInit - /// about tvm.buildStateInit read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuildstateinit) - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: TIP4_1Nft, - varInit: {_id: id}, - code: code - }); - } - - function _isOwner() internal virtual returns(bool) { - return true; - } - -} \ No newline at end of file diff --git a/contracts/TIP4_1/TIP4_1Nft.sol b/contracts/TIP4_1/TIP4_1Nft.sol deleted file mode 100644 index 1f3763e..0000000 --- a/contracts/TIP4_1/TIP4_1Nft.sol +++ /dev/null @@ -1,332 +0,0 @@ -/// We recommend using the compiler version 0.58.1. -/// You can use other versions, but we do not guarantee compatibility of the compiler version. -pragma ton-solidity >= 0.58.1; - - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import './interfaces/ITIP4_1NFT.sol'; -import './interfaces/INftChangeOwner.sol'; -import './interfaces/INftChangeManager.sol'; -import './interfaces/INftTransfer.sol'; - -import '../TIP6/TIP6.sol'; - - -/// @title One of the required contracts of an TIP4-1(Non-Fungible Token Standard) compliant technology. -/// You can read more about the technology here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/1.md) -/// For detect what interfaces a smart contract implements used TIP-6.1 standard. ... -/// ... Read more here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-6/1.md) -contract TIP4_1Nft is ITIP4_1NFT, TIP6 { - - /** - * Errors - **/ - uint8 constant value_is_empty = 101; - uint8 constant sender_is_not_collection = 102; - uint8 constant sender_is_not_manager = 103; - uint8 constant value_is_less_than_required = 104; - - /// Unique NFT id - uint256 static _id; - - /// Address of NftCollection contract - address _collection; - - /// Owner address - address _owner; - - /// Manager address. Used in onlyManager modifier. - address _manager; - - /** - @notice Initializes the contract by setting a `owner` to the NFT. - Collection address get from the contract code that is "building" into Collection._buildNftCode, Collection._buildNftState - _supportedInterfaces mapping used in TIP-6 standart - Emit TokenMinted event - */ - constructor( - address owner, - address sendGasTo, - uint128 remainOnNft - ) public { - optional(TvmCell) optSalt = tvm.codeSalt(tvm.code()); - require(optSalt.hasValue(), value_is_empty); - (address collection) = optSalt.get().toSlice().decode(address); - require(msg.sender == collection, sender_is_not_collection); - require(remainOnNft != 0, value_is_empty); - require(msg.value > remainOnNft, value_is_less_than_required); - tvm.rawReserve(remainOnNft, 0); - - _collection = collection; - _owner = owner; - _manager = owner; - - _supportedInterfaces[ bytes4(tvm.functionId(ITIP6.supportsInterface)) ] = true; - _supportedInterfaces[ - bytes4(tvm.functionId(ITIP4_1NFT.getInfo)) ^ - bytes4(tvm.functionId(ITIP4_1NFT.changeOwner)) ^ - bytes4(tvm.functionId(ITIP4_1NFT.changeManager)) ^ - bytes4(tvm.functionId(ITIP4_1NFT.transfer)) - ] = true; - - emit NftCreated(_id, _owner, _manager, _collection); - - sendGasTo.transfer({value: 0, flag: 128 + 2}); - } - - /// @notice Transfers ownership to another account (set new owner & manager) - /// @param to - the future owner of the token - /// @param sendGasTo - the address to which the remaining gas will be sent - /// @param callbacks - key (destination address for callback) => .. - /// .. value (CallbackParams structure ( CallbackParams { uint128 value; TvmCell payload; } )) - /// Can only be called from the manager's address - /// Requirements: - /// - /// - `to` can't be the zero address. - /// - `sendGasTo` can't be the zero address. - /// - `callbacks` can be the zero mapping. - /// - Callbacks(key) address must implement {INftTransfer-onNftTransfer}. - /// - /// Emits a {OwnerChanged} event if to != oldOwner && Emits a {ManagerChanged} event if to != oldManager. - function transfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) public virtual override onlyManager { - tvm.rawReserve(0, 4); - - _beforeTransfer(to, sendGasTo, callbacks); - - address oldOwner = _owner; - _changeOwner(to); - _changeManager(to); - - _afterTransfer(to, sendGasTo, callbacks); - - for ((address dest, CallbackParams p) : callbacks) { - INftTransfer(dest).onNftTransfer{ - value: p.value, - flag: 0 + 1, - bounce: false - }(_id, oldOwner, to, _manager, to, _collection, sendGasTo, p.payload); - } - - if (sendGasTo.value != 0) { - sendGasTo.transfer({ - value: 0, - flag: 128 + 2, - bounce: false - }); - } - - } - - /// @notice Change Nft owner - /// @param newOwner - the future owner of the token - /// @param sendGasTo - the address to which the remaining gas will be sent - /// @param callbacks - key (destination address for callback) => .. - /// .. value (CallbackParams structure ( CallbackParams { uint128 value; TvmCell payload; } )) - /// Can only be called from the manager's address - /// Requirements: - /// - /// - `newOwner` can't be the zero address. - /// - `sendGasTo` can't be the zero address. - /// - `callbacks` can be the zero mapping. - /// - Callbacks(key) address must implement {INftChangeOwner-onNftChangeOwner}. - /// - /// Emits a {OwnerChanged} event if newOwner != oldOwner - function changeOwner( - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) public virtual override onlyManager { - tvm.rawReserve(0, 4); - - _beforeChangeOwner(_owner, newOwner, sendGasTo, callbacks); - - address oldOwner = _owner; - _changeOwner(newOwner); - - _afterChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); - - for ((address dest, CallbackParams p) : callbacks) { - INftChangeOwner(dest).onNftChangeOwner{ - value: p.value, - flag: 0 + 1, - bounce: false - }(_id, _manager, oldOwner, newOwner, _collection, sendGasTo, p.payload); - } - - if (sendGasTo.value != 0) { - sendGasTo.transfer({ - value: 0, - flag: 128 + 2, - bounce: false - }); - } - - } - - function _changeOwner( - address newOwner - ) internal { - address oldOwner = _owner; - _owner = newOwner; - if (oldOwner != newOwner) { - emit OwnerChanged(oldOwner, newOwner); - } - } - - - /// @notice Set a new manager - /// @param newManager - future manager of the token - /// @param sendGasTo - the address to which the remaining gas will be sent - /// @param callbacks - key (destination address for callback) => .. - /// .. value (CallbackParams structure ( CallbackParams { uint128 value; TvmCell payload; } )) - /// Can only be called from the manager's address - /// Requirements: - /// - /// - `newManager` cannot be the zero address. - /// - `sendGasTo` can be the zero address. - /// - `callbacks` can be the zero mapping. - /// - Callbacks(key) address must implement {INftChangeManager-onNftChangeManager}. - /// - /// Emits a {ManagerChanged} event if newManager != oldManager. - function changeManager( - address newManager, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) external virtual override onlyManager { - tvm.rawReserve(0, 4); - - _beforeChangeManager(_manager, newManager, sendGasTo, callbacks); - - address oldManager = _manager; - _changeManager(newManager); - - _afterChangeManager(oldManager, newManager, sendGasTo, callbacks); - - for ((address dest, CallbackParams p) : callbacks) { - INftChangeManager(dest).onNftChangeManager{ - value: p.value, - flag: 0 + 1, - bounce: true - }(_id, _owner, oldManager, newManager, _collection, sendGasTo, p.payload); - } - - if (sendGasTo.value != 0) { - sendGasTo.transfer({ - value: 0, - flag: 128 + 2, - bounce: false - }); - } - - } - - function _changeManager( - address newManager - ) internal { - address oldManager = _manager; - _manager = newManager; - if (oldManager != newManager) { - emit ManagerChanged(oldManager, newManager); - } - } - - /// @notice Returns the main parameters of the token. - /// @return id - Unique NFT id - /// @return owner - Nft owner - /// @return manager - Nft manager (Used for contract management) - /// @return collection - Collection address (creator) - /// - /// Both internal message and external message can be called. - /// In case of calling external message, you need to add the answerId = 0 parameter - function getInfo() external view virtual override responsible returns( - uint256 id, - address owner, - address manager, - address collection) - { - return {value: 0, flag: 64, bounce: false} ( - _id, - _owner, - _manager, - _collection - ); - } - - function _beforeTransfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual { - to; sendGasTo; callbacks; //disable warnings - } - - function _afterTransfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual { - to; sendGasTo; callbacks; //disable warnings - } - - function _beforeChangeOwner( - address oldOwner, - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual { - oldOwner; newOwner; sendGasTo; callbacks; //disable warnings - } - - function _afterChangeOwner( - address oldOwner, - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual { - oldOwner; newOwner; sendGasTo; callbacks; //disable warnings - } - - function _beforeChangeManager( - address oldManager, - address newManager, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual { - oldManager; newManager; sendGasTo; callbacks; //disable warnings - } - - function _afterChangeManager( - address oldManager, - address newManager, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual { - oldManager; newManager; sendGasTo; callbacks; //disable warnings - } - - modifier onlyManager virtual { - require(msg.sender == _manager, sender_is_not_manager); - _; - } - - onBounce(TvmSlice body) external { - tvm.rawReserve(0, 4); - - uint32 functionId = body.decode(uint32); - - if (functionId == tvm.functionId(INftChangeManager.onNftChangeManager)) { - if (msg.sender == _manager) { - _manager = _owner; - } - _owner.transfer({value: 0, flag: 128}); - } - } -} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/INftChangeManager.sol b/contracts/TIP4_1/interfaces/INftChangeManager.sol deleted file mode 100644 index df14187..0000000 --- a/contracts/TIP4_1/interfaces/INftChangeManager.sol +++ /dev/null @@ -1,19 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -interface INftChangeManager { - - struct CallbackParams { - uint128 value; // ever value will send to address - TvmCell payload; // custom payload will proxying to address - } - - /// @notice change owner callback processing - /// @param id Unique NFT id - /// @param owner Address of nft owner - /// @param oldManager Address of nft manager before manager changed - /// @param newManager Address of new nft manager - /// @param collection Address of collection smart contract that mint the NFT - /// @param sendGasTo - Address to send remaining gas - // @param payload - Custom payload - function onNftChangeManager(uint256 id, address owner, address oldManager, address newManager, address collection, address sendGasTo, TvmCell payload) external; -} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/INftChangeOwner.sol b/contracts/TIP4_1/interfaces/INftChangeOwner.sol deleted file mode 100644 index be91208..0000000 --- a/contracts/TIP4_1/interfaces/INftChangeOwner.sol +++ /dev/null @@ -1,25 +0,0 @@ -interface INftChangeOwner { - - struct CallbackParams { - uint128 value; // ever value will send to address - TvmCell payload; // custom payload will be proxied to address - } - - /// @notice change owner callback processing - /// @param id Unique NFT id - /// @param manager Address of NFT manager - /// @param oldOwner Address of NFT owner before owner changed - /// @param newOwner Address of new NFT owner - /// @param collection Address of collection smart contract, that mint the NFT - /// @param sendGasTo Address to send remaining gas - /// @param payload Custom payload - function onNftChangeOwner( - uint256 id, - address manager, - address oldOwner, - address newOwner, - address collection, - address sendGasTo, - TvmCell payload - ) external; -} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/INftTransfer.sol b/contracts/TIP4_1/interfaces/INftTransfer.sol deleted file mode 100644 index 2d7a8f5..0000000 --- a/contracts/TIP4_1/interfaces/INftTransfer.sol +++ /dev/null @@ -1,27 +0,0 @@ -interface INftTransfer { - - struct CallbackParams { - uint128 value; // ever value will send to address - TvmCell payload; // custom payload will proxying to address - } - - /// @notice change owner callback processing - /// @param id Unique NFT id - /// @param oldOwner Address of NFT owner before transfer - /// @param newOwner Address of new NFT owner - /// @param oldManager Address of NFT manager before transfer - /// @param newManager Address of new NFT manager - /// @param collection Address of collection smart contract that mint the NFT - /// @param gasReceiver Address to send remaining gas - /// @param payload Custom payload - function onNftTransfer( - uint256 id, - address oldOwner, - address newOwner, - address oldManager, - address newManager, - address collection, - address gasReceiver, - TvmCell payload - ) external; -} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/ITIP4_1Collection.sol b/contracts/TIP4_1/interfaces/ITIP4_1Collection.sol deleted file mode 100644 index 63bfcca..0000000 --- a/contracts/TIP4_1/interfaces/ITIP4_1Collection.sol +++ /dev/null @@ -1,38 +0,0 @@ -pragma ton-solidity >= 0.58.0; - -interface ITIP4_1Collection { - - /// @notice This event emits when NFTs are created - /// @param id Unique NFT id - /// @param nft Address NFT contact - /// @param owner Address of NFT owner - /// @param manager Address of NFT manager - /// @param creator Address of creator that initialize mint NFT - event NftCreated(uint256 id, address nft, address owner, address manager, address creator); - - /// @notice This event emits when NFTs are burned - /// @param id Unique NFT id - /// @param nft Address NFT contact - /// @param owner Address of NFT owner when it burned - /// @param manager Address of NFT manager when it burned - event NftBurned(uint256 id, address nft, address owner, address manager); - - - /// @notice Count active NFTs for this collection - /// @return count A count of active NFTs minted by this contract except for burned NFTs - function totalSupply() external view responsible returns (uint128 count); - - /// @notice Returns the NFT code - /// @return code Returns the NFT code as TvmCell - function nftCode() external view responsible returns (TvmCell code); - - /// @notice Returns the NFT code hash - /// @return codeHash Returns the NFT code hash - function nftCodeHash() external view responsible returns (uint256 codeHash); - - /// @notice Computes NFT address by unique NFT id - /// @dev Return unique address for all Ids. You find nothing by address for not a valid NFT. - /// @param id Unique NFT id - /// @return nft Returns address of NFT contract - function nftAddress(uint256 id) external view responsible returns (address nft); -} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/ITIP4_1NFT.sol b/contracts/TIP4_1/interfaces/ITIP4_1NFT.sol deleted file mode 100644 index 3abcd03..0000000 --- a/contracts/TIP4_1/interfaces/ITIP4_1NFT.sol +++ /dev/null @@ -1,67 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -interface ITIP4_1NFT { - - struct CallbackParams { - uint128 value; // ever value will send to address - TvmCell payload; // custom payload will proxying to address - } - - /// @notice The event emits when NFT created - /// @dev Emit the event when NFT is ready to use - /// @param id Unique NFT id - /// @param owner Address of NFT owner - /// @param manager Address of NFT manager - /// @param collection Address of collection smart contract, that mint the NFT - event NftCreated(uint256 id, address owner, address manager, address collection); - - /// @notice The event emits when NFT owner changed - /// @param oldOwner Address of NFT owner before owner changed - /// @param newOwner Address of new NFT owner - event OwnerChanged(address oldOwner, address newOwner); - - /// @notice The event emits when NFT manager changed - /// @param oldManager Address of NFT manager before manager changed - /// @param newManager Address of new NFT manager - event ManagerChanged(address oldManager, address newManager); - - /// @param id Unique NFT id - /// @param owner Address of NFT owner - /// @param manager Address of NFT manager - /// @param collection Address of collection smart contract, that mint the NFT - event NftBurned(uint256 id, address owner, address manager, address collection); - - /// @notice NFT info - /// @return id Unique NFT id - /// @return owner Address of NFT owner - /// @return manager Address of NFT manager - /// @return collection Address of collection smart contract - function getInfo() external view responsible returns(uint256 id, address owner, address manager, address collection); - - /// @notice Change NFT owner - /// @dev Invoked from manager address only - /// @dev Good practices is сhange manager address to newOwner address too - /// @dev Emit OwnerChanged - /// @dev Emit ManagerChanged events if manager address changed - /// @param newOwner - New owner of NFT - /// @param sendGasTo - Address to send remaining gas - /// @param callbacks - Callbacks array to send by addresses. It can be empty. - function changeOwner(address newOwner, address sendGasTo, mapping(address => CallbackParams) callbacks) external; - - /// @notice Change NFT manager - /// @dev Invoked from manager address only - /// @dev Emit ManagerChanged event - /// @param newManager - New manager of NFT - /// @param sendGasTo - Address to send remaining gas - /// @param callbacks - Callbacks array to send by addresses. It can be empty. - function changeManager(address newManager, address sendGasTo, mapping(address => CallbackParams) callbacks) external; - - /// @notice Change NFT owner and manager - /// @dev Invoked from manager address only - /// @dev Emit OwnerChanged - /// @dev Emit ManagerChanged - /// @param to - New NFT owner and manager - /// @param sendGasTo Address to send remaining gas - /// @param callbacks Callbacks array to send by addresses. It can be empty - function transfer(address to, address sendGasTo, mapping(address => CallbackParams) callbacks) external; -} \ No newline at end of file diff --git a/contracts/TIP4_2/TIP4_2Collection.sol b/contracts/TIP4_2/TIP4_2Collection.sol deleted file mode 100644 index ad7e2ee..0000000 --- a/contracts/TIP4_2/TIP4_2Collection.sol +++ /dev/null @@ -1,52 +0,0 @@ -/// We recommend using the compiler version 0.58.1. -/// You can use other versions, but we do not guarantee compatibility of the compiler version. -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import '../TIP4_1/TIP4_1Collection.sol'; -import './interfaces/ITIP4_2JSON_Metadata.sol'; -import './TIP4_2Nft.sol'; - - -/// This contract implement TIP4_1Collection and ITIP4_2JSON_Metadata (add JSON Metadata) -/// Add change deploy contract in _buildNftState (TIP4_1Nft => TIP4_2Nft) -abstract contract TIP4_2Collection is TIP4_1Collection, ITIP4_2JSON_Metadata { - - /// JSON metadata - /// In order to fill in this field correctly, see https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/2.md - string _json; - - constructor( - string json - ) public { - tvm.accept(); - - _json = json; - - _supportedInterfaces[ - bytes4(tvm.functionId(ITIP4_2JSON_Metadata.getJson)) - ] = true; - } - - /// See interfaces/ITIP4_2JSON_Metadata.sol - function getJson() external virtual view override responsible returns (string json) { - return {value: 0, flag: 64, bounce: false} (_json); - } - - /// Overrides standard method, because Nft contract is changed - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual override pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: TIP4_2Nft, - varInit: {_id: id}, - code: code - }); - } - -} \ No newline at end of file diff --git a/contracts/TIP4_2/TIP4_2Nft.sol b/contracts/TIP4_2/TIP4_2Nft.sol deleted file mode 100644 index 5f6cdc9..0000000 --- a/contracts/TIP4_2/TIP4_2Nft.sol +++ /dev/null @@ -1,37 +0,0 @@ -/// We recommend using the compiler version 0.58.1. -/// You can use other versions, but we do not guarantee compatibility of the compiler version. -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import '../TIP4_1/TIP4_1Nft.sol'; -import './interfaces/ITIP4_2JSON_Metadata.sol'; - - -/// This contract implement TIP4_1Nft and ITIP4_2JSON_Metadata (add JSON Metadata) -/// ... Read more here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-6/1.md) -abstract contract TIP4_2Nft is TIP4_1Nft, ITIP4_2JSON_Metadata { - - /// JSON metadata - /// In order to fill in this field correctly, see https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/2.md - string _json; - - constructor( - string json - ) public { - _json = json; - - _supportedInterfaces[ - bytes4(tvm.functionId(ITIP4_2JSON_Metadata.getJson)) - ] = true; - } - - /// See interfaces/ITIP4_2JSON_Metadata.sol - function getJson() external virtual view override responsible returns (string json) { - return {value: 0, flag: 64, bounce: false} (_json); - } - -} \ No newline at end of file diff --git a/contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.sol b/contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.sol deleted file mode 100644 index 5965ceb..0000000 --- a/contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -interface ITIP4_2JSON_Metadata { - - /// @notice metadata in JSON format - /// @return json The JSON string with metadata - function getJson() external view responsible returns (string json); - -} \ No newline at end of file diff --git a/contracts/TIP4_3/Index.sol b/contracts/TIP4_3/Index.sol deleted file mode 100644 index 5d993f1..0000000 --- a/contracts/TIP4_3/Index.sol +++ /dev/null @@ -1,64 +0,0 @@ -pragma ton-solidity >= 0.58.0; - - -import 'interfaces/IIndex.sol'; - - -/** - * Errors - * 101 - Method for NFT only - * 102 - Salt doesn't contain any value - **/ - -/// @title This contract helps to find: -/// All user tokens in current collection using owner address and collection address -/// All user tokens in all collections using owner address -contract Index is IIndex { - - /// Nft address - address static _nft; - - /// Collection address, it is filled in either via the constructor parameter, or via salt - address _collection; - - /// Nft owner address - address _owner; - - constructor(address collection) public { - optional(TvmCell) salt = tvm.codeSalt(tvm.code()); - require(salt.hasValue(), 102, "Salt doesn't contain any value"); - (, address collection_, address owner) = salt - .get() - .toSlice() - .decode(string, address, address); - require(msg.sender == _nft); - tvm.accept(); - _collection = collection_; - _owner = owner; - if (collection_.value == 0) { - _collection = collection; - } - } - - /// @return collection (address) - collection token contract address - /// @return owner (address) - token owner contract address - /// @return nft (address) - token contract address - function getInfo() override public view responsible returns ( - address collection, - address owner, - address nft - ) { - return {value: 0, flag: 64, bounce: true} ( - _collection, - _owner, - _nft - ); - } - - /// @notice This method used for destruct token, can be called only by nft - /// @param gasReceiver - address where all crystals from the contract will be sent - function destruct(address gasReceiver) override public { - require(msg.sender == _nft, 101, "Method for NFT only"); - selfdestruct(gasReceiver); - } -} \ No newline at end of file diff --git a/contracts/TIP4_3/IndexBasis.sol b/contracts/TIP4_3/IndexBasis.sol deleted file mode 100644 index d5be877..0000000 --- a/contracts/TIP4_3/IndexBasis.sol +++ /dev/null @@ -1,37 +0,0 @@ -pragma ton-solidity >= 0.58.0; - -import './interfaces/IIndexBasis.sol'; - -/** - * Errors - * 101 - Method for collection only - **/ - - -/// @title This contract helps to find all collections by the code hash of which -/// -contract IndexBasis is IIndexBasis { - - /// Collection token contract address - address static _collection; - - modifier onlyCollection() { - require(msg.sender == _collection, 101, "Method for collection only"); - tvm.accept(); - _; - } - - /// Can only be created using a collection - constructor() public onlyCollection {} - - /// @return collection - collection token contract address - function getInfo() override public view responsible returns (address collection) { - return {value: 0, flag: 64, bounce: true} _collection; - } - - /// @notice This method used for destruct token, can be called only by nft - /// @param gasReceiver - address where all crystals from the contract will be sent - function destruct(address gasReceiver) override public onlyCollection { - selfdestruct(gasReceiver); - } -} \ No newline at end of file diff --git a/contracts/TIP4_3/TIP4_3Collection.sol b/contracts/TIP4_3/TIP4_3Collection.sol deleted file mode 100644 index 7e63a70..0000000 --- a/contracts/TIP4_3/TIP4_3Collection.sol +++ /dev/null @@ -1,137 +0,0 @@ -/// We recommend using the compiler version 0.58.1. -/// You can use other versions, but we do not guarantee compatibility of the compiler version. -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import '../TIP4_1/TIP4_1Collection.sol'; -import './interfaces/ITIP4_3Collection.sol'; -import './TIP4_3Nft.sol'; -import './Index.sol'; -import './IndexBasis.sol'; - - -/// This contract implement TIP4_1Collection, ITIP4_3Collection (add indexes) -abstract contract TIP4_3Collection is TIP4_1Collection, ITIP4_3Collection { - - /** - * Errors - **/ - uint8 constant value_is_empty = 103; - - /// TvmCell object code of Index contract - TvmCell _codeIndex; - - /// TvmCell object code of IndexBasis contract - TvmCell _codeIndexBasis; - - /// Values for deploy/destroy - uint128 _indexDeployValue = 0.15 ton; - uint128 _indexDestroyValue = 0.1 ton; - uint128 _deployIndexBasisValue = 0.15 ton; - - constructor( - TvmCell codeIndex, - TvmCell codeIndexBasis - ) public { - TvmCell empty; - require(codeIndex != empty, value_is_empty); - tvm.accept(); - - _codeIndex = codeIndex; - _codeIndexBasis = codeIndexBasis; - - _supportedInterfaces[ - bytes4(tvm.functionId(ITIP4_3Collection.indexBasisCode)) ^ - bytes4(tvm.functionId(ITIP4_3Collection.indexBasisCodeHash)) ^ - bytes4(tvm.functionId(ITIP4_3Collection.indexCode)) ^ - bytes4(tvm.functionId(ITIP4_3Collection.indexCodeHash)) ^ - bytes4(tvm.functionId(ITIP4_3Collection.resolveIndexBasis)) - ] = true; - - _deployIndexBasis(); - } - - /// _codeIndexBasis can't be empty - /// Balance value must be greater than _indexDeployValue - function _deployIndexBasis() internal virtual { - TvmCell empty; - require(_codeIndexBasis != empty, value_is_empty); - require(address(this).balance > _deployIndexBasisValue); - - TvmCell code = _buildIndexBasisCode(); - TvmCell state = _buildIndexBasisState(code, address(this)); - address indexBasis = new IndexBasis{stateInit: state, value: _deployIndexBasisValue}(); - } - - /// @return code - code of IndexBasis contract - function indexBasisCode() external view override responsible returns (TvmCell code) { - return {value: 0, flag: 64, bounce: false} (_codeIndexBasis); - } - - /// @return hash - calculated hash based on the IndexBasis code - function indexBasisCodeHash() external view override responsible returns (uint256 hash) { - return {value: 0, flag: 64, bounce: false} tvm.hash(_buildIndexBasisCode()); - } - - /// @return indexBasis - address of IndexBasisCode - function resolveIndexBasis() external view override responsible returns (address indexBasis) { - TvmCell code = _buildIndexBasisCode(); - TvmCell state = _buildIndexBasisState(code, address(this)); - uint256 hashState = tvm.hash(state); - indexBasis = address.makeAddrStd(address(this).wid, hashState); - return {value: 0, flag: 64, bounce: false} indexBasis; - } - - /// @notice build IndexBasis code used TvmCell indexBasis code & salt (string stamp) - /// @return TvmCell indexBasisCode - /// about salt read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmcodesalt) - function _buildIndexBasisCode() internal virtual view returns (TvmCell) { - string stamp = "nft"; - TvmBuilder salt; - salt.store(stamp); - return tvm.setCodeSalt(_codeIndexBasis, salt.toCell()); - } - - /// @notice Generates a StateInit from code and data - /// @param code TvmCell code - generated via the _buildIndexBasisCode method - /// @param collection address of token collection contract - /// @return TvmCell object - stateInit - /// about tvm.buildStateInit read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuildstateinit) - function _buildIndexBasisState( - TvmCell code, - address collection - ) internal virtual pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: IndexBasis, - varInit: {_collection: collection}, - code: code - }); - } - - /// @return code - code of Index contract - function indexCode() external view override responsible returns (TvmCell code) { - return {value: 0, flag: 64, bounce: false} (_codeIndex); - } - - /// @return hash - calculated hash based on the Index code - function indexCodeHash() external view override responsible returns (uint256 hash) { - return {value: 0, flag: 64, bounce: false} tvm.hash(_codeIndex); - } - - /// Overrides standard method, because Nft contract is changed - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual override pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: TIP4_3Nft, - varInit: {_id: id}, - code: code - }); - } - -} \ No newline at end of file diff --git a/contracts/TIP4_3/TIP4_3Nft.sol b/contracts/TIP4_3/TIP4_3Nft.sol deleted file mode 100644 index 6e7efd8..0000000 --- a/contracts/TIP4_3/TIP4_3Nft.sol +++ /dev/null @@ -1,132 +0,0 @@ -/// We recommend using the compiler version 0.58.1. -/// You can use other versions, but we do not guarantee compatibility of the compiler version. -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import '../TIP4_1/TIP4_1Nft.sol'; -import './interfaces/ITIP4_3NFT.sol'; -import './Index.sol'; - - -/// This contract implement TIP4_1Collection, ITIP4_3NFT (add indexes) -abstract contract TIP4_3Nft is TIP4_1Nft, ITIP4_3NFT { - - /// Values for deploy/destroy - uint128 _indexDeployValue; - uint128 _indexDestroyValue; - - /// TvmCell object code of Index contract - TvmCell _codeIndex; - - constructor( - uint128 indexDeployValue, - uint128 indexDestroyValue, - TvmCell codeIndex - ) public { - _indexDeployValue = indexDeployValue; - _indexDestroyValue = indexDestroyValue; - _codeIndex = codeIndex; - - _supportedInterfaces[ - bytes4(tvm.functionId(ITIP4_3NFT.indexCode)) ^ - bytes4(tvm.functionId(ITIP4_3NFT.indexCodeHash)) ^ - bytes4(tvm.functionId(ITIP4_3NFT.resolveIndex)) - ] = true; - - _deployIndex(); - } - - function _beforeTransfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override { - _destructIndex(sendGasTo); - } - - function _afterTransfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override { - _deployIndex(); - } - - function _beforeChangeOwner( - address oldOwner, - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override { - _destructIndex(sendGasTo); - } - - function _afterChangeOwner( - address oldOwner, - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override { - _deployIndex(); - } - - function _deployIndex() internal virtual view { - TvmCell codeIndexOwner = _buildIndexCode(address(0), _owner); - TvmCell stateIndexOwner = _buildIndexState(codeIndexOwner, address(this)); - new Index{stateInit: stateIndexOwner, value: _indexDeployValue}(_collection); - - TvmCell codeIndexOwnerRoot = _buildIndexCode(_collection, _owner); - TvmCell stateIndexOwnerRoot = _buildIndexState(codeIndexOwnerRoot, address(this)); - new Index{stateInit: stateIndexOwnerRoot, value: _indexDeployValue}(_collection); - } - - function _destructIndex(address sendGasTo) internal virtual view { - address oldIndexOwner = resolveIndex(address(0), _owner); - IIndex(oldIndexOwner).destruct{value: _indexDestroyValue}(sendGasTo); - address oldIndexOwnerRoot = resolveIndex(_collection, _owner); - IIndex(oldIndexOwnerRoot).destruct{value: _indexDestroyValue}(sendGasTo); - } - - function indexCode() external view override responsible returns (TvmCell code) { - return {value: 0, flag: 64, bounce: false} (_codeIndex); - } - - function indexCodeHash() public view override responsible returns (uint256 hash) { - return {value: 0, flag: 64, bounce: false} tvm.hash(_codeIndex); - } - - function resolveIndex(address collection, address owner) public view override responsible returns (address index) { - TvmCell code = _buildIndexCode(collection, owner); - TvmCell state = _buildIndexState(code, address(this)); - uint256 hashState = tvm.hash(state); - index = address.makeAddrStd(address(this).wid, hashState); - return {value: 0, flag: 64, bounce: false} index; - } - - function _buildIndexCode( - address collection, - address owner - ) internal virtual view returns (TvmCell) { - TvmBuilder salt; - salt.store("nft"); - salt.store(collection); - salt.store(owner); - return tvm.setCodeSalt(_codeIndex, salt.toCell()); - } - - function _buildIndexState( - TvmCell code, - address nft - ) internal virtual pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: Index, - varInit: {_nft: nft}, - code: code - }); - } - -} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/IIndex.sol b/contracts/TIP4_3/interfaces/IIndex.sol deleted file mode 100644 index 7a4acf1..0000000 --- a/contracts/TIP4_3/interfaces/IIndex.sol +++ /dev/null @@ -1,10 +0,0 @@ -pragma ton-solidity >= 0.58.0; - -interface IIndex { - function getInfo() external view responsible returns ( - address collection, - address owner, - address nft - ); - function destruct(address gasReceiver) external; -} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/IIndexBasis.sol b/contracts/TIP4_3/interfaces/IIndexBasis.sol deleted file mode 100644 index b52c30a..0000000 --- a/contracts/TIP4_3/interfaces/IIndexBasis.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma ton-solidity >= 0.58.0; - -interface IIndexBasis { - function getInfo() external view responsible returns (address collection); - function destruct(address gasReceiver) external; -} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/ITIP4_3Collection.sol b/contracts/TIP4_3/interfaces/ITIP4_3Collection.sol deleted file mode 100644 index 5371efc..0000000 --- a/contracts/TIP4_3/interfaces/ITIP4_3Collection.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma ton-solidity >= 0.58.0; - -interface ITIP4_3Collection { - function indexBasisCode() external view responsible returns (TvmCell code); - function indexBasisCodeHash() external view responsible returns (uint256 hash); - function indexCode() external view responsible returns (TvmCell code); - function indexCodeHash() external view responsible returns (uint256 hash); - function resolveIndexBasis() external view responsible returns (address indexBasis); -} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/ITIP4_3NFT.sol b/contracts/TIP4_3/interfaces/ITIP4_3NFT.sol deleted file mode 100644 index ac0be3b..0000000 --- a/contracts/TIP4_3/interfaces/ITIP4_3NFT.sol +++ /dev/null @@ -1,7 +0,0 @@ -pragma ton-solidity >= 0.58.0; - -interface ITIP4_3NFT { - function indexCode() external view responsible returns (TvmCell code); - function indexCodeHash() external view responsible returns (uint256 hash); - function resolveIndex(address collection, address owner) external view responsible returns (address index); -} \ No newline at end of file diff --git a/contracts/TIP6/ITIP6.sol b/contracts/TIP6/ITIP6.sol deleted file mode 100644 index 397271c..0000000 --- a/contracts/TIP6/ITIP6.sol +++ /dev/null @@ -1,10 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -interface ITIP6 { - /// @notice Query if a contract implements an interface - /// @param interfaceID The interface identifier, as specified in TIP6.1 - /// @dev Interface identification is specified in TIP6.1. - /// @return `true` if the contract implements `interfaceID` and - /// `interfaceID` is not 0xffffffff, `false` otherwise - function supportsInterface(bytes4 interfaceID) external view responsible returns (bool); -} \ No newline at end of file diff --git a/contracts/TIP6/TIP6.sol b/contracts/TIP6/TIP6.sol deleted file mode 100644 index 6269d9b..0000000 --- a/contracts/TIP6/TIP6.sol +++ /dev/null @@ -1,17 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - -import './ITIP6.sol'; - -abstract contract TIP6 is ITIP6 { - - mapping(bytes4 => bool) internal _supportedInterfaces; - - function supportsInterface(bytes4 interfaceID) external override view responsible returns (bool) { - return {value: 0, flag: 64, bounce: false} _supportedInterfaces[interfaceID]; - } - -} \ No newline at end of file diff --git a/contracts/access/OwnableExternal.sol b/contracts/access/OwnableExternal.sol deleted file mode 100644 index a1ef827..0000000 --- a/contracts/access/OwnableExternal.sol +++ /dev/null @@ -1,36 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -/// @title This extension is used to add the owner role to the contract. It is used to manage contracts through external messages. -abstract contract OwnableExternal { - - /// Owner pubkey (0x...) - uint256 private _owner; - - event OwnershipTransferred(uint256 oldOwner, uint256 newOwner); - - constructor (uint256 owner) public { - _transferOwnership(owner); - } - - function owner() public view virtual responsible returns (uint256 pubkey) { - return {value: 0, flag: 64, bounce: false}_owner; - } - - function transferOwnership(uint256 newOwner) public virtual onlyOwner { - require(newOwner != 0, 100); - _transferOwnership(newOwner); - } - - function _transferOwnership(uint256 newOwner) internal virtual { - uint256 oldOwner = _owner; - _owner = newOwner; - emit OwnershipTransferred(oldOwner, newOwner); - } - - modifier onlyOwner() virtual { - require(owner() == msg.pubkey(), 100); - tvm.accept(); - _; - } - -} \ No newline at end of file diff --git a/contracts/access/OwnableInternal.sol b/contracts/access/OwnableInternal.sol deleted file mode 100644 index d42c4db..0000000 --- a/contracts/access/OwnableInternal.sol +++ /dev/null @@ -1,37 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -/// @title This extension is used to add the owner role to the contract. It is used to manage contracts through internal messages. -abstract contract OwnableInternal { - - /// Owner address (0:...) - address private _owner; - - event OwnershipTransferred(address oldOwner, address newOwner); - - constructor (address owner) public { - _transferOwnership(owner); - } - - function owner() public view virtual returns (address owner) { - return _owner; - } - - function transferOwnership(address newOwner) public virtual onlyOwner { - require(newOwner.value != 0, 100); - _transferOwnership(newOwner); - } - - function _transferOwnership(address newOwner) internal virtual { - address oldOwner = _owner; - _owner = newOwner; - emit OwnershipTransferred(oldOwner, newOwner); - } - - /// @dev придумать, как хранить ошибки в extensions - modifier onlyOwner() virtual { - require(owner() == msg.sender, 100); - require(msg.value != 0, 101); - _; - } - -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c198fed..1986350 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,13 +9,13 @@ "version": "1.1.4", "license": "MIT", "devDependencies": { - "@types/chai": "^4.3.3", - "@types/mocha": "^9.1.1", - "@types/node": "^18.7.6", - "chai": "^4.3.6", - "everscale-standalone-client": "^2.0.27", - "locklift": "^2.1.10", - "prettier": "^2.7.1", + "@types/chai": "^4.3.4", + "@types/mocha": "^10.0.1", + "@types/node": "^18.15.11", + "chai": "^4.3.7", + "everscale-standalone-client": "^2.1.18", + "locklift": "^2.5.5", + "prettier": "^2.8.7", "ts-mocha": "^10.0.0", "typescript": "^4.7.4" } @@ -26,12 +26,58 @@ "integrity": "sha512-g464HtHHKxk6r6bkZc+lET1PuSgcFxlLHVb7EAqfxTlx6DRcYkjPRIQQhRHB3BQ6zRpfMrYkppL0tBtRED+HNA==", "dev": true }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "dev": true + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", + "dev": true + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, "node_modules/@types/chai": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.3.tgz", - "integrity": "sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", + "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==", "dev": true }, + "node_modules/@types/commander": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", + "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", + "deprecated": "This is a stub types definition for commander (https://github.com/tj/commander.js). commander provides its own type definitions, so you don't need @types/commander installed!", + "dev": true, + "dependencies": { + "commander": "*" + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -40,15 +86,30 @@ "optional": true }, "node_modules/@types/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", "dev": true }, "node_modules/@types/node": { - "version": "18.7.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.13.tgz", - "integrity": "sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==", + "version": "18.16.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.9.tgz", + "integrity": "sha512-IeB32oIV4oGArLrd7znD2rkHQ6EDCM+2Sr76dJnrHwv9OHBTTM6nuDLK9bmikXzPa0ZlWMWtRGo/Uw4mrzQedA==", + "dev": true + }, + "node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, "node_modules/@ungap/promise-all-settled": { @@ -228,14 +289,14 @@ } }, "node_modules/chai": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", + "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", "check-error": "^1.0.2", - "deep-eql": "^3.0.1", + "deep-eql": "^4.1.2", "get-func-name": "^2.0.0", "loupe": "^2.3.1", "pathval": "^1.1.1", @@ -449,12 +510,12 @@ } }, "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", "dev": true, "engines": { - "node": ">= 10" + "node": "^12.20.0 || >=14" } }, "node_modules/concat-map": { @@ -499,15 +560,15 @@ } }, "node_modules/deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, "dependencies": { "type-detect": "^4.0.0" }, "engines": { - "node": ">=0.12" + "node": ">=6" } }, "node_modules/deep-extend": { @@ -528,6 +589,15 @@ "node": ">=0.4.0" } }, + "node_modules/detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -617,26 +687,38 @@ "dev": true }, "node_modules/everscale-inpage-provider": { - "version": "0.3.37", - "resolved": "https://registry.npmjs.org/everscale-inpage-provider/-/everscale-inpage-provider-0.3.37.tgz", - "integrity": "sha512-OKgFwA0e9B11pOKRkN8cFPr7uxu07638ZgfYrE0OrdtxSbNhGq9e30YTuxv/1dgtm6jDPHip3TewwEdD8atd2g==", + "version": "0.3.58", + "resolved": "https://registry.npmjs.org/everscale-inpage-provider/-/everscale-inpage-provider-0.3.58.tgz", + "integrity": "sha512-iCRmahP9rxtZQ2rfF2NSOpu3gmWSa7zoqa4kTCizWwG+lU5q7nnixZdNQUFZ9DbYDjbWebN7W6fMkXGcZrQYWw==", "dev": true }, "node_modules/everscale-standalone-client": { - "version": "2.0.28", - "resolved": "https://registry.npmjs.org/everscale-standalone-client/-/everscale-standalone-client-2.0.28.tgz", - "integrity": "sha512-DNLhBqXMTKdq8bzk382YiUgTi6FnIucAAVcrkCZLDIj4PdRaADlUJn1E188uICFCYiYFMNi2mKwq2yZw2r/NTA==", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/everscale-standalone-client/-/everscale-standalone-client-2.1.18.tgz", + "integrity": "sha512-Uool0hKu0U+DAiXqwon1mqQ6+z52h7D8dLgvDvwbdzZZ3cni8OY9nFTZsxZPFZVEtKj4qK4CsofrRhKMdxPDpQ==", "dev": true, "dependencies": { "@broxus/await-semaphore": "^0.1.5", "bignumber.js": "^9.1.0", "events": "^3.3.0", - "everscale-inpage-provider": "^0.3.37", + "everscale-inpage-provider": "^0.3.55", "fast-safe-stringify": "^2.1.1", - "nekoton-wasm": "^1.0.0", + "nekoton-wasm": "^1.1.2", "node-fetch": "^2.6.7" } }, + "node_modules/expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -676,6 +758,16 @@ "node": ">=8" } }, + "node_modules/find-node-modules": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.1.3.tgz", + "integrity": "sha512-UC2I2+nx1ZuOBclWVNdcnbDR5dlrOdVb7xNjmT/lHE+LsgztWks3dG7boJ37yTS/venXw84B/mAW9uHVoC5QRg==", + "dev": true, + "dependencies": { + "findup-sync": "^4.0.0", + "merge": "^2.1.1" + } + }, "node_modules/find-replace": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", @@ -704,6 +796,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/findup-sync": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", + "dev": true, + "dependencies": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", + "resolve-dir": "^1.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -840,6 +947,36 @@ "node": ">= 6" } }, + "node_modules/global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "dependencies": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", + "dev": true, + "dependencies": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -864,6 +1001,18 @@ "he": "bin/he" } }, + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "dependencies": { + "parse-passwd": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -880,6 +1029,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -952,6 +1107,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/jake": { "version": "10.8.5", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", @@ -970,6 +1140,19 @@ "node": ">=10" } }, + "node_modules/joi": { + "version": "17.9.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.9.2.tgz", + "integrity": "sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -983,9 +1166,9 @@ } }, "node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "optional": true, "dependencies": { @@ -1023,22 +1206,26 @@ } }, "node_modules/locklift": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/locklift/-/locklift-2.1.10.tgz", - "integrity": "sha512-0Hqrhv5MBDZJtRHJD7bF8lgnsBQkAWrVeAxQ9o9pLTZ4eUCAGOCvOqY93dT67pHGUe/08vkVeWv32G7BBj44zQ==", + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/locklift/-/locklift-2.5.5.tgz", + "integrity": "sha512-8UQkCn3JdYnRK9fVkb89gjBBlp8KZj4MJrWwTEkk/rYJF5K/6RurVaAEyRg4mY7PN3Dzu/JOXZ+MbtcekfMN3A==", "dev": true, "dependencies": { + "@types/commander": "^2.12.2", + "@types/yargs": "^17.0.13", "axios": "^0.27.2", "bignumber.js": "^9.0.1", "chalk": "^4.1.2", - "commander": "^7.2.0", + "commander": "^9.4.1", "directory-tree": "^3.2.2", "ejs": "^3.1.6", "env-paths": "^2.2.1", "everscale-crypto": "^0.1.1", - "everscale-inpage-provider": "^0.3.34", - "everscale-standalone-client": "^2.0.27", + "everscale-inpage-provider": "^0.3.58", + "everscale-standalone-client": "^2.1.18", + "find-node-modules": "^2.1.3", "fs-extra": "^10.1.0", + "joi": "^17.8.3", "lodash": "^4.17.21", "mocha": "^10.0.0", "node-gzip": "^1.1.2", @@ -1048,15 +1235,58 @@ "ts-mocha": "^10.0.0", "tsconfig-paths": "^4.0.0", "typescript": "^4.7.4", - "underscore": "^1.13.1" + "typescript-tuple": "^5.0.1", + "underscore": "^1.13.1", + "yargs": "^17.6.0" }, "bin": { - "locklift": "build/cli/index.js" + "locklift": "internal/cli/cli.js" }, "engines": { "node": ">=14.0.0" } }, + "node_modules/locklift/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/locklift/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/locklift/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1106,6 +1336,25 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "node_modules/merge": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-2.1.1.tgz", + "integrity": "sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w==", + "dev": true + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -1266,9 +1515,9 @@ } }, "node_modules/nekoton-wasm": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/nekoton-wasm/-/nekoton-wasm-1.0.0.tgz", - "integrity": "sha512-Slpt/DzE6bNl8zTCaWHsyujFGaVUf8quiZkgcxw5wfbTOGzG9hY3MU34k0H1HjolLZW2J9ftMxh/7BynjzOfHA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/nekoton-wasm/-/nekoton-wasm-1.1.5.tgz", + "integrity": "sha512-3gnWPKEyBfICAc84WNj4FbQEmga8N4oGcto/vf522trs+16wR6Fh4c+0ZSW/lIPKogciCowYzPjVzATz2eZDNA==", "dev": true }, "node_modules/no-case": { @@ -1354,6 +1603,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1394,9 +1652,9 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -1447,6 +1705,19 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", + "dev": true, + "dependencies": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/rxjs": { "version": "7.5.6", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz", @@ -1736,9 +2007,9 @@ } }, "node_modules/tsconfig-paths/node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "bin": { "json5": "lib/cli.js" @@ -1775,6 +2046,30 @@ "node": ">=4.2.0" } }, + "node_modules/typescript-compare": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz", + "integrity": "sha512-8ja4j7pMHkfLJQO2/8tut7ub+J3Lw2S3061eJLFQcvs3tsmJKp8KG5NtpLn7KcY2w08edF74BSVN7qJS0U6oHA==", + "dev": true, + "dependencies": { + "typescript-logic": "^0.0.0" + } + }, + "node_modules/typescript-logic": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/typescript-logic/-/typescript-logic-0.0.0.tgz", + "integrity": "sha512-zXFars5LUkI3zP492ls0VskH3TtdeHCqu0i7/duGt60i5IGPIpAHE/DWo5FqJ6EjQ15YKXrt+AETjv60Dat34Q==", + "dev": true + }, + "node_modules/typescript-tuple": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/typescript-tuple/-/typescript-tuple-5.0.1.tgz", + "integrity": "sha512-QdAYG/L0vUwtJUVGHmp+Jt8/2l+gOMFwCwLpIhUHNDUxyLWOxuDR/2HWNUNGJtZJuoDvOF3yXMSeK9h90H0OiA==", + "dev": true, + "dependencies": { + "typescript-compare": "^0.0.2" + } + }, "node_modules/typical": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", @@ -1830,6 +2125,18 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/wordwrapjs": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", diff --git a/package.json b/package.json index e9101fc..d1a1bfa 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "/contracts/**" ], "scripts": { - "test": "cd test && npx locklift test --network rfld" + "test": "cd test && npx locklift test -n local" }, "repository": { "type": "git", @@ -28,13 +28,13 @@ "ITgold" ], "devDependencies": { - "@types/chai": "^4.3.3", - "@types/mocha": "^9.1.1", - "@types/node": "^18.7.6", - "chai": "^4.3.6", - "everscale-standalone-client": "^2.0.27", - "locklift": "^2.1.10", - "prettier": "^2.7.1", + "@types/chai": "^4.3.4", + "@types/mocha": "^10.0.1", + "@types/node": "^18.15.11", + "chai": "^4.3.7", + "everscale-standalone-client": "^2.1.18", + "locklift": "^2.5.5", + "prettier": "^2.8.7", "ts-mocha": "^10.0.0", "typescript": "^4.7.4" } diff --git a/test/build/OwnableExternalContract.base64 b/test/build/OwnableExternalContract.base64 index 113e9ad..42090d6 100644 --- a/test/build/OwnableExternalContract.base64 +++ b/test/build/OwnableExternalContract.base64 @@ -1 +1 @@ -te6ccgECFQEAAqoAAgE0AwEBAcACAEPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBCSK7VMg4wMgwP/jAiDA/uMC8gsSBQQUArztRNDXScMB+GYh2zzTAAGOHIMI1xgg+QEB0wABlNP/AwGTAvhC4iD4ZfkQ8qiV0wAB8nri0z8B+EMhufK0IPgjgQPoqIIIG3dAoLnytPhj0x8B+CO88rnTHwHbPPI8DwYDeu1E0NdJwwH4ZiLQ0wP6QDD4aak4APhEf29xggiYloBvcm1vc3BvdPhk3CHHAOMCIdcNH/K8IeMDAds88jwREQYDPCCCEDyR4cW64wIgghBYWpBkuuMCIIIQd/wgvLrjAgwJBwPeMPhG8uBM+EJu4wDTH/hEWG91+GTR2zwhjhoj0NMB+kAwMcjPhyDOghD3/CC8zwuBy//JcI4y+EQgbxMhbxL4SVUCbxHIz4SAygDPhEDOAfoC9ABxzwtpAcj4RG8Vzwsfy//NyfhEbxTi+wDjAPIAEAsIACjtRNDT/9M/MfhDWMjL/8s/zsntVAM2MPhG8uBM+EJu4wAhk9TR0N7T/9HbPDDbPPIAEAoNAizbPPhFIG6SMHDeuvLgZPgAIPLgZNs8Cw4AIPhEcG9ygEBvdHBvcfhk+EoDNjD4Qm7jAPhG8nMhk9TR0N7T/9HbPPgA2zzyAA8ODQAs+Ev4SvhD+ELIy//LP8+Dy//LD8ntVABG+Eoh+GqNBHAAAAAAAAAAAAAAAAAU2zT8oMjOy//L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CCvSkIPShFBMAFHNvbCAwLjYyLjAAAA== \ No newline at end of file diff --git a/test/build/OwnableExternalContract.tvc b/test/build/OwnableExternalContract.tvc index 60295ded76d45fc01698e79bc5408e56cd56a35d..1f3132c89bf24ee0dfe4ada04c0dfa0e983e34c0 100644 GIT binary patch delta 13 UcmdnSx{Y?03WdfZvX%Q delta 13 UcmdnSx{Y&wzme03K5VZvX%Q delta 13 UcmZqSYvJ4QpN-W}&xnBm03K8WZ~y=R diff --git a/test/build/TIP4_1NftCon.base64 b/test/build/TIP4_1NftCon.base64 index d590107..5c043e9 100644 --- a/test/build/TIP4_1NftCon.base64 +++ b/test/build/TIP4_1NftCon.base64 @@ -1 +1 @@ -te6ccgECLwEAB9UAAgE0AwEBAcACAEPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBCSK7VMg4wMgwP/jAiDA/uMC8gssBQQuA7ztRNDXScMB+GaJ+Gkh2zzTAAGOGYMI1xgg+QEB0wABlNP/AwGTAvhC4vkQ8qiV0wAB8nri0z8B+EMhufK0IPgjgQPoqIIIG3dAoLnytPhj0x8B+CO88rnTHwHbPPI8ExEGBHztRNDXScMB+GYi0NMD+kAw+GmpOAD4RH9vcYIImJaAb3Jtb3Nwb3T4ZOMCIccA4wIh1w0f8rwh4wMB2zzyPCkoKAYCKCCCEDIE7Cm74wIgghBxfwtsu+MCFAcCKCCCEEVPE+y64wIgghBxfwtsuuMCDAgDRDD4RvLgTPhCbuMAIZPU0dDe+kDU0dD6QPQE0ds8MNs88gArCSoEUvhJ+E7HBfLgZ3B0+wL4TV8z2zz4TSPbPFRwMiTbPAEggQEL9IKTbV8gJxsnCgJO4w2TIm6zjoDoXwUg+kJvE9cL/44QIMjPhQjOgG/PQMmBAIL7AN5bJQsBsCBvESb4TFOX+E74S1UGbxBVB3DIz4WAygDPhEDOAfoCcc8LalVgyM+Rglf95sv/zlVAyM5VMMjOVSDIzlnIzszNzc3Nzclx+wBTAYEBC/R0k21fIOMN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/SCk21fICcmJyMCTuMNkyJus46A6F8FIPpCbxPXC/+OECDIz4UIzoBvz0DJgQCC+wDeWyUkAbAgbxEm+ExTl/hN+EtVBm8QVQd/yM+FgMoAz4RAzgH6AnHPC2pVYMjPkI9reZ7L/85VQMjOVTDIzlUgyM5ZyM7Mzc3Nzc3JcfsAUwGBAQv0dJNtXyDjDWwTJQAQIFjTf9TRbwIAYvhOIfhuUwHHBY4kXIvcAAAAAAAAAAAAAAAAGMjOWcjPkObL8CbOAcjOzc3JcPsA31sABF8EAAr4RvLgTAJ6IdYfMfhG8uBM+EJu4wBwdPsC1wsfghAj2t5nuo4c+En4TscFlPhN+G7e+E3Iz4WIzoBvz0DJgwb7AN7bPCsqAFL4TvhN+Ez4S/hK+EP4QsjL/8s/z4P0AMv/VSDIzlnIzgHIzs3NzcntVABY7UTQ0//TP9MAMfQE0//U0dD6QNTR0PpA1NHQ+kDR+G74bfhs+Gv4avhj+GICCvSkIPShLi0AFHNvbCAwLjYyLjAAAA== \ No newline at end of file diff --git a/test/build/TIP4_1NftCon.tvc b/test/build/TIP4_1NftCon.tvc index df239a777fe3fadd9406e5b367d43c2275a9b65d..2aabf5613fc45fdf9215209d53e633b68497046b 100644 GIT binary patch delta 50 zcmaFJ|B!z}J|k10z~(|mL1ykifksB|FHMtk;}s@1Fsg6f!ZIH$8Oqkq$ZDi#z`y_i DmZc6~ delta 50 zcmaFJ|B!z}J|h#O!sbFoL1u17g+@m1FHMtk;}s@1Fsg6f!ZIH$8Oqkq$ZDu(#J~Um DfHn=F diff --git a/test/build/TIP4_2CollectionCon.base64 b/test/build/TIP4_2CollectionCon.base64 index 9abe511..bcb74da 100644 --- a/test/build/TIP4_2CollectionCon.base64 +++ b/test/build/TIP4_2CollectionCon.base64 @@ -1 +1 @@ -te6ccgECLAEAB4QAAgE0AwEBAcACAEPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBCSK7VMg4wMgwP/jAiDA/uMC8gspBQQrArb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hrghAyBOwp+ErIz4NZgCD0QyD4aoIQYR8AZIIQD6+LhLKCEC7exjuyghBSeedwsgHIz4NZgCD0Q/hq+AD4bYIQJNfV9fhKyM+DWYAg9EP4avgA2zzyABoZADj4TfhM+Ev4SvhD+ELIy//LP8+D9ADMy3/Mye1UAhbtRNDXScIBjoDjDRsnAkBw7UTQ9AVtiHCI+G34bPhr+GqAQPQO8r3XC//4YnD4YysrA9Qw+Eby4Ez4Qm7jANMf+ERYb3X4ZNHbPCGOGSPQ0wH6QDAxyM+HIM6CEJbt+1nPC4HMyXCOLvhEIG8TIW8S+ElVAm8RyM+EgMoAz4RAzgH6AvQAgGrPQPhEbxXPCx/MyfhEbxTi+wDjAPIAJx0fACD4RHBvcoBAb3Rwb3H4ZPhLA9Qw+Eby4Ez4Qm7jANMf+ERYb3X4ZNHbPCGOGSPQ0wH6QDAxyM+HIM6CEI+vi4TPC4HMyXCOLvhEIG8TIW8S+ElVAm8RyM+EgMoAz4RAzgH6AvQAgGrPQPhEbxXPCx/MyfhEbxTi+wDjAPIAJyAfACjtRNDT/9M/MfhDWMjL/8s/zsntVAEk+ERwb3KAQG90cG9x+GT4KNs8IQESyM74S9AByds8IgIWIYs4rbNYxwWKiuIkIwEIAds8ySUBJgHU1DAS0Ns8yM+OK2zWEszPEcklAWbViy9KQNcm9ATTCTEg10qR1I6A4osvShjXJjAByM+L0pD0AIAgzwsJz4vShswSzMjPEc4mAQSIASsAOu1E0NP/0z/TADH0BNTTf9TR+G34bPhr+Gr4Y/hiAAr4RvLgTAIK9KQg9KErKgAUc29sIDAuNjIuMAAA \ No newline at end of file diff --git a/test/build/TIP4_2CollectionCon.tvc b/test/build/TIP4_2CollectionCon.tvc index e68d186f6126be5fdfc603cc3603a9f71fe4b38e..e10c6a1f67a0c9f33d92390f7df9124d82e499b7 100644 GIT binary patch delta 44 zcmbQh-_Osz_1&BzMkXCb2KMHS+~F*Y2PP-8sIi?m-`a6rc=H67-%PAVdIk&(07hpH A5dZ)H delta 45 zcmeC@pTN((_1&BzMkXCb2KJVX+~F*YhbAYpsIi~CaN>Mx$GOe@EWepp4fTu|7yxDd B51Ie~ diff --git a/test/build/TIP4_2NftCon.base64 b/test/build/TIP4_2NftCon.base64 index 8ac4047..a71ad11 100644 --- a/test/build/TIP4_2NftCon.base64 +++ b/test/build/TIP4_2NftCon.base64 @@ -1 +1 @@ -te6ccgECMQEACIMAAgE0AwEBAcACAEPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBCSK7VMg4wMgwP/jAiDA/uMC8gsuBQQwA7ztRNDXScMB+GaJ+Gkh2zzTAAGOGYMI1xgg+QEB0wABlNP/AwGTAvhC4vkQ8qiV0wAB8nri0z8B+EMhufK0IPgjgQPoqIIIG3dAoLnytPhj0x8B+CO88rnTHwHbPPI8ExEGBHztRNDXScMB+GYi0NMD+kAw+GmpOAD4RH9vcYIImJaAb3Jtb3Nwb3T4ZOMCIccA4wIh1w0f8rwh4wMB2zzyPCsqKgYCKCCCECTX1fW74wIgghBxfwtsu+MCFgcDPCCCEDIE7Cm64wIgghBWak0ruuMCIIIQcX8LbLrjAhQMCANEMPhG8uBM+EJu4wAhk9TR0N76QNTR0PpA9ATR2zww2zzyAC0JLARS+En4TscF8uBncHT7AvhNXzPbPPhNI9s8VHAyJNs8ASCBAQv0gpNtXyApHSkKAk7jDZMibrOOgOhfBSD6Qm8T1wv/jhAgyM+FCM6Ab89AyYEAgvsA3lsnCwGwIG8RJvhMU5f4TvhLVQZvEFUHcMjPhYDKAM+EQM4B+gJxzwtqVWDIz5GCV/3my//OVUDIzlUwyM5VIMjOWcjOzM3Nzc3NyXH7AFMBgQEL9HSTbV8g4w1sEycD/jD4Qm7jAPhG8nMhk9TR0N76QNTR0PpA03/U0VUg+CrbPCBu8tBlIG7yf9D6QDD4SSHHBfLgZiHy4GVopv5gIrzy4GgBcPsC+Gwh+G0B+G6CEDIE7Cn4SsjPg1mAIPRDIPhqghARv1dqghBxfwtssoIQC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b9XarL/85ZyM4ByM7Nzc3JcC0iIAGKjjz4RCBvEyFvEvhJVQJvEcjPhIDKAM+EQM4B+gL0AHHPC2leMMj4RG8Vzwsfy//OWcjOAcjOzc3NyfhEbxTi+wDjAPIAIQAo7UTQ0//TPzH4Q1jIy//LP87J7VQALPhEcG9ygEBvdHBvcfhk+Ev4TfhO+EwDRDD4RvLgTPhCbuMAIZPU0dDe+kDU0dD6QPQE0ds8MNs88gAtJCwEUvhJ+E7HBfLgZ3B0+wL4Tl8z2zz4TiPbPFRwMiTbPFEQgQEL9IKTbV8gKSgpJQJO4w2TIm6zjoDoXwUg+kJvE9cL/44QIMjPhQjOgG/PQMmBAIL7AN5bJyYBsCBvESb4TFOX+E34S1UGbxBVB3/Iz4WAygDPhEDOAfoCcc8LalVgyM+Qj2t5nsv/zlVAyM5VMMjOVSDIzlnIzszNzc3Nzclx+wBTAYEBC/R0k21fIOMNbBMnABAgWNN/1NFvAgBi+E4h+G5TAccFjiRci9wAAAAAAAAAAAAAAAAYyM5ZyM+Q5svwJs4ByM7Nzclw+wDfWwAEXwQACvhG8uBMAnoh1h8x+Eby4Ez4Qm7jAHB0+wLXCx+CECPa3me6jhz4SfhOxwWU+E34bt74TcjPhYjOgG/PQMmDBvsA3ts8LSwAWvhP+E74TfhM+Ev4SvhD+ELIy//LP8+D9ADL/1UwyM5VIMjOWcjOzM3NzcntVABe7UTQ0//TP9MAMfQE0//U0dD6QNTR0PpA1NHQ+kDU0fhv+G74bfhs+Gv4avhj+GICCvSkIPShMC8AFHNvbCAwLjYyLjAAAA== \ No newline at end of file diff --git a/test/build/TIP4_2NftCon.tvc b/test/build/TIP4_2NftCon.tvc index fe3b9d9c8a5e5eab830d248dd6fb586392e70534..b92b82831d5f644f24f9a02de803b04047266def 100644 GIT binary patch delta 37 ncmeAd>=)cn#mE#Wu(^hDEi;JLW<3w)|6%K6WHr(=U|;|M(TxfL delta 37 ncmeAd>=)cn#mK~{u(^hDEi;JLW<3w)|6%K6WHrg R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Rzb2wgMC42MS4yAAA= \ No newline at end of file +te6ccgECEQEAAiEAAgE0AwEBAcACAEPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBCSK7VMg4wMgwP/jAiDA/uMC8gsOBQQQArbtRNDXScMB+GYh2zzTAAGOGYMI1xgg+QEB0wABlNP/AwGTAvhC4vkQ8qiV0wAB8nri0z8B+EMhufK0IPgjgQPoqIIIG3dAoLnytPhj0x8B+CO88rnTHwHbPPI8CAYDeu1E0NdJwwH4ZiLQ0wP6QDD4aak4APhEf29xggiYloBvcm1vc3BvdPhk3CHHAOMCIdcNH/K8IeMDAds88jwNDQYCKCCCEDIE7Cm64wIgghBotV8/uuMCCQcCRjD4Qm7jAPhG8nPR+ACCEDIE7Cn4SsjPg1mAIPRD+GrbPPIACAoBRO1E0NdJwgGOF3DtRND0BW34aoBA9A7yvdcL//hicPhj4w0MA9ww+Eby4Ez4Qm7jANMf+ERYb3X4ZNMf0ds8IY4aI9DTAfpAMDHIz4cgzoIQsgTsKc8LgcoAyXCOL/hEIG8TIW8S+ElVAm8RyM+EgMoAz4RAzgH6AvQAgGrPQPhEbxXPCx/KAMn4RG8U4vsA4wDyAAwLCgAk+Er4Q/hCyMv/yz/Pg/QAye1UADb4RHBvcoBAb3Rwb3H4ZPhKgCD0Dm+Rk9cKAN4AJu1E0NP/0z/TADH0BNH4avhj+GIACvhG8uBMAgr0pCD0oRAPABRzb2wgMC42Mi4wAAA= \ No newline at end of file diff --git a/test/build/TIP6Con.tvc b/test/build/TIP6Con.tvc index 6578a07f0696badfeddb4768a8cccc4e9ee1b5fb..832b13b7d8a1cba1db5b83e1921d9431b33d8188 100644 GIT binary patch delta 13 UcmZ3>vX*6o1{151o&f^`02+G&(f|Me delta 13 UcmZ3>vX*6o1{15Ho)H5B02+J((*OVf diff --git a/test/build/Wallet.base64 b/test/build/Wallet.base64 index 409c702..f2be0b1 100644 --- a/test/build/Wallet.base64 +++ b/test/build/Wallet.base64 @@ -1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MhufK0IPgjgQPoqIIIG3dAoLnytPhj0x8B+CO88rnTHwHbPPI8CgYDSu1E0NdJwwH4ZiLQ1wsDqTgA3CHHAOMCIdcNH/K8IeMDAds88jwREQYEUCCCEBF46b264wIgghA7UzMfuuMCIIIQTO5kbLrjAiCCEGi1Xz+64wIPDgsHA1Iw+EJu4wD4RvJz0fhFIG6SMHDe+EK68uH0+AD4RSBukjBw3ts82zzyAAoJCAAs+Ev4SvhD+ELIy//LP8+Dy//L/8ntVAAE+GoBYu1E0NdJwgGOJnDtRND0BXBxIoBA9A5vkZPXC//e+Gv4aoBA9A7yvdcL//hicPhj4w0QA0Iw+Eby4Ez4Qm7jACGT1NHQ3vpA03/SANMH1NHbPOMA8gAQDQwAKO1E0NP/0z8x+ENYyMv/yz/Oye1UAFT4RSBukjBw3vhKuvLh9fgAVQJVEsjPhYDKAM+EQM4B+gJxzwtqzMkB+wABUDDR2zz4SyGOHI0EcAAAAAAAAAAAAAAAAC7UzMfgyM7L/8lw+wDe8gAQAVAw0ds8+EohjhyNBHAAAAAAAAAAAAAAAAAkXjpvYMjOy//JcPsA3vIAEAAu7UTQ0//TP9MAMdP/0//R+Gv4avhj+GIACvhG8uBMAgr0pCD0oRQTABRzb2wgMC42Mi4wAAA= \ No newline at end of file diff --git a/test/build/Wallet.tvc b/test/build/Wallet.tvc index 3f5dfee93e72e92aab6c9e9f8450c35e950c5827..f877c7333452338032c30c157960199197dbcff8 100644 GIT binary patch delta 13 Ucmeyz@{eUhB@?TWo&f^`03@3O#Q*>R delta 13 Ucmeyz@{eUhB@?Tmo)H5B03@6P#sB~S diff --git a/test/build/factorySource.ts b/test/build/factorySource.ts index 84df9ee..f274b71 100644 --- a/test/build/factorySource.ts +++ b/test/build/factorySource.ts @@ -1,7 +1,7 @@ const indexAbi = {"ABIversion":2,"version":"2.2","header":["time"],"functions":[{"name":"constructor","inputs":[{"name":"collection","type":"address"}],"outputs":[]},{"name":"getInfo","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"collection","type":"address"},{"name":"owner","type":"address"},{"name":"nft","type":"address"}]},{"name":"destruct","inputs":[{"name":"gasReceiver","type":"address"}],"outputs":[]}],"data":[{"key":1,"name":"_nft","type":"address"}],"events":[],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_nft","type":"address"},{"name":"_collection","type":"address"},{"name":"_owner","type":"address"}]} as const const indexBasisAbi = {"ABIversion":2,"version":"2.2","header":["time"],"functions":[{"name":"constructor","inputs":[],"outputs":[]},{"name":"getInfo","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"collection","type":"address"}]},{"name":"destruct","inputs":[{"name":"gasReceiver","type":"address"}],"outputs":[]}],"data":[{"key":1,"name":"_collection","type":"address"}],"events":[],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_collection","type":"address"}]} as const const ownableExternalContractAbi = {"ABIversion":2,"version":"2.2","header":["pubkey","time","expire"],"functions":[{"name":"constructor","inputs":[{"name":"owner","type":"uint256"}],"outputs":[]},{"name":"owner","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"pubkey","type":"uint256"}]},{"name":"transferOwnership","inputs":[{"name":"newOwner","type":"uint256"}],"outputs":[]}],"data":[{"key":1,"name":"_nonce","type":"uint16"}],"events":[{"name":"Test","inputs":[],"outputs":[]},{"name":"OwnershipTransferred","inputs":[{"name":"oldOwner","type":"uint256"},{"name":"newOwner","type":"uint256"}],"outputs":[]}],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_owner","type":"uint256"},{"name":"_nonce","type":"uint16"}]} as const -const ownableInternalContractAbi = {"ABIversion":2,"version":"2.2","header":["pubkey","time","expire"],"functions":[{"name":"constructor","inputs":[{"name":"owner","type":"address"}],"outputs":[]},{"name":"owner","inputs":[],"outputs":[{"name":"owner","type":"address"}]},{"name":"transferOwnership","inputs":[{"name":"newOwner","type":"address"}],"outputs":[]}],"data":[{"key":1,"name":"_nonce","type":"uint16"}],"events":[{"name":"Test","inputs":[],"outputs":[]},{"name":"OwnershipTransferred","inputs":[{"name":"oldOwner","type":"address"},{"name":"newOwner","type":"address"}],"outputs":[]}],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_owner","type":"address"},{"name":"_nonce","type":"uint16"}]} as const +const ownableInternalContractAbi = {"ABIversion":2,"version":"2.2","header":["pubkey","time","expire"],"functions":[{"name":"constructor","inputs":[{"name":"owner","type":"address"}],"outputs":[]},{"name":"owner","inputs":[],"outputs":[{"name":"owner_","type":"address"}]},{"name":"transferOwnership","inputs":[{"name":"newOwner","type":"address"}],"outputs":[]}],"data":[{"key":1,"name":"_nonce","type":"uint16"}],"events":[{"name":"Test","inputs":[],"outputs":[]},{"name":"OwnershipTransferred","inputs":[{"name":"oldOwner","type":"address"},{"name":"newOwner","type":"address"}],"outputs":[]}],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_owner","type":"address"},{"name":"_nonce","type":"uint16"}]} as const const tIP4_1CollectionConAbi = {"ABIversion":2,"version":"2.2","header":["pubkey","time","expire"],"functions":[{"name":"constructor","inputs":[{"name":"codeNft","type":"cell"}],"outputs":[]},{"name":"mintNft","inputs":[{"name":"id","type":"uint128"},{"name":"owner","type":"address"}],"outputs":[{"name":"nftAddr","type":"address"}]},{"name":"nftCodeWithoutSalt","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"nftCode","type":"cell"}]},{"name":"totalSupply","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"count","type":"uint128"}]},{"name":"nftCode","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"code","type":"cell"}]},{"name":"nftCodeHash","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"codeHash","type":"uint256"}]},{"name":"nftAddress","inputs":[{"name":"answerId","type":"uint32"},{"name":"id","type":"uint256"}],"outputs":[{"name":"nft","type":"address"}]},{"name":"supportsInterface","inputs":[{"name":"answerId","type":"uint32"},{"name":"interfaceID","type":"uint32"}],"outputs":[{"name":"value0","type":"bool"}]}],"data":[],"events":[{"name":"NftCreated","inputs":[{"name":"id","type":"uint256"},{"name":"nft","type":"address"},{"name":"owner","type":"address"},{"name":"manager","type":"address"},{"name":"creator","type":"address"}],"outputs":[]},{"name":"NftBurned","inputs":[{"name":"id","type":"uint256"},{"name":"nft","type":"address"},{"name":"owner","type":"address"},{"name":"manager","type":"address"}],"outputs":[]}],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_supportedInterfaces","type":"optional(cell)"},{"name":"_codeNft","type":"cell"},{"name":"_totalSupply","type":"uint128"}]} as const const tIP4_1NftConAbi = {"ABIversion":2,"version":"2.2","header":["pubkey","time","expire"],"functions":[{"name":"constructor","inputs":[{"name":"owner","type":"address"},{"name":"sendGasTo","type":"address"},{"name":"remainOnNft","type":"uint128"}],"outputs":[]},{"name":"transfer","inputs":[{"name":"to","type":"address"},{"name":"sendGasTo","type":"address"},{"components":[{"name":"value","type":"uint128"},{"name":"payload","type":"cell"}],"name":"callbacks","type":"map(address,tuple)"}],"outputs":[]},{"name":"changeOwner","inputs":[{"name":"newOwner","type":"address"},{"name":"sendGasTo","type":"address"},{"components":[{"name":"value","type":"uint128"},{"name":"payload","type":"cell"}],"name":"callbacks","type":"map(address,tuple)"}],"outputs":[]},{"name":"changeManager","inputs":[{"name":"newManager","type":"address"},{"name":"sendGasTo","type":"address"},{"components":[{"name":"value","type":"uint128"},{"name":"payload","type":"cell"}],"name":"callbacks","type":"map(address,tuple)"}],"outputs":[]},{"name":"getInfo","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"id","type":"uint256"},{"name":"owner","type":"address"},{"name":"manager","type":"address"},{"name":"collection","type":"address"}]},{"name":"supportsInterface","inputs":[{"name":"answerId","type":"uint32"},{"name":"interfaceID","type":"uint32"}],"outputs":[{"name":"value0","type":"bool"}]}],"data":[{"key":1,"name":"_id","type":"uint256"}],"events":[{"name":"NftCreated","inputs":[{"name":"id","type":"uint256"},{"name":"owner","type":"address"},{"name":"manager","type":"address"},{"name":"collection","type":"address"}],"outputs":[]},{"name":"OwnerChanged","inputs":[{"name":"oldOwner","type":"address"},{"name":"newOwner","type":"address"}],"outputs":[]},{"name":"ManagerChanged","inputs":[{"name":"oldManager","type":"address"},{"name":"newManager","type":"address"}],"outputs":[]},{"name":"NftBurned","inputs":[{"name":"id","type":"uint256"},{"name":"owner","type":"address"},{"name":"manager","type":"address"},{"name":"collection","type":"address"}],"outputs":[]}],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_supportedInterfaces","type":"optional(cell)"},{"name":"_id","type":"uint256"},{"name":"_collection","type":"address"},{"name":"_owner","type":"address"},{"name":"_manager","type":"address"}]} as const const tIP4_2CollectionConAbi = {"ABIversion":2,"version":"2.2","header":["pubkey","time","expire"],"functions":[{"name":"constructor","inputs":[{"name":"codeNft","type":"cell"},{"name":"json","type":"string"}],"outputs":[]},{"name":"mintNft","inputs":[{"name":"id","type":"uint128"},{"name":"owner","type":"address"},{"name":"json","type":"string"}],"outputs":[]},{"name":"nftCodeWithoutSalt","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"nftCode","type":"cell"}]},{"name":"getJson","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"json","type":"string"}]},{"name":"totalSupply","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"count","type":"uint128"}]},{"name":"nftCode","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"code","type":"cell"}]},{"name":"nftCodeHash","inputs":[{"name":"answerId","type":"uint32"}],"outputs":[{"name":"codeHash","type":"uint256"}]},{"name":"nftAddress","inputs":[{"name":"answerId","type":"uint32"},{"name":"id","type":"uint256"}],"outputs":[{"name":"nft","type":"address"}]},{"name":"supportsInterface","inputs":[{"name":"answerId","type":"uint32"},{"name":"interfaceID","type":"uint32"}],"outputs":[{"name":"value0","type":"bool"}]}],"data":[],"events":[{"name":"NftCreated","inputs":[{"name":"id","type":"uint256"},{"name":"nft","type":"address"},{"name":"owner","type":"address"},{"name":"manager","type":"address"},{"name":"creator","type":"address"}],"outputs":[]},{"name":"NftBurned","inputs":[{"name":"id","type":"uint256"},{"name":"nft","type":"address"},{"name":"owner","type":"address"},{"name":"manager","type":"address"}],"outputs":[]}],"fields":[{"name":"_pubkey","type":"uint256"},{"name":"_timestamp","type":"uint64"},{"name":"_constructorFlag","type":"bool"},{"name":"_supportedInterfaces","type":"optional(cell)"},{"name":"_codeNft","type":"cell"},{"name":"_totalSupply","type":"uint128"},{"name":"_json","type":"string"}]} as const diff --git a/test/contracts/TIP4_1/TIP4_1CollectionCon.sol b/test/contracts/TIP4_1/TIP4_1CollectionCon.sol deleted file mode 100644 index 8de1375..0000000 --- a/test/contracts/TIP4_1/TIP4_1CollectionCon.sol +++ /dev/null @@ -1,53 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import "../../../contracts/TIP4_1/TIP4_1Collection.sol"; -import "./TIP4_1NftCon.sol"; - - -contract TIP4_1CollectionCon is TIP4_1Collection { - - constructor(TvmCell codeNft) TIP4_1Collection(codeNft) public { - tvm.accept(); - } - - function mintNft( - uint128 id, - address owner - ) external returns(address nftAddr) { - tvm.accept(); - - TvmCell codeNft = _buildNftCode(address(this)); - TvmCell stateNft = _buildNftState(codeNft, uint256(id)); - nftAddr = new TIP4_1NftCon{ - stateInit: stateNft, - value: 0.5 ever, - flag: 1 - }( - owner, - address(this), - 0.3 ever - ); - - _totalSupply++; - } - - function nftCodeWithoutSalt() external view responsible returns (TvmCell nftCode) { - return {value: 0, flag: 64, bounce: false} (_codeNft); - } - - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual override pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: TIP4_1NftCon, - varInit: {_id: id}, - code: code - }); - } -} diff --git a/test/contracts/TIP4_1/TIP4_1NftCon.sol b/test/contracts/TIP4_1/TIP4_1NftCon.sol deleted file mode 100644 index e1ff292..0000000 --- a/test/contracts/TIP4_1/TIP4_1NftCon.sol +++ /dev/null @@ -1,23 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - -import "../../../contracts/TIP4_1/TIP4_1Nft.sol"; - -contract TIP4_1NftCon is TIP4_1Nft { - - constructor( - address owner, - address sendGasTo, - uint128 remainOnNft - ) TIP4_1Nft( - owner, - sendGasTo, - remainOnNft - ) public { - tvm.accept(); - } - -} \ No newline at end of file diff --git a/test/contracts/TIP4_2/TIP4_2CollectionCon.sol b/test/contracts/TIP4_2/TIP4_2CollectionCon.sol deleted file mode 100644 index daf5fd3..0000000 --- a/test/contracts/TIP4_2/TIP4_2CollectionCon.sol +++ /dev/null @@ -1,63 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import "../../../contracts/TIP4_2/TIP4_2Collection.sol"; -import "./TIP4_2NftCon.sol"; - - -contract Collection is TIP4_2Collection { - - constructor( - TvmCell codeNft, - string json - ) TIP4_1Collection ( - codeNft - ) TIP4_2Collection ( - json - ) public { - tvm.accept(); - } - - function mintNft( - uint128 id, - address owner, - string json - ) external virtual { - tvm.accept(); - - _totalSupply++; - - TvmCell codeNft = _buildNftCode(address(this)); - TvmCell stateNft = _buildNftState(codeNft, uint256(id)); - address nftAddr = new TIP4_2NftCon{ - stateInit: stateNft, - value: 0.2 ever, - flag: 1 - }( - owner, - address(this), - 0.1 ever, - json - ); - } - - function nftCodeWithoutSalt() external view responsible returns (TvmCell nftCode) { - return {value: 0, flag: 64, bounce: false} (_codeNft); - } - - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual override pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: TIP4_2NftCon, - varInit: {_id: id}, - code: code - }); - } - -} \ No newline at end of file diff --git a/test/contracts/TIP4_2/TIP4_2NftCon.sol b/test/contracts/TIP4_2/TIP4_2NftCon.sol deleted file mode 100644 index 442351a..0000000 --- a/test/contracts/TIP4_2/TIP4_2NftCon.sol +++ /dev/null @@ -1,29 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import "../../../contracts/TIP4_1/TIP4_1Nft.sol"; -import "../../../contracts/TIP4_2/TIP4_2Nft.sol"; - - -contract TIP4_2NftCon is TIP4_1Nft, TIP4_2Nft { - - constructor( - address owner, - address sendGasTo, - uint128 remainOnNft, - string json - ) TIP4_1Nft( - owner, - sendGasTo, - remainOnNft - ) TIP4_2Nft ( - json - ) public { - tvm.accept(); - } - -} \ No newline at end of file diff --git a/test/contracts/TIP4_3/TIP4_3CollectionCon.sol b/test/contracts/TIP4_3/TIP4_3CollectionCon.sol deleted file mode 100644 index 4a16a5e..0000000 --- a/test/contracts/TIP4_3/TIP4_3CollectionCon.sol +++ /dev/null @@ -1,70 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import "../../../contracts/TIP4_3/TIP4_3Collection.sol"; -import './TIP4_3NftCon.sol'; - - -contract Collection is TIP4_3Collection { - - /// _remainOnNft - the number of crystals that will remain after the entire mint - /// process is completed on the Nft contract - uint128 _remainOnNft = 0.3 ever; - - constructor( - TvmCell codeNft, - TvmCell codeIndex, - TvmCell codeIndexBasis - ) TIP4_1Collection ( - codeNft - ) TIP4_3Collection ( - codeIndex, - codeIndexBasis - ) public { - tvm.accept(); - } - - function mintNft( - uint128 id, - address owner - ) external virtual { - tvm.accept(); - - _totalSupply++; - - TvmCell codeNft = _buildNftCode(address(this)); - TvmCell stateNft = _buildNftState(codeNft, uint256(id)); - address nftAddr = new TIP4_3NftCon{ - stateInit: stateNft, - value: 0.7 ever, - flag: 1 - }( - owner, - owner, - _remainOnNft, - _indexDeployValue, - _indexDestroyValue, - _codeIndex - ); - } - - function nftCodeWithoutSalt() external view responsible returns (TvmCell nftCode) { - return {value: 0, flag: 64, bounce: false} (_codeNft); - } - - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual override pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: TIP4_3NftCon, - varInit: {_id: id}, - code: code - }); - } - -} \ No newline at end of file diff --git a/test/contracts/TIP4_3/TIP4_3NftCon.sol b/test/contracts/TIP4_3/TIP4_3NftCon.sol deleted file mode 100644 index b1a7c2f..0000000 --- a/test/contracts/TIP4_3/TIP4_3NftCon.sol +++ /dev/null @@ -1,68 +0,0 @@ -pragma ton-solidity >= 0.58.1; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import "../../../contracts/TIP4_1/TIP4_1Nft.sol"; -import "../../../contracts/TIP4_3/TIP4_3Nft.sol"; - - -contract TIP4_3NftCon is TIP4_1Nft, TIP4_3Nft { - - constructor( - address owner, - address sendGasTo, - uint128 remainOnNft, - uint128 indexDeployValue, - uint128 indexDestroyValue, - TvmCell codeIndex - ) TIP4_1Nft( - owner, - sendGasTo, - remainOnNft - ) TIP4_3Nft ( - indexDeployValue, - indexDestroyValue, - codeIndex - ) public { - tvm.accept(); - } - - function _beforeTransfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { - TIP4_3Nft._beforeTransfer(to, sendGasTo, callbacks); - } - - function _afterTransfer( - address to, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { - TIP4_3Nft._afterTransfer(to, sendGasTo, callbacks); - } - - - function _beforeChangeOwner( - address oldOwner, - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { - TIP4_3Nft._beforeChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); - } - - function _afterChangeOwner( - address oldOwner, - address newOwner, - address sendGasTo, - mapping(address => CallbackParams) callbacks - ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { - TIP4_3Nft._afterChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); - } - -} \ No newline at end of file diff --git a/test/contracts/TIP6/TIP6Con.sol b/test/contracts/TIP6/TIP6Con.sol deleted file mode 100644 index fa5b0ef..0000000 --- a/test/contracts/TIP6/TIP6Con.sol +++ /dev/null @@ -1,17 +0,0 @@ -pragma ton-solidity >= 0.58.1; -pragma AbiHeader expire; -pragma AbiHeader pubkey; - - -import "../../../contracts/TIP6/TIP6.sol"; - - -contract TIP6Con is TIP6 { - - constructor() public { - tvm.accept(); - - _supportedInterfaces[ bytes4(tvm.functionId(ITIP6.supportsInterface)) ] = true; - } - -} diff --git a/test/contracts/Wallet.sol b/test/contracts/Wallet.sol deleted file mode 100644 index 033e241..0000000 --- a/test/contracts/Wallet.sol +++ /dev/null @@ -1,43 +0,0 @@ -pragma ton-solidity >= 0.39.0; -pragma AbiHeader expire; -pragma AbiHeader pubkey; - -contract Account { - uint public owner; - uint public static _randomNonce; - - modifier onlyOwner() { - require(msg.pubkey() == owner, 501); - _; - } - - modifier checkPubKey() { - require(msg.pubkey() == tvm.pubkey(), 500); - _; - } - - constructor() public checkPubKey { - tvm.accept(); - setOwnership(msg.pubkey()); - } - - function setOwnership(uint newOwner) internal { - owner = newOwner; - } - - function sendTransaction( - address dest, - uint128 value, - bool bounce, - uint8 flags, - TvmCell payload - ) - public - view - onlyOwner - { - tvm.accept(); - - dest.transfer(value, bounce, flags, payload); - } -} \ No newline at end of file diff --git a/test/contracts/access/OwnableExternalContract.sol b/test/contracts/access/OwnableExternalContract.sol deleted file mode 100644 index c79e678..0000000 --- a/test/contracts/access/OwnableExternalContract.sol +++ /dev/null @@ -1,19 +0,0 @@ -pragma ton-solidity >= 0.58.1; -pragma AbiHeader expire; -pragma AbiHeader pubkey; - - -import "../../../contracts/access/OwnableExternal.sol"; - - -contract OwnableExternalContract is OwnableExternal { - - uint16 static _nonce; - - event Test(); - - constructor(uint256 owner) OwnableExternal(owner) public { - tvm.accept(); - } - -} diff --git a/test/contracts/access/OwnableInternalContract.sol b/test/contracts/access/OwnableInternalContract.sol deleted file mode 100644 index fe6fa7c..0000000 --- a/test/contracts/access/OwnableInternalContract.sol +++ /dev/null @@ -1,19 +0,0 @@ -pragma ton-solidity >= 0.58.1; -pragma AbiHeader expire; -pragma AbiHeader pubkey; - - -import "../../../contracts/access/OwnableInternal.sol"; - - -contract OwnableInternalContract is OwnableInternal { - - uint16 static _nonce; - - event Test(); - - constructor(address owner) OwnableInternal(owner) public { - tvm.accept(); - } - -} diff --git a/test/giverSettings/index.ts b/test/giverSettings/index.ts deleted file mode 100644 index 27a9b46..0000000 --- a/test/giverSettings/index.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { Address, Contract, Giver, ProviderRpcClient, Transaction } from "locklift"; -import { Ed25519KeyPair } from "everscale-standalone-client"; - -// Reimplements this class if you need to use custom giver contract -export class SimpleGiver implements Giver { - public giverContract: Contract; - - constructor(ever: ProviderRpcClient, readonly keyPair: Ed25519KeyPair, address: string) { - const giverAddr = new Address(address); - this.giverContract = new ever.Contract(giverAbi, giverAddr); - } - - public async sendTo(sendTo: Address, value: string): Promise<{ transaction: Transaction; output?: {} }> { - return this.giverContract.methods - .sendTransaction({ - value: value, - dest: sendTo, - bounce: false, - }) - .sendExternal({ publicKey: this.keyPair.publicKey }); - } -} - -const giverAbi = { - "ABI version": 2, - header: ["time", "expire"], - functions: [ - { - name: "upgrade", - inputs: [{ name: "newcode", type: "cell" }], - outputs: [], - }, - { - name: "sendTransaction", - inputs: [ - { name: "dest", type: "address" }, - { name: "value", type: "uint128" }, - { name: "bounce", type: "bool" }, - ], - outputs: [], - }, - { - name: "getMessages", - inputs: [], - outputs: [ - { - components: [ - { name: "hash", type: "uint256" }, - { name: "expireAt", type: "uint64" }, - ], - name: "messages", - type: "tuple[]", - }, - ], - }, - { - name: "constructor", - inputs: [], - outputs: [], - }, - ], - events: [], -} as const; - -export class GiverWallet implements Giver { - public giverContract: Contract; - - constructor(ever: ProviderRpcClient, readonly keyPair: Ed25519KeyPair, address: string) { - const giverAddr = new Address(address); - this.giverContract = new ever.Contract(giverWallet, giverAddr); - } - - public async sendTo(sendTo: Address, value: string): Promise<{ transaction: Transaction; output?: {} }> { - return this.giverContract.methods - .sendTransaction({ - value: value, - dest: sendTo, - bounce: false, - flags: 3, - payload: "", - }) - .sendExternal({ publicKey: this.keyPair.publicKey }); - } -} - -const giverWallet = { - "ABI version": 2, - header: ["pubkey", "time", "expire"], - functions: [ - { - name: "sendTransaction", - inputs: [ - { name: "dest", type: "address" }, - { name: "value", type: "uint128" }, - { name: "bounce", type: "bool" }, - { name: "flags", type: "uint8" }, - { name: "payload", type: "cell" }, - ], - outputs: [], - }, - ], - events: [], -} as const; - -export class GiverWalletV2_3 implements Giver { - public giverContract: Contract; - - constructor(ever: ProviderRpcClient, readonly keyPair: Ed25519KeyPair, address: string) { - const giverAddr = new Address(address); - this.giverContract = new ever.Contract(broxusEverWallet, giverAddr); - } - - public async sendTo(sendTo: Address, value: string): Promise<{ transaction: Transaction; output?: {} }> { - return this.giverContract.methods - .sendTransaction({ - value: value, - dest: sendTo, - bounce: false, - flags: 3, - payload: "", - }) - .sendExternal({ publicKey: this.keyPair.publicKey }); - } -} - -const broxusEverWallet = { - "ABI version": 2, - version: "2.3", - header: ["pubkey", "time", "expire"], - functions: [ - { - name: "sendTransaction", - inputs: [ - { name: "dest", type: "address" }, - { name: "value", type: "uint128" }, - { name: "bounce", type: "bool" }, - { name: "flags", type: "uint8" }, - { name: "payload", type: "cell" }, - ], - outputs: [], - }, - ], - events: [], -} as const; diff --git a/test/locklift.config.ts b/test/locklift.config.ts index 388e6ce..04575d1 100644 --- a/test/locklift.config.ts +++ b/test/locklift.config.ts @@ -1,6 +1,9 @@ import { LockliftConfig } from "locklift"; import { FactorySource } from "./build/factorySource"; -import { SimpleGiver, GiverWalletV2_3 } from "./giverSettings"; + +import { lockliftChai } from "locklift"; +import chai from "chai"; +chai.use(lockliftChai); declare global { const locklift: import("locklift").Locklift; @@ -11,10 +14,10 @@ const RFLD_ENDPOINT = "https://rfld-dapp.itgold.io/graphql"; const config: LockliftConfig = { compiler: { - version: "0.61.2" + version: "0.62.0" }, linker: { - version: "0.14.51", + version: "0.15.48", }, networks: { local: { @@ -28,7 +31,6 @@ const config: LockliftConfig = { }, }, giver: { - giverFactory: (ever, keyPair, address) => new SimpleGiver(ever, keyPair, address), address: "0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415", key: "172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3", }, @@ -36,6 +38,7 @@ const config: LockliftConfig = { endpoint: LOCAL_NETWORK_ENDPOINT, }, keys: { + phrase: "goat cousin cotton supreme tide recipe cause surface empower chaos try anxiety", amount: 20, }, }, @@ -50,7 +53,6 @@ const config: LockliftConfig = { }, }, giver: { - giverFactory: (ever, keyPair, address) => new GiverWalletV2_3(ever, keyPair, address), address: "0:f2169a6b1f1b42e8b8dfb45d3d459eedbd15d601b701fd7f9e2992beae43736a", key: "1cf6b8f2148058f70a3916768beb46e4f3d3a60597bef88181a544bc7cf00bcd", }, diff --git a/test/test/ownable-internal-test.ts b/test/test/ownable-internal-test.ts index 2a517f7..0a9ca69 100644 --- a/test/test/ownable-internal-test.ts +++ b/test/test/ownable-internal-test.ts @@ -91,7 +91,7 @@ describe("Test Ownable internal contract", async function () { ); const response = await ownableInternal.methods.owner().call(); - expect(response.owner.toString()).to.be.equal(owner.address.toString()); + expect(response.owner_.toString()).to.be.equal(owner.address.toString()); const pastEvents = await ownableInternal.getPastEvents({ filter: event => event.event === "OwnershipTransferred" }); expect(pastEvents.events.length).to.be.equal(1); @@ -99,7 +99,7 @@ describe("Test Ownable internal contract", async function () { it("Get owner test", async function () { const response = await ownableInternal.methods.owner({}).call(); - expect(response.owner.toString()).to.be.equal(owner.address.toString()); + expect(response.owner_.toString()).to.be.equal(owner.address.toString()); }); it("Transfer ownership test with zero new owner address", async function () { @@ -126,7 +126,7 @@ describe("Test Ownable internal contract", async function () { ); const response = await ownableInternal.methods.owner().call(); - expect(response.owner.toString()).to.be.equal(owner.address.toString()); + expect(response.owner_.toString()).to.be.equal(owner.address.toString()); const pastEvents = await ownableInternal.getPastEvents({ filter: event => event.event === "OwnershipTransferred" }); expect(pastEvents.events.length).to.be.equal(1); @@ -154,7 +154,7 @@ describe("Test Ownable internal contract", async function () { ); const response = await ownableInternal.methods.owner({}).call(); - expect(response.owner.toString()).to.be.equal(newOwner.address.toString()); + expect(response.owner_.toString()).to.be.equal(newOwner.address.toString()); const pastEvents = await ownableInternal.getPastEvents({ filter: event => event.event === "OwnershipTransferred" }); expect(pastEvents.events.length).to.be.equal(2); From c440303477d030993e44b89422b08705bd2774ee Mon Sep 17 00:00:00 2001 From: 1 Date: Sat, 13 May 2023 21:30:19 +0200 Subject: [PATCH 2/8] upd .tsol --- contracts/TIP4_1/TIP4_1Collection.tsol | 110 ++++++ contracts/TIP4_1/TIP4_1Nft.tsol | 332 ++++++++++++++++++ .../TIP4_1/interfaces/INftChangeManager.tsol | 19 + .../TIP4_1/interfaces/INftChangeOwner.tsol | 27 ++ contracts/TIP4_1/interfaces/INftTransfer.tsol | 29 ++ .../TIP4_1/interfaces/ITIP4_1Collection.tsol | 38 ++ contracts/TIP4_1/interfaces/ITIP4_1NFT.tsol | 67 ++++ contracts/TIP4_2/TIP4_2Collection.tsol | 52 +++ contracts/TIP4_2/TIP4_2Nft.tsol | 37 ++ .../interfaces/ITIP4_2JSON_Metadata.tsol | 9 + contracts/TIP4_3/Index.tsol | 64 ++++ contracts/TIP4_3/IndexBasis.tsol | 37 ++ contracts/TIP4_3/TIP4_3Collection.tsol | 137 ++++++++ contracts/TIP4_3/TIP4_3Nft.tsol | 136 +++++++ contracts/TIP4_3/interfaces/IIndex.tsol | 10 + contracts/TIP4_3/interfaces/IIndexBasis.tsol | 6 + .../TIP4_3/interfaces/ITIP4_3Collection.tsol | 9 + contracts/TIP4_3/interfaces/ITIP4_3NFT.tsol | 7 + contracts/TIP6/ITIP6.tsol | 10 + contracts/TIP6/TIP6.tsol | 17 + contracts/access/OwnableExternal.tsol | 36 ++ contracts/access/OwnableInternal.tsol | 37 ++ .../contracts/TIP4_1/TIP4_1CollectionCon.tsol | 53 +++ test/contracts/TIP4_1/TIP4_1NftCon.tsol | 23 ++ .../contracts/TIP4_2/TIP4_2CollectionCon.tsol | 63 ++++ test/contracts/TIP4_2/TIP4_2NftCon.tsol | 29 ++ .../contracts/TIP4_3/TIP4_3CollectionCon.tsol | 70 ++++ test/contracts/TIP4_3/TIP4_3NftCon.tsol | 68 ++++ test/contracts/TIP6/TIP6Con.tsol | 17 + test/contracts/Wallet.tsol | 43 +++ .../access/OwnableExternalContract.tsol | 19 + .../access/OwnableInternalContract.tsol | 19 + 32 files changed, 1630 insertions(+) create mode 100644 contracts/TIP4_1/TIP4_1Collection.tsol create mode 100644 contracts/TIP4_1/TIP4_1Nft.tsol create mode 100644 contracts/TIP4_1/interfaces/INftChangeManager.tsol create mode 100644 contracts/TIP4_1/interfaces/INftChangeOwner.tsol create mode 100644 contracts/TIP4_1/interfaces/INftTransfer.tsol create mode 100644 contracts/TIP4_1/interfaces/ITIP4_1Collection.tsol create mode 100644 contracts/TIP4_1/interfaces/ITIP4_1NFT.tsol create mode 100644 contracts/TIP4_2/TIP4_2Collection.tsol create mode 100644 contracts/TIP4_2/TIP4_2Nft.tsol create mode 100644 contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.tsol create mode 100644 contracts/TIP4_3/Index.tsol create mode 100644 contracts/TIP4_3/IndexBasis.tsol create mode 100644 contracts/TIP4_3/TIP4_3Collection.tsol create mode 100644 contracts/TIP4_3/TIP4_3Nft.tsol create mode 100644 contracts/TIP4_3/interfaces/IIndex.tsol create mode 100644 contracts/TIP4_3/interfaces/IIndexBasis.tsol create mode 100644 contracts/TIP4_3/interfaces/ITIP4_3Collection.tsol create mode 100644 contracts/TIP4_3/interfaces/ITIP4_3NFT.tsol create mode 100644 contracts/TIP6/ITIP6.tsol create mode 100644 contracts/TIP6/TIP6.tsol create mode 100644 contracts/access/OwnableExternal.tsol create mode 100644 contracts/access/OwnableInternal.tsol create mode 100644 test/contracts/TIP4_1/TIP4_1CollectionCon.tsol create mode 100644 test/contracts/TIP4_1/TIP4_1NftCon.tsol create mode 100644 test/contracts/TIP4_2/TIP4_2CollectionCon.tsol create mode 100644 test/contracts/TIP4_2/TIP4_2NftCon.tsol create mode 100644 test/contracts/TIP4_3/TIP4_3CollectionCon.tsol create mode 100644 test/contracts/TIP4_3/TIP4_3NftCon.tsol create mode 100644 test/contracts/TIP6/TIP6Con.tsol create mode 100644 test/contracts/Wallet.tsol create mode 100644 test/contracts/access/OwnableExternalContract.tsol create mode 100644 test/contracts/access/OwnableInternalContract.tsol diff --git a/contracts/TIP4_1/TIP4_1Collection.tsol b/contracts/TIP4_1/TIP4_1Collection.tsol new file mode 100644 index 0000000..70aa1c1 --- /dev/null +++ b/contracts/TIP4_1/TIP4_1Collection.tsol @@ -0,0 +1,110 @@ +/// We recommend using the compiler version 0.58.1. +/// You can use other versions, but we do not guarantee compatibility of the compiler version. +pragma ton-solidity >= 0.58.1; + + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import '../TIP6/TIP6.tsol'; +import './interfaces/ITIP4_1Collection.tsol'; +import './TIP4_1Nft.tsol'; + + +/// @title One of the required contracts of an TIP4-1(Non-Fungible Token Standard) compliant technology. +/// You can read more about the technology here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/1.md) +/// For detect what interfaces a smart contract implements used TIP-6.1 standard. ... +/// ... Read more here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-6/1.md) +contract TIP4_1Collection is ITIP4_1Collection, TIP6 { + + /// Code of the TIP4_1Nft conract or of the custom Nft contract based on the TIP4_1Nft + TvmCell _codeNft; + + /// Number of minted tokens + uint128 _totalSupply; + + constructor(TvmCell codeNft) public { + tvm.accept(); + + _codeNft = codeNft; + + _supportedInterfaces[ bytes4(tvm.functionId(ITIP6.supportsInterface)) ] = true; + _supportedInterfaces[ + bytes4(tvm.functionId(ITIP4_1Collection.totalSupply)) ^ + bytes4(tvm.functionId(ITIP4_1Collection.nftCode)) ^ + bytes4(tvm.functionId(ITIP4_1Collection.nftCodeHash)) ^ + bytes4(tvm.functionId(ITIP4_1Collection.nftAddress)) + ] = true; + } + + /// @notice Count active NFTs for this collection + /// @return count A count of active NFTs minted by this contract except for burned NFTs + function totalSupply() external view virtual override responsible returns (uint128 count) { + return {value: 0, flag: 64, bounce: false} (_totalSupply); + } + + /// @notice Returns the NFT code + /// @return code Returns the NFT code as TvmCell + function nftCode() external view virtual override responsible returns (TvmCell code) { + return {value: 0, flag: 64, bounce: false} (_buildNftCode(address(this))); + } + + /// @notice Returns the NFT code hash + /// @return codeHash Returns the NFT code hash + function nftCodeHash() external view virtual override responsible returns (uint256 codeHash) { + return {value: 0, flag: 64, bounce: false} (tvm.hash(_buildNftCode(address(this)))); + } + + /// @notice Computes NFT address by unique NFT id + /// @dev Return unique address for all Ids. You find nothing by address for not a valid NFT. + /// @param id Unique NFT id + /// @return nft Returns address of NFT contract + function nftAddress(uint256 id) external view virtual override responsible returns (address nft) { + return {value: 0, flag: 64, bounce: false} (_resolveNft(id)); + } + + /// @notice Resolve nft address used addrRoot & nft id + /// @param id Unique nft number + function _resolveNft( + uint256 id + ) internal virtual view returns (address nft) { + TvmCell code = _buildNftCode(address(this)); + TvmCell state = _buildNftState(code, id); + uint256 hashState = tvm.hash(state); + nft = address.makeAddrStd(address(this).wid, hashState); + } + + /// @notice build nft code used TvmCell nft code & salt (address collection) ... + /// ... to create unique nft address BC nft code & id can be repeated + /// @param collection - collection address + /// @return TvmCell nftCode + /// about salt read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmcodesalt) + function _buildNftCode(address collection) internal virtual view returns (TvmCell) { + TvmBuilder salt; + salt.store(collection); + return tvm.setCodeSalt(_codeNft, salt.toCell()); + } + + /// @notice Generates a StateInit from code and data + /// @param code TvmCell code - generated via the _buildNftCode method + /// @param id Unique nft number + /// @return TvmCell object - stateInit + /// about tvm.buildStateInit read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuildstateinit) + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: TIP4_1Nft, + varInit: {_id: id}, + code: code + }); + } + + function _isOwner() internal virtual returns(bool) { + return true; + } + +} \ No newline at end of file diff --git a/contracts/TIP4_1/TIP4_1Nft.tsol b/contracts/TIP4_1/TIP4_1Nft.tsol new file mode 100644 index 0000000..26e76a3 --- /dev/null +++ b/contracts/TIP4_1/TIP4_1Nft.tsol @@ -0,0 +1,332 @@ +/// We recommend using the compiler version 0.58.1. +/// You can use other versions, but we do not guarantee compatibility of the compiler version. +pragma ton-solidity >= 0.58.1; + + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import './interfaces/ITIP4_1NFT.tsol'; +import './interfaces/INftChangeOwner.tsol'; +import './interfaces/INftChangeManager.tsol'; +import './interfaces/INftTransfer.tsol'; + +import '../TIP6/TIP6.tsol'; + + +/// @title One of the required contracts of an TIP4-1(Non-Fungible Token Standard) compliant technology. +/// You can read more about the technology here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/1.md) +/// For detect what interfaces a smart contract implements used TIP-6.1 standard. ... +/// ... Read more here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-6/1.md) +contract TIP4_1Nft is ITIP4_1NFT, TIP6 { + + /** + * Errors + **/ + uint8 constant value_is_empty = 101; + uint8 constant sender_is_not_collection = 102; + uint8 constant sender_is_not_manager = 103; + uint8 constant value_is_less_than_required = 104; + + /// Unique NFT id + uint256 static _id; + + /// Address of NftCollection contract + address _collection; + + /// Owner address + address _owner; + + /// Manager address. Used in onlyManager modifier. + address _manager; + + /** + @notice Initializes the contract by setting a `owner` to the NFT. + Collection address get from the contract code that is "building" into Collection._buildNftCode, Collection._buildNftState + _supportedInterfaces mapping used in TIP-6 standart + Emit TokenMinted event + */ + constructor( + address owner, + address sendGasTo, + uint128 remainOnNft + ) public { + optional(TvmCell) optSalt = tvm.codeSalt(tvm.code()); + require(optSalt.hasValue(), value_is_empty); + (address collection) = optSalt.get().toSlice().decode(address); + require(msg.sender == collection, sender_is_not_collection); + require(remainOnNft != 0, value_is_empty); + require(msg.value > remainOnNft, value_is_less_than_required); + tvm.rawReserve(remainOnNft, 0); + + _collection = collection; + _owner = owner; + _manager = owner; + + _supportedInterfaces[ bytes4(tvm.functionId(ITIP6.supportsInterface)) ] = true; + _supportedInterfaces[ + bytes4(tvm.functionId(ITIP4_1NFT.getInfo)) ^ + bytes4(tvm.functionId(ITIP4_1NFT.changeOwner)) ^ + bytes4(tvm.functionId(ITIP4_1NFT.changeManager)) ^ + bytes4(tvm.functionId(ITIP4_1NFT.transfer)) + ] = true; + + emit NftCreated(_id, _owner, _manager, _collection); + + sendGasTo.transfer({value: 0, flag: 128 + 2}); + } + + /// @notice Transfers ownership to another account (set new owner & manager) + /// @param to - the future owner of the token + /// @param sendGasTo - the address to which the remaining gas will be sent + /// @param callbacks - key (destination address for callback) => .. + /// .. value (CallbackParams structure ( CallbackParams { uint128 value; TvmCell payload; } )) + /// Can only be called from the manager's address + /// Requirements: + /// + /// - `to` can't be the zero address. + /// - `sendGasTo` can't be the zero address. + /// - `callbacks` can be the zero mapping. + /// - Callbacks(key) address must implement {INftTransfer-onNftTransfer}. + /// + /// Emits a {OwnerChanged} event if to != oldOwner && Emits a {ManagerChanged} event if to != oldManager. + function transfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) public virtual override onlyManager { + tvm.rawReserve(0, 4); + + _beforeTransfer(to, sendGasTo, callbacks); + + address oldOwner = _owner; + _changeOwner(to); + _changeManager(to); + + _afterTransfer(to, sendGasTo, callbacks); + + for ((address dest, CallbackParams p) : callbacks) { + INftTransfer(dest).onNftTransfer{ + value: p.value, + flag: 0 + 1, + bounce: false + }(_id, oldOwner, to, _manager, to, _collection, sendGasTo, p.payload); + } + + if (sendGasTo.value != 0) { + sendGasTo.transfer({ + value: 0, + flag: 128 + 2, + bounce: false + }); + } + + } + + /// @notice Change Nft owner + /// @param newOwner - the future owner of the token + /// @param sendGasTo - the address to which the remaining gas will be sent + /// @param callbacks - key (destination address for callback) => .. + /// .. value (CallbackParams structure ( CallbackParams { uint128 value; TvmCell payload; } )) + /// Can only be called from the manager's address + /// Requirements: + /// + /// - `newOwner` can't be the zero address. + /// - `sendGasTo` can't be the zero address. + /// - `callbacks` can be the zero mapping. + /// - Callbacks(key) address must implement {INftChangeOwner-onNftChangeOwner}. + /// + /// Emits a {OwnerChanged} event if newOwner != oldOwner + function changeOwner( + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) public virtual override onlyManager { + tvm.rawReserve(0, 4); + + _beforeChangeOwner(_owner, newOwner, sendGasTo, callbacks); + + address oldOwner = _owner; + _changeOwner(newOwner); + + _afterChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); + + for ((address dest, CallbackParams p) : callbacks) { + INftChangeOwner(dest).onNftChangeOwner{ + value: p.value, + flag: 0 + 1, + bounce: false + }(_id, _manager, oldOwner, newOwner, _collection, sendGasTo, p.payload); + } + + if (sendGasTo.value != 0) { + sendGasTo.transfer({ + value: 0, + flag: 128 + 2, + bounce: false + }); + } + + } + + function _changeOwner( + address newOwner + ) internal { + address oldOwner = _owner; + _owner = newOwner; + if (oldOwner != newOwner) { + emit OwnerChanged(oldOwner, newOwner); + } + } + + + /// @notice Set a new manager + /// @param newManager - future manager of the token + /// @param sendGasTo - the address to which the remaining gas will be sent + /// @param callbacks - key (destination address for callback) => .. + /// .. value (CallbackParams structure ( CallbackParams { uint128 value; TvmCell payload; } )) + /// Can only be called from the manager's address + /// Requirements: + /// + /// - `newManager` cannot be the zero address. + /// - `sendGasTo` can be the zero address. + /// - `callbacks` can be the zero mapping. + /// - Callbacks(key) address must implement {INftChangeManager-onNftChangeManager}. + /// + /// Emits a {ManagerChanged} event if newManager != oldManager. + function changeManager( + address newManager, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) external virtual override onlyManager { + tvm.rawReserve(0, 4); + + _beforeChangeManager(_manager, newManager, sendGasTo, callbacks); + + address oldManager = _manager; + _changeManager(newManager); + + _afterChangeManager(oldManager, newManager, sendGasTo, callbacks); + + for ((address dest, CallbackParams p) : callbacks) { + INftChangeManager(dest).onNftChangeManager{ + value: p.value, + flag: 0 + 1, + bounce: true + }(_id, _owner, oldManager, newManager, _collection, sendGasTo, p.payload); + } + + if (sendGasTo.value != 0) { + sendGasTo.transfer({ + value: 0, + flag: 128 + 2, + bounce: false + }); + } + + } + + function _changeManager( + address newManager + ) internal { + address oldManager = _manager; + _manager = newManager; + if (oldManager != newManager) { + emit ManagerChanged(oldManager, newManager); + } + } + + /// @notice Returns the main parameters of the token. + /// @return id - Unique NFT id + /// @return owner - Nft owner + /// @return manager - Nft manager (Used for contract management) + /// @return collection - Collection address (creator) + /// + /// Both internal message and external message can be called. + /// In case of calling external message, you need to add the answerId = 0 parameter + function getInfo() external view virtual override responsible returns( + uint256 id, + address owner, + address manager, + address collection) + { + return {value: 0, flag: 64, bounce: false} ( + _id, + _owner, + _manager, + _collection + ); + } + + function _beforeTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual { + to; sendGasTo; callbacks; //disable warnings + } + + function _afterTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual { + to; sendGasTo; callbacks; //disable warnings + } + + function _beforeChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual { + oldOwner; newOwner; sendGasTo; callbacks; //disable warnings + } + + function _afterChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual { + oldOwner; newOwner; sendGasTo; callbacks; //disable warnings + } + + function _beforeChangeManager( + address oldManager, + address newManager, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual { + oldManager; newManager; sendGasTo; callbacks; //disable warnings + } + + function _afterChangeManager( + address oldManager, + address newManager, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual { + oldManager; newManager; sendGasTo; callbacks; //disable warnings + } + + modifier onlyManager virtual { + require(msg.sender == _manager, sender_is_not_manager); + _; + } + + onBounce(TvmSlice body) external { + tvm.rawReserve(0, 4); + + uint32 functionId = body.decode(uint32); + + if (functionId == tvm.functionId(INftChangeManager.onNftChangeManager)) { + if (msg.sender == _manager) { + _manager = _owner; + } + _owner.transfer({value: 0, flag: 128}); + } + } +} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/INftChangeManager.tsol b/contracts/TIP4_1/interfaces/INftChangeManager.tsol new file mode 100644 index 0000000..df14187 --- /dev/null +++ b/contracts/TIP4_1/interfaces/INftChangeManager.tsol @@ -0,0 +1,19 @@ +pragma ton-solidity >= 0.58.1; + +interface INftChangeManager { + + struct CallbackParams { + uint128 value; // ever value will send to address + TvmCell payload; // custom payload will proxying to address + } + + /// @notice change owner callback processing + /// @param id Unique NFT id + /// @param owner Address of nft owner + /// @param oldManager Address of nft manager before manager changed + /// @param newManager Address of new nft manager + /// @param collection Address of collection smart contract that mint the NFT + /// @param sendGasTo - Address to send remaining gas + // @param payload - Custom payload + function onNftChangeManager(uint256 id, address owner, address oldManager, address newManager, address collection, address sendGasTo, TvmCell payload) external; +} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/INftChangeOwner.tsol b/contracts/TIP4_1/interfaces/INftChangeOwner.tsol new file mode 100644 index 0000000..963392c --- /dev/null +++ b/contracts/TIP4_1/interfaces/INftChangeOwner.tsol @@ -0,0 +1,27 @@ +pragma ever-solidity ^0.62.0; + +interface INftChangeOwner { + + struct CallbackParams { + uint128 value; // ever value will send to address + TvmCell payload; // custom payload will be proxied to address + } + + /// @notice change owner callback processing + /// @param id Unique NFT id + /// @param manager Address of NFT manager + /// @param oldOwner Address of NFT owner before owner changed + /// @param newOwner Address of new NFT owner + /// @param collection Address of collection smart contract, that mint the NFT + /// @param sendGasTo Address to send remaining gas + /// @param payload Custom payload + function onNftChangeOwner( + uint256 id, + address manager, + address oldOwner, + address newOwner, + address collection, + address sendGasTo, + TvmCell payload + ) external; +} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/INftTransfer.tsol b/contracts/TIP4_1/interfaces/INftTransfer.tsol new file mode 100644 index 0000000..c637f41 --- /dev/null +++ b/contracts/TIP4_1/interfaces/INftTransfer.tsol @@ -0,0 +1,29 @@ +pragma ever-solidity ^0.62.0; + +interface INftTransfer { + + struct CallbackParams { + uint128 value; // ever value will send to address + TvmCell payload; // custom payload will proxying to address + } + + /// @notice change owner callback processing + /// @param id Unique NFT id + /// @param oldOwner Address of NFT owner before transfer + /// @param newOwner Address of new NFT owner + /// @param oldManager Address of NFT manager before transfer + /// @param newManager Address of new NFT manager + /// @param collection Address of collection smart contract that mint the NFT + /// @param gasReceiver Address to send remaining gas + /// @param payload Custom payload + function onNftTransfer( + uint256 id, + address oldOwner, + address newOwner, + address oldManager, + address newManager, + address collection, + address gasReceiver, + TvmCell payload + ) external; +} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/ITIP4_1Collection.tsol b/contracts/TIP4_1/interfaces/ITIP4_1Collection.tsol new file mode 100644 index 0000000..63bfcca --- /dev/null +++ b/contracts/TIP4_1/interfaces/ITIP4_1Collection.tsol @@ -0,0 +1,38 @@ +pragma ton-solidity >= 0.58.0; + +interface ITIP4_1Collection { + + /// @notice This event emits when NFTs are created + /// @param id Unique NFT id + /// @param nft Address NFT contact + /// @param owner Address of NFT owner + /// @param manager Address of NFT manager + /// @param creator Address of creator that initialize mint NFT + event NftCreated(uint256 id, address nft, address owner, address manager, address creator); + + /// @notice This event emits when NFTs are burned + /// @param id Unique NFT id + /// @param nft Address NFT contact + /// @param owner Address of NFT owner when it burned + /// @param manager Address of NFT manager when it burned + event NftBurned(uint256 id, address nft, address owner, address manager); + + + /// @notice Count active NFTs for this collection + /// @return count A count of active NFTs minted by this contract except for burned NFTs + function totalSupply() external view responsible returns (uint128 count); + + /// @notice Returns the NFT code + /// @return code Returns the NFT code as TvmCell + function nftCode() external view responsible returns (TvmCell code); + + /// @notice Returns the NFT code hash + /// @return codeHash Returns the NFT code hash + function nftCodeHash() external view responsible returns (uint256 codeHash); + + /// @notice Computes NFT address by unique NFT id + /// @dev Return unique address for all Ids. You find nothing by address for not a valid NFT. + /// @param id Unique NFT id + /// @return nft Returns address of NFT contract + function nftAddress(uint256 id) external view responsible returns (address nft); +} \ No newline at end of file diff --git a/contracts/TIP4_1/interfaces/ITIP4_1NFT.tsol b/contracts/TIP4_1/interfaces/ITIP4_1NFT.tsol new file mode 100644 index 0000000..3abcd03 --- /dev/null +++ b/contracts/TIP4_1/interfaces/ITIP4_1NFT.tsol @@ -0,0 +1,67 @@ +pragma ton-solidity >= 0.58.1; + +interface ITIP4_1NFT { + + struct CallbackParams { + uint128 value; // ever value will send to address + TvmCell payload; // custom payload will proxying to address + } + + /// @notice The event emits when NFT created + /// @dev Emit the event when NFT is ready to use + /// @param id Unique NFT id + /// @param owner Address of NFT owner + /// @param manager Address of NFT manager + /// @param collection Address of collection smart contract, that mint the NFT + event NftCreated(uint256 id, address owner, address manager, address collection); + + /// @notice The event emits when NFT owner changed + /// @param oldOwner Address of NFT owner before owner changed + /// @param newOwner Address of new NFT owner + event OwnerChanged(address oldOwner, address newOwner); + + /// @notice The event emits when NFT manager changed + /// @param oldManager Address of NFT manager before manager changed + /// @param newManager Address of new NFT manager + event ManagerChanged(address oldManager, address newManager); + + /// @param id Unique NFT id + /// @param owner Address of NFT owner + /// @param manager Address of NFT manager + /// @param collection Address of collection smart contract, that mint the NFT + event NftBurned(uint256 id, address owner, address manager, address collection); + + /// @notice NFT info + /// @return id Unique NFT id + /// @return owner Address of NFT owner + /// @return manager Address of NFT manager + /// @return collection Address of collection smart contract + function getInfo() external view responsible returns(uint256 id, address owner, address manager, address collection); + + /// @notice Change NFT owner + /// @dev Invoked from manager address only + /// @dev Good practices is сhange manager address to newOwner address too + /// @dev Emit OwnerChanged + /// @dev Emit ManagerChanged events if manager address changed + /// @param newOwner - New owner of NFT + /// @param sendGasTo - Address to send remaining gas + /// @param callbacks - Callbacks array to send by addresses. It can be empty. + function changeOwner(address newOwner, address sendGasTo, mapping(address => CallbackParams) callbacks) external; + + /// @notice Change NFT manager + /// @dev Invoked from manager address only + /// @dev Emit ManagerChanged event + /// @param newManager - New manager of NFT + /// @param sendGasTo - Address to send remaining gas + /// @param callbacks - Callbacks array to send by addresses. It can be empty. + function changeManager(address newManager, address sendGasTo, mapping(address => CallbackParams) callbacks) external; + + /// @notice Change NFT owner and manager + /// @dev Invoked from manager address only + /// @dev Emit OwnerChanged + /// @dev Emit ManagerChanged + /// @param to - New NFT owner and manager + /// @param sendGasTo Address to send remaining gas + /// @param callbacks Callbacks array to send by addresses. It can be empty + function transfer(address to, address sendGasTo, mapping(address => CallbackParams) callbacks) external; +} \ No newline at end of file diff --git a/contracts/TIP4_2/TIP4_2Collection.tsol b/contracts/TIP4_2/TIP4_2Collection.tsol new file mode 100644 index 0000000..3f6cf55 --- /dev/null +++ b/contracts/TIP4_2/TIP4_2Collection.tsol @@ -0,0 +1,52 @@ +/// We recommend using the compiler version 0.58.1. +/// You can use other versions, but we do not guarantee compatibility of the compiler version. +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import '../TIP4_1/TIP4_1Collection.tsol'; +import './interfaces/ITIP4_2JSON_Metadata.tsol'; +import './TIP4_2Nft.tsol'; + + +/// This contract implement TIP4_1Collection and ITIP4_2JSON_Metadata (add JSON Metadata) +/// Add change deploy contract in _buildNftState (TIP4_1Nft => TIP4_2Nft) +abstract contract TIP4_2Collection is TIP4_1Collection, ITIP4_2JSON_Metadata { + + /// JSON metadata + /// In order to fill in this field correctly, see https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/2.md + string _json; + + constructor( + string json + ) public { + tvm.accept(); + + _json = json; + + _supportedInterfaces[ + bytes4(tvm.functionId(ITIP4_2JSON_Metadata.getJson)) + ] = true; + } + + /// See interfaces/ITIP4_2JSON_Metadata.sol + function getJson() external virtual view override responsible returns (string json) { + return {value: 0, flag: 64, bounce: false} (_json); + } + + /// Overrides standard method, because Nft contract is changed + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual override pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: TIP4_2Nft, + varInit: {_id: id}, + code: code + }); + } + +} \ No newline at end of file diff --git a/contracts/TIP4_2/TIP4_2Nft.tsol b/contracts/TIP4_2/TIP4_2Nft.tsol new file mode 100644 index 0000000..32c20b1 --- /dev/null +++ b/contracts/TIP4_2/TIP4_2Nft.tsol @@ -0,0 +1,37 @@ +/// We recommend using the compiler version 0.58.1. +/// You can use other versions, but we do not guarantee compatibility of the compiler version. +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import '../TIP4_1/TIP4_1Nft.tsol'; +import './interfaces/ITIP4_2JSON_Metadata.tsol'; + + +/// This contract implement TIP4_1Nft and ITIP4_2JSON_Metadata (add JSON Metadata) +/// ... Read more here (https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-6/1.md) +abstract contract TIP4_2Nft is TIP4_1Nft, ITIP4_2JSON_Metadata { + + /// JSON metadata + /// In order to fill in this field correctly, see https://github.com/nftalliance/docs/blob/main/src/Standard/TIP-4/2.md + string _json; + + constructor( + string json + ) public { + _json = json; + + _supportedInterfaces[ + bytes4(tvm.functionId(ITIP4_2JSON_Metadata.getJson)) + ] = true; + } + + /// See interfaces/ITIP4_2JSON_Metadata.sol + function getJson() external virtual view override responsible returns (string json) { + return {value: 0, flag: 64, bounce: false} (_json); + } + +} \ No newline at end of file diff --git a/contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.tsol b/contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.tsol new file mode 100644 index 0000000..5965ceb --- /dev/null +++ b/contracts/TIP4_2/interfaces/ITIP4_2JSON_Metadata.tsol @@ -0,0 +1,9 @@ +pragma ton-solidity >= 0.58.1; + +interface ITIP4_2JSON_Metadata { + + /// @notice metadata in JSON format + /// @return json The JSON string with metadata + function getJson() external view responsible returns (string json); + +} \ No newline at end of file diff --git a/contracts/TIP4_3/Index.tsol b/contracts/TIP4_3/Index.tsol new file mode 100644 index 0000000..f452413 --- /dev/null +++ b/contracts/TIP4_3/Index.tsol @@ -0,0 +1,64 @@ +pragma ton-solidity >= 0.58.0; + + +import 'interfaces/IIndex.tsol'; + + +/** + * Errors + * 101 - Method for NFT only + * 102 - Salt doesn't contain any value + **/ + +/// @title This contract helps to find: +/// All user tokens in current collection using owner address and collection address +/// All user tokens in all collections using owner address +contract Index is IIndex { + + /// Nft address + address static _nft; + + /// Collection address, it is filled in either via the constructor parameter, or via salt + address _collection; + + /// Nft owner address + address _owner; + + constructor(address collection) public { + optional(TvmCell) salt = tvm.codeSalt(tvm.code()); + require(salt.hasValue(), 102, "Salt doesn't contain any value"); + (, address collection_, address owner) = salt + .get() + .toSlice() + .decode(string, address, address); + require(msg.sender == _nft); + tvm.accept(); + _collection = collection_; + _owner = owner; + if (collection_.value == 0) { + _collection = collection; + } + } + + /// @return collection (address) - collection token contract address + /// @return owner (address) - token owner contract address + /// @return nft (address) - token contract address + function getInfo() override public view responsible returns ( + address collection, + address owner, + address nft + ) { + return {value: 0, flag: 64, bounce: true} ( + _collection, + _owner, + _nft + ); + } + + /// @notice This method used for destruct token, can be called only by nft + /// @param gasReceiver - address where all crystals from the contract will be sent + function destruct(address gasReceiver) override public { + require(msg.sender == _nft, 101, "Method for NFT only"); + selfdestruct(gasReceiver); + } +} \ No newline at end of file diff --git a/contracts/TIP4_3/IndexBasis.tsol b/contracts/TIP4_3/IndexBasis.tsol new file mode 100644 index 0000000..f42469e --- /dev/null +++ b/contracts/TIP4_3/IndexBasis.tsol @@ -0,0 +1,37 @@ +pragma ton-solidity >= 0.58.0; + +import './interfaces/IIndexBasis.tsol'; + +/** + * Errors + * 101 - Method for collection only + **/ + + +/// @title This contract helps to find all collections by the code hash of which +/// +contract IndexBasis is IIndexBasis { + + /// Collection token contract address + address static _collection; + + modifier onlyCollection() { + require(msg.sender == _collection, 101, "Method for collection only"); + tvm.accept(); + _; + } + + /// Can only be created using a collection + constructor() public onlyCollection {} + + /// @return collection - collection token contract address + function getInfo() override public view responsible returns (address collection) { + return {value: 0, flag: 64, bounce: true} _collection; + } + + /// @notice This method used for destruct token, can be called only by nft + /// @param gasReceiver - address where all crystals from the contract will be sent + function destruct(address gasReceiver) override public onlyCollection { + selfdestruct(gasReceiver); + } +} \ No newline at end of file diff --git a/contracts/TIP4_3/TIP4_3Collection.tsol b/contracts/TIP4_3/TIP4_3Collection.tsol new file mode 100644 index 0000000..6aec407 --- /dev/null +++ b/contracts/TIP4_3/TIP4_3Collection.tsol @@ -0,0 +1,137 @@ +/// We recommend using the compiler version 0.58.1. +/// You can use other versions, but we do not guarantee compatibility of the compiler version. +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import '../TIP4_1/TIP4_1Collection.tsol'; +import './interfaces/ITIP4_3Collection.tsol'; +import './TIP4_3Nft.tsol'; +import './Index.tsol'; +import './IndexBasis.tsol'; + + +/// This contract implement TIP4_1Collection, ITIP4_3Collection (add indexes) +abstract contract TIP4_3Collection is TIP4_1Collection, ITIP4_3Collection { + + /** + * Errors + **/ + uint8 constant value_is_empty = 103; + + /// TvmCell object code of Index contract + TvmCell _codeIndex; + + /// TvmCell object code of IndexBasis contract + TvmCell _codeIndexBasis; + + /// Values for deploy/destroy + uint128 _indexDeployValue = 0.15 ton; + uint128 _indexDestroyValue = 0.1 ton; + uint128 _deployIndexBasisValue = 0.15 ton; + + constructor( + TvmCell codeIndex, + TvmCell codeIndexBasis + ) public { + TvmCell empty; + require(codeIndex != empty, value_is_empty); + tvm.accept(); + + _codeIndex = codeIndex; + _codeIndexBasis = codeIndexBasis; + + _supportedInterfaces[ + bytes4(tvm.functionId(ITIP4_3Collection.indexBasisCode)) ^ + bytes4(tvm.functionId(ITIP4_3Collection.indexBasisCodeHash)) ^ + bytes4(tvm.functionId(ITIP4_3Collection.indexCode)) ^ + bytes4(tvm.functionId(ITIP4_3Collection.indexCodeHash)) ^ + bytes4(tvm.functionId(ITIP4_3Collection.resolveIndexBasis)) + ] = true; + + _deployIndexBasis(); + } + + /// _codeIndexBasis can't be empty + /// Balance value must be greater than _indexDeployValue + function _deployIndexBasis() internal virtual { + TvmCell empty; + require(_codeIndexBasis != empty, value_is_empty); + require(address(this).balance > _deployIndexBasisValue); + + TvmCell code = _buildIndexBasisCode(); + TvmCell state = _buildIndexBasisState(code, address(this)); + new IndexBasis{stateInit: state, value: _deployIndexBasisValue}(); + } + + /// @return code - code of IndexBasis contract + function indexBasisCode() external view override responsible returns (TvmCell code) { + return {value: 0, flag: 64, bounce: false} (_codeIndexBasis); + } + + /// @return hash - calculated hash based on the IndexBasis code + function indexBasisCodeHash() external view override responsible returns (uint256 hash) { + return {value: 0, flag: 64, bounce: false} tvm.hash(_buildIndexBasisCode()); + } + + /// @return indexBasis - address of IndexBasisCode + function resolveIndexBasis() external view override responsible returns (address indexBasis) { + TvmCell code = _buildIndexBasisCode(); + TvmCell state = _buildIndexBasisState(code, address(this)); + uint256 hashState = tvm.hash(state); + indexBasis = address.makeAddrStd(address(this).wid, hashState); + return {value: 0, flag: 64, bounce: false} indexBasis; + } + + /// @notice build IndexBasis code used TvmCell indexBasis code & salt (string stamp) + /// @return TvmCell indexBasisCode + /// about salt read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmcodesalt) + function _buildIndexBasisCode() internal virtual view returns (TvmCell) { + string stamp = "nft"; + TvmBuilder salt; + salt.store(stamp); + return tvm.setCodeSalt(_codeIndexBasis, salt.toCell()); + } + + /// @notice Generates a StateInit from code and data + /// @param code TvmCell code - generated via the _buildIndexBasisCode method + /// @param collection address of token collection contract + /// @return TvmCell object - stateInit + /// about tvm.buildStateInit read more here (https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuildstateinit) + function _buildIndexBasisState( + TvmCell code, + address collection + ) internal virtual pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: IndexBasis, + varInit: {_collection: collection}, + code: code + }); + } + + /// @return code - code of Index contract + function indexCode() external view override responsible returns (TvmCell code) { + return {value: 0, flag: 64, bounce: false} (_codeIndex); + } + + /// @return hash - calculated hash based on the Index code + function indexCodeHash() external view override responsible returns (uint256 hash) { + return {value: 0, flag: 64, bounce: false} tvm.hash(_codeIndex); + } + + /// Overrides standard method, because Nft contract is changed + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual override pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: TIP4_3Nft, + varInit: {_id: id}, + code: code + }); + } + +} \ No newline at end of file diff --git a/contracts/TIP4_3/TIP4_3Nft.tsol b/contracts/TIP4_3/TIP4_3Nft.tsol new file mode 100644 index 0000000..32abd1e --- /dev/null +++ b/contracts/TIP4_3/TIP4_3Nft.tsol @@ -0,0 +1,136 @@ +/// We recommend using the compiler version 0.58.1. +/// You can use other versions, but we do not guarantee compatibility of the compiler version. +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import '../TIP4_1/TIP4_1Nft.tsol'; +import './interfaces/ITIP4_3NFT.tsol'; +import './Index.tsol'; + + +/// This contract implement TIP4_1Collection, ITIP4_3NFT (add indexes) +abstract contract TIP4_3Nft is TIP4_1Nft, ITIP4_3NFT { + + /// Values for deploy/destroy + uint128 _indexDeployValue; + uint128 _indexDestroyValue; + + /// TvmCell object code of Index contract + TvmCell _codeIndex; + + constructor( + uint128 indexDeployValue, + uint128 indexDestroyValue, + TvmCell codeIndex + ) public { + _indexDeployValue = indexDeployValue; + _indexDestroyValue = indexDestroyValue; + _codeIndex = codeIndex; + + _supportedInterfaces[ + bytes4(tvm.functionId(ITIP4_3NFT.indexCode)) ^ + bytes4(tvm.functionId(ITIP4_3NFT.indexCodeHash)) ^ + bytes4(tvm.functionId(ITIP4_3NFT.resolveIndex)) + ] = true; + + _deployIndex(); + } + + function _beforeTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override { + _destructIndex(sendGasTo); + to; callbacks; + } + + function _afterTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override { + to; sendGasTo; callbacks; + _deployIndex(); + } + + function _beforeChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override { + _destructIndex(sendGasTo); + oldOwner; newOwner; callbacks; + } + + function _afterChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override { + oldOwner; newOwner; sendGasTo; callbacks; + _deployIndex(); + } + + function _deployIndex() internal virtual view { + TvmCell codeIndexOwner = _buildIndexCode(address(0), _owner); + TvmCell stateIndexOwner = _buildIndexState(codeIndexOwner, address(this)); + new Index{stateInit: stateIndexOwner, value: _indexDeployValue}(_collection); + + TvmCell codeIndexOwnerRoot = _buildIndexCode(_collection, _owner); + TvmCell stateIndexOwnerRoot = _buildIndexState(codeIndexOwnerRoot, address(this)); + new Index{stateInit: stateIndexOwnerRoot, value: _indexDeployValue}(_collection); + } + + function _destructIndex(address sendGasTo) internal virtual view { + address oldIndexOwner = resolveIndex(address(0), _owner); + IIndex(oldIndexOwner).destruct{value: _indexDestroyValue}(sendGasTo); + address oldIndexOwnerRoot = resolveIndex(_collection, _owner); + IIndex(oldIndexOwnerRoot).destruct{value: _indexDestroyValue}(sendGasTo); + } + + function indexCode() external view override responsible returns (TvmCell code) { + return {value: 0, flag: 64, bounce: false} (_codeIndex); + } + + function indexCodeHash() public view override responsible returns (uint256 hash) { + return {value: 0, flag: 64, bounce: false} tvm.hash(_codeIndex); + } + + function resolveIndex(address collection, address owner) public view override responsible returns (address index) { + TvmCell code = _buildIndexCode(collection, owner); + TvmCell state = _buildIndexState(code, address(this)); + uint256 hashState = tvm.hash(state); + index = address.makeAddrStd(address(this).wid, hashState); + return {value: 0, flag: 64, bounce: false} index; + } + + function _buildIndexCode( + address collection, + address owner + ) internal virtual view returns (TvmCell) { + TvmBuilder salt; + salt.store("nft"); + salt.store(collection); + salt.store(owner); + return tvm.setCodeSalt(_codeIndex, salt.toCell()); + } + + function _buildIndexState( + TvmCell code, + address nft + ) internal virtual pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: Index, + varInit: {_nft: nft}, + code: code + }); + } + +} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/IIndex.tsol b/contracts/TIP4_3/interfaces/IIndex.tsol new file mode 100644 index 0000000..7a4acf1 --- /dev/null +++ b/contracts/TIP4_3/interfaces/IIndex.tsol @@ -0,0 +1,10 @@ +pragma ton-solidity >= 0.58.0; + +interface IIndex { + function getInfo() external view responsible returns ( + address collection, + address owner, + address nft + ); + function destruct(address gasReceiver) external; +} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/IIndexBasis.tsol b/contracts/TIP4_3/interfaces/IIndexBasis.tsol new file mode 100644 index 0000000..b52c30a --- /dev/null +++ b/contracts/TIP4_3/interfaces/IIndexBasis.tsol @@ -0,0 +1,6 @@ +pragma ton-solidity >= 0.58.0; + +interface IIndexBasis { + function getInfo() external view responsible returns (address collection); + function destruct(address gasReceiver) external; +} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/ITIP4_3Collection.tsol b/contracts/TIP4_3/interfaces/ITIP4_3Collection.tsol new file mode 100644 index 0000000..5371efc --- /dev/null +++ b/contracts/TIP4_3/interfaces/ITIP4_3Collection.tsol @@ -0,0 +1,9 @@ +pragma ton-solidity >= 0.58.0; + +interface ITIP4_3Collection { + function indexBasisCode() external view responsible returns (TvmCell code); + function indexBasisCodeHash() external view responsible returns (uint256 hash); + function indexCode() external view responsible returns (TvmCell code); + function indexCodeHash() external view responsible returns (uint256 hash); + function resolveIndexBasis() external view responsible returns (address indexBasis); +} \ No newline at end of file diff --git a/contracts/TIP4_3/interfaces/ITIP4_3NFT.tsol b/contracts/TIP4_3/interfaces/ITIP4_3NFT.tsol new file mode 100644 index 0000000..ac0be3b --- /dev/null +++ b/contracts/TIP4_3/interfaces/ITIP4_3NFT.tsol @@ -0,0 +1,7 @@ +pragma ton-solidity >= 0.58.0; + +interface ITIP4_3NFT { + function indexCode() external view responsible returns (TvmCell code); + function indexCodeHash() external view responsible returns (uint256 hash); + function resolveIndex(address collection, address owner) external view responsible returns (address index); +} \ No newline at end of file diff --git a/contracts/TIP6/ITIP6.tsol b/contracts/TIP6/ITIP6.tsol new file mode 100644 index 0000000..397271c --- /dev/null +++ b/contracts/TIP6/ITIP6.tsol @@ -0,0 +1,10 @@ +pragma ton-solidity >= 0.58.1; + +interface ITIP6 { + /// @notice Query if a contract implements an interface + /// @param interfaceID The interface identifier, as specified in TIP6.1 + /// @dev Interface identification is specified in TIP6.1. + /// @return `true` if the contract implements `interfaceID` and + /// `interfaceID` is not 0xffffffff, `false` otherwise + function supportsInterface(bytes4 interfaceID) external view responsible returns (bool); +} \ No newline at end of file diff --git a/contracts/TIP6/TIP6.tsol b/contracts/TIP6/TIP6.tsol new file mode 100644 index 0000000..0512fd6 --- /dev/null +++ b/contracts/TIP6/TIP6.tsol @@ -0,0 +1,17 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + +import './ITIP6.tsol'; + +abstract contract TIP6 is ITIP6 { + + mapping(bytes4 => bool) internal _supportedInterfaces; + + function supportsInterface(bytes4 interfaceID) external override view responsible returns (bool) { + return {value: 0, flag: 64, bounce: false} _supportedInterfaces[interfaceID]; + } + +} \ No newline at end of file diff --git a/contracts/access/OwnableExternal.tsol b/contracts/access/OwnableExternal.tsol new file mode 100644 index 0000000..a1ef827 --- /dev/null +++ b/contracts/access/OwnableExternal.tsol @@ -0,0 +1,36 @@ +pragma ton-solidity >= 0.58.1; + +/// @title This extension is used to add the owner role to the contract. It is used to manage contracts through external messages. +abstract contract OwnableExternal { + + /// Owner pubkey (0x...) + uint256 private _owner; + + event OwnershipTransferred(uint256 oldOwner, uint256 newOwner); + + constructor (uint256 owner) public { + _transferOwnership(owner); + } + + function owner() public view virtual responsible returns (uint256 pubkey) { + return {value: 0, flag: 64, bounce: false}_owner; + } + + function transferOwnership(uint256 newOwner) public virtual onlyOwner { + require(newOwner != 0, 100); + _transferOwnership(newOwner); + } + + function _transferOwnership(uint256 newOwner) internal virtual { + uint256 oldOwner = _owner; + _owner = newOwner; + emit OwnershipTransferred(oldOwner, newOwner); + } + + modifier onlyOwner() virtual { + require(owner() == msg.pubkey(), 100); + tvm.accept(); + _; + } + +} \ No newline at end of file diff --git a/contracts/access/OwnableInternal.tsol b/contracts/access/OwnableInternal.tsol new file mode 100644 index 0000000..2922956 --- /dev/null +++ b/contracts/access/OwnableInternal.tsol @@ -0,0 +1,37 @@ +pragma ton-solidity >= 0.58.1; + +/// @title This extension is used to add the owner role to the contract. It is used to manage contracts through internal messages. +abstract contract OwnableInternal { + + /// Owner address (0:...) + address private _owner; + + event OwnershipTransferred(address oldOwner, address newOwner); + + constructor (address owner) public { + _transferOwnership(owner); + } + + function owner() public view virtual returns (address owner_) { + return _owner; + } + + function transferOwnership(address newOwner) public virtual onlyOwner { + require(newOwner.value != 0, 100); + _transferOwnership(newOwner); + } + + function _transferOwnership(address newOwner) internal virtual { + address oldOwner = _owner; + _owner = newOwner; + emit OwnershipTransferred(oldOwner, newOwner); + } + + /// @dev придумать, как хранить ошибки в extensions + modifier onlyOwner() virtual { + require(owner() == msg.sender, 100); + require(msg.value != 0, 101); + _; + } + +} \ No newline at end of file diff --git a/test/contracts/TIP4_1/TIP4_1CollectionCon.tsol b/test/contracts/TIP4_1/TIP4_1CollectionCon.tsol new file mode 100644 index 0000000..9c2595a --- /dev/null +++ b/test/contracts/TIP4_1/TIP4_1CollectionCon.tsol @@ -0,0 +1,53 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import "../../../contracts/TIP4_1/TIP4_1Collection.tsol"; +import "./TIP4_1NftCon.tsol"; + + +contract TIP4_1CollectionCon is TIP4_1Collection { + + constructor(TvmCell codeNft) TIP4_1Collection(codeNft) public { + tvm.accept(); + } + + function mintNft( + uint128 id, + address owner + ) external returns(address nftAddr) { + tvm.accept(); + + TvmCell codeNft = _buildNftCode(address(this)); + TvmCell stateNft = _buildNftState(codeNft, uint256(id)); + nftAddr = new TIP4_1NftCon{ + stateInit: stateNft, + value: 0.5 ever, + flag: 1 + }( + owner, + address(this), + 0.3 ever + ); + + _totalSupply++; + } + + function nftCodeWithoutSalt() external view responsible returns (TvmCell nftCode) { + return {value: 0, flag: 64, bounce: false} (_codeNft); + } + + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual override pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: TIP4_1NftCon, + varInit: {_id: id}, + code: code + }); + } +} diff --git a/test/contracts/TIP4_1/TIP4_1NftCon.tsol b/test/contracts/TIP4_1/TIP4_1NftCon.tsol new file mode 100644 index 0000000..89951cb --- /dev/null +++ b/test/contracts/TIP4_1/TIP4_1NftCon.tsol @@ -0,0 +1,23 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + +import "../../../contracts/TIP4_1/TIP4_1Nft.tsol"; + +contract TIP4_1NftCon is TIP4_1Nft { + + constructor( + address owner, + address sendGasTo, + uint128 remainOnNft + ) TIP4_1Nft( + owner, + sendGasTo, + remainOnNft + ) public { + tvm.accept(); + } + +} \ No newline at end of file diff --git a/test/contracts/TIP4_2/TIP4_2CollectionCon.tsol b/test/contracts/TIP4_2/TIP4_2CollectionCon.tsol new file mode 100644 index 0000000..590415d --- /dev/null +++ b/test/contracts/TIP4_2/TIP4_2CollectionCon.tsol @@ -0,0 +1,63 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import "../../../contracts/TIP4_2/TIP4_2Collection.tsol"; +import "./TIP4_2NftCon.tsol"; + + +contract Collection is TIP4_2Collection { + + constructor( + TvmCell codeNft, + string json + ) TIP4_1Collection ( + codeNft + ) TIP4_2Collection ( + json + ) public { + tvm.accept(); + } + + function mintNft( + uint128 id, + address owner, + string json + ) external virtual { + tvm.accept(); + + _totalSupply++; + + TvmCell codeNft = _buildNftCode(address(this)); + TvmCell stateNft = _buildNftState(codeNft, uint256(id)); + new TIP4_2NftCon{ + stateInit: stateNft, + value: 0.2 ever, + flag: 1 + }( + owner, + address(this), + 0.1 ever, + json + ); + } + + function nftCodeWithoutSalt() external view responsible returns (TvmCell nftCode) { + return {value: 0, flag: 64, bounce: false} (_codeNft); + } + + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual override pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: TIP4_2NftCon, + varInit: {_id: id}, + code: code + }); + } + +} \ No newline at end of file diff --git a/test/contracts/TIP4_2/TIP4_2NftCon.tsol b/test/contracts/TIP4_2/TIP4_2NftCon.tsol new file mode 100644 index 0000000..0c9a5e2 --- /dev/null +++ b/test/contracts/TIP4_2/TIP4_2NftCon.tsol @@ -0,0 +1,29 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import "../../../contracts/TIP4_1/TIP4_1Nft.tsol"; +import "../../../contracts/TIP4_2/TIP4_2Nft.tsol"; + + +contract TIP4_2NftCon is TIP4_1Nft, TIP4_2Nft { + + constructor( + address owner, + address sendGasTo, + uint128 remainOnNft, + string json + ) TIP4_1Nft( + owner, + sendGasTo, + remainOnNft + ) TIP4_2Nft ( + json + ) public { + tvm.accept(); + } + +} \ No newline at end of file diff --git a/test/contracts/TIP4_3/TIP4_3CollectionCon.tsol b/test/contracts/TIP4_3/TIP4_3CollectionCon.tsol new file mode 100644 index 0000000..247241f --- /dev/null +++ b/test/contracts/TIP4_3/TIP4_3CollectionCon.tsol @@ -0,0 +1,70 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import "../../../contracts/TIP4_3/TIP4_3Collection.tsol"; +import './TIP4_3NftCon.tsol'; + + +contract Collection is TIP4_3Collection { + + /// _remainOnNft - the number of crystals that will remain after the entire mint + /// process is completed on the Nft contract + uint128 _remainOnNft = 0.3 ever; + + constructor( + TvmCell codeNft, + TvmCell codeIndex, + TvmCell codeIndexBasis + ) TIP4_1Collection ( + codeNft + ) TIP4_3Collection ( + codeIndex, + codeIndexBasis + ) public { + tvm.accept(); + } + + function mintNft( + uint128 id, + address owner + ) external virtual { + tvm.accept(); + + _totalSupply++; + + TvmCell codeNft = _buildNftCode(address(this)); + TvmCell stateNft = _buildNftState(codeNft, uint256(id)); + new TIP4_3NftCon{ + stateInit: stateNft, + value: 0.7 ever, + flag: 1 + }( + owner, + owner, + _remainOnNft, + _indexDeployValue, + _indexDestroyValue, + _codeIndex + ); + } + + function nftCodeWithoutSalt() external view responsible returns (TvmCell nftCode) { + return {value: 0, flag: 64, bounce: false} (_codeNft); + } + + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual override pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: TIP4_3NftCon, + varInit: {_id: id}, + code: code + }); + } + +} \ No newline at end of file diff --git a/test/contracts/TIP4_3/TIP4_3NftCon.tsol b/test/contracts/TIP4_3/TIP4_3NftCon.tsol new file mode 100644 index 0000000..c410e68 --- /dev/null +++ b/test/contracts/TIP4_3/TIP4_3NftCon.tsol @@ -0,0 +1,68 @@ +pragma ton-solidity >= 0.58.1; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import "../../../contracts/TIP4_1/TIP4_1Nft.tsol"; +import "../../../contracts/TIP4_3/TIP4_3Nft.tsol"; + + +contract TIP4_3NftCon is TIP4_1Nft, TIP4_3Nft { + + constructor( + address owner, + address sendGasTo, + uint128 remainOnNft, + uint128 indexDeployValue, + uint128 indexDestroyValue, + TvmCell codeIndex + ) TIP4_1Nft( + owner, + sendGasTo, + remainOnNft + ) TIP4_3Nft ( + indexDeployValue, + indexDestroyValue, + codeIndex + ) public { + tvm.accept(); + } + + function _beforeTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._beforeTransfer(to, sendGasTo, callbacks); + } + + function _afterTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._afterTransfer(to, sendGasTo, callbacks); + } + + + function _beforeChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._beforeChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); + } + + function _afterChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._afterChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); + } + +} \ No newline at end of file diff --git a/test/contracts/TIP6/TIP6Con.tsol b/test/contracts/TIP6/TIP6Con.tsol new file mode 100644 index 0000000..508b58f --- /dev/null +++ b/test/contracts/TIP6/TIP6Con.tsol @@ -0,0 +1,17 @@ +pragma ton-solidity >= 0.58.1; +pragma AbiHeader expire; +pragma AbiHeader pubkey; + + +import "../../../contracts/TIP6/TIP6.tsol"; + + +contract TIP6Con is TIP6 { + + constructor() public { + tvm.accept(); + + _supportedInterfaces[ bytes4(tvm.functionId(ITIP6.supportsInterface)) ] = true; + } + +} diff --git a/test/contracts/Wallet.tsol b/test/contracts/Wallet.tsol new file mode 100644 index 0000000..033e241 --- /dev/null +++ b/test/contracts/Wallet.tsol @@ -0,0 +1,43 @@ +pragma ton-solidity >= 0.39.0; +pragma AbiHeader expire; +pragma AbiHeader pubkey; + +contract Account { + uint public owner; + uint public static _randomNonce; + + modifier onlyOwner() { + require(msg.pubkey() == owner, 501); + _; + } + + modifier checkPubKey() { + require(msg.pubkey() == tvm.pubkey(), 500); + _; + } + + constructor() public checkPubKey { + tvm.accept(); + setOwnership(msg.pubkey()); + } + + function setOwnership(uint newOwner) internal { + owner = newOwner; + } + + function sendTransaction( + address dest, + uint128 value, + bool bounce, + uint8 flags, + TvmCell payload + ) + public + view + onlyOwner + { + tvm.accept(); + + dest.transfer(value, bounce, flags, payload); + } +} \ No newline at end of file diff --git a/test/contracts/access/OwnableExternalContract.tsol b/test/contracts/access/OwnableExternalContract.tsol new file mode 100644 index 0000000..e159ca8 --- /dev/null +++ b/test/contracts/access/OwnableExternalContract.tsol @@ -0,0 +1,19 @@ +pragma ton-solidity >= 0.58.1; +pragma AbiHeader expire; +pragma AbiHeader pubkey; + + +import "../../../contracts/access/OwnableExternal.tsol"; + + +contract OwnableExternalContract is OwnableExternal { + + uint16 static _nonce; + + event Test(); + + constructor(uint256 owner) OwnableExternal(owner) public { + tvm.accept(); + } + +} diff --git a/test/contracts/access/OwnableInternalContract.tsol b/test/contracts/access/OwnableInternalContract.tsol new file mode 100644 index 0000000..5dd153c --- /dev/null +++ b/test/contracts/access/OwnableInternalContract.tsol @@ -0,0 +1,19 @@ +pragma ton-solidity >= 0.58.1; +pragma AbiHeader expire; +pragma AbiHeader pubkey; + + +import "../../../contracts/access/OwnableInternal.tsol"; + + +contract OwnableInternalContract is OwnableInternal { + + uint16 static _nonce; + + event Test(); + + constructor(address owner) OwnableInternal(owner) public { + tvm.accept(); + } + +} From 8a3c071929a639eb98cc968967b1ab014b1fad2a Mon Sep 17 00:00:00 2001 From: Ivan Kotelnikov Date: Mon, 15 May 2023 05:42:05 +0300 Subject: [PATCH 3/8] Update README.md --- README.md | 72 +++++++++++++++++++------------------------------------ 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 89c6b49..465d9ef 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# everscale-tip +# TIP4 NFT +# Prerequisites -# What is needed for development? +- Install [npm](https://www.npmjs.com/) +- Install [Locklift](https://github.com/broxus/locklift.git) -- Install [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) -- Install [TVM linker](https://github.com/tonlabs/TVM-linker/releases/tag/0.14.2) -- Install [nmp](https://www.npmjs.com/) # Initialize project 1. Create empty folder and move to it -1. Init npm project. ```npm init -y``` -1. Install itgold library for development NFT. ```npm i @itgold/everscale-tip``` +2. Init locklift project. ```locklift init -y``` +3. Install library for NFT. ```npm i tip4``` +4. Add NFT contracts to `externalContracts` and `precompiled` sections of your `locklift.config.ts` # How to run tests ```npm run test``` @@ -21,22 +21,22 @@ 1. Create ```Nft.tsol``` file and fill it. ```solidity -pragma ton-solidity = 0.62.0; +pragma ton-solidity >= 0.62.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; -import '@itgold/everscale-tip/contracts/TIP4_1/TIP4_1Nft.tsol'; +import 'tip4/contracts/NftBase.tsol'; -contract Nft is TIP4_1Nft { +contract Nft is NftBase { constructor( address owner, address sendGasTo, uint128 remainOnNft - ) TIP4_1Nft( + ) NftBase( owner, sendGasTo, remainOnNft @@ -48,42 +48,36 @@ contract Nft is TIP4_1Nft { 2. Create ```Collection.tsol``` file and fill it. ```solidity -pragma ton-solidity = 0.62.0; +pragma ton-solidity >= 0.62.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; -import '@itgold/everscale-tip/contracts/TIP4_1/TIP4_1Collection.tsol'; -import '@itgold/everscale-tip/contracts/access/OwnableExternal.tsol'; +import 'tip4/contracts/CollectionBase.tsol'; import './Nft.tsol'; -contract Collection is TIP4_1Collection, OwnableExternal { +contract Collection is CollectionBase { /** * Errors **/ - uint8 constant sender_is_not_owner = 100; - uint8 constant value_is_less_than_required = 101; + uint8 constant value_is_less_than_required = 100; - /// _remainOnNft - the number of crystals that will remain after the entire mint - /// process is completed on the Nft contract - uint128 _remainOnNft = 0.3 ton; + /// _remainOnNft - the number of coins that will remain after mint + uint128 _remainOnNft = 3_000_000_00; constructor( - TvmCell codeNft, - uint256 ownerPubkey - ) OwnableExternal( - ownerPubkey - ) TIP4_1Collection ( + TvmCell codeNft + ) CollectionBase ( codeNft ) public { tvm.accept(); } function mintNft() external virtual { - require(msg.value > _remainOnNft + 0.1 ton, value_is_less_than_required); + require(msg.value > _remainOnNft + 1_000_000_00, value_is_less_than_required); tvm.rawReserve(0, 4); uint256 id = uint256(_totalSupply); @@ -111,15 +105,6 @@ contract Collection is TIP4_1Collection, OwnableExternal { } - function setRemainOnNft(uint128 remainOnNft) external virtual { - require(TIP4_1Collection._isOwner(), sender_is_not_owner); - _remainOnNft = remainOnNft; - } - - function _isOwner() internal override onlyOwner returns(bool){ - return true; - } - function _buildNftState( TvmCell code, uint256 id @@ -136,18 +121,9 @@ contract Collection is TIP4_1Collection, OwnableExternal { > TIP: You can use another samples from [everscale-tip-samples](https://github.com/itgoldio/everscale-tip-samples/tree/main/demo) -# Build project +# Build -1. build ```Nft.tsol``` file to use [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) - 1. ```solc Nft.tsol --include-path node_modules``` -1. build ```Collection.tsol``` file to use [TON Solidity Compiler](https://github.com/tonlabs/TON-Solidity-Compiler.git) - 1. ```solc Collection.tsol --include-path node_modules``` -1. compile ```Nft.code``` file to use [TVM linker](https://github.com/tonlabs/TVM-linker/releases/tag/0.14.2) - 1. ```tvm_linker compile --abi-json Nft.abi.json Nft.code --lib stdlib_sol.tvm -o Nft.tvc``` -1. compile ```Collection.code``` file to use [TVM linker](https://github.com/tonlabs/TVM-linker/releases/tag/0.14.2) - 1. ```tvm_linker compile --abi-json Collection.abi.json Collection.code --lib stdlib_sol.tvm -o Collection.tvc``` - -# Deploy NFT - -Deploy ```Collection.tvc``` use [ever-sdk](https://github.com/tonlabs/ever-sdk) or [cli](https://github.com/tonlabs/tonos-cli) +```shell +npx locklift build +``` From 99ed2dd63c5144b0b316a303611f8f6cdd8a1d17 Mon Sep 17 00:00:00 2001 From: Ivan Kotelnikov Date: Mon, 15 May 2023 05:42:18 +0300 Subject: [PATCH 4/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 465d9ef..dfae523 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ # Initialize project 1. Create empty folder and move to it -2. Init locklift project. ```locklift init -y``` +2. Init locklift project. ```locklift init``` 3. Install library for NFT. ```npm i tip4``` 4. Add NFT contracts to `externalContracts` and `precompiled` sections of your `locklift.config.ts` From 095c1f47fa40c69e6c342413b004e0088ecc27e7 Mon Sep 17 00:00:00 2001 From: 1 Date: Mon, 15 May 2023 05:39:30 +0200 Subject: [PATCH 5/8] add base contracts --- CHANGELOG.md | 6 ++ README.md | 113 +-------------------- contracts/CollectionBase.tsol | 89 ++++++++++++++++ contracts/NftBase.tsol | 71 +++++++++++++ package.json | 184 ++++++++++++++++++++++++++++++++-- 5 files changed, 344 insertions(+), 119 deletions(-) create mode 100644 contracts/CollectionBase.tsol create mode 100644 contracts/NftBase.tsol diff --git a/CHANGELOG.md b/CHANGELOG.md index ac65564..ea62ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.1.5 (2023-05-15) + +### Improvements +* Updated to newer compiler version 0.62.0 +* Added `CollectionBase` and `NftBase` implementations to inherit from + ## 1.1.4 (2022-08-17) ### Improvements diff --git a/README.md b/README.md index dfae523..a896a40 100644 --- a/README.md +++ b/README.md @@ -13,117 +13,6 @@ 3. Install library for NFT. ```npm i tip4``` 4. Add NFT contracts to `externalContracts` and `precompiled` sections of your `locklift.config.ts` -# How to run tests +# Run tests ```npm run test``` -# How to use library - -1. Create ```Nft.tsol``` file and fill it. - -```solidity -pragma ton-solidity >= 0.62.0; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import 'tip4/contracts/NftBase.tsol'; - -contract Nft is NftBase { - - constructor( - address owner, - address sendGasTo, - uint128 remainOnNft - ) NftBase( - owner, - sendGasTo, - remainOnNft - ) public {} - -} -``` - -2. Create ```Collection.tsol``` file and fill it. - -```solidity -pragma ton-solidity >= 0.62.0; - -pragma AbiHeader expire; -pragma AbiHeader time; -pragma AbiHeader pubkey; - - -import 'tip4/contracts/CollectionBase.tsol'; -import './Nft.tsol'; - -contract Collection is CollectionBase { - - /** - * Errors - **/ - uint8 constant value_is_less_than_required = 100; - - /// _remainOnNft - the number of coins that will remain after mint - uint128 _remainOnNft = 3_000_000_00; - - constructor( - TvmCell codeNft - ) CollectionBase ( - codeNft - ) public { - tvm.accept(); - } - - function mintNft() external virtual { - require(msg.value > _remainOnNft + 1_000_000_00, value_is_less_than_required); - tvm.rawReserve(0, 4); - - uint256 id = uint256(_totalSupply); - _totalSupply++; - - TvmCell codeNft = _buildNftCode(address(this)); - TvmCell stateNft = _buildNftState(codeNft, id); - address nftAddr = new Nft{ - stateInit: stateNft, - value: 0, - flag: 128 - }( - msg.sender, - msg.sender, - _remainOnNft - ); - - emit NftCreated( - id, - nftAddr, - msg.sender, - msg.sender, - msg.sender - ); - - } - - function _buildNftState( - TvmCell code, - uint256 id - ) internal virtual override pure returns (TvmCell) { - return tvm.buildStateInit({ - contr: Nft, - varInit: {_id: id}, - code: code - }); - } - -} -``` - -> TIP: You can use another samples from [everscale-tip-samples](https://github.com/itgoldio/everscale-tip-samples/tree/main/demo) - -# Build - -```shell -npx locklift build -``` - diff --git a/contracts/CollectionBase.tsol b/contracts/CollectionBase.tsol new file mode 100644 index 0000000..46ded1f --- /dev/null +++ b/contracts/CollectionBase.tsol @@ -0,0 +1,89 @@ +pragma ever-solidity >= 0.62.0; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import './TIP4_2/TIP4_2Collection.tsol'; +import './TIP4_3/TIP4_3Collection.tsol'; +import './NftBase.tsol'; + + +contract Collection is TIP4_2Collection, TIP4_3Collection { + + /** + * Errors + **/ + uint8 constant sender_is_not_owner = 101; + uint8 constant value_is_less_than_required = 102; + + + /// _remainOnNft - the number of crystals that will remain after the entire mint + /// process is completed on the Nft contract + uint128 _remainOnNft = 0.3 ever; + + constructor( + TvmCell codeNft, + TvmCell codeIndex, + TvmCell codeIndexBasis, + string json + ) TIP4_1Collection ( + codeNft + ) TIP4_2Collection ( + json + ) TIP4_3Collection ( + codeIndex, + codeIndexBasis + ) public { + tvm.accept(); + } + + function mintNft( + string json + ) external { + require(msg.value > _remainOnNft + (2 * _indexDeployValue), value_is_less_than_required); + /// reserve original_balance + tvm.rawReserve(0, 4); + + uint256 id = _totalSupply; + _totalSupply++; + + TvmCell codeNft = _buildNftCode(address(this)); + TvmCell stateNft = _buildNftState(codeNft, id); + address nftAddr = new NftBase{ + stateInit: stateNft, + value: 0, + flag: 128 + }( + msg.sender, + msg.sender, + _remainOnNft, + json, + _indexDeployValue, + _indexDestroyValue, + _codeIndex + ); + + emit NftCreated( + id, + nftAddr, + msg.sender, + msg.sender, + msg.sender + ); + + } + + function _buildNftState( + TvmCell code, + uint256 id + ) internal virtual override(TIP4_2Collection, TIP4_3Collection) pure returns (TvmCell) { + return tvm.buildStateInit({ + contr: NftBase, + varInit: {_id: id}, + code: code + }); + } + +} diff --git a/contracts/NftBase.tsol b/contracts/NftBase.tsol new file mode 100644 index 0000000..6349780 --- /dev/null +++ b/contracts/NftBase.tsol @@ -0,0 +1,71 @@ +pragma ever-solidity >= 0.62.0; + +pragma AbiHeader expire; +pragma AbiHeader time; +pragma AbiHeader pubkey; + + +import './TIP4_1/TIP4_1Nft.tsol'; +import './TIP4_2/TIP4_2Nft.tsol'; +import './TIP4_3/TIP4_3Nft.tsol'; + + +contract NftBase is TIP4_1Nft, TIP4_2Nft, TIP4_3Nft { + + constructor( + address owner, + address sendGasTo, + uint128 remainOnNft, + string json, + uint128 indexDeployValue, + uint128 indexDestroyValue, + TvmCell codeIndex + ) TIP4_1Nft( + owner, + sendGasTo, + remainOnNft + ) TIP4_2Nft ( + json + ) TIP4_3Nft ( + indexDeployValue, + indexDestroyValue, + codeIndex + ) public { + tvm.accept(); + } + + function _beforeTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._beforeTransfer(to, sendGasTo, callbacks); + } + + function _afterTransfer( + address to, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._afterTransfer(to, sendGasTo, callbacks); + } + + function _beforeChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._beforeChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); + } + + function _afterChangeOwner( + address oldOwner, + address newOwner, + address sendGasTo, + mapping(address => CallbackParams) callbacks + ) internal virtual override(TIP4_1Nft, TIP4_3Nft) { + TIP4_3Nft._afterChangeOwner(oldOwner, newOwner, sendGasTo, callbacks); + } + +} \ No newline at end of file diff --git a/package.json b/package.json index d1a1bfa..afd2d1b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@itgold/everscale-tip", + "name": "tip4", "version": "1.1.4", - "description": "Secure Smart Contract library for Solidity", + "description": "TIP-4 NFT Smart Contracts for TVM-compatible networks", "files": [ "/contracts/**" ], @@ -10,22 +10,22 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/itgoldio/everscale-tip4.git" + "url": "git+https://github.com/qwadratic/tip4.git" }, "author": "ITgold ", "license": "MIT", "bugs": { - "url": "https://github.com/itgoldio/everscale-tip4/issues" + "url": "https://github.com/qwadratic/tip4/issues" }, - "homepage": "https://github.com/itgoldio/everscale-tip4#readme", + "homepage": "https://github.com/qwadratic/tip4#readme", "keywords": [ "solidity", + "tsol", + "venom", "everscale", "smart", "contracts", - "security", "nft", - "ITgold" ], "devDependencies": { "@types/chai": "^4.3.4", @@ -37,5 +37,175 @@ "prettier": "^2.8.7", "ts-mocha": "^10.0.0", "typescript": "^4.7.4" + }, + "main": "index.js", + "directories": { + "test": "test" + }, + "dependencies": { + "ansi-styles": "^4.3.0", + "ansi-regex": "^5.0.1", + "arrify": "^1.0.1", + "assertion-error": "^1.1.0", + "argparse": "^2.0.1", + "async": "^3.2.4", + "asynckit": "^0.4.0", + "anymatch": "^3.1.2", + "bignumber.js": "^9.1.0", + "ansi-colors": "^4.1.1", + "brace-expansion": "^2.0.1", + "array-back": "^3.1.0", + "braces": "^3.0.2", + "browser-stdout": "^1.3.1", + "axios": "^0.27.2", + "balanced-match": "^1.0.2", + "buffer-from": "^1.1.2", + "check-error": "^1.0.2", + "binary-extensions": "^2.2.0", + "camelcase": "^6.3.0", + "combined-stream": "^1.0.8", + "color-convert": "^2.0.1", + "chalk": "^4.1.2", + "command-line-args": "^5.2.1", + "chokidar": "^3.5.3", + "commander": "^9.5.0", + "concat-map": "^0.0.1", + "deep-eql": "^4.1.3", + "debug": "^4.3.4", + "color-name": "^1.1.4", + "deep-extend": "^0.6.0", + "delayed-stream": "^1.0.0", + "detect-file": "^1.0.0", + "cliui": "^7.0.4", + "emoji-regex": "^8.0.0", + "escalade": "^3.1.1", + "directory-tree": "^3.3.0", + "events": "^3.3.0", + "everscale-crypto": "^0.1.1", + "everscale-inpage-provider": "^0.3.58", + "env-paths": "^2.2.1", + "decamelize": "^4.0.0", + "expand-tilde": "^2.0.2", + "diff": "^5.0.0", + "command-line-usage": "^6.1.3", + "escape-string-regexp": "^1.0.5", + "ejs": "^3.1.8", + "fill-range": "^7.0.1", + "fast-safe-stringify": "^2.1.1", + "find-node-modules": "^2.1.3", + "findup-sync": "^4.0.0", + "find-replace": "^3.0.0", + "filelist": "^1.0.4", + "find-up": "^5.0.0", + "follow-redirects": "^1.15.1", + "fs-extra": "^10.1.0", + "fs.realpath": "^1.0.0", + "flat": "^5.0.2", + "fsevents": "^2.3.2", + "get-stdin": "^5.0.1", + "get-func-name": "^2.0.0", + "global-prefix": "^1.0.2", + "get-caller-file": "^2.0.5", + "global-modules": "^1.0.0", + "form-data": "^4.0.0", + "has-flag": "^4.0.0", + "he": "^1.2.0", + "ini": "^1.3.8", + "homedir-polyfill": "^1.0.3", + "glob-parent": "^5.1.2", + "graceful-fs": "^4.2.10", + "glob": "^7.2.0", + "inflight": "^1.0.6", + "is-extglob": "^2.1.1", + "is-fullwidth-code-point": "^3.0.0", + "is-binary-path": "^2.1.0", + "inherits": "^2.0.4", + "is-number": "^7.0.0", + "is-glob": "^4.0.3", + "joi": "^17.9.2", + "is-unicode-supported": "^0.1.0", + "is-plain-obj": "^2.1.0", + "is-windows": "^1.0.2", + "jsonfile": "^6.1.0", + "isexe": "^2.0.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "json5": "^1.0.2", + "locate-path": "^6.0.0", + "make-error": "^1.3.6", + "lodash": "^4.17.21", + "jake": "^10.8.5", + "loupe": "^2.3.4", + "merge": "^2.1.1", + "micromatch": "^4.0.5", + "lodash.camelcase": "^4.3.0", + "mime-db": "^1.52.0", + "mime-types": "^2.1.35", + "mkdirp": "^0.5.6", + "nekoton-wasm": "^1.1.5", + "ms": "^2.1.3", + "lower-case": "^1.1.4", + "minimatch": "^3.1.2", + "no-case": "^2.3.2", + "nanoid": "^3.3.3", + "node-gzip": "^1.1.2", + "node-fetch": "^2.6.7", + "normalize-path": "^3.0.0", + "parse-passwd": "^1.0.0", + "minimist": "^1.2.6", + "once": "^1.4.0", + "path-is-absolute": "^1.0.1", + "pathval": "^1.1.1", + "path-exists": "^4.0.0", + "reduce-flatten": "^2.0.0", + "require-directory": "^2.1.1", + "picomatch": "^2.3.1", + "p-limit": "^3.1.0", + "p-locate": "^5.0.0", + "readdirp": "^3.6.0", + "randombytes": "^2.1.0", + "resolve-dir": "^1.0.1", + "source-map": "^0.6.1", + "sentence-case": "^2.1.1", + "safe-buffer": "^5.2.1", + "serialize-javascript": "^6.0.0", + "strip-ansi": "^6.0.1", + "string-width": "^4.2.3", + "source-map-support": "^0.5.21", + "split-text-to-chunks": "^1.0.0", + "supports-color": "^7.2.0", + "strip-bom": "^3.0.0", + "strip-json-comments": "^3.1.1", + "tablemark": "^2.0.0", + "to-regex-range": "^5.0.1", + "ts-node": "^7.0.1", + "tr46": "^0.0.3", + "tsconfig-paths": "^4.1.0", + "table-layout": "^1.0.2", + "typescript-compare": "^0.0.2", + "typescript-logic": "^0.0.0", + "superstruct": "^0.16.0", + "tslib": "^2.4.0", + "typescript-tuple": "^5.0.1", + "rxjs": "^7.5.6", + "typical": "^4.0.0", + "underscore": "^1.13.4", + "upper-case": "^1.1.3", + "type-detect": "^4.0.8", + "universalify": "^2.0.0", + "webidl-conversions": "^3.0.1", + "whatwg-url": "^5.0.0", + "which": "^1.3.1", + "upper-case-first": "^1.1.2", + "wrap-ansi": "^7.0.0", + "yargs-parser": "^20.2.4", + "wrappy": "^1.0.2", + "y18n": "^5.0.8", + "yargs": "^16.2.0", + "workerpool": "^6.2.1", + "wordwrapjs": "^4.0.1", + "yargs-unparser": "^2.0.0", + "yn": "^2.0.0", + "yocto-queue": "^0.1.0" } } From 4ce1cf3e2238bbc52a953f13b59d8aadcf5b07be Mon Sep 17 00:00:00 2001 From: 1 Date: Mon, 15 May 2023 05:40:52 +0200 Subject: [PATCH 6/8] upd package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index afd2d1b..4e544a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tip4", - "version": "1.1.4", + "version": "1.1.5", "description": "TIP-4 NFT Smart Contracts for TVM-compatible networks", "files": [ "/contracts/**" @@ -25,7 +25,7 @@ "everscale", "smart", "contracts", - "nft", + "nft" ], "devDependencies": { "@types/chai": "^4.3.4", From 528c518283cab8c3cb1a02365ccfea467001d830 Mon Sep 17 00:00:00 2001 From: 1 Date: Mon, 15 May 2023 05:43:52 +0200 Subject: [PATCH 7/8] Collection -> CollectionBase --- contracts/CollectionBase.tsol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/CollectionBase.tsol b/contracts/CollectionBase.tsol index 46ded1f..d115782 100644 --- a/contracts/CollectionBase.tsol +++ b/contracts/CollectionBase.tsol @@ -10,7 +10,7 @@ import './TIP4_3/TIP4_3Collection.tsol'; import './NftBase.tsol'; -contract Collection is TIP4_2Collection, TIP4_3Collection { +contract CollectionBase is TIP4_2Collection, TIP4_3Collection { /** * Errors From c784d64295224230b93dd40fa5c0b710fef1d633 Mon Sep 17 00:00:00 2001 From: 1 Date: Mon, 15 May 2023 05:51:36 +0200 Subject: [PATCH 8/8] rename base collection contract + switch mintNft to internal --- CHANGELOG.md | 2 +- contracts/CollectionBase.tsol | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea62ff7..db0a996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 1.1.5 (2023-05-15) +## 1.1.6 (2023-05-15) ### Improvements * Updated to newer compiler version 0.62.0 diff --git a/contracts/CollectionBase.tsol b/contracts/CollectionBase.tsol index d115782..812f43d 100644 --- a/contracts/CollectionBase.tsol +++ b/contracts/CollectionBase.tsol @@ -39,9 +39,9 @@ contract CollectionBase is TIP4_2Collection, TIP4_3Collection { tvm.accept(); } - function mintNft( + function _mintNft( string json - ) external { + ) internal { require(msg.value > _remainOnNft + (2 * _indexDeployValue), value_is_less_than_required); /// reserve original_balance tvm.rawReserve(0, 4); diff --git a/package.json b/package.json index 4e544a7..55ab2ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tip4", - "version": "1.1.5", + "version": "1.1.6", "description": "TIP-4 NFT Smart Contracts for TVM-compatible networks", "files": [ "/contracts/**"