diff --git a/.env b/.env index 09f01f48..ea988566 100644 --- a/.env +++ b/.env @@ -1,10 +1,10 @@ NODE_MODE=developement DATABASE_URL_LOCAL=mongodb://localhost:27017/V2-graphQL DATABASE_URL_ONLINE=mongodb+srv://admin:scytalelabs@cluster0-9yop5.mongodb.net/V2-graphQL?retryWrites=true&w=majority -FACTORY_ADDRESS=eed67f1280bec8429fea0fe7dab38624f0721d0d623ffce6dd0c8647d8cf440e -token0=16aba5b7c0f5d5da614524b0c06f8f07e3c48040ccd0afaafaac32ea3e0d6ca1 -token1=d9157da9a14332fcdf0bf03b5e131112ce3c4f1fa4fa30c462c44d3d8c504115 -pair=d9685083521ad03c0f649d0d33e243762573538896f9b8b72955b26000889079 +FACTORY_ADDRESS=9b3ea6e98ccc08d427b1803242f55cef11468a887498380170284436fc9ae245 +token0=ed4cd910aa2ee3d8df3512fa715e499cb737867770e2cbce458a4af805dd14c4 +token1=7df2fb64e16a464fd97052401984eaadb2c7c7f20deed4b721e6ad8eefec27e4 +pair=d607981f8acc74d69ebce1ebf0cb76b74891b777c51fae2b833e916c811b0afb GRAPHQL=http://localhost:3000/graphql CHAIN_NAME=casper-test @@ -22,7 +22,7 @@ PAIR_MASTER_KEY_PAIR_PATH=JsClients/PAIR/keys/ ERC20_CONTRACT_NAME=erc20 -ERC20_TOKEN_NAME=token3 +ERC20_TOKEN_NAME=token1 ERC20_TOKEN_SYMBOL=erc ERC20_DECIMALS=18 ERC20_TOTAL_SUPPLY=1000 @@ -35,7 +35,7 @@ PAIR_TOTAL_SUPPLY=1000 FACTORY_CONTRACT_NAME=Factory -INSTALL_PAYMENT_AMOUNT=170000000000 +INSTALL_PAYMENT_AMOUNT=235000000000 MINT_PAYMENT_AMOUNT=5000000000 MINT_AMOUNT=50 @@ -66,8 +66,8 @@ SET_FEE_TO_PAYMENT_AMOUNT=5000000000 SET_FEE_TO_SETTER_PAYMENT_AMOUNT=5000000000 CREATE_PAIR_PAYMENT_AMOUNT=5000000000 -FACTORY_CONTRACT=eed67f1280bec8429fea0fe7dab38624f0721d0d623ffce6dd0c8647d8cf440e -PAIR_CONTRACT=d9685083521ad03c0f649d0d33e243762573538896f9b8b72955b26000889079 +FACTORY_CONTRACT=9b3ea6e98ccc08d427b1803242f55cef11468a887498380170284436fc9ae245 +PAIR_CONTRACT=d607981f8acc74d69ebce1ebf0cb76b74891b777c51fae2b833e916c811b0afb CALLEE_CONTRACT=fbfeda8b97f056f526f20c2fc2b486d9bdbfb3e46b9a164527e57c0c86e68612 -TOKEN0_CONTRACT=16aba5b7c0f5d5da614524b0c06f8f07e3c48040ccd0afaafaac32ea3e0d6ca1 -TOKEN1_CONTRACT=d9157da9a14332fcdf0bf03b5e131112ce3c4f1fa4fa30c462c44d3d8c504115 \ No newline at end of file +TOKEN0_CONTRACT=40ce47cab39c3b5629b551876f63c88b8142814be6823b2cc789a8d3780783bb +TOKEN1_CONTRACT=0a2e5c7c70431fafcf624f5f99ceaecb07cdc6f290019e1da956361e5cb3ccae \ No newline at end of file diff --git a/JsClients/ERC20/keys/public_key.pem b/JsClients/ERC20/keys/public_key.pem index 5424d7eb..2aa1bb83 100644 --- a/JsClients/ERC20/keys/public_key.pem +++ b/JsClients/ERC20/keys/public_key.pem @@ -1,3 +1,3 @@ -----BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAkULIvEz/bjrjEeUuTGaHy7rxT+rOtdHw/HefJcpygsU= +MCowBQYDK2VwAyEAjizGZCcsy4nEFJIEgGJyzz3gz3a1QQV9A8pu/qUUfMA= -----END PUBLIC KEY----- diff --git a/JsClients/ERC20/keys/public_key_hex b/JsClients/ERC20/keys/public_key_hex index 633cc4a3..7a27e2f1 100644 --- a/JsClients/ERC20/keys/public_key_hex +++ b/JsClients/ERC20/keys/public_key_hex @@ -1 +1 @@ -019142c8bc4cff6e3ae311e52e4c6687cbbaf14feaceb5d1f0fc779f25ca7282c5 \ No newline at end of file +018e2cc664272ccb89c4149204806272cf3de0cf76b541057d03ca6efea5147cc0 \ No newline at end of file diff --git a/JsClients/ERC20/keys/secret_key.pem b/JsClients/ERC20/keys/secret_key.pem index bb6863bf..759a1966 100644 --- a/JsClients/ERC20/keys/secret_key.pem +++ b/JsClients/ERC20/keys/secret_key.pem @@ -1,3 +1,3 @@ -----BEGIN PRIVATE KEY----- -MC4CAQAwBQYDK2VwBCIEIHCHw1pJnsTA+YQono8c0ruL+CQ7zx3verD6vKuVdf26 +MC4CAQAwBQYDK2VwBCIEIOO917lkyr8iYYAE9fP3A53fWkMk85SHKgwxBoiCEaNd -----END PRIVATE KEY----- diff --git a/JsClients/ERC20/wasm/erc20-token.wasm b/JsClients/ERC20/wasm/erc20-token.wasm old mode 100644 new mode 100755 diff --git a/JsClients/FACTORY/keys/public_key.pem b/JsClients/FACTORY/keys/public_key.pem index 44935150..d3119fb9 100644 --- a/JsClients/FACTORY/keys/public_key.pem +++ b/JsClients/FACTORY/keys/public_key.pem @@ -1,3 +1,3 @@ -----BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAzBXFldMWQP8mB9wug4T2PeMoqZiK4IlsriYFy+dMGCQ= +MCowBQYDK2VwAyEARrB0WI8th0JcT45BaWBbZj/HShL7W5EvHvanmwix/eM= -----END PUBLIC KEY----- diff --git a/JsClients/FACTORY/keys/public_key_hex b/JsClients/FACTORY/keys/public_key_hex index edf6af05..c82f85ba 100644 --- a/JsClients/FACTORY/keys/public_key_hex +++ b/JsClients/FACTORY/keys/public_key_hex @@ -1 +1 @@ -01cc15c595d31640ff2607dc2e8384f63de328a9988ae0896cae2605cbe74c1824 \ No newline at end of file +0146b074588f2d87425c4f8e4169605b663fc74a12fb5b912f1ef6a79b08b1fde3 \ No newline at end of file diff --git a/JsClients/FACTORY/keys/secret_key.pem b/JsClients/FACTORY/keys/secret_key.pem index d4461bbe..9cb4a1d7 100644 --- a/JsClients/FACTORY/keys/secret_key.pem +++ b/JsClients/FACTORY/keys/secret_key.pem @@ -1,3 +1,3 @@ -----BEGIN PRIVATE KEY----- -MC4CAQAwBQYDK2VwBCIEIEdBvTt7jYWwgCbUJDLPl5EYfSOR35tzsxU1h/Bwo1zq +MC4CAQAwBQYDK2VwBCIEIOr0z7ZEPoZOevO07B6opAKs9Y9wQUariizlAzTZ7X+3 -----END PRIVATE KEY----- diff --git a/JsClients/FACTORY/test/install.ts b/JsClients/FACTORY/test/install.ts index 58d01bdc..eea3a93f 100644 --- a/JsClients/FACTORY/test/install.ts +++ b/JsClients/FACTORY/test/install.ts @@ -58,4 +58,4 @@ const test = async () => { console.log(`... Contract Hash: ${contractHash}`); }; -//test(); +test(); diff --git a/JsClients/FACTORY/test/installed.ts b/JsClients/FACTORY/test/installed.ts index 6b483c59..15a6cbe7 100644 --- a/JsClients/FACTORY/test/installed.ts +++ b/JsClients/FACTORY/test/installed.ts @@ -41,6 +41,13 @@ const factory = new FACTORYClient( EVENT_STREAM_ADDRESS! ); +function splitdata(data:string) +{ + var temp=data.split('('); + var result=temp[1].split(')'); + return result[0]; +} + const test = async () => { const listener = factory.onEvent( @@ -53,7 +60,7 @@ const test = async () => { const [timestamp,block_hash]= await getDeploy(NODE_ADDRESS!, deploy.deployHash); console.log("... Timestamp: ", timestamp); console.log("... Block hash: ", block_hash); - + console.log("result.value(): ", result.value()); let newData = JSON.parse(JSON.stringify(result.value())); console.log(eventName+ " Event result: "); @@ -64,18 +71,26 @@ const test = async () => { console.log(newData[4][0].data + " = " + newData[4][1].data); console.log(newData[5][0].data + " = " + newData[5][1].data); - // (newData[2][1].data); - // var token0=(newData[2][1].data).split(')'); - // request(GRAPHQL!, - // `mutation handleNewPair( $token0: String!, $token1: String!, $pair: String!, $all_pairs_length: Int!, $timeStamp: Int!, $blockHash: String!){ - // handleNewPair( token0: $token0, token1: $token1, pair: $pair, all_pairs_length: $all_pairs_length, timeStamp: $timeStamp, blockHash: $blockHash) { - // result - // } + var allpairslength=parseInt(newData[0][1].data); + var pair=splitdata(newData[3][1].data); + var token0=splitdata(newData[4][1].data); + var token1=splitdata(newData[5][1].data); + + console.log("allpairslength: ", allpairslength); + console.log("pair splited: ", pair); + console.log("token0 splited: ", token0); + console.log("token1 splited: ", token1); + + request(GRAPHQL!, + `mutation handleNewPair( $token0: String!, $token1: String!, $pair: String!, $all_pairs_length: Int!, $timeStamp: Int!, $blockHash: String!){ + handleNewPair( token0: $token0, token1: $token1, pair: $pair, all_pairs_length: $all_pairs_length, timeStamp: $timeStamp, blockHash: $blockHash) { + result + } - // }`, - // {token0:newData[2][1].data, token1: newData[3][1].data, pair: newData[4][1].data, all_pairs_length: newData[5][1].data, timeStamp:timestamp, blockHash:block_hash}) - // .then(data => console.log(data)) - // .catch(error => console.error(error)); + }`, + {token0:token0, token1:token1, pair: pair, all_pairs_length: allpairslength, timeStamp:timestamp, blockHash:block_hash}) + .then(data => console.log(data)) + .catch(error => console.error(error)); } else { console.log(`Failed deploy of ${eventName}, deployHash: ${deploy.deployHash}`); diff --git a/JsClients/FACTORY/wasm/factory.wasm b/JsClients/FACTORY/wasm/factory.wasm old mode 100644 new mode 100755 index 9a987e8f..611c315e Binary files a/JsClients/FACTORY/wasm/factory.wasm and b/JsClients/FACTORY/wasm/factory.wasm differ diff --git a/JsClients/PAIR/keys/public_key.pem b/JsClients/PAIR/keys/public_key.pem index 54f01fbc..62dbbc51 100644 --- a/JsClients/PAIR/keys/public_key.pem +++ b/JsClients/PAIR/keys/public_key.pem @@ -1,3 +1,3 @@ -----BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAMXHwIBQCqJCyGQ+tcbBS6jH1XiQNJ4BXR5NwJRByUbM= +MCowBQYDK2VwAyEAPVHw9EEgdN6yJ95ih/fgL+ypTItvpQFxSDd0MtQKy4s= -----END PUBLIC KEY----- diff --git a/JsClients/PAIR/keys/public_key_hex b/JsClients/PAIR/keys/public_key_hex index d6a5e11f..bf1fe067 100644 --- a/JsClients/PAIR/keys/public_key_hex +++ b/JsClients/PAIR/keys/public_key_hex @@ -1 +1 @@ -013171f0201402a890b2190fad71b052ea31f55e240d27805747937025107251b3 \ No newline at end of file +013d51f0f4412074deb227de6287f7e02feca94c8b6fa5017148377432d40acb8b \ No newline at end of file diff --git a/JsClients/PAIR/keys/secret_key.pem b/JsClients/PAIR/keys/secret_key.pem index adaea469..9e3ebf2a 100644 --- a/JsClients/PAIR/keys/secret_key.pem +++ b/JsClients/PAIR/keys/secret_key.pem @@ -1,3 +1,3 @@ -----BEGIN PRIVATE KEY----- -MC4CAQAwBQYDK2VwBCIEILtdFGfuUGR3lDEHOYGCoznprN4pnSB/P0QL6HfKo5lx +MC4CAQAwBQYDK2VwBCIEIG/YMcbuTy9PwihNuTEEIvsfELG9sfZKqWhLc1oymVP5 -----END PRIVATE KEY----- diff --git a/JsClients/PAIR/wasm/pair-token.wasm b/JsClients/PAIR/wasm/pair-token.wasm old mode 100644 new mode 100755