Skip to content

Commit

Permalink
rolled back reduced event signature for subgraph compatibility
Browse files Browse the repository at this point in the history
new deployment preparation script

Signed-off-by: stadolf <[email protected]>
  • Loading branch information
elmariachi111 committed Jul 8, 2024
1 parent 78638e5 commit 8566a19
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
21 changes: 19 additions & 2 deletions src/Tokenizer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
61 changes: 6 additions & 55 deletions subgraph/abis/Tokenizer.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@
"type": "event",
"name": "TokensCreated",
"inputs": [
{
"name": "moleculesId",
"type": "uint256",
"indexed": true,
"internalType": "uint256"
},
{
"name": "ipnftId",
"type": "uint256",
Expand Down Expand Up @@ -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
}
]
54 changes: 0 additions & 54 deletions subgraph/makeAbis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8566a19

Please sign in to comment.