Skip to content

Commit

Permalink
add refundsponsor
Browse files Browse the repository at this point in the history
  • Loading branch information
coffee-converter committed Jan 4, 2021
1 parent b73e505 commit 19545c7
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 0 deletions.
293 changes: 293 additions & 0 deletions abis/RefundSponsor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "refundedTo",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "RefundIssued",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "sponsor",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "SponsoredContribution",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "_a",
"type": "address"
},
{
"internalType": "uint256",
"name": "_g",
"type": "uint256"
}
],
"name": "addGasRefund",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_newPauoutPercent",
"type": "uint256"
}
],
"name": "changePayoutPercent",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "flush",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "flushNonce",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "x",
"type": "address"
}
],
"name": "getHash",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "x",
"type": "address"
}
],
"name": "getRefundAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isPaused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "myRefundAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "payoutPercent",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "refundAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "refundSponsor",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "requestGasRefund",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "resume",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_a",
"type": "address"
},
{
"internalType": "uint256",
"name": "_g",
"type": "uint256"
}
],
"name": "setGasRefund",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_s",
"type": "address"
}
],
"name": "setSponsoredContract",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "sponsoredAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "sponsoredContract",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
4 changes: 4 additions & 0 deletions config/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"wiseToken": {
"address": "0x66a0f676479Cee1d7373f3DC2e2952778BfF5bd6",
"startBlock": 11504583
},
"refundSponsor": {
"address": "0xc3FC68dDdB1bf4Cb61307eEf89729DC317f2325a",
"startBlock": 11576737
}
}
4 changes: 4 additions & 0 deletions config/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"wiseToken": {
"address": "0xa89Cb3AA23F7d85DEF5dCCdb73450aE236AFEe61",
"startBlock": 9312570
},
"refundSponsor": {
"address": "0xc3FC68dDdB1bf4Cb61307eEf89729DC317f2325a",
"startBlock": 11576737
}
}
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type User @entity {
stakeCount: BigInt!
cmStatus: Boolean!
cmStatusInLaunch: Boolean!
gasRefunded: BigInt!
}

type Reservation @entity {
Expand Down
9 changes: 9 additions & 0 deletions src/mapping-refundSponsor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { RefundIssued } from "../generated/RefundSponsor/RefundSponsor"
import { createUser } from "./shared"

export function handleRefundIssued (event: RefundIssued): void {
let userID = event.params.refundedTo.toHexString()
let user = createUser(userID)
user.gasRefunded = event.params.amount
user.save()
}
1 change: 1 addition & 0 deletions src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ export function createUser(id: string): User | null {
user.stakeCount = ZERO
user.cmStatus = false
user.cmStatusInLaunch = false
user.gasRefunded = ZERO
return user
}
20 changes: 20 additions & 0 deletions subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,23 @@ dataSources:
- event: GeneratedRandomSupply(indexed uint256,uint256)
handler: handleGeneratedRandomSupply
file: ./src/mapping-liquidityTransformer.ts
- kind: ethereum/contract
name: RefundSponsor
network: {{ network }}
source:
address: '{{ refundSponsor.address }}'
abi: RefundSponsor
startBlock: {{ refundSponsor.startBlock }}
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyscript
entities:
- User
abis:
- name: RefundSponsor
file: ./abis/RefundSponsor.json
eventHandlers:
- event: RefundIssued(address,uint256)
handler: handleRefundIssued
file: ./src/mapping-refundSponsor.ts

0 comments on commit 19545c7

Please sign in to comment.