From 62698000c207db01dd20b6cc62168186d2b98611 Mon Sep 17 00:00:00 2001 From: Jerry Okolo Date: Tue, 13 Sep 2022 14:46:08 +0100 Subject: [PATCH] more progress with matchstick --- src/Marketplaces/RaribleExchangeV1.ts | 2 +- tests/.bin/handletransfer.wasm | Bin 640551 -> 640840 bytes tests/.latest.json | 2 +- tests/handleTransfer.test.ts | 4 ++-- tests/helpers/utils.ts | 22 +++++++++++++++++++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Marketplaces/RaribleExchangeV1.ts b/src/Marketplaces/RaribleExchangeV1.ts index da09922..e0dcf4f 100644 --- a/src/Marketplaces/RaribleExchangeV1.ts +++ b/src/Marketplaces/RaribleExchangeV1.ts @@ -52,7 +52,7 @@ export function handleExchangeV1Buy(event: RaribleExchangeV1Buy): void { let price = event.params.buyValue let buyer = event.params.owner let seller = event.params.buyer - let tokenId = event.params.sellToken.toString() + let tokenId = event.params.buyToken.toString() let bidPrice = getPriceAfterRaribleCut(price) diff --git a/tests/.bin/handletransfer.wasm b/tests/.bin/handletransfer.wasm index 034016b43af3d96b88520c242498f43c69f8345d..492bba29f3e8e12507f765ad621c0033b79df58c 100644 GIT binary patch delta 4316 zcmZ`+dr(x@89(>#y}Ntv#c~m^0xqzu4^R+LQBq&=ByD2SOp=+T$)vH<5L}hWOIQ@6 zacz8&6eC8G<4kutcKSz{&StXHq{SJx9sHvK743>K#gs`*YoKB%_Gh(C{5Z3ddY2?0JAUh@!a|;t_S|;r9hbCg>BkSY|6DE@lKlZVcclQ@k z`!Hc0{dWaD6ZSh!P2f-1?>K#zp9+vlg;=RPkUVYL$@HAIl3|AvrpOz`mvx00ivC+g zGQu5vI}SVxU3eN zqN3uYcWWvcd3>2m&2@L2H(BC5|Cvkm$+6@76_@&6W^~AWX%UK~vWujV$sraU;`b}+ zLK!rqsKtW*T2bfEE71?hk{b3)Oxh6eFtSQn$r8P0y6*S<(7C+;5ly0k&2KB}xI1~- ziYK|%rBWeZ?pAXi?)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>>^n|>x{w1>t!Nv*nBNFbAaB>UA)a7SQspeIYm3!2#k&-N(84^ z(_WRaEQWVvoPX^icS>IVb4q;9jx$2b1|z8;kqQRRrl?J(f`N0Xl3O50KW_?H;~ z{*Xqz&IAO)(4Dt6lJ6Y&(gGI+h+3f64euQZOHcy9HDCdaUviTi*L)fLl18!}6P6xG z@*GwdD28`0zKOCihX4tbN8ZPOD5Cdy|MX!J>xkA$lVB%Q_t|jx% zlXPk}6MQ9LrCFw04cw6W0&>)OjR*`;V`KbuGi?k-KD0dorNSe8#iDBP zWAkTI`OkpAaZA4sXflH)h#iF0B62(-G@y=?K$CSav<*HDpivKcEN*+5^1usS03ltl zAl*6JxI4lJpP~NHiHH^MB+#TD+&~e*hafSa9+9^25kxz{c`dZ-K6u}To&>S_JN(0mu zcc16iS|H}|c}qNcp7XubuTBdraz4+a&(h6m{DS3f>H=T2k1kXDKLXqjllT$OdWlx@ zfqk@A9lmHgxyaMoY2k`#8_xpG4nV&a!m56Xz!RaUO*^&|#QI~F`{Oabvz@L{;{rqY zsThB=oo-hnA6xR+$K11@uAt$+1BMap;}7qrPt))xmbi~c_tWJL_(`B0lKCG(w0NlI z0Np8R@lOp6`xJ2a>CkUOG)Wx3e4Lod?2dxixBN25TK1_P-Eaa&^w zXfjj5b4%=|_OFqy= zbIYa$hCF70CNHdJ^bC3swxdbh5#hwVgUeksuXI>IkvP!g7B`^1aC3>Pg~f$@GsI8u zW!?1Q^5Gdy4! z^Si%I;fsR{SVTMVEr0K2T2vVqSacq!A;bQ|&lFU>kC@93?=Ez6uTme}T`P?mtA-Z6 zLf0vLNe_M9>sfrDZs+4wP0f3D)<03T$t0Cqw$wiDYD!oZyXh} diff --git a/tests/.latest.json b/tests/.latest.json index 4371eec..6cd89ec 100644 --- a/tests/.latest.json +++ b/tests/.latest.json @@ -1,4 +1,4 @@ { "version": "0.5.3", - "timestamp": 1662746419095 + "timestamp": 1663067442910 } \ No newline at end of file diff --git a/tests/handleTransfer.test.ts b/tests/handleTransfer.test.ts index 36ab225..a53bb19 100644 --- a/tests/handleTransfer.test.ts +++ b/tests/handleTransfer.test.ts @@ -37,8 +37,8 @@ describe('handleTransfer', () => { assert.fieldEquals( 'Punk', Utils.id_STRING, - 'id', - Utils.id_BYTES.toHexString() + 'numberOfTransfers', + Utils.Bi_ONE.toString() ) }) }) diff --git a/tests/helpers/utils.ts b/tests/helpers/utils.ts index bc70c80..55f1661 100644 --- a/tests/helpers/utils.ts +++ b/tests/helpers/utils.ts @@ -29,16 +29,32 @@ export default class Utils { return Bytes.fromHexString('0x0000000000000000000000000000000000000000') } + static get loremIpsum(): string { + return 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor' + } + static get Bi_ZERO(): BigInt { return BigInt.zero() } + static get Bi_ONE(): BigInt { + return BigInt.fromI32(1) + } + static seedAccount(): void { let entity = new Entity() - entity.setString('id', Utils.id_STRING) - entity.setBytes('address', Utils.id_BYTES) - entity.setBigInt('status', Utils.Bi_ZERO) + entity.setBytes('id', Utils.id_BYTES) + entity.setBigInt('averageAmountSpent', Utils.Bi_ZERO) + entity.setBigInt('totalEarned', Utils.Bi_ZERO) + entity.setBigInt('totalSpent', Utils.Bi_ZERO) + entity.setBigInt('numberOfSales', Utils.Bi_ZERO) + entity.setBigInt('numberOfTransfers', Utils.Bi_ZERO) + entity.setBigInt('numberOfPunksAssigned', Utils.Bi_ZERO) + entity.setBigInt('numberOfPunksOwned', Utils.Bi_ZERO) + entity.setBigInt('numberOfPurchases', Utils.Bi_ZERO) + entity.setBigInt('averageAmountSpent', Utils.Bi_ZERO) + entity.setString('accountUrl', Utils.loremIpsum) store.set('Account', Utils.id_STRING, entity) }