Skip to content

Commit

Permalink
more staking WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
coffee-converter committed Dec 30, 2020
1 parent ce79d2b commit 182880a
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 9 deletions.
36 changes: 33 additions & 3 deletions abis/WiseToken.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,15 @@
},
{
"indexed": false,
"internalType": "bytes32",
"name": "stakeID",
"type": "bytes32"
"internalType": "uint256",
"name": "oldSharePrice",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint64",
"name": "currentWiseDay",
"type": "uint64"
}
],
"name": "NewSharePrice",
Expand Down Expand Up @@ -1529,6 +1535,30 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "bytes16",
"name": "",
"type": "bytes16"
}
],
"name": "scrapes",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down
4 changes: 2 additions & 2 deletions config/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"startBlock": 11010573
},
"wiseToken": {
"address": "0x1dEF8c947adC6e2962259A2Ce0f1BF590Ba8b92F",
"startBlock": 11426046
"address": "0x66a0f676479Cee1d7373f3DC2e2952778BfF5bd6",
"startBlock": 11504583
}
}
8 changes: 4 additions & 4 deletions config/ropsten.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"network": "ropsten",
"liquidityTransformer": {
"address": "0xC4dA529E611a8b1B62dFde4037e606BA2Bce339F",
"startBlock": 9251263
"address": "0x156d7b05f70fe870c83bf5eda1f987cca44e8a96",
"startBlock": 9312612
},
"wiseToken": {
"address": "0xDb4de4303295c0E7559449aB4d121bFB4EE235AE",
"startBlock": 9251234
"address": "0xa89Cb3AA23F7d85DEF5dCCdb73450aE236AFEe61",
"startBlock": 9312570
}
}
6 changes: 6 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type User @entity {
reservationReferrals: [ReservationReferral!]! @derivedFrom(field: "referrer")
reservationReferralActualWei: BigInt!
reservationReferralCount: BigInt!
stakes: [Stake!]! @derivedFrom(field: "staker")
stakeReferrals: [Stake!]! @derivedFrom(field: "referrer")
stakeCount: BigInt!
cmStatus: Boolean!
cmStatusInLaunch: Boolean!
Expand Down Expand Up @@ -96,10 +98,14 @@ type Stake @entity {
principal: BigInt!
shares: BigInt!
cmShares: BigInt!
currentShares: BigInt!
startDay: BigInt!
lockDays: BigInt!
daiEquivalent: BigInt!
reward: BigInt
closeDay: BigInt
penalty: BigInt
scraped: BigInt
sharesPenalized: BigInt
referrerSharesPenalized: BigInt
}
14 changes: 14 additions & 0 deletions src/mapping-wiseToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
import {
GiveStatusCall,
StakeStart,
StakeEnd,
InterestScraped,
} from "../generated/WiseToken/WiseToken"
import {
Stake,
Expand Down Expand Up @@ -73,3 +75,15 @@ export function handleStakeStart (event: StakeStart): void {
stake.daiEquivalent = event.params.daiEquivalent
stake.save()
}

export function handleStakeEnd (event: StakeEnd): void {
let stake = new Stake(event.params.stakeID.toHexString())
stake.closeDay = event.params.closeDay
stake.penalty = event.params.penaltyAmount
stake.reward = event.params.rewardAmount
stake.save()
}

export function handleInterestScraped (event: InterestScraped): void {

}
4 changes: 4 additions & 0 deletions subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ dataSources:
eventHandlers:
- event: StakeStart(indexed bytes16,indexed address,indexed address,uint256,uint256,uint256,uint256,uint256,uint256)
handler: handleStakeStart
- event: StakeEnd(indexed bytes16,indexed address,indexed address,uint256,uint256,uint256,uint256,uint256,uint256)
handler: handleStakeEnd
- event: InterestScraped(indexed bytes16,indexed address,uint256,uint256,uint256,uint256,uint256)
handler: handleInterestScraped
callHandlers:
- function: giveStatus(address)
handler: handleGiveStatus
Expand Down

0 comments on commit 182880a

Please sign in to comment.