mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
updated
This commit is contained in:
parent
b39ecb6e12
commit
bc1784edfe
334
abis/Dispenser.json
Normal file
334
abis/Dispenser.json
Normal file
File diff suppressed because one or more lines are too long
225
abis/ERC20.json
Normal file
225
abis/ERC20.json
Normal file
@ -0,0 +1,225 @@
|
||||
{
|
||||
"contractName": "ERC20",
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "fallback"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
}
|
204
abis/ERC20Roles.json
Normal file
204
abis/ERC20Roles.json
Normal file
@ -0,0 +1,204 @@
|
||||
|
||||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "ERC20Roles",
|
||||
"sourceName": "contracts/utils/ERC20Roles.sol",
|
||||
"abi": [
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddedFeeManager",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddedMinter",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "CleanedPermissions",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemovedFeeManager",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemovedMinter",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "authERC20",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "permissions",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "minter",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "feeManager",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x608060405234801561001057600080fd5b50610157806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806301e882081461003b578063ef867ff414610083575b600080fd5b6100676100493660046100d8565b60006020819052908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152015b60405180910390f35b610096610091366004610108565b6100ae565b6040516001600160a01b03909116815260200161007a565b600181815481106100be57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000602082840312156100ea57600080fd5b81356001600160a01b038116811461010157600080fd5b9392505050565b60006020828403121561011a57600080fd5b503591905056fea26469706673582212208b39415173b3f678559d83bbb56ee8b4f17b6bd1c999526ee00defa21731a4cc64736f6c63430008070033",
|
||||
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806301e882081461003b578063ef867ff414610083575b600080fd5b6100676100493660046100d8565b60006020819052908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152015b60405180910390f35b610096610091366004610108565b6100ae565b6040516001600160a01b03909116815260200161007a565b600181815481106100be57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000602082840312156100ea57600080fd5b81356001600160a01b038116811461010157600080fd5b9392505050565b60006020828403121561011a57600080fd5b503591905056fea26469706673582212208b39415173b3f678559d83bbb56ee8b4f17b6bd1c999526ee00defa21731a4cc64736f6c63430008070033",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
422
abis/ERC721RolesAddress.json
Normal file
422
abis/ERC721RolesAddress.json
Normal file
@ -0,0 +1,422 @@
|
||||
{
|
||||
"_format": "hh-sol-artifact-1",
|
||||
"contractName": "ERC721RolesAddress",
|
||||
"sourceName": "contracts/utils/ERC721RolesAddress.sol",
|
||||
"abi": [
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddedManager",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddedTo725StoreList",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddedToCreateERC20List",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "AddedToMetadataList",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "CleanedPermissions",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemovedFrom725StoreList",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemovedFromCreateERC20List",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemovedFromMetadataList",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "signer",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "timestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "blockNumber",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "RemovedManager",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_allowedAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addTo725StoreList",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_allowedAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addToCreateERC20List",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_allowedAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addToMetadataList",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "auth",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "user",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getPermissions",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "manager",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "deployERC20",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "updateMetadata",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "store",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"internalType": "struct ERC721RolesAddress.Roles",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_allowedAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeFrom725StoreList",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_allowedAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeFromCreateERC20List",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "_allowedAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeFromMetadataList",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x608060405234801561001057600080fd5b5061090f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063431053ac1161005b578063431053ac1461019f5780634a63740a146101b2578063b0c41ead146101c5578063fe1ec880146101f057600080fd5b806310c558bf1461008d578063160a7925146100a257806319c186e514610179578063273e06b31461018c575b600080fd5b6100a061009b366004610859565b610203565b005b6101356100b0366004610859565b604080516080810182526000808252602082018190529181018290526060810191909152506001600160a01b0316600090815260208181526040918290208251608081018452905460ff808216151583526101008204811615159383019390935262010000810483161515938201939093526301000000909204161515606082015290565b604051610170919081511515815260208083015115159082015260408083015115159082015260609182015115159181019190915260800190565b60405180910390f35b6100a0610187366004610859565b6102f0565b6100a061019a366004610859565b6103ca565b6100a06101ad366004610859565b6104fc565b6100a06101c0366004610859565b61062d565b6101d86101d3366004610889565b610703565b6040516001600160a01b039091168152602001610170565b6100a06101fe366004610859565b61072d565b3360009081526020819052604090205460ff1615156001146102405760405162461bcd60e51b8152600401610237906108a2565b60405180910390fd5b6001600160a01b038116600081815260208190526040808220805462ff000019166201000017815560018054808201825593527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168417905551909133917fc2a42571a74ce1442c8c44d375ba9442e7d55d94b37afeace261c83c62128fa4906102e49042904390918252602082015260400190565b60405180910390a35050565b3360009081526020819052604090205460ff1615156001146103245760405162461bcd60e51b8152600401610237906108a2565b6001600160a01b038116600081815260208190526040808220805463ff0000001916630100000017815560018054808201825593527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168417905551909133917feb09276310ed110a7e565d64966d0ff68a47112d2dd5eeb6cbd7451836ce35ee906102e49042904390918252602082015260400190565b3360009081526020819052604090205460ff1615156001148061041b5750336001600160a01b03821614801561041b5750336000908152602081905260409020546301000000900460ff1615156001145b1561047f576001600160a01b03811660008181526020818152604091829020805463ff000000191681558251428152439281019290925292339290917fc929b18b08ffea86a1f95e29384dbe8968f2fcbd70cfd735df3aba1cc548cbf391016102e4565b60405162461bcd60e51b815260206004820152604660248201527f455243373231526f6c6573416464726573733a204e6f7420656e6f756768207060448201527f65726d697373696f6e7320746f2072656d6f76652066726f6d2037323553746f6064820152651c99531a5cdd60d21b608482015260a401610237565b3360009081526020819052604090205460ff1615156001148061054c5750336001600160a01b03821614801561054c57503360009081526020819052604090205462010000900460ff1615156001145b156105af576001600160a01b03811660008181526020818152604091829020805462ff0000191681558251428152439281019290925292339290917f9b41e1311fa819e825bc77fa2568492112e15ea92d173f3f8ee1c8ec3c1c562b91016102e4565b60405162461bcd60e51b815260206004820152604760248201527f455243373231526f6c6573416464726573733a204e6f7420656e6f756768207060448201527f65726d697373696f6e7320746f2072656d6f76652066726f6d206d65746164616064820152661d18481b1a5cdd60ca1b608482015260a401610237565b3360009081526020819052604090205460ff1615156001146106615760405162461bcd60e51b8152600401610237906108a2565b6001600160a01b038116600081815260208190526040808220805461ff00191661010017815560018054808201825593527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168417905551909133917f0572d56343be407a66810f01449212e8545e14ff5049c479d34be944cdfd0d4f906102e49042904390918252602082015260400190565b6001818154811061071357600080fd5b6000918252602090912001546001600160a01b0316905081565b3360009081526020819052604090205460ff1615156001148061077d5750336001600160a01b03821614801561077d57503360009081526020819052604090205460ff6101009091041615156001145b156107df576001600160a01b03811660008181526020818152604091829020805461ff00191681558251428152439281019290925292339290917f59bd33f4c27cc16a2d74450e1fa43d7896020be9aecea4bee009db9294de899791016102e4565b60405162461bcd60e51b815260206004820152604360248201527f455243373231526f6c6573416464726573733a204e6f7420656e6f756768207060448201527f65726d697373696f6e7320746f2072656d6f76652066726f6d2045524332304c6064820152621a5cdd60ea1b608482015260a401610237565b60006020828403121561086b57600080fd5b81356001600160a01b038116811461088257600080fd5b9392505050565b60006020828403121561089b57600080fd5b5035919050565b6020808252601f908201527f455243373231526f6c6573416464726573733a204e4f54204d414e414745520060408201526060019056fea2646970667358221220248218b22aec91e387c93ed97ce3e042c3ec436875947fa77390c9eaed3129ec64736f6c63430008070033",
|
||||
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063431053ac1161005b578063431053ac1461019f5780634a63740a146101b2578063b0c41ead146101c5578063fe1ec880146101f057600080fd5b806310c558bf1461008d578063160a7925146100a257806319c186e514610179578063273e06b31461018c575b600080fd5b6100a061009b366004610859565b610203565b005b6101356100b0366004610859565b604080516080810182526000808252602082018190529181018290526060810191909152506001600160a01b0316600090815260208181526040918290208251608081018452905460ff808216151583526101008204811615159383019390935262010000810483161515938201939093526301000000909204161515606082015290565b604051610170919081511515815260208083015115159082015260408083015115159082015260609182015115159181019190915260800190565b60405180910390f35b6100a0610187366004610859565b6102f0565b6100a061019a366004610859565b6103ca565b6100a06101ad366004610859565b6104fc565b6100a06101c0366004610859565b61062d565b6101d86101d3366004610889565b610703565b6040516001600160a01b039091168152602001610170565b6100a06101fe366004610859565b61072d565b3360009081526020819052604090205460ff1615156001146102405760405162461bcd60e51b8152600401610237906108a2565b60405180910390fd5b6001600160a01b038116600081815260208190526040808220805462ff000019166201000017815560018054808201825593527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168417905551909133917fc2a42571a74ce1442c8c44d375ba9442e7d55d94b37afeace261c83c62128fa4906102e49042904390918252602082015260400190565b60405180910390a35050565b3360009081526020819052604090205460ff1615156001146103245760405162461bcd60e51b8152600401610237906108a2565b6001600160a01b038116600081815260208190526040808220805463ff0000001916630100000017815560018054808201825593527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168417905551909133917feb09276310ed110a7e565d64966d0ff68a47112d2dd5eeb6cbd7451836ce35ee906102e49042904390918252602082015260400190565b3360009081526020819052604090205460ff1615156001148061041b5750336001600160a01b03821614801561041b5750336000908152602081905260409020546301000000900460ff1615156001145b1561047f576001600160a01b03811660008181526020818152604091829020805463ff000000191681558251428152439281019290925292339290917fc929b18b08ffea86a1f95e29384dbe8968f2fcbd70cfd735df3aba1cc548cbf391016102e4565b60405162461bcd60e51b815260206004820152604660248201527f455243373231526f6c6573416464726573733a204e6f7420656e6f756768207060448201527f65726d697373696f6e7320746f2072656d6f76652066726f6d2037323553746f6064820152651c99531a5cdd60d21b608482015260a401610237565b3360009081526020819052604090205460ff1615156001148061054c5750336001600160a01b03821614801561054c57503360009081526020819052604090205462010000900460ff1615156001145b156105af576001600160a01b03811660008181526020818152604091829020805462ff0000191681558251428152439281019290925292339290917f9b41e1311fa819e825bc77fa2568492112e15ea92d173f3f8ee1c8ec3c1c562b91016102e4565b60405162461bcd60e51b815260206004820152604760248201527f455243373231526f6c6573416464726573733a204e6f7420656e6f756768207060448201527f65726d697373696f6e7320746f2072656d6f76652066726f6d206d65746164616064820152661d18481b1a5cdd60ca1b608482015260a401610237565b3360009081526020819052604090205460ff1615156001146106615760405162461bcd60e51b8152600401610237906108a2565b6001600160a01b038116600081815260208190526040808220805461ff00191661010017815560018054808201825593527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168417905551909133917f0572d56343be407a66810f01449212e8545e14ff5049c479d34be944cdfd0d4f906102e49042904390918252602082015260400190565b6001818154811061071357600080fd5b6000918252602090912001546001600160a01b0316905081565b3360009081526020819052604090205460ff1615156001148061077d5750336001600160a01b03821614801561077d57503360009081526020819052604090205460ff6101009091041615156001145b156107df576001600160a01b03811660008181526020818152604091829020805461ff00191681558251428152439281019290925292339290917f59bd33f4c27cc16a2d74450e1fa43d7896020be9aecea4bee009db9294de899791016102e4565b60405162461bcd60e51b815260206004820152604360248201527f455243373231526f6c6573416464726573733a204e6f7420656e6f756768207060448201527f65726d697373696f6e7320746f2072656d6f76652066726f6d2045524332304c6064820152621a5cdd60ea1b608482015260a401610237565b60006020828403121561086b57600080fd5b81356001600160a01b038116811461088257600080fd5b9392505050565b60006020828403121561089b57600080fd5b5035919050565b6020808252601f908201527f455243373231526f6c6573416464726573733a204e4f54204d414e414745520060408201526060019056fea2646970667358221220248218b22aec91e387c93ed97ce3e042c3ec436875947fa77390c9eaed3129ec64736f6c63430008070033",
|
||||
"linkReferences": {},
|
||||
"deployedLinkReferences": {}
|
||||
}
|
@ -19,7 +19,7 @@ type Token @entity {
|
||||
holderCount: BigInt # Number of addresses holding a balance of datatoken
|
||||
orderCount: BigInt # Number of orders executed for this datatoken
|
||||
|
||||
createTime: Int # Block time datatoken was created
|
||||
createdTimestamp: Int # Block time datatoken was created
|
||||
tx: Bytes # Datatoken creation transaction id
|
||||
block: Int # Block number when it was created
|
||||
}
|
||||
@ -46,7 +46,7 @@ type Nft @entity{
|
||||
metadataRole: [String!] # addresses that can update the metadata
|
||||
|
||||
template: String! # template address
|
||||
createTime: Int! # Block time pool was created
|
||||
createdTimestamp: Int! # Block time pool was created
|
||||
tx: Bytes # Pool creation transaction id
|
||||
block: Int # Block number when it was created
|
||||
}
|
||||
@ -84,7 +84,7 @@ type Pool @entity {
|
||||
swapCount: BigInt!
|
||||
transactionCount: BigInt! # Number of transactions in this pool involving liquidity changes
|
||||
|
||||
createTime: Int! # Block time pool was created
|
||||
createdTimestamp: Int! # Block time pool was created
|
||||
tx: Bytes # Pool creation transaction id
|
||||
block: Int # Block number when it was created
|
||||
|
||||
@ -127,7 +127,7 @@ type PoolTransaction @entity {
|
||||
tx: Bytes!
|
||||
event: String
|
||||
block: Int!
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
gasUsed: BigDecimal!
|
||||
gasPrice: BigDecimal!
|
||||
|
||||
@ -154,7 +154,7 @@ type Order @entity { # renamed from Toke
|
||||
consumerMarketToken: Token #
|
||||
consumerMarketAmmount: BigDecimal #call contract to get fee ammount
|
||||
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes
|
||||
block: Int!
|
||||
}
|
||||
@ -169,7 +169,7 @@ type TokenTransaction @entity {
|
||||
block: Int!
|
||||
gasUsed: BigDecimal!
|
||||
gasPrice: BigDecimal!
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes!
|
||||
}
|
||||
|
||||
@ -192,29 +192,33 @@ type FixedRateExchange @entity {
|
||||
active: Boolean!
|
||||
totalSwapValue: BigDecimal! # amount of total basetokens spent
|
||||
allowedSwapper: String # address that is allowed to swap tokens
|
||||
supply: Int!
|
||||
supply: BigInt!
|
||||
withMint: Boolean # if the owner allowes the fre to mint
|
||||
isMinter: Boolean # if the fre has the minter role on the datatoken
|
||||
|
||||
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
||||
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
|
||||
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes
|
||||
block: Int!
|
||||
}
|
||||
|
||||
type FixedRateExchangeUpdate @entity {
|
||||
id: ID!
|
||||
exchangeId: FixedRateExchange!
|
||||
|
||||
oldPrice: BigDecimal!
|
||||
newPrice: BigDecimal!
|
||||
oldPrice: BigDecimal
|
||||
newPrice: BigDecimal
|
||||
|
||||
oldActive: Boolean!
|
||||
newActive: Boolean!
|
||||
oldActive: Boolean
|
||||
newActive: Boolean
|
||||
|
||||
oldAllowedSwapper: String
|
||||
newAllowedSwapper: String
|
||||
|
||||
block: Int!
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes!
|
||||
}
|
||||
|
||||
@ -225,7 +229,7 @@ type FixedRateExchangeSwap @entity {
|
||||
baseTokenAmount: BigDecimal!
|
||||
dataTokenAmount: BigDecimal!
|
||||
block: Int!
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes!
|
||||
}
|
||||
|
||||
@ -237,6 +241,7 @@ type Dispenser @entity {
|
||||
owner: User!
|
||||
datatoken: Token!
|
||||
|
||||
allowedSwapper: String
|
||||
withMint: Boolean # if the owner allowes the fre to mint
|
||||
isMinter: Boolean # if the fre has the minter role on the datatoken
|
||||
maxTokens: BigDecimal! # max tokens that can be dispensed
|
||||
@ -247,14 +252,13 @@ type Dispenser @entity {
|
||||
}
|
||||
|
||||
type DispenserTransaction @entity {
|
||||
id: ID!
|
||||
id: ID!
|
||||
dispenser: Dispenser!
|
||||
datatoken: Token!
|
||||
user: User!
|
||||
amount: BigDecimal!
|
||||
|
||||
block: Int!
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes!
|
||||
}
|
||||
|
||||
@ -264,7 +268,7 @@ type PoolSnapshot @entity {
|
||||
totalShares: BigDecimal!
|
||||
swapVolume: BigDecimal! # swap value 24h
|
||||
swapFees: BigDecimal! # swap fee value 24h
|
||||
timestamp: Int! # date without time
|
||||
createdTimestamp: Int! # date without time
|
||||
spotPrice: BigDecimal! # TODO: last spot price or first one?
|
||||
tokens: [PoolSnapshotTokenValue!] @derivedFrom(field: "poolSnapshot")
|
||||
}
|
||||
@ -300,6 +304,6 @@ type MetadataUpdate @entity {
|
||||
userAddress: String!
|
||||
|
||||
block: Int!
|
||||
timestamp: Int!
|
||||
createdTimestamp: Int!
|
||||
tx: Bytes!
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import {
|
||||
MinterApproved,
|
||||
OrderStarted
|
||||
} from '../@types/ERC20Template/ERC20Template'
|
||||
// TODO: no events in contracts
|
||||
// TODO: no events in contracts , it's ok !!
|
||||
export function handleMinterApproved(event: MinterApproved): void {}
|
||||
|
||||
// TODO: to complicated at this point, return after basic events implemented ¯\_(ツ)_/¯
|
65
src/mappings/dispenser.ts
Normal file
65
src/mappings/dispenser.ts
Normal file
@ -0,0 +1,65 @@
|
||||
import {
|
||||
DispenserActivated,
|
||||
DispenserAllowedSwapperChanged,
|
||||
DispenserDeactivated,
|
||||
OwnerWithdrawed,
|
||||
TokensDispensed
|
||||
} from '../@types/Dispenser/Dispenser'
|
||||
import { DispenserCreated } from '../@types/ERC721Factory/ERC721Factory'
|
||||
import { DispenserTransaction } from '../@types/schema'
|
||||
import { ZERO_BD } from '../helpers'
|
||||
import { createDispenser, getDispenser } from './utils/dispenserUtils'
|
||||
import { getUser } from './utils/userUtils'
|
||||
|
||||
export function handleNewDispenser(event: DispenserCreated): void {
|
||||
createDispenser(event.params.datatokenAddress.toHex())
|
||||
}
|
||||
|
||||
export function handleActivate(event: DispenserActivated): void {
|
||||
const dispenser = getDispenser(event.params.datatokenAddress.toHex())
|
||||
dispenser.active = true
|
||||
dispenser.save()
|
||||
}
|
||||
|
||||
export function handleDeactivate(event: DispenserDeactivated): void {
|
||||
const dispenser = getDispenser(event.params.datatokenAddress.toHex())
|
||||
dispenser.active = true
|
||||
dispenser.save()
|
||||
}
|
||||
|
||||
export function handleAllowedSwapperChanged(
|
||||
event: DispenserAllowedSwapperChanged
|
||||
): void {
|
||||
const dispenser = getDispenser(event.params.datatoken.toHex())
|
||||
dispenser.allowedSwapper = event.params.newAllowedSwapper.toHex()
|
||||
dispenser.save()
|
||||
}
|
||||
|
||||
export function handleTokensDispensed(event: TokensDispensed): void {
|
||||
const id = event.transaction.hash
|
||||
.toHexString()
|
||||
.concat('-')
|
||||
.concat(event.params.datatokenAddress.toHexString())
|
||||
|
||||
const dispenserTransaction = new DispenserTransaction(id)
|
||||
const dispenser = getDispenser(event.params.datatokenAddress.toHex())
|
||||
dispenser.balance = dispenser.balance.minus(
|
||||
event.params.amount.toBigDecimal()
|
||||
)
|
||||
dispenser.save()
|
||||
|
||||
dispenserTransaction.dispenser = dispenser.id
|
||||
const user = getUser(event.params.userAddress.toHex())
|
||||
dispenserTransaction.user = user.id
|
||||
|
||||
dispenserTransaction.createdTimestamp = event.block.timestamp.toI32()
|
||||
dispenserTransaction.tx = event.transaction.hash
|
||||
dispenserTransaction.block = event.block.number.toI32()
|
||||
dispenserTransaction.save()
|
||||
}
|
||||
|
||||
export function handleOwnerWinthdraw(event: OwnerWithdrawed): void {
|
||||
const dispenser = getDispenser(event.params.datatoken.toHex())
|
||||
dispenser.balance = ZERO_BD
|
||||
dispenser.save()
|
||||
}
|
@ -1,16 +1,17 @@
|
||||
import { log } from '@graphprotocol/graph-ts'
|
||||
import { NFTCreated, TokenCreated } from '../@types/ERC721Factory/ERC721Factory'
|
||||
import { Nft, Token } from '../@types/schema'
|
||||
import { ZERO_BD } from '../helpers'
|
||||
import { getUser } from './utils/userUtils'
|
||||
|
||||
export function handleNftCreated(event: NFTCreated): void {
|
||||
const nft = new Nft(event.params.newTokenAddress.toHexString())
|
||||
|
||||
nft.owner = event.params.admin.toHexString()
|
||||
const user = getUser(event.params.admin.toHexString())
|
||||
nft.owner = user.id
|
||||
nft.address = event.params.newTokenAddress.toHexString()
|
||||
nft.name = event.params.tokenName.toHex()
|
||||
nft.symbol = ''
|
||||
nft.createTime = event.block.timestamp.toI32()
|
||||
nft.createdTimestamp = event.block.timestamp.toI32()
|
||||
nft.tx = event.transaction.hash
|
||||
nft.block = event.block.number.toI32()
|
||||
|
||||
@ -21,13 +22,12 @@ export function handleNewToken(event: TokenCreated): void {
|
||||
const token = new Token(event.params.newTokenAddress.toHexString())
|
||||
token.isDatatoken = true
|
||||
token.address = event.params.newTokenAddress.toHexString()
|
||||
token.createTime = event.block.timestamp.toI32()
|
||||
token.createdTimestamp = event.block.timestamp.toI32()
|
||||
token.tx = event.transaction.hash
|
||||
token.block = event.block.number.toI32()
|
||||
|
||||
token.name = event.params.tokenName.toString()
|
||||
token.decimals = 18
|
||||
token.supply = ZERO_BD
|
||||
log.info('dt name {} ', [event.params.tokenName.toString()])
|
||||
token.save()
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { Pool } from '../@types/schema'
|
||||
export function handleNewPool(event: NewPool): void {
|
||||
const newPool = new Pool(event.params.poolAddress.toHex())
|
||||
|
||||
newPool.createTime = event.block.timestamp.toI32()
|
||||
newPool.createdTimestamp = event.block.timestamp.toI32()
|
||||
newPool.tx = event.transaction.hash
|
||||
newPool.block = event.block.number.toI32()
|
||||
newPool.save()
|
||||
|
@ -1,15 +1,29 @@
|
||||
import { BigInt } from '@graphprotocol/graph-ts'
|
||||
import { ExchangeCreated } from '../@types/FixedRateExchange/FixedRateExchange'
|
||||
|
||||
import { FixedRateExchange } from '../@types/schema'
|
||||
|
||||
import {
|
||||
ExchangeActivated,
|
||||
ExchangeAllowedSwapperChanged,
|
||||
ExchangeCreated,
|
||||
ExchangeDeactivated,
|
||||
ExchangeMintStateChanged,
|
||||
ExchangeRateChanged,
|
||||
Swapped
|
||||
} from '../@types/FixedRateExchange/FixedRateExchange'
|
||||
import {
|
||||
FixedRateExchange,
|
||||
FixedRateExchangeSwap,
|
||||
FixedRateExchangeUpdate
|
||||
} from '../@types/schema'
|
||||
import { tokenToDecimal } from '../helpers'
|
||||
import { getFixedRateExchange, getUpdateOrSwapId } from './utils/fixedRateUtils'
|
||||
import { getToken } from './utils/tokenUtils'
|
||||
import { getUser } from './utils/userUtils'
|
||||
|
||||
export function handleExchangeCreated(event: ExchangeCreated): void {
|
||||
const fixedRateExchange = new FixedRateExchange(
|
||||
event.params.exchangeId.toHexString()
|
||||
)
|
||||
fixedRateExchange.owner = event.params.exchangeOwner.toHexString()
|
||||
const user = getUser(event.params.exchangeOwner.toHexString())
|
||||
fixedRateExchange.owner = user.id
|
||||
fixedRateExchange.datatoken = event.params.dataToken.toHexString()
|
||||
fixedRateExchange.baseToken = event.params.baseToken.toHexString()
|
||||
// fixedRateExchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
|
||||
@ -21,3 +35,144 @@ export function handleExchangeCreated(event: ExchangeCreated): void {
|
||||
)
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
export function handleRateChange(event: ExchangeRateChanged): void {
|
||||
const fixedRateExchange = getFixedRateExchange(
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
const newExchangeUpdate = new FixedRateExchangeUpdate(
|
||||
getUpdateOrSwapId(
|
||||
event.transaction.hash.toHex(),
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
)
|
||||
newExchangeUpdate.oldPrice = fixedRateExchange.price
|
||||
newExchangeUpdate.createdTimestamp = event.block.timestamp.toI32()
|
||||
newExchangeUpdate.tx = event.transaction.hash
|
||||
newExchangeUpdate.block = event.block.number.toI32()
|
||||
|
||||
fixedRateExchange.price = tokenToDecimal(
|
||||
event.params.newRate.toBigDecimal(),
|
||||
BigInt.fromI32(18).toI32()
|
||||
)
|
||||
newExchangeUpdate.newPrice = fixedRateExchange.price
|
||||
|
||||
newExchangeUpdate.save()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
export function handleMintStateChanged(event: ExchangeMintStateChanged): void {
|
||||
const fixedRateExchange = getFixedRateExchange(
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
fixedRateExchange.withMint = event.params.withMint
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
// TODO: implement fre updates/history for changes
|
||||
|
||||
export function handleActivated(event: ExchangeActivated): void {
|
||||
const fixedRateExchange = getFixedRateExchange(
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
const newExchangeUpdate = new FixedRateExchangeUpdate(
|
||||
getUpdateOrSwapId(
|
||||
event.transaction.hash.toHex(),
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
)
|
||||
newExchangeUpdate.oldActive = fixedRateExchange.active
|
||||
newExchangeUpdate.newActive = true
|
||||
newExchangeUpdate.createdTimestamp = event.block.timestamp.toI32()
|
||||
newExchangeUpdate.tx = event.transaction.hash
|
||||
newExchangeUpdate.block = event.block.number.toI32()
|
||||
|
||||
fixedRateExchange.active = true
|
||||
|
||||
newExchangeUpdate.save()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
export function handleDeactivated(event: ExchangeDeactivated): void {
|
||||
const fixedRateExchange = getFixedRateExchange(
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
const newExchangeUpdate = new FixedRateExchangeUpdate(
|
||||
getUpdateOrSwapId(
|
||||
event.transaction.hash.toHex(),
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
)
|
||||
newExchangeUpdate.oldActive = fixedRateExchange.active
|
||||
newExchangeUpdate.newActive = false
|
||||
newExchangeUpdate.createdTimestamp = event.block.timestamp.toI32()
|
||||
newExchangeUpdate.tx = event.transaction.hash
|
||||
newExchangeUpdate.block = event.block.number.toI32()
|
||||
|
||||
fixedRateExchange.active = false
|
||||
newExchangeUpdate.save()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
export function handleAllowedSwapperChanged(
|
||||
event: ExchangeAllowedSwapperChanged
|
||||
): void {
|
||||
const fixedRateExchange = getFixedRateExchange(
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
const newExchangeUpdate = new FixedRateExchangeUpdate(
|
||||
getUpdateOrSwapId(
|
||||
event.transaction.hash.toHex(),
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
)
|
||||
|
||||
newExchangeUpdate.createdTimestamp = event.block.timestamp.toI32()
|
||||
newExchangeUpdate.tx = event.transaction.hash
|
||||
newExchangeUpdate.block = event.block.number.toI32()
|
||||
newExchangeUpdate.oldAllowedSwapper = fixedRateExchange.allowedSwapper
|
||||
|
||||
fixedRateExchange.allowedSwapper = event.params.allowedSwapper.toHex()
|
||||
newExchangeUpdate.newAllowedSwapper = fixedRateExchange.allowedSwapper
|
||||
newExchangeUpdate.save()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
// TODO: implement market fee, opf fee
|
||||
export function handleSwap(event: Swapped): void {
|
||||
const fixedRateExchange = getFixedRateExchange(
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
|
||||
// reduce supply if the fixed rate is not minting tokens
|
||||
if (fixedRateExchange.isMinter || fixedRateExchange.withMint) {
|
||||
fixedRateExchange.supply =
|
||||
fixedRateExchange.supply - event.params.dataTokenSwappedAmount
|
||||
}
|
||||
|
||||
const swap = new FixedRateExchangeSwap(
|
||||
getUpdateOrSwapId(
|
||||
event.transaction.hash.toHex(),
|
||||
event.params.exchangeId.toHex()
|
||||
)
|
||||
)
|
||||
swap.createdTimestamp = event.block.timestamp.toI32()
|
||||
swap.tx = event.transaction.hash
|
||||
swap.block = event.block.number.toI32()
|
||||
|
||||
swap.exchangeId = event.params.exchangeId.toHex()
|
||||
swap.by = getUser(event.params.by.toHex()).id
|
||||
|
||||
// we need to fetch the decimals of the base token
|
||||
const baseToken = getToken(fixedRateExchange.baseToken)
|
||||
swap.baseTokenAmount = tokenToDecimal(
|
||||
event.params.baseTokenSwappedAmount.toBigDecimal(),
|
||||
BigInt.fromI32(baseToken.decimals).toI32()
|
||||
)
|
||||
swap.dataTokenAmount = tokenToDecimal(
|
||||
event.params.dataTokenSwappedAmount.toBigDecimal(),
|
||||
BigInt.fromI32(18).toI32()
|
||||
)
|
||||
|
||||
swap.save()
|
||||
}
|
||||
|
17
src/mappings/utils/dispenserUtils.ts
Normal file
17
src/mappings/utils/dispenserUtils.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Dispenser } from '../../@types/schema'
|
||||
import { getToken } from './tokenUtils'
|
||||
|
||||
export function createDispenser(address: string): Dispenser {
|
||||
const dispenser = new Dispenser(address)
|
||||
dispenser.datatoken = getToken(address).id
|
||||
dispenser.save()
|
||||
return dispenser
|
||||
}
|
||||
|
||||
export function getDispenser(address: string): Dispenser {
|
||||
let dispenser = Dispenser.load(address)
|
||||
if (dispenser === null) {
|
||||
dispenser = createDispenser(address)
|
||||
}
|
||||
return dispenser
|
||||
}
|
19
src/mappings/utils/fixedRateUtils.ts
Normal file
19
src/mappings/utils/fixedRateUtils.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { FixedRateExchange } from '../../@types/schema'
|
||||
|
||||
export function getFixedRateExchange(exchangeId: string): FixedRateExchange {
|
||||
let fixedRateExhange = FixedRateExchange.load(exchangeId)
|
||||
if (fixedRateExhange === null) {
|
||||
fixedRateExhange = new FixedRateExchange(exchangeId)
|
||||
// TODO: get data from contract and fill in new fixed rate exchange
|
||||
fixedRateExhange.save()
|
||||
}
|
||||
|
||||
return fixedRateExhange
|
||||
}
|
||||
|
||||
export function getUpdateOrSwapId(
|
||||
txAddress: string,
|
||||
exchangeId: string
|
||||
): string {
|
||||
return `${txAddress}-${exchangeId}`
|
||||
}
|
23
src/mappings/utils/tokenUtils.ts
Normal file
23
src/mappings/utils/tokenUtils.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Address } from '@graphprotocol/graph-ts'
|
||||
import { Token } from '../../@types/schema'
|
||||
import { ERC20 } from '../../@types/templates/ERC20Template/ERC20'
|
||||
|
||||
export function createToken(address: string): Token {
|
||||
const token = new Token(address)
|
||||
const contract = ERC20.bind(Address.fromString(address))
|
||||
token.name = contract.name()
|
||||
token.symbol = contract.symbol()
|
||||
token.address = address
|
||||
token.isDatatoken = false
|
||||
token.decimals = contract.decimals()
|
||||
token.save()
|
||||
return token
|
||||
}
|
||||
|
||||
export function getToken(address: string): Token {
|
||||
let newToken = Token.load(address)
|
||||
if (newToken === null) {
|
||||
newToken = createToken(address)
|
||||
}
|
||||
return newToken
|
||||
}
|
11
src/mappings/utils/userUtils.ts
Normal file
11
src/mappings/utils/userUtils.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { User } from '../../@types/schema'
|
||||
|
||||
export function getUser(address: string): User {
|
||||
let user = User.load(address)
|
||||
if (user === null) {
|
||||
user = new User(address)
|
||||
user.save()
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
@ -46,6 +46,18 @@ dataSources:
|
||||
eventHandlers:
|
||||
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
|
||||
handler: handleExchangeCreated
|
||||
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
|
||||
handler: handleRateChange
|
||||
- event: ExchangeMintStateChanged(indexed bytes32,indexed address,bool)
|
||||
handler: handleMintStateChanged
|
||||
- event: ExchangeActivated(indexed bytes32,indexed address)
|
||||
handler: handleActivated
|
||||
- event: ExchangeDeactivated(indexed bytes32,indexed address)
|
||||
handler: handleDeactivated
|
||||
- event: ExchangeAllowedSwapperChanged(indexed bytes32,indexed address)
|
||||
handler: handleAllowedSwapperChanged
|
||||
- event: Swapped(indexed bytes32,indexed address,uint256,uint256,address,uint256,uint256)
|
||||
handler: handleSwap
|
||||
- kind: ethereum/contract
|
||||
name: FactoryRouter
|
||||
network: barge
|
||||
@ -66,6 +78,36 @@ dataSources:
|
||||
eventHandlers:
|
||||
- event: NewPool(indexed address,bool)
|
||||
handler: handleNewPool
|
||||
- kind: ethereum/contract
|
||||
name: Dispenser
|
||||
network: barge
|
||||
source:
|
||||
address: '0xb119b8895801111ff323ba63a77D4Fe78ED057a5'
|
||||
abi: Dispenser
|
||||
startBlock: 0
|
||||
mapping:
|
||||
kind: ethereum/events
|
||||
apiVersion: 0.0.5
|
||||
language: wasm/assemblyscript
|
||||
file: ./src/mappings/dispenser.ts
|
||||
entities:
|
||||
- Dispenser
|
||||
abis:
|
||||
- name: Dispenser
|
||||
file: ./abis/Dispenser.json
|
||||
eventHandlers:
|
||||
- event: DispenserCreated(indexed address)
|
||||
handler: handleNewDispenser
|
||||
- event: DispenserActivated(indexed address)
|
||||
handler: handleActivate
|
||||
- event: DispenserDeactivated(indexed address)
|
||||
handler: handleDeactivate
|
||||
- event: DispenserAllowedSwapperChanged(indexed address,indexed address)
|
||||
handler: handleAllowedSwapperChanged
|
||||
- event: TokensDispensed(indexed address,indexed address,uint256)
|
||||
handler: handleTokensDispensed
|
||||
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
|
||||
handler: handleOwnerWinthdraw
|
||||
templates:
|
||||
- name: ERC20Template
|
||||
kind: ethereum/contract
|
||||
@ -82,6 +124,8 @@ templates:
|
||||
abis:
|
||||
- name: ERC20Template
|
||||
file: ./abis/ERC20Template.json
|
||||
- name: ERC20
|
||||
file: ./abis/ERC20.json
|
||||
eventHandlers:
|
||||
- event: OrderStarted(indexed address,address,uint256,uint256,uint256,indexed address,indexed address,uint256)
|
||||
handler: handleOrderStarted
|
||||
|
Loading…
Reference in New Issue
Block a user