diff --git a/abis/ConnextABI.json b/abis/ConnextABI.json new file mode 100644 index 0000000..313ab9b --- /dev/null +++ b/abis/ConnextABI.json @@ -0,0 +1,466 @@ +[ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "proposedOwner", + "type": "address" + } + ], + "name": "OwnershipProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptProposedOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint32", "name": "pos", "type": "uint32" } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { "internalType": "uint32", "name": "fromBlock", "type": "uint32" }, + { "internalType": "uint224", "name": "votes", "type": "uint224" } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "delay", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "delegatee", "type": "address" } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "delegatee", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "uint256", "name": "expiry", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "delegates", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } + ], + "name": "getPastTotalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } + ], + "name": "getPastVotes", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "getVotes", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_owner", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_account", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "numCheckpoints", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newlyProposed", "type": "address" } + ], + "name": "proposeNewOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proposed", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposedTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounced", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/build/Connext/abis/ConnextABI.json b/build/Connext/abis/ConnextABI.json new file mode 100644 index 0000000..de0e299 --- /dev/null +++ b/build/Connext/abis/ConnextABI.json @@ -0,0 +1,788 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "proposedOwner", + "type": "address" + } + ], + "name": "OwnershipProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptProposedOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "delay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newlyProposed", + "type": "address" + } + ], + "name": "proposeNewOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proposed", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposedTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounced", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/build/schema.graphql b/build/schema.graphql index 4ffa369..83d4504 100644 --- a/build/schema.graphql +++ b/build/schema.graphql @@ -55,6 +55,5 @@ type DelegatingHistory @entity { fromDelegate: String toDelegate: String delegator: String! - amount: BigInt! timestamp: BigInt! } diff --git a/build/subgraph.yaml b/build/subgraph.yaml index 22118b8..ffc2931 100644 --- a/build/subgraph.yaml +++ b/build/subgraph.yaml @@ -11,7 +11,7 @@ dataSources: startBlock: 34284528 mapping: kind: ethereum/events - apiVersion: 0.0.6 + apiVersion: 0.0.7 language: wasm/assemblyscript entities: - Delegate @@ -27,3 +27,26 @@ dataSources: - event: Transfer(indexed address,indexed address,uint256) handler: transfer file: DimoToken/DimoToken.wasm + - kind: ethereum + name: Connext + network: matic + source: + abi: Connext + address: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8" + startBlock: 47110158 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DelegateChanged + - DelegateVotesChanged + abis: + - name: Connext + file: Connext/abis/ConnextABI.json + eventHandlers: + - event: DelegateChanged(indexed address,indexed address,indexed address) + handler: handleDelegateChanged + - event: DelegateVotesChanged(indexed address,uint256,uint256) + handler: handleDelegateVotesChanged + file: Connext/Connext.wasm diff --git a/generated/Connext/Connext.ts b/generated/Connext/Connext.ts new file mode 100644 index 0000000..14a4ea8 --- /dev/null +++ b/generated/Connext/Connext.ts @@ -0,0 +1,1276 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt +} from "@graphprotocol/graph-ts"; + +export class Approval extends ethereum.Event { + get params(): Approval__Params { + return new Approval__Params(this); + } +} + +export class Approval__Params { + _event: Approval; + + constructor(event: Approval) { + this._event = event; + } + + get owner(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get spender(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get value(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class DelegateChanged extends ethereum.Event { + get params(): DelegateChanged__Params { + return new DelegateChanged__Params(this); + } +} + +export class DelegateChanged__Params { + _event: DelegateChanged; + + constructor(event: DelegateChanged) { + this._event = event; + } + + get delegator(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get fromDelegate(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get toDelegate(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class DelegateVotesChanged extends ethereum.Event { + get params(): DelegateVotesChanged__Params { + return new DelegateVotesChanged__Params(this); + } +} + +export class DelegateVotesChanged__Params { + _event: DelegateVotesChanged; + + constructor(event: DelegateVotesChanged) { + this._event = event; + } + + get delegate(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get previousBalance(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get newBalance(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Initialized extends ethereum.Event { + get params(): Initialized__Params { + return new Initialized__Params(this); + } +} + +export class Initialized__Params { + _event: Initialized; + + constructor(event: Initialized) { + this._event = event; + } + + get version(): i32 { + return this._event.parameters[0].value.toI32(); + } +} + +export class OwnershipProposed extends ethereum.Event { + get params(): OwnershipProposed__Params { + return new OwnershipProposed__Params(this); + } +} + +export class OwnershipProposed__Params { + _event: OwnershipProposed; + + constructor(event: OwnershipProposed) { + this._event = event; + } + + get proposedOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class OwnershipTransferred extends ethereum.Event { + get params(): OwnershipTransferred__Params { + return new OwnershipTransferred__Params(this); + } +} + +export class OwnershipTransferred__Params { + _event: OwnershipTransferred; + + constructor(event: OwnershipTransferred) { + this._event = event; + } + + get previousOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get newOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class Transfer extends ethereum.Event { + get params(): Transfer__Params { + return new Transfer__Params(this); + } +} + +export class Transfer__Params { + _event: Transfer; + + constructor(event: Transfer) { + this._event = event; + } + + get from(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get to(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get value(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class Connext__checkpointsResultValue0Struct extends ethereum.Tuple { + get fromBlock(): BigInt { + return this[0].toBigInt(); + } + + get votes(): BigInt { + return this[1].toBigInt(); + } +} + +export class Connext extends ethereum.SmartContract { + static bind(address: Address): Connext { + return new Connext("Connext", address); + } + + DOMAIN_SEPARATOR(): Bytes { + let result = super.call( + "DOMAIN_SEPARATOR", + "DOMAIN_SEPARATOR():(bytes32)", + [] + ); + + return result[0].toBytes(); + } + + try_DOMAIN_SEPARATOR(): ethereum.CallResult { + let result = super.tryCall( + "DOMAIN_SEPARATOR", + "DOMAIN_SEPARATOR():(bytes32)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytes()); + } + + allowance(owner: Address, spender: Address): BigInt { + let result = super.call( + "allowance", + "allowance(address,address):(uint256)", + [ethereum.Value.fromAddress(owner), ethereum.Value.fromAddress(spender)] + ); + + return result[0].toBigInt(); + } + + try_allowance(owner: Address, spender: Address): ethereum.CallResult { + let result = super.tryCall( + "allowance", + "allowance(address,address):(uint256)", + [ethereum.Value.fromAddress(owner), ethereum.Value.fromAddress(spender)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + approve(spender: Address, amount: BigInt): boolean { + let result = super.call("approve", "approve(address,uint256):(bool)", [ + ethereum.Value.fromAddress(spender), + ethereum.Value.fromUnsignedBigInt(amount) + ]); + + return result[0].toBoolean(); + } + + try_approve(spender: Address, amount: BigInt): ethereum.CallResult { + let result = super.tryCall("approve", "approve(address,uint256):(bool)", [ + ethereum.Value.fromAddress(spender), + ethereum.Value.fromUnsignedBigInt(amount) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + balanceOf(account: Address): BigInt { + let result = super.call("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(account) + ]); + + return result[0].toBigInt(); + } + + try_balanceOf(account: Address): ethereum.CallResult { + let result = super.tryCall("balanceOf", "balanceOf(address):(uint256)", [ + ethereum.Value.fromAddress(account) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + checkpoints( + account: Address, + pos: BigInt + ): Connext__checkpointsResultValue0Struct { + let result = super.call( + "checkpoints", + "checkpoints(address,uint32):((uint32,uint224))", + [ + ethereum.Value.fromAddress(account), + ethereum.Value.fromUnsignedBigInt(pos) + ] + ); + + return changetype( + result[0].toTuple() + ); + } + + try_checkpoints( + account: Address, + pos: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "checkpoints", + "checkpoints(address,uint32):((uint32,uint224))", + [ + ethereum.Value.fromAddress(account), + ethereum.Value.fromUnsignedBigInt(pos) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + decimals(): i32 { + let result = super.call("decimals", "decimals():(uint8)", []); + + return result[0].toI32(); + } + + try_decimals(): ethereum.CallResult { + let result = super.tryCall("decimals", "decimals():(uint8)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + decreaseAllowance(spender: Address, subtractedValue: BigInt): boolean { + let result = super.call( + "decreaseAllowance", + "decreaseAllowance(address,uint256):(bool)", + [ + ethereum.Value.fromAddress(spender), + ethereum.Value.fromUnsignedBigInt(subtractedValue) + ] + ); + + return result[0].toBoolean(); + } + + try_decreaseAllowance( + spender: Address, + subtractedValue: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "decreaseAllowance", + "decreaseAllowance(address,uint256):(bool)", + [ + ethereum.Value.fromAddress(spender), + ethereum.Value.fromUnsignedBigInt(subtractedValue) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + delay(): BigInt { + let result = super.call("delay", "delay():(uint256)", []); + + return result[0].toBigInt(); + } + + try_delay(): ethereum.CallResult { + let result = super.tryCall("delay", "delay():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + delegates(account: Address): Address { + let result = super.call("delegates", "delegates(address):(address)", [ + ethereum.Value.fromAddress(account) + ]); + + return result[0].toAddress(); + } + + try_delegates(account: Address): ethereum.CallResult
{ + let result = super.tryCall("delegates", "delegates(address):(address)", [ + ethereum.Value.fromAddress(account) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getPastTotalSupply(blockNumber: BigInt): BigInt { + let result = super.call( + "getPastTotalSupply", + "getPastTotalSupply(uint256):(uint256)", + [ethereum.Value.fromUnsignedBigInt(blockNumber)] + ); + + return result[0].toBigInt(); + } + + try_getPastTotalSupply(blockNumber: BigInt): ethereum.CallResult { + let result = super.tryCall( + "getPastTotalSupply", + "getPastTotalSupply(uint256):(uint256)", + [ethereum.Value.fromUnsignedBigInt(blockNumber)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getPastVotes(account: Address, blockNumber: BigInt): BigInt { + let result = super.call( + "getPastVotes", + "getPastVotes(address,uint256):(uint256)", + [ + ethereum.Value.fromAddress(account), + ethereum.Value.fromUnsignedBigInt(blockNumber) + ] + ); + + return result[0].toBigInt(); + } + + try_getPastVotes( + account: Address, + blockNumber: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "getPastVotes", + "getPastVotes(address,uint256):(uint256)", + [ + ethereum.Value.fromAddress(account), + ethereum.Value.fromUnsignedBigInt(blockNumber) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getVotes(account: Address): BigInt { + let result = super.call("getVotes", "getVotes(address):(uint256)", [ + ethereum.Value.fromAddress(account) + ]); + + return result[0].toBigInt(); + } + + try_getVotes(account: Address): ethereum.CallResult { + let result = super.tryCall("getVotes", "getVotes(address):(uint256)", [ + ethereum.Value.fromAddress(account) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + increaseAllowance(spender: Address, addedValue: BigInt): boolean { + let result = super.call( + "increaseAllowance", + "increaseAllowance(address,uint256):(bool)", + [ + ethereum.Value.fromAddress(spender), + ethereum.Value.fromUnsignedBigInt(addedValue) + ] + ); + + return result[0].toBoolean(); + } + + try_increaseAllowance( + spender: Address, + addedValue: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "increaseAllowance", + "increaseAllowance(address,uint256):(bool)", + [ + ethereum.Value.fromAddress(spender), + ethereum.Value.fromUnsignedBigInt(addedValue) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + name(): string { + let result = super.call("name", "name():(string)", []); + + return result[0].toString(); + } + + try_name(): ethereum.CallResult { + let result = super.tryCall("name", "name():(string)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + nonces(owner: Address): BigInt { + let result = super.call("nonces", "nonces(address):(uint256)", [ + ethereum.Value.fromAddress(owner) + ]); + + return result[0].toBigInt(); + } + + try_nonces(owner: Address): ethereum.CallResult { + let result = super.tryCall("nonces", "nonces(address):(uint256)", [ + ethereum.Value.fromAddress(owner) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + numCheckpoints(account: Address): BigInt { + let result = super.call( + "numCheckpoints", + "numCheckpoints(address):(uint32)", + [ethereum.Value.fromAddress(account)] + ); + + return result[0].toBigInt(); + } + + try_numCheckpoints(account: Address): ethereum.CallResult { + let result = super.tryCall( + "numCheckpoints", + "numCheckpoints(address):(uint32)", + [ethereum.Value.fromAddress(account)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + owner(): Address { + let result = super.call("owner", "owner():(address)", []); + + return result[0].toAddress(); + } + + try_owner(): ethereum.CallResult
{ + let result = super.tryCall("owner", "owner():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + proposed(): Address { + let result = super.call("proposed", "proposed():(address)", []); + + return result[0].toAddress(); + } + + try_proposed(): ethereum.CallResult
{ + let result = super.tryCall("proposed", "proposed():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + proposedTimestamp(): BigInt { + let result = super.call( + "proposedTimestamp", + "proposedTimestamp():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_proposedTimestamp(): ethereum.CallResult { + let result = super.tryCall( + "proposedTimestamp", + "proposedTimestamp():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + renounced(): boolean { + let result = super.call("renounced", "renounced():(bool)", []); + + return result[0].toBoolean(); + } + + try_renounced(): ethereum.CallResult { + let result = super.tryCall("renounced", "renounced():(bool)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + symbol(): string { + let result = super.call("symbol", "symbol():(string)", []); + + return result[0].toString(); + } + + try_symbol(): ethereum.CallResult { + let result = super.tryCall("symbol", "symbol():(string)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + totalSupply(): BigInt { + let result = super.call("totalSupply", "totalSupply():(uint256)", []); + + return result[0].toBigInt(); + } + + try_totalSupply(): ethereum.CallResult { + let result = super.tryCall("totalSupply", "totalSupply():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + transfer(to: Address, amount: BigInt): boolean { + let result = super.call("transfer", "transfer(address,uint256):(bool)", [ + ethereum.Value.fromAddress(to), + ethereum.Value.fromUnsignedBigInt(amount) + ]); + + return result[0].toBoolean(); + } + + try_transfer(to: Address, amount: BigInt): ethereum.CallResult { + let result = super.tryCall("transfer", "transfer(address,uint256):(bool)", [ + ethereum.Value.fromAddress(to), + ethereum.Value.fromUnsignedBigInt(amount) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + transferFrom(from: Address, to: Address, amount: BigInt): boolean { + let result = super.call( + "transferFrom", + "transferFrom(address,address,uint256):(bool)", + [ + ethereum.Value.fromAddress(from), + ethereum.Value.fromAddress(to), + ethereum.Value.fromUnsignedBigInt(amount) + ] + ); + + return result[0].toBoolean(); + } + + try_transferFrom( + from: Address, + to: Address, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "transferFrom", + "transferFrom(address,address,uint256):(bool)", + [ + ethereum.Value.fromAddress(from), + ethereum.Value.fromAddress(to), + ethereum.Value.fromUnsignedBigInt(amount) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } +} + +export class ConstructorCall extends ethereum.Call { + get inputs(): ConstructorCall__Inputs { + return new ConstructorCall__Inputs(this); + } + + get outputs(): ConstructorCall__Outputs { + return new ConstructorCall__Outputs(this); + } +} + +export class ConstructorCall__Inputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } +} + +export class ConstructorCall__Outputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } +} + +export class AcceptProposedOwnerCall extends ethereum.Call { + get inputs(): AcceptProposedOwnerCall__Inputs { + return new AcceptProposedOwnerCall__Inputs(this); + } + + get outputs(): AcceptProposedOwnerCall__Outputs { + return new AcceptProposedOwnerCall__Outputs(this); + } +} + +export class AcceptProposedOwnerCall__Inputs { + _call: AcceptProposedOwnerCall; + + constructor(call: AcceptProposedOwnerCall) { + this._call = call; + } +} + +export class AcceptProposedOwnerCall__Outputs { + _call: AcceptProposedOwnerCall; + + constructor(call: AcceptProposedOwnerCall) { + this._call = call; + } +} + +export class ApproveCall extends ethereum.Call { + get inputs(): ApproveCall__Inputs { + return new ApproveCall__Inputs(this); + } + + get outputs(): ApproveCall__Outputs { + return new ApproveCall__Outputs(this); + } +} + +export class ApproveCall__Inputs { + _call: ApproveCall; + + constructor(call: ApproveCall) { + this._call = call; + } + + get spender(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class ApproveCall__Outputs { + _call: ApproveCall; + + constructor(call: ApproveCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class BurnCall extends ethereum.Call { + get inputs(): BurnCall__Inputs { + return new BurnCall__Inputs(this); + } + + get outputs(): BurnCall__Outputs { + return new BurnCall__Outputs(this); + } +} + +export class BurnCall__Inputs { + _call: BurnCall; + + constructor(call: BurnCall) { + this._call = call; + } + + get amount(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class BurnCall__Outputs { + _call: BurnCall; + + constructor(call: BurnCall) { + this._call = call; + } +} + +export class BurnFromCall extends ethereum.Call { + get inputs(): BurnFromCall__Inputs { + return new BurnFromCall__Inputs(this); + } + + get outputs(): BurnFromCall__Outputs { + return new BurnFromCall__Outputs(this); + } +} + +export class BurnFromCall__Inputs { + _call: BurnFromCall; + + constructor(call: BurnFromCall) { + this._call = call; + } + + get account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class BurnFromCall__Outputs { + _call: BurnFromCall; + + constructor(call: BurnFromCall) { + this._call = call; + } +} + +export class DecreaseAllowanceCall extends ethereum.Call { + get inputs(): DecreaseAllowanceCall__Inputs { + return new DecreaseAllowanceCall__Inputs(this); + } + + get outputs(): DecreaseAllowanceCall__Outputs { + return new DecreaseAllowanceCall__Outputs(this); + } +} + +export class DecreaseAllowanceCall__Inputs { + _call: DecreaseAllowanceCall; + + constructor(call: DecreaseAllowanceCall) { + this._call = call; + } + + get spender(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get subtractedValue(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class DecreaseAllowanceCall__Outputs { + _call: DecreaseAllowanceCall; + + constructor(call: DecreaseAllowanceCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class DelegateCall extends ethereum.Call { + get inputs(): DelegateCall__Inputs { + return new DelegateCall__Inputs(this); + } + + get outputs(): DelegateCall__Outputs { + return new DelegateCall__Outputs(this); + } +} + +export class DelegateCall__Inputs { + _call: DelegateCall; + + constructor(call: DelegateCall) { + this._call = call; + } + + get delegatee(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class DelegateCall__Outputs { + _call: DelegateCall; + + constructor(call: DelegateCall) { + this._call = call; + } +} + +export class DelegateBySigCall extends ethereum.Call { + get inputs(): DelegateBySigCall__Inputs { + return new DelegateBySigCall__Inputs(this); + } + + get outputs(): DelegateBySigCall__Outputs { + return new DelegateBySigCall__Outputs(this); + } +} + +export class DelegateBySigCall__Inputs { + _call: DelegateBySigCall; + + constructor(call: DelegateBySigCall) { + this._call = call; + } + + get delegatee(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get nonce(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get expiry(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get v(): i32 { + return this._call.inputValues[3].value.toI32(); + } + + get r(): Bytes { + return this._call.inputValues[4].value.toBytes(); + } + + get s(): Bytes { + return this._call.inputValues[5].value.toBytes(); + } +} + +export class DelegateBySigCall__Outputs { + _call: DelegateBySigCall; + + constructor(call: DelegateBySigCall) { + this._call = call; + } +} + +export class IncreaseAllowanceCall extends ethereum.Call { + get inputs(): IncreaseAllowanceCall__Inputs { + return new IncreaseAllowanceCall__Inputs(this); + } + + get outputs(): IncreaseAllowanceCall__Outputs { + return new IncreaseAllowanceCall__Outputs(this); + } +} + +export class IncreaseAllowanceCall__Inputs { + _call: IncreaseAllowanceCall; + + constructor(call: IncreaseAllowanceCall) { + this._call = call; + } + + get spender(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get addedValue(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class IncreaseAllowanceCall__Outputs { + _call: IncreaseAllowanceCall; + + constructor(call: IncreaseAllowanceCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class InitializeCall extends ethereum.Call { + get inputs(): InitializeCall__Inputs { + return new InitializeCall__Inputs(this); + } + + get outputs(): InitializeCall__Outputs { + return new InitializeCall__Outputs(this); + } +} + +export class InitializeCall__Inputs { + _call: InitializeCall; + + constructor(call: InitializeCall) { + this._call = call; + } + + get _owner(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class InitializeCall__Outputs { + _call: InitializeCall; + + constructor(call: InitializeCall) { + this._call = call; + } +} + +export class MintCall extends ethereum.Call { + get inputs(): MintCall__Inputs { + return new MintCall__Inputs(this); + } + + get outputs(): MintCall__Outputs { + return new MintCall__Outputs(this); + } +} + +export class MintCall__Inputs { + _call: MintCall; + + constructor(call: MintCall) { + this._call = call; + } + + get _account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class MintCall__Outputs { + _call: MintCall; + + constructor(call: MintCall) { + this._call = call; + } +} + +export class PermitCall extends ethereum.Call { + get inputs(): PermitCall__Inputs { + return new PermitCall__Inputs(this); + } + + get outputs(): PermitCall__Outputs { + return new PermitCall__Outputs(this); + } +} + +export class PermitCall__Inputs { + _call: PermitCall; + + constructor(call: PermitCall) { + this._call = call; + } + + get owner(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get spender(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get value(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get deadline(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get v(): i32 { + return this._call.inputValues[4].value.toI32(); + } + + get r(): Bytes { + return this._call.inputValues[5].value.toBytes(); + } + + get s(): Bytes { + return this._call.inputValues[6].value.toBytes(); + } +} + +export class PermitCall__Outputs { + _call: PermitCall; + + constructor(call: PermitCall) { + this._call = call; + } +} + +export class ProposeNewOwnerCall extends ethereum.Call { + get inputs(): ProposeNewOwnerCall__Inputs { + return new ProposeNewOwnerCall__Inputs(this); + } + + get outputs(): ProposeNewOwnerCall__Outputs { + return new ProposeNewOwnerCall__Outputs(this); + } +} + +export class ProposeNewOwnerCall__Inputs { + _call: ProposeNewOwnerCall; + + constructor(call: ProposeNewOwnerCall) { + this._call = call; + } + + get newlyProposed(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ProposeNewOwnerCall__Outputs { + _call: ProposeNewOwnerCall; + + constructor(call: ProposeNewOwnerCall) { + this._call = call; + } +} + +export class RenounceOwnershipCall extends ethereum.Call { + get inputs(): RenounceOwnershipCall__Inputs { + return new RenounceOwnershipCall__Inputs(this); + } + + get outputs(): RenounceOwnershipCall__Outputs { + return new RenounceOwnershipCall__Outputs(this); + } +} + +export class RenounceOwnershipCall__Inputs { + _call: RenounceOwnershipCall; + + constructor(call: RenounceOwnershipCall) { + this._call = call; + } +} + +export class RenounceOwnershipCall__Outputs { + _call: RenounceOwnershipCall; + + constructor(call: RenounceOwnershipCall) { + this._call = call; + } +} + +export class TransferCall extends ethereum.Call { + get inputs(): TransferCall__Inputs { + return new TransferCall__Inputs(this); + } + + get outputs(): TransferCall__Outputs { + return new TransferCall__Outputs(this); + } +} + +export class TransferCall__Inputs { + _call: TransferCall; + + constructor(call: TransferCall) { + this._call = call; + } + + get to(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TransferCall__Outputs { + _call: TransferCall; + + constructor(call: TransferCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class TransferFromCall extends ethereum.Call { + get inputs(): TransferFromCall__Inputs { + return new TransferFromCall__Inputs(this); + } + + get outputs(): TransferFromCall__Outputs { + return new TransferFromCall__Outputs(this); + } +} + +export class TransferFromCall__Inputs { + _call: TransferFromCall; + + constructor(call: TransferFromCall) { + this._call = call; + } + + get from(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get to(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class TransferFromCall__Outputs { + _call: TransferFromCall; + + constructor(call: TransferFromCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} diff --git a/generated/schema.ts b/generated/schema.ts index c72a4a1..8a5f152 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -35,7 +35,11 @@ export class Organization extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -44,7 +48,11 @@ export class Organization extends Entity { get token(): string { let value = this.get("token"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set token(value: string) { @@ -60,14 +68,6 @@ export class Organization extends Entity { } } - set delegates(value: Array | null) { - if (!value) { - this.unset("delegates"); - } else { - this.set("delegates", Value.fromStringArray(>value)); - } - } - get delegators(): Array | null { let value = this.get("delegators"); if (!value || value.kind == ValueKind.NULL) { @@ -76,14 +76,6 @@ export class Organization extends Entity { return value.toStringArray(); } } - - set delegators(value: Array | null) { - if (!value) { - this.unset("delegators"); - } else { - this.set("delegators", Value.fromStringArray(>value)); - } - } } export class User extends Entity { @@ -110,7 +102,11 @@ export class User extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -126,17 +122,6 @@ export class User extends Entity { } } - set delegateorganizations(value: Array | null) { - if (!value) { - this.unset("delegateorganizations"); - } else { - this.set( - "delegateorganizations", - Value.fromStringArray(>value) - ); - } - } - get delegatororganizations(): Array | null { let value = this.get("delegatororganizations"); if (!value || value.kind == ValueKind.NULL) { @@ -145,17 +130,6 @@ export class User extends Entity { return value.toStringArray(); } } - - set delegatororganizations(value: Array | null) { - if (!value) { - this.unset("delegatororganizations"); - } else { - this.set( - "delegatororganizations", - Value.fromStringArray(>value) - ); - } - } } export class DelegateOrganization extends Entity { @@ -184,7 +158,11 @@ export class DelegateOrganization extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -193,7 +171,11 @@ export class DelegateOrganization extends Entity { get delegate(): string { let value = this.get("delegate"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set delegate(value: string) { @@ -202,7 +184,11 @@ export class DelegateOrganization extends Entity { get organization(): string { let value = this.get("organization"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set organization(value: string) { @@ -211,7 +197,11 @@ export class DelegateOrganization extends Entity { get voteBalance(): BigInt { let value = this.get("voteBalance"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set voteBalance(value: BigInt) { @@ -265,7 +255,11 @@ export class DelegatorOrganization extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -274,7 +268,11 @@ export class DelegatorOrganization extends Entity { get delegator(): string { let value = this.get("delegator"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set delegator(value: string) { @@ -283,7 +281,11 @@ export class DelegatorOrganization extends Entity { get delegate(): string { let value = this.get("delegate"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set delegate(value: string) { @@ -292,7 +294,11 @@ export class DelegatorOrganization extends Entity { get organization(): string { let value = this.get("organization"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set organization(value: string) { @@ -329,7 +335,11 @@ export class DelegateVotingPowerChange extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -338,7 +348,11 @@ export class DelegateVotingPowerChange extends Entity { get tokenAddress(): string { let value = this.get("tokenAddress"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set tokenAddress(value: string) { @@ -347,7 +361,11 @@ export class DelegateVotingPowerChange extends Entity { get delegate(): string { let value = this.get("delegate"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set delegate(value: string) { @@ -356,7 +374,11 @@ export class DelegateVotingPowerChange extends Entity { get previousBalance(): BigInt { let value = this.get("previousBalance"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set previousBalance(value: BigInt) { @@ -365,7 +387,11 @@ export class DelegateVotingPowerChange extends Entity { get newBalance(): BigInt { let value = this.get("newBalance"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set newBalance(value: BigInt) { @@ -374,7 +400,11 @@ export class DelegateVotingPowerChange extends Entity { get blockTimestamp(): BigInt { let value = this.get("blockTimestamp"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set blockTimestamp(value: BigInt) { @@ -383,7 +413,11 @@ export class DelegateVotingPowerChange extends Entity { get txnHash(): string { let value = this.get("txnHash"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set txnHash(value: string) { @@ -392,7 +426,11 @@ export class DelegateVotingPowerChange extends Entity { get blockNumber(): BigInt { let value = this.get("blockNumber"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set blockNumber(value: BigInt) { @@ -424,7 +462,11 @@ export class DelegateChange extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -467,7 +509,11 @@ export class DelegateChange extends Entity { get delegator(): string { let value = this.get("delegator"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set delegator(value: string) { @@ -476,7 +522,11 @@ export class DelegateChange extends Entity { get blockTimestamp(): BigInt { let value = this.get("blockTimestamp"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set blockTimestamp(value: BigInt) { @@ -485,7 +535,11 @@ export class DelegateChange extends Entity { get txnHash(): string { let value = this.get("txnHash"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set txnHash(value: string) { @@ -494,7 +548,11 @@ export class DelegateChange extends Entity { get blockNumber(): BigInt { let value = this.get("blockNumber"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set blockNumber(value: BigInt) { @@ -528,7 +586,11 @@ export class DelegatingHistory extends Entity { get id(): string { let value = this.get("id"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set id(value: string) { @@ -537,7 +599,11 @@ export class DelegatingHistory extends Entity { get daoName(): string { let value = this.get("daoName"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set daoName(value: string) { @@ -580,25 +646,24 @@ export class DelegatingHistory extends Entity { get delegator(): string { let value = this.get("delegator"); - return value!.toString(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } } set delegator(value: string) { this.set("delegator", Value.fromString(value)); } - get amount(): BigInt { - let value = this.get("amount"); - return value!.toBigInt(); - } - - set amount(value: BigInt) { - this.set("amount", Value.fromBigInt(value)); - } - get timestamp(): BigInt { let value = this.get("timestamp"); - return value!.toBigInt(); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } } set timestamp(value: BigInt) { diff --git a/schema.graphql b/schema.graphql index 4ffa369..83d4504 100644 --- a/schema.graphql +++ b/schema.graphql @@ -55,6 +55,5 @@ type DelegatingHistory @entity { fromDelegate: String toDelegate: String delegator: String! - amount: BigInt! timestamp: BigInt! } diff --git a/src/connext_mapping.ts b/src/connext_mapping.ts new file mode 100644 index 0000000..c01129c --- /dev/null +++ b/src/connext_mapping.ts @@ -0,0 +1,86 @@ +import { BigInt } from "@graphprotocol/graph-ts" +import { + Organization, + User, + DelegatorOrganization, + DelegateVotingPowerChange, + DelegateChange, + DelegatingHistory +} from "../generated/schema" +import { DelegateChanged, DelegateVotesChanged, Transfer } from "../generated/Connext/Connext" +import { getDelegateOrganization } from "./shared/getDelegateOrganization" +import { getFirstTokenDelegatedAt } from "./shared/getFirstTokenDelegatedAt" + +const daoName = 'connext' + +export function handleDelegateChanged(event: DelegateChanged): void { + let organization = new Organization(daoName) + organization.token = daoName + organization.save() + + let delegate = new User(event.params.toDelegate.toHexString()) + delegate.save(); + + let delegator = new User(event.params.delegator.toHexString()) + delegator.save(); + + let delegatorOrganization = new DelegatorOrganization(`${delegator.id}-${organization.id}`) + delegatorOrganization.delegate = delegate.id + delegatorOrganization.delegator = delegator.id + delegatorOrganization.organization = organization.id + + let delegatingHistory = DelegatingHistory.load(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`) + + if(!delegatingHistory){ + delegatingHistory = new DelegatingHistory(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); + delegatingHistory.daoName = organization.id; + delegatingHistory.timestamp = event.block.timestamp; + } + + delegatingHistory.fromDelegate = event.params.fromDelegate.toHexString(); + delegatingHistory.toDelegate = event.params.toDelegate.toHexString(); + delegatingHistory.delegator = delegator.id; + + delegatingHistory.save(); + delegatorOrganization.save(); + + const delegateChange = new DelegateChange(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); + delegateChange.oldDelegate = event.params.fromDelegate.toHexString(), + delegateChange.newDelegate = event.params.toDelegate.toHexString(), + delegateChange.delegator = event.params.delegator.toHexString(), + delegateChange.blockTimestamp = event.block.timestamp, + delegateChange.txnHash = event.transaction.hash.toHexString(), + delegateChange.blockNumber = event.block.number, + delegateChange.save(); +} + +export function handleDelegateVotesChanged(event: DelegateVotesChanged): void { + let organization = new Organization(daoName) + organization.token = daoName + organization.save() + + let user = new User(event.params.delegate.toHexString()) + user.save(); + + const delegateOrganizationId = `${user.id}-${organization.id}`; + const delegateOrganization = getDelegateOrganization(delegateOrganizationId); + + delegateOrganization.delegate = user.id; + delegateOrganization.organization = organization.id; + delegateOrganization.voteBalance = event.params.newBalance; + + delegateOrganization.firstTokenDelegatedAt = getFirstTokenDelegatedAt(event, delegateOrganization); + + delegateOrganization.save() + + const delegatePowerChange = new DelegateVotingPowerChange( `${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); + + delegatePowerChange.previousBalance = event.params.previousBalance; + delegatePowerChange.newBalance = event.params.newBalance; + delegatePowerChange.delegate = event.params.delegate.toHexString(); + delegatePowerChange.tokenAddress = event.address.toHexString(); + delegatePowerChange.txnHash = event.transaction.hash.toHexString(); + delegatePowerChange.blockTimestamp = event.block.timestamp; + delegatePowerChange.blockNumber = event.block.number; + delegatePowerChange.save(); +} diff --git a/src/dimo_mapping.ts b/src/dimo_mapping.ts index 3d57bc6..1018fb8 100644 --- a/src/dimo_mapping.ts +++ b/src/dimo_mapping.ts @@ -40,7 +40,6 @@ export function delegateChanged(event: DelegateChanged): void { if(!delegatingHistory){ delegatingHistory = new DelegatingHistory(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); delegatingHistory.daoName = organization.id; - delegatingHistory.amount = BigInt.zero(); delegatingHistory.timestamp = event.block.timestamp; } @@ -89,24 +88,10 @@ export function delegateVotesChanged(event: DelegateVotesChanged): void { if(!delegatingHistory){ delegatingHistory = new DelegatingHistory(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); delegatingHistory.daoName = organization.id; - delegatingHistory.amount = BigInt.zero(); delegatingHistory.timestamp = event.block.timestamp; delegatingHistory.delegator = "0"; } - let delegatedAmount = event.params.newBalance.minus(event.params.previousBalance) - - if (delegatedAmount < BigInt.zero()) { - delegatingHistory.fromDelegate = user.id - } else { - delegatingHistory.toDelegate = user.id - } - if (delegatingHistory.amount) { - delegatingHistory.amount = delegatingHistory.amount.plus(delegatedAmount); - } else { - delegatingHistory.amount = delegatedAmount; - } - delegatingHistory.save(); const delegatePowerChange = new DelegateVotingPowerChange(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); @@ -127,7 +112,6 @@ export function transfer(event: Transfer): void { if(!delegatingHistory){ delegatingHistory = new DelegatingHistory(`${event.transaction.hash.toHexString()}-${event.logIndex.toString()}`); delegatingHistory.daoName = "dimo"; - delegatingHistory.amount = BigInt.zero(); delegatingHistory.timestamp = event.block.timestamp; delegatingHistory.delegator = event.params.from.toHexString(); } diff --git a/subgraph.yaml b/subgraph.yaml index 94504bb..f01b2e1 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -11,7 +11,7 @@ dataSources: startBlock: 34284528 mapping: kind: ethereum/events - apiVersion: 0.0.6 + apiVersion: 0.0.7 language: wasm/assemblyscript entities: - Delegate @@ -27,3 +27,26 @@ dataSources: - event: Transfer(indexed address,indexed address,uint256) handler: transfer file: ./src/dimo_mapping.ts + - kind: ethereum + name: Connext + network: matic + source: + abi: Connext + address: "0x58b9cB810A68a7f3e1E4f8Cb45D1B9B3c79705E8" + startBlock: 47110158 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - DelegateChanged + - DelegateVotesChanged + abis: + - name: Connext + file: ./abis/ConnextABI.json + eventHandlers: + - event: DelegateChanged(indexed address,indexed address,indexed address) + handler: handleDelegateChanged + - event: DelegateVotesChanged(indexed address,uint256,uint256) + handler: handleDelegateVotesChanged + file: ./src/connext_mapping.ts