diff --git a/script/prod/RolloutTokenizerV12.s.sol b/script/prod/RolloutTokenizerV13.s.sol similarity index 85% rename from script/prod/RolloutTokenizerV12.s.sol rename to script/prod/RolloutTokenizerV13.s.sol index 5bcbb1f9..35aa5f4e 100644 --- a/script/prod/RolloutTokenizerV12.s.sol +++ b/script/prod/RolloutTokenizerV13.s.sol @@ -6,14 +6,14 @@ import { Tokenizer } from "../../src/Tokenizer.sol"; import { IPToken } from "../../src/IPToken.sol"; import { console } from "forge-std/console.sol"; -contract RolloutTokenizerV12 is Script { +contract RolloutTokenizerV13 is Script { function run() public { vm.startBroadcast(); IPToken newIpTokenImplementation = new IPToken(); Tokenizer newTokenizerImplementation = new Tokenizer(); - bytes memory upgradeCallData = abi.encodeWithSelector(Tokenizer.setIPTokenImplementation.selector, address(newIpTokenImplementation)); + bytes memory upgradeCallData = abi.encodeWithSelector(Tokenizer.reinit.selector, address(newIpTokenImplementation)); console.log("NEWTOKENIMPLEMENTATION=%s", address(newIpTokenImplementation)); console.log("NEWTOKENIZER=%s", address(newTokenizerImplementation)); diff --git a/src/Tokenizer.sol b/src/Tokenizer.sol index 3f33690d..2c16c7e9 100644 --- a/src/Tokenizer.sol +++ b/src/Tokenizer.sol @@ -19,7 +19,14 @@ error IPTNotControlledByTokenizer(); /// @notice tokenizes an IPNFT to an ERC20 token (called IPToken or IPT) and controls its supply. contract Tokenizer is UUPSUpgradeable, OwnableUpgradeable { event TokensCreated( - uint256 indexed ipnftId, address indexed tokenContract, address emitter, uint256 amount, string agreementCid, string name, string symbol + uint256 indexed moleculesId, + uint256 indexed ipnftId, + address indexed tokenContract, + address emitter, + uint256 amount, + string agreementCid, + string name, + string symbol ); event IPTokenImplementationUpdated(IPToken indexed old, IPToken indexed _new); @@ -129,7 +136,17 @@ contract Tokenizer is UUPSUpgradeable, OwnableUpgradeable { synthesized[ipnftId] = token; //this has been called MoleculesCreated before - emit TokensCreated(ipnftId, address(token), _msgSender(), tokenAmount, agreementCid, name, tokenSymbol); + emit TokensCreated( + //upwards compatibility: signaling an unique "Molecules ID" as first parameter ("sales cycle id"). This is unused and not interpreted. + uint256(keccak256(abi.encodePacked(ipnftId))), + ipnftId, + address(token), + _msgSender(), + tokenAmount, + agreementCid, + name, + tokenSymbol + ); permissioner.accept(token, _msgSender(), signedAgreement); token.issue(_msgSender(), tokenAmount); } diff --git a/subgraph/abis/Tokenizer.json b/subgraph/abis/Tokenizer.json index ec86c282..ac4e89c7 100644 --- a/subgraph/abis/Tokenizer.json +++ b/subgraph/abis/Tokenizer.json @@ -370,6 +370,12 @@ "type": "event", "name": "TokensCreated", "inputs": [ + { + "name": "moleculesId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, { "name": "ipnftId", "type": "uint256", @@ -502,60 +508,5 @@ ], "name": "MoleculesCreated", "type": "event" - }, - { - "type": "event", - "name": "TokensCreated", - "inputs": [ - { - "name": "moleculesId", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "ipnftId", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "tokenContract", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "emitter", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "agreementCid", - "type": "string", - "indexed": false, - "internalType": "string" - }, - { - "name": "name", - "type": "string", - "indexed": false, - "internalType": "string" - }, - { - "name": "symbol", - "type": "string", - "indexed": false, - "internalType": "string" - } - ], - "anonymous": false } ] diff --git a/subgraph/makeAbis.sh b/subgraph/makeAbis.sh index c46e627d..9ad940ae 100755 --- a/subgraph/makeAbis.sh +++ b/subgraph/makeAbis.sh @@ -68,60 +68,6 @@ jq '. += [{ ], "name": "MoleculesCreated", "type": "event" - },{ - "type": "event", - "name": "TokensCreated", - "inputs": [ - { - "name": "moleculesId", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "ipnftId", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "tokenContract", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "emitter", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "agreementCid", - "type": "string", - "indexed": false, - "internalType": "string" - }, - { - "name": "name", - "type": "string", - "indexed": false, - "internalType": "string" - }, - { - "name": "symbol", - "type": "string", - "indexed": false, - "internalType": "string" - } - ], - "anonymous": false }]' ./abis/_Tokenizer.json > ./abis/Tokenizer.json rm ./abis/_Tokenizer.json diff --git a/subgraph/subgraph.yaml b/subgraph/subgraph.yaml index fe79cd2c..94d7b019 100644 --- a/subgraph/subgraph.yaml +++ b/subgraph/subgraph.yaml @@ -73,9 +73,6 @@ dataSources: - name: Tokenizer file: ./abis/Tokenizer.json eventHandlers: - - event: TokensCreated(indexed uint256,indexed - address,address,uint256,string,string,string) - handler: handleIPTsCreated - event: TokensCreated(indexed uint256,indexed uint256,indexed address,address,uint256,string,string,string) handler: handleIPTsCreated