Watch OSM contracts and transform LogValue events#10
Conversation
|
|
||
| var models []event.InsertionModel | ||
| for _, logValueEntity := range entities { | ||
| bigIntVal := new(big.Int).SetBytes(logValueEntity.Val[:]) // TODO: verify this is a good type |
There was a problem hiding this comment.
I wasn't quite sure what type to make the val value. It's not obvious from the contract what it's being used for, but since the OSM contracts are oracles (presumably about collateral evaluations), I figured an int would be a good choice, and the resulting bigint values don't seem too objectionable.
There was a problem hiding this comment.
Contract says val uint128 so big.Int is fine :)
There was a problem hiding this comment.
This is true but in general I'm a fan of using https://github.com/makerdao/vdb-mcd-transformers/blob/staging/transformers/shared/utilities.go#L67 or https://github.com/makerdao/vdb-mcd-transformers/blob/staging/transformers/shared/utilities.go#L62 depending on whether it's an int or uint, since that distinction can cause sneaky 🐛
There was a problem hiding this comment.
Thanks 🤦♂ I always forget we have these nice conversion utils!
m0ar
left a comment
There was a problem hiding this comment.
Looking good!
Wondering how much sense it makes to track prices of non-deployed collateral types, but I'll check in with Wouter/Nik.
elizabethengelman
left a comment
There was a problem hiding this comment.
LGTM! ![]()
Just a couple of clarifying questions.
| Expect(NewCdpSignature()).To(Equal("0xd6be0bc178658a382ff4f91c8c68b542aa6b71685b8fe427966b87745c3ea7a2")) | ||
| }) | ||
|
|
||
| It("generates log note signature", func() { |
There was a problem hiding this comment.
should this say log value instead of log note?
There was a problem hiding this comment.
Yeah, nice catch! So used to working with LogNote events that I kept typing that on accident :P
| abi = '[{"constant":false,"inputs":[],"name":"flap","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"hump","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"rad","type":"uint256"}],"name":"kiss","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"what","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Ash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vat","outputs":[{"internalType":"contract VatLike","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"flopper","outputs":[{"internalType":"contract FlopLike","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"flapper","outputs":[{"internalType":"contract FlapLike","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wait","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"bump","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"cage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"tab","type":"uint256"}],"name":"fess","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"live","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"flop","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sump","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"sin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Sin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"era","type":"uint256"}],"name":"flog","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dump","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"rad","type":"uint256"}],"name":"heal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vat_","type":"address"},{"internalType":"address","name":"flapper_","type":"address"},{"internalType":"address","name":"flopper_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"internalType":"bytes4","name":"sig","type":"bytes4"},{"indexed":true,"internalType":"address","name":"usr","type":"address"},{"indexed":true,"internalType":"bytes32","name":"arg1","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"arg2","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"LogNote","type":"event"}]' | ||
| deployed = 14374540 | ||
| [contract.OSM_ETH] | ||
| address = "0x75dd74e8afe8110c8320ed397cccff3b8134d981" |
There was a problem hiding this comment.
Are these from release 0.2.15? I think we'll want to make sure to update these, depending on when the 0.2.16 PR is merged in.
There was a problem hiding this comment.
Conveniently they don't change between versions, although all of them besides ETH and BAT are removed from the 0.2.16 changelog. It sounds like we might want to remove all the collateral types besides those 2 anyway.
environments/docker.toml
Outdated
| type = "eth_event" | ||
| repository = "github.com/makerdao/vdb-mcd-transformers" | ||
| migrations = "db/migrations" | ||
| contracts = ["OSM_ETH", "OSM_REP", "OSM_ZRX", "OSM_OMG", "OSM_BAT", "OSM_DGD", "OSM_GNT"] |
There was a problem hiding this comment.
Do these contracts correspond to the PIP_* addresses or the VAL_ *addresses in the changelog? They're mostly the same, except that there is a PIP_SAI address, but not a VAL_SAI one, and I'm wondering if we should include one for Sai.
There was a problem hiding this comment.
Good question-- it took me a while to realize that the addresses I wanted were even in the changelog, so I actually got them by looking in etherscan and just grabbing every pip_ value that was passed to the Spotter.file method. So I guess these addresses are more closely linked with the PIP_* addresses.
I was also curious about the Sai situation, but in the changelog the PIP_SAI address is 0x0000000000000000000000000000000000000001 (not a real address ofc), and interestingly that's also what's passed to Spotter.file. So I assume there's not really an oracle in the system for Sai.
There was a problem hiding this comment.
Yeah iirc we just assume sai/dai always == $1. Not sure why an address would be declared for its spotter, though, if that's the case... 🤔
Discard logs created during tests
Lock down Goose at v2.6.0
2eabf6d to
9ac5a46
Compare
No description provided.