mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
mostly pool stuff
This commit is contained in:
parent
dd7710b2f1
commit
3eeba287fb
@ -1,328 +1,328 @@
|
|||||||
{
|
{
|
||||||
"_format": "hh-sol-artifact-1",
|
"_format": "hh-sol-artifact-1",
|
||||||
"contractName": "BFactory",
|
"contractName": "BFactory",
|
||||||
"sourceName": "contracts/pools/balancer/BFactory.sol",
|
"sourceName": "contracts/pools/balancer/BFactory.sol",
|
||||||
"abi": [
|
"abi": [
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "_bpoolTemplate",
|
"name": "_bpoolTemplate",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "_opfCollector",
|
"name": "_opfCollector",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"internalType": "address[]",
|
"internalType": "address[]",
|
||||||
"name": "_preCreatedPools",
|
"name": "_preCreatedPools",
|
||||||
"type": "address[]"
|
"type": "address[]"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "nonpayable",
|
"stateMutability": "nonpayable",
|
||||||
"type": "constructor"
|
"type": "constructor"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"anonymous": false,
|
"anonymous": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"indexed": true,
|
"indexed": true,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "newBPoolAddress",
|
"name": "newBPoolAddress",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": true,
|
"indexed": true,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "registeredBy",
|
"name": "registeredBy",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": true,
|
"indexed": true,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "datatokenAddress",
|
"name": "datatokenAddress",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "basetokenAddress",
|
"name": "basetokenAddress",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "bpoolTemplateAddress",
|
"name": "bpoolTemplateAddress",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "ssAddress",
|
"name": "ssAddress",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "BPoolCreated",
|
"name": "BPoolCreated",
|
||||||
"type": "event"
|
"type": "event"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"anonymous": false,
|
"anonymous": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"indexed": false,
|
"indexed": false,
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "instance",
|
"name": "instance",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "InstanceDeployed",
|
"name": "InstanceDeployed",
|
||||||
"type": "event"
|
"type": "event"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "BONE",
|
"name": "BONE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "BPOW_PRECISION",
|
"name": "BPOW_PRECISION",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "EXIT_FEE",
|
"name": "EXIT_FEE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "INIT_POOL_SUPPLY",
|
"name": "INIT_POOL_SUPPLY",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_BOUND_TOKENS",
|
"name": "MAX_BOUND_TOKENS",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_BPOW_BASE",
|
"name": "MAX_BPOW_BASE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_FEE",
|
"name": "MAX_FEE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_IN_RATIO",
|
"name": "MAX_IN_RATIO",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_OUT_RATIO",
|
"name": "MAX_OUT_RATIO",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_TOTAL_WEIGHT",
|
"name": "MAX_TOTAL_WEIGHT",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MAX_WEIGHT",
|
"name": "MAX_WEIGHT",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MIN_BALANCE",
|
"name": "MIN_BALANCE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MIN_BOUND_TOKENS",
|
"name": "MIN_BOUND_TOKENS",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MIN_BPOW_BASE",
|
"name": "MIN_BPOW_BASE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MIN_FEE",
|
"name": "MIN_FEE",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "MIN_WEIGHT",
|
"name": "MIN_WEIGHT",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "uint256",
|
"internalType": "uint256",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "poolTemplate",
|
"name": "poolTemplate",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "isPoolTemplate",
|
"name": "isPoolTemplate",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "bool",
|
"internalType": "bool",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "bool"
|
"type": "bool"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"name": "opfCollector",
|
"name": "opfCollector",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"internalType": "address",
|
"internalType": "address",
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "address"
|
"type": "address"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bytecode": "0x608060405234801561001057600080fd5b5060405161071938038061071983398101604081905261002f91610207565b6001600160a01b0383166100a05760405162461bcd60e51b815260206004820152602d60248201527f42466163746f72793a20696e76616c69642062706f6f6c2074656d706c61746560448201526c207a65726f206164647265737360981b60648201526084015b60405180910390fd5b6001600160a01b0382166100f65760405162461bcd60e51b815260206004820152601660248201527f42466163746f72793a207a65726f2061646472657373000000000000000000006044820152606401610097565b600080546001600160a01b0319166001600160a01b03841617905561013c836001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b8051156101e35760005b81518110156101e15760006001600160a01b0316336001600160a01b03168383815181106101765761017661031f565b602090810291909101810151604080516000808252938101849052908101929092526001600160a01b0316907fbb6121447d29a04cc37bfd93cdf6a9dd08229f2d941116c1528f04698c4e790e9060600160405180910390a4806101d9816102f6565b915050610146565b505b50505061034b565b80516001600160a01b038116811461020257600080fd5b919050565b60008060006060848603121561021c57600080fd5b610225846101eb565b925060206102348186016101eb565b60408601519093506001600160401b038082111561025157600080fd5b818701915087601f83011261026557600080fd5b81518181111561027757610277610335565b8060051b604051601f19603f8301168101818110858211171561029c5761029c610335565b604052828152858101935084860182860187018c10156102bb57600080fd5b600095505b838610156102e5576102d1816101eb565b8552600195909501949386019386016102c0565b508096505050505050509250925092565b600060001982141561031857634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6103bf8061035a6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063b7b800a4116100a2578063c07c00fe11610071578063c07c00fe146101b8578063c36596a61461013e578063c6580d12146101f4578063e4a28a521461011b578063ec093021146101fc57600080fd5b8063b7b800a414610198578063ba019dab146101a0578063bc063e1a146101a8578063bc694ea2146101b057600080fd5b8063867378c5116100e9578063867378c5146101555780639381cd2b1461015d578063992e2a9214610165578063a28f78f11461016d578063b0e0d1361461019857600080fd5b806309a3bbe41461011b578063189d00ca14610136578063218b53821461013e57806376c7a3c71461014d575b600080fd5b610123610204565b6040519081526020015b60405180910390f35b61012361021a565b610123670de0b6b3a764000081565b610123610231565b610123610246565b61012361025d565b610123610270565b600054610180906001600160a01b031681565b6040516001600160a01b03909116815260200161012d565b610123600281565b610123600181565b61012361028e565b6101236102a1565b6101e46101c63660046102d3565b6001600160a01b031660009081526001602052604090205460ff1690565b604051901515815260200161012d565b610123600081565b6101236102c0565b610217670de0b6b3a7640000603261033d565b81565b6102176402540be400670de0b6b3a764000061031b565b610217620f4240670de0b6b3a764000061031b565b61021764e8d4a51000670de0b6b3a764000061031b565b610217670de0b6b3a7640000606461033d565b6102836003670de0b6b3a764000061031b565b610217906001610303565b610217600a670de0b6b3a764000061031b565b60016102b6670de0b6b3a7640000600261033d565b610217919061035c565b6102176002670de0b6b3a764000061031b565b6000602082840312156102e557600080fd5b81356001600160a01b03811681146102fc57600080fd5b9392505050565b6000821982111561031657610316610373565b500190565b60008261033857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561035757610357610373565b500290565b60008282101561036e5761036e610373565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122051baecb88b2e3924258c058b6adf28c8a64ed8675ac122a5a6e5e1267dbdf04f64736f6c63430008070033",
|
"bytecode": "0x608060405234801561001057600080fd5b5060405161071938038061071983398101604081905261002f91610207565b6001600160a01b0383166100a05760405162461bcd60e51b815260206004820152602d60248201527f42466163746f72793a20696e76616c69642062706f6f6c2074656d706c61746560448201526c207a65726f206164647265737360981b60648201526084015b60405180910390fd5b6001600160a01b0382166100f65760405162461bcd60e51b815260206004820152601660248201527f42466163746f72793a207a65726f2061646472657373000000000000000000006044820152606401610097565b600080546001600160a01b0319166001600160a01b03841617905561013c836001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b8051156101e35760005b81518110156101e15760006001600160a01b0316336001600160a01b03168383815181106101765761017661031f565b602090810291909101810151604080516000808252938101849052908101929092526001600160a01b0316907fbb6121447d29a04cc37bfd93cdf6a9dd08229f2d941116c1528f04698c4e790e9060600160405180910390a4806101d9816102f6565b915050610146565b505b50505061034b565b80516001600160a01b038116811461020257600080fd5b919050565b60008060006060848603121561021c57600080fd5b610225846101eb565b925060206102348186016101eb565b60408601519093506001600160401b038082111561025157600080fd5b818701915087601f83011261026557600080fd5b81518181111561027757610277610335565b8060051b604051601f19603f8301168101818110858211171561029c5761029c610335565b604052828152858101935084860182860187018c10156102bb57600080fd5b600095505b838610156102e5576102d1816101eb565b8552600195909501949386019386016102c0565b508096505050505050509250925092565b600060001982141561031857634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6103bf8061035a6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063b7b800a4116100a2578063c07c00fe11610071578063c07c00fe146101b8578063c36596a61461013e578063c6580d12146101f4578063e4a28a521461011b578063ec093021146101fc57600080fd5b8063b7b800a414610198578063ba019dab146101a0578063bc063e1a146101a8578063bc694ea2146101b057600080fd5b8063867378c5116100e9578063867378c5146101555780639381cd2b1461015d578063992e2a9214610165578063a28f78f11461016d578063b0e0d1361461019857600080fd5b806309a3bbe41461011b578063189d00ca14610136578063218b53821461013e57806376c7a3c71461014d575b600080fd5b610123610204565b6040519081526020015b60405180910390f35b61012361021a565b610123670de0b6b3a764000081565b610123610231565b610123610246565b61012361025d565b610123610270565b600054610180906001600160a01b031681565b6040516001600160a01b03909116815260200161012d565b610123600281565b610123600181565b61012361028e565b6101236102a1565b6101e46101c63660046102d3565b6001600160a01b031660009081526001602052604090205460ff1690565b604051901515815260200161012d565b610123600081565b6101236102c0565b610217670de0b6b3a7640000603261033d565b81565b6102176402540be400670de0b6b3a764000061031b565b610217620f4240670de0b6b3a764000061031b565b61021764e8d4a51000670de0b6b3a764000061031b565b610217670de0b6b3a7640000606461033d565b6102836003670de0b6b3a764000061031b565b610217906001610303565b610217600a670de0b6b3a764000061031b565b60016102b6670de0b6b3a7640000600261033d565b610217919061035c565b6102176002670de0b6b3a764000061031b565b6000602082840312156102e557600080fd5b81356001600160a01b03811681146102fc57600080fd5b9392505050565b6000821982111561031657610316610373565b500190565b60008261033857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561035757610357610373565b500290565b60008282101561036e5761036e610373565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220f4f9367d9939a8dac54a482bb30fc85ba7649a673baccad6dd6c89f740b79f9f64736f6c63430008070033",
|
||||||
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063b7b800a4116100a2578063c07c00fe11610071578063c07c00fe146101b8578063c36596a61461013e578063c6580d12146101f4578063e4a28a521461011b578063ec093021146101fc57600080fd5b8063b7b800a414610198578063ba019dab146101a0578063bc063e1a146101a8578063bc694ea2146101b057600080fd5b8063867378c5116100e9578063867378c5146101555780639381cd2b1461015d578063992e2a9214610165578063a28f78f11461016d578063b0e0d1361461019857600080fd5b806309a3bbe41461011b578063189d00ca14610136578063218b53821461013e57806376c7a3c71461014d575b600080fd5b610123610204565b6040519081526020015b60405180910390f35b61012361021a565b610123670de0b6b3a764000081565b610123610231565b610123610246565b61012361025d565b610123610270565b600054610180906001600160a01b031681565b6040516001600160a01b03909116815260200161012d565b610123600281565b610123600181565b61012361028e565b6101236102a1565b6101e46101c63660046102d3565b6001600160a01b031660009081526001602052604090205460ff1690565b604051901515815260200161012d565b610123600081565b6101236102c0565b610217670de0b6b3a7640000603261033d565b81565b6102176402540be400670de0b6b3a764000061031b565b610217620f4240670de0b6b3a764000061031b565b61021764e8d4a51000670de0b6b3a764000061031b565b610217670de0b6b3a7640000606461033d565b6102836003670de0b6b3a764000061031b565b610217906001610303565b610217600a670de0b6b3a764000061031b565b60016102b6670de0b6b3a7640000600261033d565b610217919061035c565b6102176002670de0b6b3a764000061031b565b6000602082840312156102e557600080fd5b81356001600160a01b03811681146102fc57600080fd5b9392505050565b6000821982111561031657610316610373565b500190565b60008261033857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561035757610357610373565b500290565b60008282101561036e5761036e610373565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122051baecb88b2e3924258c058b6adf28c8a64ed8675ac122a5a6e5e1267dbdf04f64736f6c63430008070033",
|
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063b7b800a4116100a2578063c07c00fe11610071578063c07c00fe146101b8578063c36596a61461013e578063c6580d12146101f4578063e4a28a521461011b578063ec093021146101fc57600080fd5b8063b7b800a414610198578063ba019dab146101a0578063bc063e1a146101a8578063bc694ea2146101b057600080fd5b8063867378c5116100e9578063867378c5146101555780639381cd2b1461015d578063992e2a9214610165578063a28f78f11461016d578063b0e0d1361461019857600080fd5b806309a3bbe41461011b578063189d00ca14610136578063218b53821461013e57806376c7a3c71461014d575b600080fd5b610123610204565b6040519081526020015b60405180910390f35b61012361021a565b610123670de0b6b3a764000081565b610123610231565b610123610246565b61012361025d565b610123610270565b600054610180906001600160a01b031681565b6040516001600160a01b03909116815260200161012d565b610123600281565b610123600181565b61012361028e565b6101236102a1565b6101e46101c63660046102d3565b6001600160a01b031660009081526001602052604090205460ff1690565b604051901515815260200161012d565b610123600081565b6101236102c0565b610217670de0b6b3a7640000603261033d565b81565b6102176402540be400670de0b6b3a764000061031b565b610217620f4240670de0b6b3a764000061031b565b61021764e8d4a51000670de0b6b3a764000061031b565b610217670de0b6b3a7640000606461033d565b6102836003670de0b6b3a764000061031b565b610217906001610303565b610217600a670de0b6b3a764000061031b565b60016102b6670de0b6b3a7640000600261033d565b610217919061035c565b6102176002670de0b6b3a764000061031b565b6000602082840312156102e557600080fd5b81356001600160a01b03811681146102fc57600080fd5b9392505050565b6000821982111561031657610316610373565b500190565b60008261033857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561035757610357610373565b500290565b60008282101561036e5761036e610373565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220f4f9367d9939a8dac54a482bb30fc85ba7649a673baccad6dd6c89f740b79f9f64736f6c63430008070033",
|
||||||
"linkReferences": {},
|
"linkReferences": {},
|
||||||
"deployedLinkReferences": {}
|
"deployedLinkReferences": {}
|
||||||
}
|
}
|
||||||
|
314
abis/BMath.json
Normal file
314
abis/BMath.json
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
{
|
||||||
|
"_format": "hh-sol-artifact-1",
|
||||||
|
"contractName": "BMath",
|
||||||
|
"sourceName": "contracts/pools/balancer/BMath.sol",
|
||||||
|
"abi": [
|
||||||
|
{
|
||||||
|
"anonymous": false,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "swapFeeAmount",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "oceanFeeAmount",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "marketFeeAmount",
|
||||||
|
"type": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "tokenFees",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "SWAP_FEES",
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "BONE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "BPOW_PRECISION",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "EXIT_FEE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "INIT_POOL_SUPPLY",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_BOUND_TOKENS",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_BPOW_BASE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_FEE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_IN_RATIO",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_OUT_RATIO",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_TOTAL_WEIGHT",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MAX_WEIGHT",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MIN_BALANCE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MIN_BOUND_TOKENS",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MIN_BPOW_BASE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MIN_FEE",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "MIN_WEIGHT",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "_swapMarketFee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "communityFees",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [],
|
||||||
|
"name": "getOPFFee",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"internalType": "address",
|
||||||
|
"name": "",
|
||||||
|
"type": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "marketFees",
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
|
"name": "",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view",
|
||||||
|
"type": "function"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bytecode": "0x608060405234801561001057600080fd5b50610460806100206000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063992e2a92116100ad578063bc694ea211610071578063bc694ea2146101eb578063c36596a614610153578063c6580d12146101f3578063e4a28a5214610131578063ec093021146101fb57600080fd5b8063992e2a92146101cb578063b0e0d136146101d3578063b7b800a4146101d3578063ba019dab146101db578063bc063e1a146101e357600080fd5b806349e9350f116100f457806349e9350f146101a2578063700dd7e8146101ab57806376c7a3c7146101b3578063867378c5146101bb5780639381cd2b146101c357600080fd5b806309a3bbe414610131578063189d00ca1461014b578063218b538214610153578063300621921461016257806331e2761b14610182575b600080fd5b610139610203565b60405190815260200160405180910390f35b610139610219565b610139670de0b6b3a764000081565b61013961017036600461035b565b60056020526000908152604090205481565b61013961019036600461035b565b60066020526000908152604090205481565b61013960005481565b610139610230565b6101396102b9565b6101396102ce565b6101396102e5565b6101396102f8565b610139600281565b610139600181565b610139610316565b610139610329565b610139600081565b610139610348565b610216670de0b6b3a764000060326103de565b81565b6102166402540be400670de0b6b3a76400006103bc565b60025460048054604051637c0aa57760e11b81526001600160a01b0391821692810192909252600092169063f8154aee9060240160206040518083038186803b15801561027c57600080fd5b505afa158015610290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b4919061038b565b905090565b610216620f4240670de0b6b3a76400006103bc565b61021664e8d4a51000670de0b6b3a76400006103bc565b610216670de0b6b3a764000060646103de565b61030b6003670de0b6b3a76400006103bc565b6102169060016103a4565b610216600a670de0b6b3a76400006103bc565b600161033e670de0b6b3a764000060026103de565b61021691906103fd565b6102166002670de0b6b3a76400006103bc565b60006020828403121561036d57600080fd5b81356001600160a01b038116811461038457600080fd5b9392505050565b60006020828403121561039d57600080fd5b5051919050565b600082198211156103b7576103b7610414565b500190565b6000826103d957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156103f8576103f8610414565b500290565b60008282101561040f5761040f610414565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220699b1f34bf1d54caa297e60d6fddebd8dc902d2243c98d4a62f4485302305a1064736f6c63430008070033",
|
||||||
|
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063992e2a92116100ad578063bc694ea211610071578063bc694ea2146101eb578063c36596a614610153578063c6580d12146101f3578063e4a28a5214610131578063ec093021146101fb57600080fd5b8063992e2a92146101cb578063b0e0d136146101d3578063b7b800a4146101d3578063ba019dab146101db578063bc063e1a146101e357600080fd5b806349e9350f116100f457806349e9350f146101a2578063700dd7e8146101ab57806376c7a3c7146101b3578063867378c5146101bb5780639381cd2b146101c357600080fd5b806309a3bbe414610131578063189d00ca1461014b578063218b538214610153578063300621921461016257806331e2761b14610182575b600080fd5b610139610203565b60405190815260200160405180910390f35b610139610219565b610139670de0b6b3a764000081565b61013961017036600461035b565b60056020526000908152604090205481565b61013961019036600461035b565b60066020526000908152604090205481565b61013960005481565b610139610230565b6101396102b9565b6101396102ce565b6101396102e5565b6101396102f8565b610139600281565b610139600181565b610139610316565b610139610329565b610139600081565b610139610348565b610216670de0b6b3a764000060326103de565b81565b6102166402540be400670de0b6b3a76400006103bc565b60025460048054604051637c0aa57760e11b81526001600160a01b0391821692810192909252600092169063f8154aee9060240160206040518083038186803b15801561027c57600080fd5b505afa158015610290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102b4919061038b565b905090565b610216620f4240670de0b6b3a76400006103bc565b61021664e8d4a51000670de0b6b3a76400006103bc565b610216670de0b6b3a764000060646103de565b61030b6003670de0b6b3a76400006103bc565b6102169060016103a4565b610216600a670de0b6b3a76400006103bc565b600161033e670de0b6b3a764000060026103de565b61021691906103fd565b6102166002670de0b6b3a76400006103bc565b60006020828403121561036d57600080fd5b81356001600160a01b038116811461038457600080fd5b9392505050565b60006020828403121561039d57600080fd5b5051919050565b600082198211156103b7576103b7610414565b500190565b6000826103d957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156103f8576103f8610414565b500290565b60008282101561040f5761040f610414565b500390565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220699b1f34bf1d54caa297e60d6fddebd8dc902d2243c98d4a62f4485302305a1064736f6c63430008070033",
|
||||||
|
"linkReferences": {},
|
||||||
|
"deployedLinkReferences": {}
|
||||||
|
}
|
3105
abis/BPool.json
3105
abis/BPool.json
File diff suppressed because one or more lines are too long
489
abis/BToken.json
Normal file
489
abis/BToken.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1470
abis/ERC721Template.json
Normal file
1470
abis/ERC721Template.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,5 +1,4 @@
|
|||||||
type Token @entity {
|
type Token @entity {
|
||||||
|
|
||||||
id: ID!
|
id: ID!
|
||||||
symbol: String
|
symbol: String
|
||||||
name: String
|
name: String
|
||||||
@ -81,9 +80,7 @@ type Pool @entity {
|
|||||||
"pool address"
|
"pool address"
|
||||||
id: ID!
|
id: ID!
|
||||||
"owner address, pool controller"
|
"owner address, pool controller"
|
||||||
owner: String!
|
owner: String!
|
||||||
"if swap/trade is activated, probably always true"
|
|
||||||
isPublicSwap: Boolean!
|
|
||||||
"only finalized pools are relevant to us"
|
"only finalized pools are relevant to us"
|
||||||
isFinalized: Boolean!
|
isFinalized: Boolean!
|
||||||
|
|
||||||
@ -92,9 +89,7 @@ type Pool @entity {
|
|||||||
"pool token name"
|
"pool token name"
|
||||||
name: String
|
name: String
|
||||||
"maximum supply if any, converted from wei"
|
"maximum supply if any, converted from wei"
|
||||||
cap: BigDecimal
|
cap: BigDecimal
|
||||||
"pool is active"
|
|
||||||
isActive: Boolean!
|
|
||||||
|
|
||||||
baseToken: PoolToken!
|
baseToken: PoolToken!
|
||||||
datatoken: PoolToken!
|
datatoken: PoolToken!
|
||||||
@ -140,7 +135,7 @@ type Pool @entity {
|
|||||||
"block number when it was created"
|
"block number when it was created"
|
||||||
block: Int
|
block: Int
|
||||||
|
|
||||||
shares: [PoolShare!] @derivedFrom(field: "pool")
|
shares: [PoolShares!] @derivedFrom(field: "pool")
|
||||||
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
|
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,12 +152,12 @@ type PoolToken @entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# we will need to track pool share tx between users - bpool transfer tx event
|
# we will need to track pool share tx between users - bpool transfer tx event
|
||||||
type PoolShare @entity {
|
type PoolShares @entity {
|
||||||
"poolAddress + userAddress"
|
"poolAddress + userAddress"
|
||||||
id: ID!
|
id: ID!
|
||||||
user: User!
|
user: User!
|
||||||
pool: Pool!
|
pool: Pool!
|
||||||
balance: BigDecimal!
|
shares: BigDecimal!
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PoolTransactionType {
|
enum PoolTransactionType {
|
||||||
@ -200,11 +195,14 @@ type PoolTransaction @entity {
|
|||||||
"price expressed in eth"
|
"price expressed in eth"
|
||||||
gasPrice: BigDecimal!
|
gasPrice: BigDecimal!
|
||||||
|
|
||||||
# change to baseToken and dataToken
|
"base tokens transfered"
|
||||||
"base tokens transfered , if value is negative it means it was removed"
|
baseToken: TokenValuePair
|
||||||
baseToken: TokenValuePair
|
"number of tokens transfered"
|
||||||
|
baseTokenValue: BigDecimal
|
||||||
"datatokens transfered , if value is negative it means it was removed"
|
"datatokens transfered , if value is negative it means it was removed"
|
||||||
datatoken: TokenValuePair
|
datatoken: TokenValuePair
|
||||||
|
"number of tokens transfered, if value is negative it means it was removed"
|
||||||
|
datatokenValue: BigDecimal
|
||||||
}
|
}
|
||||||
|
|
||||||
type Order @entity { # renamed from TokenOrder to Order
|
type Order @entity { # renamed from TokenOrder to Order
|
||||||
@ -247,7 +245,7 @@ type TokenTransaction @entity {
|
|||||||
|
|
||||||
type User @entity {
|
type User @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
sharesOwned: [PoolShare!] @derivedFrom(field: "user")
|
sharesOwned: [PoolShares!] @derivedFrom(field: "user")
|
||||||
tokenBalancesOwned: [TokenValuePair!]
|
tokenBalancesOwned: [TokenValuePair!]
|
||||||
tokensOwned: [Token!] @derivedFrom(field: "minter")
|
tokensOwned: [Token!] @derivedFrom(field: "minter")
|
||||||
poolTransactions: [PoolTransaction!] @derivedFrom(field: "user")
|
poolTransactions: [PoolTransaction!] @derivedFrom(field: "user")
|
||||||
@ -363,7 +361,7 @@ type PoolSnapshotTokenValue @entity {
|
|||||||
poolSnapshot: PoolSnapshot!
|
poolSnapshot: PoolSnapshot!
|
||||||
}
|
}
|
||||||
|
|
||||||
type Global @entity {
|
type GlobalStats @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
|
|
||||||
"total value locked represented in the base token , basically 2x liqudity for each base token"
|
"total value locked represented in the base token , basically 2x liqudity for each base token"
|
||||||
|
@ -60,6 +60,6 @@ export function handleTokensDispensed(event: TokensDispensed): void {
|
|||||||
|
|
||||||
export function handleOwnerWinthdraw(event: OwnerWithdrawed): void {
|
export function handleOwnerWinthdraw(event: OwnerWithdrawed): void {
|
||||||
const dispenser = getDispenser(event.params.datatoken.toHex())
|
const dispenser = getDispenser(event.params.datatoken.toHex())
|
||||||
dispenser.balance = decimal.ZERO_BD
|
dispenser.balance = decimal.ZERO
|
||||||
dispenser.save()
|
dispenser.save()
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ export function handleNftCreated(event: NFTCreated): void {
|
|||||||
const user = getUser(event.params.admin.toHexString())
|
const user = getUser(event.params.admin.toHexString())
|
||||||
nft.owner = user.id
|
nft.owner = user.id
|
||||||
nft.address = event.params.newTokenAddress.toHexString()
|
nft.address = event.params.newTokenAddress.toHexString()
|
||||||
nft.name = event.params.tokenName.toHex()
|
nft.name = event.params.tokenName
|
||||||
nft.symbol = ''
|
nft.symbol = ''
|
||||||
nft.createdTimestamp = event.block.timestamp.toI32()
|
nft.createdTimestamp = event.block.timestamp.toI32()
|
||||||
nft.tx = event.transaction.hash
|
nft.tx = event.transaction.hash
|
||||||
@ -26,8 +26,8 @@ export function handleNewToken(event: TokenCreated): void {
|
|||||||
token.tx = event.transaction.hash
|
token.tx = event.transaction.hash
|
||||||
token.block = event.block.number.toI32()
|
token.block = event.block.number.toI32()
|
||||||
|
|
||||||
token.name = event.params.tokenName.toString()
|
token.name = event.params.name
|
||||||
token.decimals = 18
|
token.decimals = 18
|
||||||
token.supply = decimal.ZERO_BD
|
token.supply = decimal.ZERO
|
||||||
token.save()
|
token.save()
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
FixedRateExchangeUpdate
|
FixedRateExchangeUpdate
|
||||||
} from '../@types/schema'
|
} from '../@types/schema'
|
||||||
import { getFixedRateExchange, getUpdateOrSwapId } from './utils/fixedRateUtils'
|
import { getFixedRateExchange, getUpdateOrSwapId } from './utils/fixedRateUtils'
|
||||||
import { tokenToDecimal } from './utils/generic'
|
import { weiToDecimal } from './utils/generic'
|
||||||
import { getToken } from './utils/tokenUtils'
|
import { getToken } from './utils/tokenUtils'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ export function handleExchangeCreated(event: ExchangeCreated): void {
|
|||||||
// fixedRateExchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
|
// fixedRateExchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
|
||||||
fixedRateExchange.active = false
|
fixedRateExchange.active = false
|
||||||
|
|
||||||
fixedRateExchange.price = tokenToDecimal(
|
fixedRateExchange.price = weiToDecimal(
|
||||||
event.params.fixedRate.toBigDecimal(),
|
event.params.fixedRate.toBigDecimal(),
|
||||||
BigInt.fromI32(18).toI32()
|
BigInt.fromI32(18).toI32()
|
||||||
)
|
)
|
||||||
@ -51,7 +51,7 @@ export function handleRateChange(event: ExchangeRateChanged): void {
|
|||||||
newExchangeUpdate.tx = event.transaction.hash
|
newExchangeUpdate.tx = event.transaction.hash
|
||||||
newExchangeUpdate.block = event.block.number.toI32()
|
newExchangeUpdate.block = event.block.number.toI32()
|
||||||
|
|
||||||
fixedRateExchange.price = tokenToDecimal(
|
fixedRateExchange.price = weiToDecimal(
|
||||||
event.params.newRate.toBigDecimal(),
|
event.params.newRate.toBigDecimal(),
|
||||||
BigInt.fromI32(18).toI32()
|
BigInt.fromI32(18).toI32()
|
||||||
)
|
)
|
||||||
@ -166,11 +166,11 @@ export function handleSwap(event: Swapped): void {
|
|||||||
|
|
||||||
// we need to fetch the decimals of the base token
|
// we need to fetch the decimals of the base token
|
||||||
const baseToken = getToken(fixedRateExchange.baseToken)
|
const baseToken = getToken(fixedRateExchange.baseToken)
|
||||||
swap.baseTokenAmount = tokenToDecimal(
|
swap.baseTokenAmount = weiToDecimal(
|
||||||
event.params.baseTokenSwappedAmount.toBigDecimal(),
|
event.params.baseTokenSwappedAmount.toBigDecimal(),
|
||||||
BigInt.fromI32(baseToken.decimals).toI32()
|
BigInt.fromI32(baseToken.decimals).toI32()
|
||||||
)
|
)
|
||||||
swap.dataTokenAmount = tokenToDecimal(
|
swap.dataTokenAmount = weiToDecimal(
|
||||||
event.params.dataTokenSwappedAmount.toBigDecimal(),
|
event.params.dataTokenSwappedAmount.toBigDecimal(),
|
||||||
BigInt.fromI32(18).toI32()
|
BigInt.fromI32(18).toI32()
|
||||||
)
|
)
|
||||||
|
@ -1,30 +1,214 @@
|
|||||||
import { Pool, PoolTransaction } from '../@types/schema'
|
import { PoolTransaction } from '../@types/schema'
|
||||||
import { LOG_JOIN } from '../@types/templates/BPool/BPool'
|
import {
|
||||||
import { integer } from './utils/constants'
|
LOG_BPT,
|
||||||
import { gweiToEth } from './utils/generic'
|
LOG_EXIT,
|
||||||
|
LOG_JOIN,
|
||||||
|
LOG_SETUP,
|
||||||
|
LOG_SWAP
|
||||||
|
} from '../@types/templates/BPool/BPool'
|
||||||
|
import { Transfer } from '../@types/templates/BPool/BToken'
|
||||||
|
import { integer, PoolTransactionType } from './utils/constants'
|
||||||
|
import { weiToDecimal } from './utils/generic'
|
||||||
|
import {
|
||||||
|
calcSpotPrice,
|
||||||
|
getPool,
|
||||||
|
getPoolToken,
|
||||||
|
getPoolTransaction,
|
||||||
|
getPoolShares
|
||||||
|
} from './utils/poolUtils'
|
||||||
|
import { getToken } from './utils/tokenUtils'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
|
||||||
|
// kinda redundant code in join/swap/exit
|
||||||
export function handleJoin(event: LOG_JOIN): void {
|
export function handleJoin(event: LOG_JOIN): void {
|
||||||
const pool = Pool.load(event.address.toHex())
|
const pool = getPool(event.address.toHex())
|
||||||
|
const user = getUser(event.params.caller.toHex())
|
||||||
// should we do something else here?
|
const poolTx = getPoolTransaction(event, user.id, PoolTransactionType.JOIN)
|
||||||
if (pool === null || pool.isFinalized === true) return
|
|
||||||
|
|
||||||
pool.transactionCount = pool.transactionCount.plus(integer.ONE)
|
pool.transactionCount = pool.transactionCount.plus(integer.ONE)
|
||||||
pool.joinCount = pool.joinCount.plus(integer.ONE)
|
pool.joinCount = pool.joinCount.plus(integer.ONE)
|
||||||
|
|
||||||
const poolTx = new PoolTransaction(event.transaction.hash.toHex())
|
// get token, update pool transaction and update pool user liquidity
|
||||||
const user = getUser(event.params.caller.toHex())
|
const token = getToken(event.params.tokenIn.toHex())
|
||||||
poolTx.user = user.id
|
const ammount = weiToDecimal(
|
||||||
poolTx.pool = pool.id
|
event.params.tokenAmountIn.toBigDecimal(),
|
||||||
|
token.decimals
|
||||||
|
)
|
||||||
|
if (token.isDatatoken) {
|
||||||
|
poolTx.datatoken = token.id
|
||||||
|
poolTx.datatokenValue = ammount
|
||||||
|
} else {
|
||||||
|
poolTx.baseToken = token.id
|
||||||
|
poolTx.baseTokenValue = ammount
|
||||||
|
}
|
||||||
|
|
||||||
poolTx.timestamp = event.block.timestamp.toI32()
|
// update pool token
|
||||||
poolTx.tx = event.transaction.hash
|
const poolToken = getPoolToken(pool.id, token.id)
|
||||||
poolTx.block = event.block.number.toI32()
|
poolToken.balance.plus(ammount)
|
||||||
|
|
||||||
poolTx.gasPrice = gweiToEth(event.transaction.gasPrice.toBigDecimal())
|
|
||||||
poolTx.gasLimit = event.transaction.gasLimit.toBigDecimal()
|
|
||||||
|
|
||||||
|
poolToken.save()
|
||||||
poolTx.save()
|
poolTx.save()
|
||||||
pool.save()
|
pool.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function handleExit(event: LOG_EXIT): void {
|
||||||
|
const pool = getPool(event.address.toHex())
|
||||||
|
const user = getUser(event.params.caller.toHex())
|
||||||
|
const poolTx = getPoolTransaction(event, user.id, PoolTransactionType.EXIT)
|
||||||
|
|
||||||
|
pool.transactionCount = pool.transactionCount.plus(integer.ONE)
|
||||||
|
pool.joinCount = pool.joinCount.plus(integer.ONE)
|
||||||
|
|
||||||
|
// get token and update pool transaction, value is negative because this is an exit event.
|
||||||
|
const token = getToken(event.params.tokenOut.toHex())
|
||||||
|
const ammount = weiToDecimal(
|
||||||
|
event.params.tokenAmountOut.toBigDecimal(),
|
||||||
|
token.decimals
|
||||||
|
)
|
||||||
|
if (token.isDatatoken) {
|
||||||
|
poolTx.datatoken = token.id
|
||||||
|
poolTx.datatokenValue = ammount.neg()
|
||||||
|
} else {
|
||||||
|
poolTx.baseToken = token.id
|
||||||
|
poolTx.baseTokenValue = ammount.neg()
|
||||||
|
}
|
||||||
|
|
||||||
|
const poolToken = getPoolToken(pool.id, token.id)
|
||||||
|
poolToken.balance.minus(ammount)
|
||||||
|
|
||||||
|
poolToken.save()
|
||||||
|
poolTx.save()
|
||||||
|
pool.save()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleSwap(event: LOG_SWAP): void {
|
||||||
|
const pool = getPool(event.address.toHex())
|
||||||
|
const user = getUser(event.params.caller.toHex())
|
||||||
|
const poolTx = getPoolTransaction(event, user.id, PoolTransactionType.SWAP)
|
||||||
|
|
||||||
|
pool.transactionCount = pool.transactionCount.plus(integer.ONE)
|
||||||
|
pool.joinCount = pool.joinCount.plus(integer.ONE)
|
||||||
|
|
||||||
|
// get token out and update pool transaction, value is negative
|
||||||
|
const tokenOut = getToken(event.params.tokenOut.toHex())
|
||||||
|
const ammountOut = weiToDecimal(
|
||||||
|
event.params.tokenAmountOut.toBigDecimal(),
|
||||||
|
tokenOut.decimals
|
||||||
|
)
|
||||||
|
if (tokenOut.isDatatoken) {
|
||||||
|
poolTx.datatoken = tokenOut.id
|
||||||
|
poolTx.datatokenValue = ammountOut.neg()
|
||||||
|
} else {
|
||||||
|
poolTx.baseToken = tokenOut.id
|
||||||
|
poolTx.baseTokenValue = ammountOut.neg()
|
||||||
|
}
|
||||||
|
const poolTokenOut = getPoolToken(pool.id, tokenOut.id)
|
||||||
|
poolTokenOut.balance.minus(ammountOut)
|
||||||
|
|
||||||
|
// update pool token in
|
||||||
|
const tokenIn = getToken(event.params.tokenIn.toHex())
|
||||||
|
const ammountIn = weiToDecimal(
|
||||||
|
event.params.tokenAmountIn.toBigDecimal(),
|
||||||
|
tokenIn.decimals
|
||||||
|
)
|
||||||
|
if (tokenIn.isDatatoken) {
|
||||||
|
poolTx.datatoken = tokenIn.id
|
||||||
|
poolTx.datatokenValue = ammountIn
|
||||||
|
} else {
|
||||||
|
poolTx.baseToken = tokenIn.id
|
||||||
|
poolTx.baseTokenValue = ammountIn
|
||||||
|
}
|
||||||
|
const poolTokenIn = getPoolToken(pool.id, tokenIn.id)
|
||||||
|
poolTokenIn.balance.plus(ammountIn)
|
||||||
|
|
||||||
|
// update spot price
|
||||||
|
const isTokenInDatatoken = tokenIn.isDatatoken
|
||||||
|
const spotPrice = calcSpotPrice(
|
||||||
|
pool.id,
|
||||||
|
isTokenInDatatoken ? tokenOut.id : tokenIn.id,
|
||||||
|
isTokenInDatatoken ? tokenIn.id : tokenOut.id,
|
||||||
|
isTokenInDatatoken ? tokenIn.decimals : tokenOut.decimals
|
||||||
|
)
|
||||||
|
pool.spotPrice = spotPrice
|
||||||
|
|
||||||
|
poolTokenIn.save()
|
||||||
|
poolTokenOut.save()
|
||||||
|
poolTx.save()
|
||||||
|
pool.save()
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup is just to set token weight and spotPrice , it will mostly be 50:50
|
||||||
|
export function handleSetup(event: LOG_SETUP): void {
|
||||||
|
const pool = getPool(event.address.toHex())
|
||||||
|
|
||||||
|
const token = getToken(event.params.baseToken.toHex())
|
||||||
|
const baseToken = getPoolToken(pool.id, event.params.baseToken.toHex())
|
||||||
|
baseToken.denormWeight = weiToDecimal(
|
||||||
|
event.params.baseTokenWeight.toBigDecimal(),
|
||||||
|
token.decimals
|
||||||
|
)
|
||||||
|
baseToken.save()
|
||||||
|
|
||||||
|
// decimals hardcoded because datatokens have 18 decimals
|
||||||
|
const datatoken = getPoolToken(pool.id, event.params.dataToken.toHex())
|
||||||
|
datatoken.denormWeight = weiToDecimal(
|
||||||
|
event.params.dataTokenWeight.toBigDecimal(),
|
||||||
|
18
|
||||||
|
)
|
||||||
|
|
||||||
|
// calculate spotPrice
|
||||||
|
const spotPrice = calcSpotPrice(
|
||||||
|
pool.id,
|
||||||
|
pool.baseToken,
|
||||||
|
pool.datatoken,
|
||||||
|
token.decimals
|
||||||
|
)
|
||||||
|
pool.spotPrice = spotPrice
|
||||||
|
pool.isFinalized = true
|
||||||
|
|
||||||
|
pool.save()
|
||||||
|
datatoken.save()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleBpt(event: LOG_BPT): void {
|
||||||
|
const pool = getPool(event.address.toHex())
|
||||||
|
const poolShares = getPoolShares(pool.id, event.transaction.from.toHex())
|
||||||
|
const poolTx = PoolTransaction.load(event.transaction.hash.toHex())
|
||||||
|
// TODO: should we return here if null? theoretically this should not be null since LOG_BPT is after the other events
|
||||||
|
if (!poolTx) return
|
||||||
|
|
||||||
|
const decimalBpt = weiToDecimal(event.params.bptAmount.toBigDecimal(), 18)
|
||||||
|
|
||||||
|
switch (poolTx.type) {
|
||||||
|
case PoolTransactionType.JOIN: {
|
||||||
|
poolShares.shares = poolShares.shares.plus(decimalBpt)
|
||||||
|
pool.totalShares.plus(decimalBpt)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
case PoolTransactionType.EXIT: {
|
||||||
|
poolShares.shares = poolShares.shares.minus(decimalBpt)
|
||||||
|
pool.totalShares.minus(decimalBpt)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
poolShares.shares = weiToDecimal(event.params.bptAmount.toBigDecimal(), 18)
|
||||||
|
|
||||||
|
pool.save()
|
||||||
|
poolShares.save()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handlerBptTransfer(event: Transfer): void {
|
||||||
|
const fromUser = getPoolShares(
|
||||||
|
event.address.toHex(),
|
||||||
|
event.params.src.toHex()
|
||||||
|
)
|
||||||
|
const toUser = getPoolShares(event.address.toHex(), event.params.dst.toHex())
|
||||||
|
const ammount = weiToDecimal(event.params.amt.toBigDecimal(), 18)
|
||||||
|
|
||||||
|
fromUser.shares = fromUser.shares.minus(ammount)
|
||||||
|
toUser.shares = toUser.shares.plus(ammount)
|
||||||
|
|
||||||
|
fromUser.save()
|
||||||
|
toUser.save()
|
||||||
|
}
|
||||||
|
@ -11,8 +11,15 @@ export namespace integer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export namespace decimal {
|
export namespace decimal {
|
||||||
export const ZERO_BD = BigDecimal.fromString('0.0')
|
export const ZERO = BigDecimal.fromString('0.0')
|
||||||
export const MINUS_1_BD = BigDecimal.fromString('-1.0')
|
export const MINUS_1 = BigDecimal.fromString('-1.0')
|
||||||
export const ONE_BD = BigDecimal.fromString('1.0')
|
export const ONE = BigDecimal.fromString('1.0')
|
||||||
export const BONE = BigDecimal.fromString('1000000000000000000')
|
export const BONE = BigDecimal.fromString('1000000000000000000')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum PoolTransactionType {
|
||||||
|
JOIN = 'JOIN',
|
||||||
|
EXIT = 'EXIT',
|
||||||
|
SWAP = 'SWAP',
|
||||||
|
SETUP = 'SETUP'
|
||||||
|
}
|
||||||
|
@ -26,7 +26,7 @@ export function getOceanAddress(): string {
|
|||||||
|
|
||||||
export const OCEAN: string = getOceanAddress()
|
export const OCEAN: string = getOceanAddress()
|
||||||
|
|
||||||
export function tokenToDecimal(amount: BigDecimal, decimals: i32): BigDecimal {
|
export function weiToDecimal(amount: BigDecimal, decimals: i32): BigDecimal {
|
||||||
const scale = BigInt.fromI32(10)
|
const scale = BigInt.fromI32(10)
|
||||||
.pow(decimals as u8)
|
.pow(decimals as u8)
|
||||||
.toBigDecimal()
|
.toBigDecimal()
|
||||||
|
3
src/mappings/utils/globalUtils.ts
Normal file
3
src/mappings/utils/globalUtils.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const GLOBAL_ID = 1
|
||||||
|
|
||||||
|
export function getGlobalStats(): void {}
|
@ -1,4 +1,66 @@
|
|||||||
import { PoolToken } from '../../@types/schema'
|
import { Address, BigDecimal, ethereum } from '@graphprotocol/graph-ts'
|
||||||
|
import {
|
||||||
|
Pool,
|
||||||
|
PoolShares,
|
||||||
|
PoolToken,
|
||||||
|
PoolTransaction
|
||||||
|
} from '../../@types/schema'
|
||||||
|
import { BPool } from '../../@types/templates/BPool/BPool'
|
||||||
|
import { PoolTransactionType } from './constants'
|
||||||
|
import { gweiToEth, weiToDecimal } from './generic'
|
||||||
|
|
||||||
|
export function getPoolSharesId(
|
||||||
|
poolAddress: string,
|
||||||
|
userAddress: string
|
||||||
|
): string {
|
||||||
|
return `${poolAddress}-${userAddress}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPoolTransaction(
|
||||||
|
event: ethereum.Event,
|
||||||
|
userAddress: string,
|
||||||
|
type: PoolTransactionType
|
||||||
|
): PoolTransaction {
|
||||||
|
let poolTx = PoolTransaction.load(event.transaction.hash.toHex())
|
||||||
|
|
||||||
|
// create pool transaction and fill basic fields
|
||||||
|
if (poolTx === null) {
|
||||||
|
poolTx = new PoolTransaction(event.transaction.hash.toHex())
|
||||||
|
|
||||||
|
poolTx.user = userAddress
|
||||||
|
poolTx.pool = event.address.toHex()
|
||||||
|
poolTx.type = type
|
||||||
|
|
||||||
|
poolTx.timestamp = event.block.timestamp.toI32()
|
||||||
|
poolTx.tx = event.transaction.hash
|
||||||
|
poolTx.block = event.block.number.toI32()
|
||||||
|
|
||||||
|
poolTx.gasPrice = gweiToEth(event.transaction.gasPrice.toBigDecimal())
|
||||||
|
poolTx.gasLimit = event.transaction.gasLimit.toBigDecimal()
|
||||||
|
}
|
||||||
|
|
||||||
|
return poolTx
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPoolShares(
|
||||||
|
poolAddress: string,
|
||||||
|
userAddress: string
|
||||||
|
): PoolShares {
|
||||||
|
let poolShares = PoolShares.load(getPoolSharesId(poolAddress, userAddress))
|
||||||
|
if (poolShares === null) {
|
||||||
|
poolShares = new PoolShares(getPoolSharesId(poolAddress, userAddress))
|
||||||
|
}
|
||||||
|
return poolShares
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPool(poolAddress: string): Pool {
|
||||||
|
const pool = Pool.load(poolAddress)
|
||||||
|
if (pool === null) {
|
||||||
|
// what now?
|
||||||
|
throw new Error(`Didn't find pool with address ${poolAddress} `)
|
||||||
|
}
|
||||||
|
return pool
|
||||||
|
}
|
||||||
|
|
||||||
export function getPoolTokenId(
|
export function getPoolTokenId(
|
||||||
poolAddress: string,
|
poolAddress: string,
|
||||||
@ -19,3 +81,20 @@ export function getPoolToken(
|
|||||||
|
|
||||||
return poolToken
|
return poolToken
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function calcSpotPrice(
|
||||||
|
poolAddress: string,
|
||||||
|
baseTokenAddress: string,
|
||||||
|
datatokenAddress: string,
|
||||||
|
baseTokenDecimals: i32
|
||||||
|
): BigDecimal {
|
||||||
|
const poolContract = BPool.bind(Address.fromString(poolAddress))
|
||||||
|
// tokenIn is always the baseToken and tokenOut is the datatoken because we want the spot price to be in baseToken eg: 1 DT = 0.5 OCEAN
|
||||||
|
const weiPrice = poolContract.try_getSpotPrice(
|
||||||
|
Address.fromString(baseTokenAddress),
|
||||||
|
Address.fromString(datatokenAddress)
|
||||||
|
).reverted
|
||||||
|
const price = weiToDecimal(weiPrice, baseTokenDecimals)
|
||||||
|
|
||||||
|
return price
|
||||||
|
}
|
||||||
|
@ -22,9 +22,9 @@ dataSources:
|
|||||||
- name: ERC721Factory
|
- name: ERC721Factory
|
||||||
file: ./abis/ERC721Factory.json
|
file: ./abis/ERC721Factory.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: NFTCreated(indexed address,indexed address,indexed string,address)
|
- event: NFTCreated(indexed address,indexed address,string,address,string,string)
|
||||||
handler: handleNftCreated
|
handler: handleNftCreated
|
||||||
- event: TokenCreated(indexed address,indexed address,indexed string)
|
- event: TokenCreated(indexed address,indexed address,string,string,uint256,address)
|
||||||
handler: handleNewToken
|
handler: handleNewToken
|
||||||
- kind: ethereum/contract
|
- kind: ethereum/contract
|
||||||
name: FixedRateExchange
|
name: FixedRateExchange
|
||||||
@ -59,11 +59,11 @@ dataSources:
|
|||||||
- event: Swapped(indexed bytes32,indexed address,uint256,uint256,address,uint256,uint256)
|
- event: Swapped(indexed bytes32,indexed address,uint256,uint256,address,uint256,uint256)
|
||||||
handler: handleSwap
|
handler: handleSwap
|
||||||
- kind: ethereum/contract
|
- kind: ethereum/contract
|
||||||
name: Dispenser
|
name: Dispenser
|
||||||
network: barge
|
network: barge
|
||||||
source:
|
source:
|
||||||
address: '0xb119b8895801111ff323ba63a77D4Fe78ED057a5'
|
address: '0xb119b8895801111ff323ba63a77D4Fe78ED057a5'
|
||||||
abi: Dispenser
|
abi: Dispenser
|
||||||
startBlock: 0
|
startBlock: 0
|
||||||
mapping:
|
mapping:
|
||||||
kind: ethereum/events
|
kind: ethereum/events
|
||||||
@ -71,12 +71,12 @@ dataSources:
|
|||||||
language: wasm/assemblyscript
|
language: wasm/assemblyscript
|
||||||
file: ./src/mappings/dispenser.ts
|
file: ./src/mappings/dispenser.ts
|
||||||
entities:
|
entities:
|
||||||
- Dispenser
|
- Dispenser
|
||||||
abis:
|
abis:
|
||||||
- name: Dispenser
|
- name: Dispenser
|
||||||
file: ./abis/Dispenser.json
|
file: ./abis/Dispenser.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: DispenserCreated(indexed address)
|
- event: DispenserCreated(indexed address,indexed address,uint256,uint256,address)
|
||||||
handler: handleNewDispenser
|
handler: handleNewDispenser
|
||||||
- event: DispenserActivated(indexed address)
|
- event: DispenserActivated(indexed address)
|
||||||
handler: handleActivate
|
handler: handleActivate
|
||||||
@ -124,38 +124,40 @@ templates:
|
|||||||
- event: CleanedPermissions(indexed address,uint256,uint256)
|
- event: CleanedPermissions(indexed address,uint256,uint256)
|
||||||
handler: handleCleanPermissions
|
handler: handleCleanPermissions
|
||||||
- kind: ethereum/contract
|
- kind: ethereum/contract
|
||||||
name: BFactory
|
name: BFactory
|
||||||
network: barge
|
network: barge
|
||||||
source:
|
source:
|
||||||
abi: BFactory
|
abi: BFactory
|
||||||
mapping:
|
mapping:
|
||||||
kind: ethereum/events
|
kind: ethereum/events
|
||||||
apiVersion: 0.0.5
|
apiVersion: 0.0.5
|
||||||
language: wasm/assemblyscript
|
language: wasm/assemblyscript
|
||||||
file: ./src/mappings/poolFactory.ts
|
file: ./src/mappings/poolFactory.ts
|
||||||
entities:
|
entities:
|
||||||
- BFactory
|
- BFactory
|
||||||
abis:
|
abis:
|
||||||
- name: BFactory
|
- name: BFactory
|
||||||
file: ./abis/BFactory.json
|
file: ./abis/BFactory.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: BPoolCreated(indexed address,indexed address,indexed address,address,address,address)
|
- event: BPoolCreated(indexed address,indexed address,indexed address,address,address,address)
|
||||||
handler: handleNewPool
|
handler: handleNewPool
|
||||||
- kind: ethereum/contract
|
- kind: ethereum/contract
|
||||||
name: BPool
|
name: BPool
|
||||||
network: barge
|
network: barge
|
||||||
source:
|
source:
|
||||||
abi: BPool
|
abi: BPool
|
||||||
mapping:
|
mapping:
|
||||||
kind: ethereum/events
|
kind: ethereum/events
|
||||||
apiVersion: 0.0.5
|
apiVersion: 0.0.5
|
||||||
language: wasm/assemblyscript
|
language: wasm/assemblyscript
|
||||||
file: ./src/mappings/pool.ts
|
file: ./src/mappings/pool.ts
|
||||||
entities:
|
entities:
|
||||||
- BPool
|
- BPool
|
||||||
abis:
|
abis:
|
||||||
- name: BPool
|
- name: BPool
|
||||||
file: ./abis/BPool.json
|
file: ./abis/BPool.json
|
||||||
|
- name: BToken
|
||||||
|
file: ./abis/BToken.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256,uint256)
|
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256,uint256)
|
||||||
handler: handleSwap
|
handler: handleSwap
|
||||||
@ -163,5 +165,12 @@ templates:
|
|||||||
handler: handleJoin
|
handler: handleJoin
|
||||||
- event: LOG_EXIT(indexed address,indexed address,uint256,uint256)
|
- event: LOG_EXIT(indexed address,indexed address,uint256,uint256)
|
||||||
handler: handleExit
|
handler: handleExit
|
||||||
|
- event: LOG_SETUP(indexed address,indexed address,uint256,uint256,indexed address,uint256,uint256)
|
||||||
|
handler: handleSetup
|
||||||
- event: LOG_BPT(uint256)
|
- event: LOG_BPT(uint256)
|
||||||
handler: handleBpt
|
handler: handleBpt
|
||||||
|
- event: Transfer(indexed address,indexed address,uint256)
|
||||||
|
handler: handlerBptTransfer
|
||||||
|
|
||||||
|
features:
|
||||||
|
- nonFatalErrors
|
||||||
|
Loading…
Reference in New Issue
Block a user