mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-07 16:34:06 +00:00
Implement data source templates (#106)
* Implement data source templates * Remove optional param from wasm instantiate * Add all types for solidity to typescript mapping * Set contract address in context for data source templates * Implement block handlers for data source templates
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
build/
|
||||
node_modules/
|
||||
generated/
|
||||
|
||||
yarn-error.log
|
||||
@@ -0,0 +1,148 @@
|
||||
[
|
||||
{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint24",
|
||||
"name": "fee",
|
||||
"type": "uint24"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickSpacing",
|
||||
"type": "int24"
|
||||
}
|
||||
],
|
||||
"name": "FeeAmountEnabled",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "oldOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "OwnerChanged",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token0",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token1",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "uint24",
|
||||
"name": "fee",
|
||||
"type": "uint24"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "int24",
|
||||
"name": "tickSpacing",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "pool",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "PoolCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "tokenA", "type": "address" },
|
||||
{ "internalType": "address", "name": "tokenB", "type": "address" },
|
||||
{ "internalType": "uint24", "name": "fee", "type": "uint24" }
|
||||
],
|
||||
"name": "createPool",
|
||||
"outputs": [
|
||||
{ "internalType": "address", "name": "pool", "type": "address" }
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
||||
{ "internalType": "int24", "name": "tickSpacing", "type": "int24" }
|
||||
],
|
||||
"name": "enableFeeAmount",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [{ "internalType": "uint24", "name": "", "type": "uint24" }],
|
||||
"name": "feeAmountTickSpacing",
|
||||
"outputs": [{ "internalType": "int24", "name": "", "type": "int24" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "", "type": "address" },
|
||||
{ "internalType": "address", "name": "", "type": "address" },
|
||||
{ "internalType": "uint24", "name": "", "type": "uint24" }
|
||||
],
|
||||
"name": "getPool",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "parameters",
|
||||
"outputs": [
|
||||
{ "internalType": "address", "name": "factory", "type": "address" },
|
||||
{ "internalType": "address", "name": "token0", "type": "address" },
|
||||
{ "internalType": "address", "name": "token1", "type": "address" },
|
||||
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
||||
{ "internalType": "int24", "name": "tickSpacing", "type": "int24" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "address", "name": "_owner", "type": "address" }
|
||||
],
|
||||
"name": "setOwner",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,988 @@
|
||||
[
|
||||
{
|
||||
"inputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "amount",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Burn",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "amount0",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "amount1",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"name": "Collect",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "amount0",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "amount1",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"name": "CollectProtocol",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "paid0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "paid1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Flash",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint16",
|
||||
"name": "observationCardinalityNextOld",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint16",
|
||||
"name": "observationCardinalityNextNew",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "IncreaseObservationCardinalityNext",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint160",
|
||||
"name": "sqrtPriceX96",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "int24",
|
||||
"name": "tick",
|
||||
"type": "int24"
|
||||
}
|
||||
],
|
||||
"name": "Initialize",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "amount",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Mint",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol0Old",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol1Old",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol0New",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol1New",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"name": "SetFeeProtocol",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "int256",
|
||||
"name": "amount0",
|
||||
"type": "int256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "int256",
|
||||
"name": "amount1",
|
||||
"type": "int256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint160",
|
||||
"name": "sqrtPriceX96",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint128",
|
||||
"name": "liquidity",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "int24",
|
||||
"name": "tick",
|
||||
"type": "int24"
|
||||
}
|
||||
],
|
||||
"name": "Swap",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"name": "burn",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount0Requested",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount1Requested",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"name": "collect",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount0",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount1",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount0Requested",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount1Requested",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"name": "collectProtocol",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount0",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount1",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "factory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "fee",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint24",
|
||||
"name": "",
|
||||
"type": "uint24"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "feeGrowthGlobal0X128",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "feeGrowthGlobal1X128",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "flash",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint16",
|
||||
"name": "observationCardinalityNext",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "increaseObservationCardinalityNext",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint160",
|
||||
"name": "sqrtPriceX96",
|
||||
"type": "uint160"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "liquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "maxLiquidityPerTick",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "amount",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "mint",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "index",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "observations",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint32",
|
||||
"name": "blockTimestamp",
|
||||
"type": "uint32"
|
||||
},
|
||||
{
|
||||
"internalType": "int56",
|
||||
"name": "tickCumulative",
|
||||
"type": "int56"
|
||||
},
|
||||
{
|
||||
"internalType": "uint160",
|
||||
"name": "secondsPerLiquidityCumulativeX128",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "initialized",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint32[]",
|
||||
"name": "secondsAgos",
|
||||
"type": "uint32[]"
|
||||
}
|
||||
],
|
||||
"name": "observe",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int56[]",
|
||||
"name": "tickCumulatives",
|
||||
"type": "int56[]"
|
||||
},
|
||||
{
|
||||
"internalType": "uint160[]",
|
||||
"name": "secondsPerLiquidityCumulativeX128s",
|
||||
"type": "uint160[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "key",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "positions",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "_liquidity",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "feeGrowthInside0LastX128",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "feeGrowthInside1LastX128",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "tokensOwed0",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "tokensOwed1",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "protocolFees",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "token0",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "token1",
|
||||
"type": "uint128"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol0",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol1",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"name": "setFeeProtocol",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "slot0",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint160",
|
||||
"name": "sqrtPriceX96",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tick",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "uint16",
|
||||
"name": "observationIndex",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"internalType": "uint16",
|
||||
"name": "observationCardinality",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"internalType": "uint16",
|
||||
"name": "observationCardinalityNext",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "feeProtocol",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "unlocked",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickLower",
|
||||
"type": "int24"
|
||||
},
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tickUpper",
|
||||
"type": "int24"
|
||||
}
|
||||
],
|
||||
"name": "snapshotCumulativesInside",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int56",
|
||||
"name": "tickCumulativeInside",
|
||||
"type": "int56"
|
||||
},
|
||||
{
|
||||
"internalType": "uint160",
|
||||
"name": "secondsPerLiquidityInsideX128",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"internalType": "uint32",
|
||||
"name": "secondsInside",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "recipient",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "zeroForOne",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "amountSpecified",
|
||||
"type": "int256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint160",
|
||||
"name": "sqrtPriceLimitX96",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "swap",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "amount0",
|
||||
"type": "int256"
|
||||
},
|
||||
{
|
||||
"internalType": "int256",
|
||||
"name": "amount1",
|
||||
"type": "int256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int16",
|
||||
"name": "wordPosition",
|
||||
"type": "int16"
|
||||
}
|
||||
],
|
||||
"name": "tickBitmap",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "tickSpacing",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "",
|
||||
"type": "int24"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "int24",
|
||||
"name": "tick",
|
||||
"type": "int24"
|
||||
}
|
||||
],
|
||||
"name": "ticks",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint128",
|
||||
"name": "liquidityGross",
|
||||
"type": "uint128"
|
||||
},
|
||||
{
|
||||
"internalType": "int128",
|
||||
"name": "liquidityNet",
|
||||
"type": "int128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "feeGrowthOutside0X128",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "feeGrowthOutside1X128",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "int56",
|
||||
"name": "tickCumulativeOutside",
|
||||
"type": "int56"
|
||||
},
|
||||
{
|
||||
"internalType": "uint160",
|
||||
"name": "secondsPerLiquidityOutsideX128",
|
||||
"type": "uint160"
|
||||
},
|
||||
{
|
||||
"internalType": "uint32",
|
||||
"name": "secondsOutside",
|
||||
"type": "uint32"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "initialized",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "token0",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "token1",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
@@ -1,184 +0,0 @@
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
|
||||
import {
|
||||
ethereum,
|
||||
JSONValue,
|
||||
TypedMap,
|
||||
Entity,
|
||||
Bytes,
|
||||
Address,
|
||||
BigInt
|
||||
} from "@graphprotocol/graph-ts";
|
||||
|
||||
export class Test extends ethereum.Event {
|
||||
get params(): Test__Params {
|
||||
return new Test__Params(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class Test__Params {
|
||||
_event: Test;
|
||||
|
||||
constructor(event: Test) {
|
||||
this._event = event;
|
||||
}
|
||||
|
||||
get param1(): string {
|
||||
return this._event.parameters[0].value.toString();
|
||||
}
|
||||
|
||||
get param2(): i32 {
|
||||
return this._event.parameters[1].value.toI32();
|
||||
}
|
||||
|
||||
get param3(): BigInt {
|
||||
return this._event.parameters[2].value.toBigInt();
|
||||
}
|
||||
}
|
||||
|
||||
export class Example1__structMethodResultValue0Struct extends ethereum.Tuple {
|
||||
get bidAmount1(): BigInt {
|
||||
return this[0].toBigInt();
|
||||
}
|
||||
|
||||
get bidAmount2(): BigInt {
|
||||
return this[1].toBigInt();
|
||||
}
|
||||
}
|
||||
|
||||
export class Example1 extends ethereum.SmartContract {
|
||||
static bind(address: Address): Example1 {
|
||||
return new Example1("Example1", address);
|
||||
}
|
||||
|
||||
addMethod(bidAmount1: BigInt, bidAmount2: BigInt): BigInt {
|
||||
let result = super.call(
|
||||
"addMethod",
|
||||
"addMethod(uint128,uint128):(uint256)",
|
||||
[
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount1),
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount2)
|
||||
]
|
||||
);
|
||||
|
||||
return result[0].toBigInt();
|
||||
}
|
||||
|
||||
try_addMethod(
|
||||
bidAmount1: BigInt,
|
||||
bidAmount2: BigInt
|
||||
): ethereum.CallResult<BigInt> {
|
||||
let result = super.tryCall(
|
||||
"addMethod",
|
||||
"addMethod(uint128,uint128):(uint256)",
|
||||
[
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount1),
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount2)
|
||||
]
|
||||
);
|
||||
if (result.reverted) {
|
||||
return new ethereum.CallResult();
|
||||
}
|
||||
let value = result.value;
|
||||
return ethereum.CallResult.fromValue(value[0].toBigInt());
|
||||
}
|
||||
|
||||
emitEvent(): boolean {
|
||||
let result = super.call("emitEvent", "emitEvent():(bool)", []);
|
||||
|
||||
return result[0].toBoolean();
|
||||
}
|
||||
|
||||
try_emitEvent(): ethereum.CallResult<boolean> {
|
||||
let result = super.tryCall("emitEvent", "emitEvent():(bool)", []);
|
||||
if (result.reverted) {
|
||||
return new ethereum.CallResult();
|
||||
}
|
||||
let value = result.value;
|
||||
return ethereum.CallResult.fromValue(value[0].toBoolean());
|
||||
}
|
||||
|
||||
getMethod(): string {
|
||||
let result = super.call("getMethod", "getMethod():(string)", []);
|
||||
|
||||
return result[0].toString();
|
||||
}
|
||||
|
||||
try_getMethod(): ethereum.CallResult<string> {
|
||||
let result = super.tryCall("getMethod", "getMethod():(string)", []);
|
||||
if (result.reverted) {
|
||||
return new ethereum.CallResult();
|
||||
}
|
||||
let value = result.value;
|
||||
return ethereum.CallResult.fromValue(value[0].toString());
|
||||
}
|
||||
|
||||
structMethod(
|
||||
bidAmount1: BigInt,
|
||||
bidAmount2: BigInt
|
||||
): Example1__structMethodResultValue0Struct {
|
||||
let result = super.call(
|
||||
"structMethod",
|
||||
"structMethod(uint128,uint128):((uint128,uint128))",
|
||||
[
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount1),
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount2)
|
||||
]
|
||||
);
|
||||
|
||||
return changetype<Example1__structMethodResultValue0Struct>(
|
||||
result[0].toTuple()
|
||||
);
|
||||
}
|
||||
|
||||
try_structMethod(
|
||||
bidAmount1: BigInt,
|
||||
bidAmount2: BigInt
|
||||
): ethereum.CallResult<Example1__structMethodResultValue0Struct> {
|
||||
let result = super.tryCall(
|
||||
"structMethod",
|
||||
"structMethod(uint128,uint128):((uint128,uint128))",
|
||||
[
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount1),
|
||||
ethereum.Value.fromUnsignedBigInt(bidAmount2)
|
||||
]
|
||||
);
|
||||
if (result.reverted) {
|
||||
return new ethereum.CallResult();
|
||||
}
|
||||
let value = result.value;
|
||||
return ethereum.CallResult.fromValue(
|
||||
changetype<Example1__structMethodResultValue0Struct>(value[0].toTuple())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class EmitEventCall extends ethereum.Call {
|
||||
get inputs(): EmitEventCall__Inputs {
|
||||
return new EmitEventCall__Inputs(this);
|
||||
}
|
||||
|
||||
get outputs(): EmitEventCall__Outputs {
|
||||
return new EmitEventCall__Outputs(this);
|
||||
}
|
||||
}
|
||||
|
||||
export class EmitEventCall__Inputs {
|
||||
_call: EmitEventCall;
|
||||
|
||||
constructor(call: EmitEventCall) {
|
||||
this._call = call;
|
||||
}
|
||||
}
|
||||
|
||||
export class EmitEventCall__Outputs {
|
||||
_call: EmitEventCall;
|
||||
|
||||
constructor(call: EmitEventCall) {
|
||||
this._call = call;
|
||||
}
|
||||
|
||||
get value0(): boolean {
|
||||
return this._call.outputValues[0].value.toBoolean();
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
|
||||
// Re-exports
|
||||
import {
|
||||
BigDecimal,
|
||||
BigInt,
|
||||
ethereum,
|
||||
Address,
|
||||
ByteArray,
|
||||
Bytes,
|
||||
Entity,
|
||||
Value,
|
||||
JSONValue,
|
||||
TypedMap,
|
||||
JSONValueKind,
|
||||
Result,
|
||||
Wrapped
|
||||
} from '@graphprotocol/graph-ts';
|
||||
|
||||
// All exports are used in JS host API implementations.
|
||||
|
||||
/**
|
||||
* Class used to create TypedMap<string, JSONValue> instance in json fromBytes host API.
|
||||
*/
|
||||
export class JSONValueTypedMap extends TypedMap<string, JSONValue> {}
|
||||
|
||||
/**
|
||||
* Class used to create JSONValue instances from different value types.
|
||||
* Implementation is based on Value class in graph-ts. https://github.com/graphprotocol/graph-ts/blob/master/common/value.ts#L188
|
||||
*/
|
||||
export class CustomJSONValue extends JSONValue {
|
||||
static fromArray(input: Array<JSONValue>): JSONValue {
|
||||
const jsonValue = new JSONValue();
|
||||
jsonValue.kind = JSONValueKind.ARRAY;
|
||||
jsonValue.data = changetype<u32>(input);
|
||||
return jsonValue;
|
||||
}
|
||||
|
||||
static fromObject(object: TypedMap<string, JSONValue>): JSONValue {
|
||||
const jsonValue = new JSONValue();
|
||||
jsonValue.kind = JSONValueKind.OBJECT;
|
||||
jsonValue.data = changetype<u32>(object);
|
||||
return jsonValue;
|
||||
}
|
||||
|
||||
static fromNumber(n: string): JSONValue {
|
||||
const jsonValue = new JSONValue();
|
||||
jsonValue.kind = JSONValueKind.NUMBER;
|
||||
jsonValue.data = changetype<u32>(n);
|
||||
return jsonValue;
|
||||
}
|
||||
|
||||
static fromBoolean(b: boolean): JSONValue {
|
||||
const jsonValue = new JSONValue();
|
||||
jsonValue.kind = JSONValueKind.BOOL;
|
||||
jsonValue.data = b ? 1 : 0;
|
||||
return jsonValue;
|
||||
}
|
||||
|
||||
static fromString(s: string): JSONValue {
|
||||
const jsonValue = new JSONValue();
|
||||
jsonValue.kind = JSONValueKind.STRING;
|
||||
jsonValue.data = changetype<u32>(s);
|
||||
return jsonValue;
|
||||
}
|
||||
|
||||
static fromNull(): JSONValue {
|
||||
const jsonValue = new JSONValue();
|
||||
jsonValue.kind = JSONValueKind.NULL;
|
||||
return jsonValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class used to create Result instance in json try_fromBytes host API.
|
||||
*/
|
||||
export class JSONResult extends Result<JSONValue, boolean> {
|
||||
constructor (value: JSONValue | null) {
|
||||
super();
|
||||
|
||||
if (value) {
|
||||
this._value = new Wrapped(value);
|
||||
} else {
|
||||
this._error = new Wrapped(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
BigDecimal,
|
||||
BigInt,
|
||||
|
||||
ethereum,
|
||||
Entity,
|
||||
|
||||
Address,
|
||||
ByteArray,
|
||||
Bytes,
|
||||
Value,
|
||||
JSONValue
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
|
||||
import {
|
||||
TypedMap,
|
||||
Entity,
|
||||
Value,
|
||||
ValueKind,
|
||||
store,
|
||||
Address,
|
||||
Bytes,
|
||||
BigInt,
|
||||
BigDecimal
|
||||
} from "@graphprotocol/graph-ts";
|
||||
|
||||
export class Blog extends Entity {
|
||||
constructor(id: string) {
|
||||
super();
|
||||
this.set("id", Value.fromString(id));
|
||||
|
||||
this.set("kind", Value.fromString(""));
|
||||
this.set("isActive", Value.fromBoolean(false));
|
||||
this.set("reviews", Value.fromBigIntArray(new Array(0)));
|
||||
this.set("author", Value.fromString(""));
|
||||
this.set("categories", Value.fromStringArray(new Array(0)));
|
||||
}
|
||||
|
||||
save(): void {
|
||||
let id = this.get("id");
|
||||
assert(id != null, "Cannot save Blog entity without an ID");
|
||||
if (id) {
|
||||
assert(
|
||||
id.kind == ValueKind.STRING,
|
||||
"Cannot save Blog entity with non-string ID. " +
|
||||
'Considering using .toHex() to convert the "id" to a string.'
|
||||
);
|
||||
store.set("Blog", id.toString(), this);
|
||||
}
|
||||
}
|
||||
|
||||
static load(id: string): Blog | null {
|
||||
return changetype<Blog | null>(store.get("Blog", id));
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
let value = this.get("id");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set id(value: string) {
|
||||
this.set("id", Value.fromString(value));
|
||||
}
|
||||
|
||||
get kind(): string {
|
||||
let value = this.get("kind");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set kind(value: string) {
|
||||
this.set("kind", Value.fromString(value));
|
||||
}
|
||||
|
||||
get isActive(): boolean {
|
||||
let value = this.get("isActive");
|
||||
return value!.toBoolean();
|
||||
}
|
||||
|
||||
set isActive(value: boolean) {
|
||||
this.set("isActive", Value.fromBoolean(value));
|
||||
}
|
||||
|
||||
get reviews(): Array<BigInt> {
|
||||
let value = this.get("reviews");
|
||||
return value!.toBigIntArray();
|
||||
}
|
||||
|
||||
set reviews(value: Array<BigInt>) {
|
||||
this.set("reviews", Value.fromBigIntArray(value));
|
||||
}
|
||||
|
||||
get author(): string {
|
||||
let value = this.get("author");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set author(value: string) {
|
||||
this.set("author", Value.fromString(value));
|
||||
}
|
||||
|
||||
get categories(): Array<string> {
|
||||
let value = this.get("categories");
|
||||
return value!.toStringArray();
|
||||
}
|
||||
|
||||
set categories(value: Array<string>) {
|
||||
this.set("categories", Value.fromStringArray(value));
|
||||
}
|
||||
}
|
||||
|
||||
export class Author extends Entity {
|
||||
constructor(id: string) {
|
||||
super();
|
||||
this.set("id", Value.fromString(id));
|
||||
|
||||
this.set("blogCount", Value.fromBigInt(BigInt.zero()));
|
||||
this.set("name", Value.fromString(""));
|
||||
this.set("rating", Value.fromBigDecimal(BigDecimal.zero()));
|
||||
this.set("paramInt", Value.fromI32(0));
|
||||
this.set("paramBigInt", Value.fromBigInt(BigInt.zero()));
|
||||
this.set("paramBytes", Value.fromBytes(Bytes.empty()));
|
||||
}
|
||||
|
||||
save(): void {
|
||||
let id = this.get("id");
|
||||
assert(id != null, "Cannot save Author entity without an ID");
|
||||
if (id) {
|
||||
assert(
|
||||
id.kind == ValueKind.STRING,
|
||||
"Cannot save Author entity with non-string ID. " +
|
||||
'Considering using .toHex() to convert the "id" to a string.'
|
||||
);
|
||||
store.set("Author", id.toString(), this);
|
||||
}
|
||||
}
|
||||
|
||||
static load(id: string): Author | null {
|
||||
return changetype<Author | null>(store.get("Author", id));
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
let value = this.get("id");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set id(value: string) {
|
||||
this.set("id", Value.fromString(value));
|
||||
}
|
||||
|
||||
get blogCount(): BigInt {
|
||||
let value = this.get("blogCount");
|
||||
return value!.toBigInt();
|
||||
}
|
||||
|
||||
set blogCount(value: BigInt) {
|
||||
this.set("blogCount", Value.fromBigInt(value));
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
let value = this.get("name");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set name(value: string) {
|
||||
this.set("name", Value.fromString(value));
|
||||
}
|
||||
|
||||
get rating(): BigDecimal {
|
||||
let value = this.get("rating");
|
||||
return value!.toBigDecimal();
|
||||
}
|
||||
|
||||
set rating(value: BigDecimal) {
|
||||
this.set("rating", Value.fromBigDecimal(value));
|
||||
}
|
||||
|
||||
get paramInt(): i32 {
|
||||
let value = this.get("paramInt");
|
||||
return value!.toI32();
|
||||
}
|
||||
|
||||
set paramInt(value: i32) {
|
||||
this.set("paramInt", Value.fromI32(value));
|
||||
}
|
||||
|
||||
get paramBigInt(): BigInt {
|
||||
let value = this.get("paramBigInt");
|
||||
return value!.toBigInt();
|
||||
}
|
||||
|
||||
set paramBigInt(value: BigInt) {
|
||||
this.set("paramBigInt", Value.fromBigInt(value));
|
||||
}
|
||||
|
||||
get paramBytes(): Bytes {
|
||||
let value = this.get("paramBytes");
|
||||
return value!.toBytes();
|
||||
}
|
||||
|
||||
set paramBytes(value: Bytes) {
|
||||
this.set("paramBytes", Value.fromBytes(value));
|
||||
}
|
||||
|
||||
get blogs(): Array<string> {
|
||||
let value = this.get("blogs");
|
||||
return value!.toStringArray();
|
||||
}
|
||||
|
||||
set blogs(value: Array<string>) {
|
||||
this.set("blogs", Value.fromStringArray(value));
|
||||
}
|
||||
}
|
||||
|
||||
export class Category extends Entity {
|
||||
constructor(id: string) {
|
||||
super();
|
||||
this.set("id", Value.fromString(id));
|
||||
|
||||
this.set("name", Value.fromString(""));
|
||||
this.set("count", Value.fromBigInt(BigInt.zero()));
|
||||
}
|
||||
|
||||
save(): void {
|
||||
let id = this.get("id");
|
||||
assert(id != null, "Cannot save Category entity without an ID");
|
||||
if (id) {
|
||||
assert(
|
||||
id.kind == ValueKind.STRING,
|
||||
"Cannot save Category entity with non-string ID. " +
|
||||
'Considering using .toHex() to convert the "id" to a string.'
|
||||
);
|
||||
store.set("Category", id.toString(), this);
|
||||
}
|
||||
}
|
||||
|
||||
static load(id: string): Category | null {
|
||||
return changetype<Category | null>(store.get("Category", id));
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
let value = this.get("id");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set id(value: string) {
|
||||
this.set("id", Value.fromString(value));
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
let value = this.get("name");
|
||||
return value!.toString();
|
||||
}
|
||||
|
||||
set name(value: string) {
|
||||
this.set("name", Value.fromString(value));
|
||||
}
|
||||
|
||||
get count(): BigInt {
|
||||
let value = this.get("count");
|
||||
return value!.toBigInt();
|
||||
}
|
||||
|
||||
set count(value: BigInt) {
|
||||
this.set("count", Value.fromBigInt(value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { PoolCreated } from '../../generated/Factory/Factory';
|
||||
import { Pool as PoolTemplate } from '../../generated/templates';
|
||||
import { log } from '@graphprotocol/graph-ts';
|
||||
|
||||
export function handlePoolCreated (event: PoolCreated): void {
|
||||
log.debug('PoolCreated event', []);
|
||||
|
||||
// create the tracked contract based on the template
|
||||
PoolTemplate.create(event.params.pool);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { dataSource, ethereum, log } from '@graphprotocol/graph-ts';
|
||||
|
||||
import { Initialize } from '../../generated/templates/Pool/Pool';
|
||||
|
||||
export function handleInitialize (event: Initialize): void {
|
||||
log.debug('event.address: {}', [event.address.toHexString()]);
|
||||
log.debug('event.params.sqrtPriceX96: {}', [event.params.sqrtPriceX96.toString()]);
|
||||
log.debug('event.params.tick: {}', [event.params.tick.toString()]);
|
||||
}
|
||||
|
||||
export function handleBlock (block: ethereum.Block): void {
|
||||
log.debug('block info: {}', [block.number.toString()]);
|
||||
log.debug('dataSource address: {}', [dataSource.address().toHex()]);
|
||||
}
|
||||
@@ -24,3 +24,44 @@ dataSources:
|
||||
blockHandlers:
|
||||
- handler: handleBlock
|
||||
file: ./src/mapping.ts
|
||||
- kind: ethereum/contract
|
||||
name: Factory
|
||||
network: mainnet
|
||||
source:
|
||||
address: ""
|
||||
abi: Factory
|
||||
startBlock: 100
|
||||
mapping:
|
||||
kind: ethereum/events
|
||||
apiVersion: 0.0.5
|
||||
language: wasm/assemblyscript
|
||||
entities: []
|
||||
abis:
|
||||
- name: Factory
|
||||
file: ./abis/factory.json
|
||||
- name: Pool
|
||||
file: ./abis/pool.json
|
||||
eventHandlers:
|
||||
- event: PoolCreated(indexed address,indexed address,indexed uint24,int24,address)
|
||||
handler: handlePoolCreated
|
||||
file: ./src/factory.ts
|
||||
templates:
|
||||
- kind: ethereum/contract
|
||||
name: Pool
|
||||
network: mainnet
|
||||
source:
|
||||
abi: Pool
|
||||
mapping:
|
||||
kind: ethereum/events
|
||||
apiVersion: 0.0.5
|
||||
language: wasm/assemblyscript
|
||||
entities: []
|
||||
file: ./src/pool.ts
|
||||
abis:
|
||||
- name: Pool
|
||||
file: ./abis/pool.json
|
||||
blockHandlers:
|
||||
- handler: handleBlock
|
||||
eventHandlers:
|
||||
- event: Initialize(uint160,int24)
|
||||
handler: handleInitialize
|
||||
|
||||
Reference in New Issue
Block a user