-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from Once-Upon/feature/ou-2595-key-changes-to…
…-gold-function-calls-and-events Key changes to CropXYZ function calls and events
- Loading branch information
Showing
24 changed files
with
21,449 additions
and
9,441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 188 additions & 0 deletions
188
src/contextualizers/protocol/cropXyz/abis/PlotAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
const abi = [ | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'player', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'plotId', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'stakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'newStakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint16', | ||
name: 'harvestableAmount', | ||
type: 'uint16', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint16', | ||
name: 'actuallyProducedAmount', | ||
type: 'uint16', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint24', | ||
name: 'plotHarvests', | ||
type: 'uint24', | ||
}, | ||
], | ||
name: 'HarvestedPlot', | ||
type: 'event', | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'player', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'plotId', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'diedStakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'newStakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint16', | ||
name: 'diedAmount', | ||
type: 'uint16', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint24', | ||
name: 'plotDeaths', | ||
type: 'uint24', | ||
}, | ||
], | ||
name: 'ClearedDiedHarvest', | ||
type: 'event', | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'player', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'plotId', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'clearedStakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'newStakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint16', | ||
name: 'clearedAmount', | ||
type: 'uint16', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint24', | ||
name: 'plotClears', | ||
type: 'uint24', | ||
}, | ||
], | ||
name: 'ClearedHarvest', | ||
type: 'event', | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'player', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'plotId', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'uint256', | ||
name: 'stakedElement', | ||
type: 'uint256', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint16', | ||
name: 'stakedAmount', | ||
type: 'uint16', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint64', | ||
name: 'timeStartStaked', | ||
type: 'uint64', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint64', | ||
name: 'timeReadyDelta', | ||
type: 'uint64', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint64', | ||
name: 'timeExpiredDelta', | ||
type: 'uint64', | ||
}, | ||
], | ||
name: 'StakedCrop', | ||
type: 'event', | ||
}, | ||
] as const; | ||
|
||
export default abi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Transaction } from '../../../types'; | ||
import { detect, generate } from './destination'; | ||
import { containsBigInt, contextSummary } from '../../../helpers/utils'; | ||
import goldDestination0x2b1c6528 from '../../test/transactions/goldDestination-0x2b1c6528.json'; | ||
|
||
describe('CropXYZ Destination', () => { | ||
it('Should detect transaction', () => { | ||
const isCropXYZDestination1 = detect( | ||
goldDestination0x2b1c6528 as unknown as Transaction, | ||
); | ||
expect(isCropXYZDestination1).toBe(true); | ||
}); | ||
|
||
describe('Should generate context', () => { | ||
it('Should generate context for one tx', () => { | ||
const transaction1 = generate( | ||
goldDestination0x2b1c6528 as unknown as Transaction, | ||
); | ||
expect(transaction1.context?.summaries?.en.title).toBe('CropXYZ'); | ||
expect(contextSummary(transaction1.context)).toBe( | ||
'0x9a37e57d177c5ff8817b55da36f2a2b3532cde3f RECEIVED plots 0xe2f275b2a5c376fd10006b67a9be0cc3bd5488e8 #4 and 0xe2f275b2a5c376fd10006b67a9be0cc3bd5488e8 #5 and 9 0xf4a785a80d91cadc149f778ee17d35cd008203f7 and 202816 0x387d73bd8682dceb3327b940213d5de50ee2bba2', | ||
); | ||
expect(containsBigInt(transaction1.context)).toBe(false); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.