From dbe4f5b8fd4b784185a778b955ca6c35e3731ea4 Mon Sep 17 00:00:00 2001 From: Sniezka Date: Mon, 26 Feb 2024 06:08:18 +0100 Subject: [PATCH] Renamed chunk to TickmapChunk --- contracts/collections/tickmap.ral | 6 +++--- contracts/storage/{chunk.ral => tickmap_chunk.ral} | 6 +++--- src/utils.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename contracts/storage/{chunk.ral => tickmap_chunk.ral} (54%) diff --git a/contracts/collections/tickmap.ral b/contracts/collections/tickmap.ral index 61527f31..d85ce0c7 100644 --- a/contracts/collections/tickmap.ral +++ b/contracts/collections/tickmap.ral @@ -186,7 +186,7 @@ Contract Tickmap( if (!exists) { return 0 } else { - let contract = Chunk(subContractId) + let contract = TickmapChunk(subContractId) return contract.get() } } @@ -207,7 +207,7 @@ Contract Tickmap( let id = poolKey ++ toByteVec!(chunk) let subContractId = subContractId!(id) assert!(contractExists!(subContractId), TickmapErrors.ChunkNotFound) - let contract = Chunk(subContractId) + let contract = TickmapChunk(subContractId) assert!(value == true && isInitialized == false || value == false && isInitialized == true, TickmapErrors.TickInitialized) @@ -223,7 +223,7 @@ Contract Tickmap( let exists = contractExists!(subContractId!(id)) if(!exists) { - let (encodedImmFields, encodedMutFields) = Chunk.encodeFields!(0, selfAddress!()) + let (encodedImmFields, encodedMutFields) = TickmapChunk.encodeFields!(0, selfAddress!()) copyCreateSubContract!{caller -> ALPH: 1 alph}( id, chunkTemplateContractId, diff --git a/contracts/storage/chunk.ral b/contracts/storage/tickmap_chunk.ral similarity index 54% rename from contracts/storage/chunk.ral rename to contracts/storage/tickmap_chunk.ral index fbb9a09d..4c3abc21 100644 --- a/contracts/storage/chunk.ral +++ b/contracts/storage/tickmap_chunk.ral @@ -1,5 +1,5 @@ -Contract Chunk(mut value: U256, admin: Address) { - enum ChunkError { +Contract TickmapChunk(mut value: U256, admin: Address) { + enum TickmapChunkError { NotAdmin = 1100 } pub fn get() -> U256 { @@ -8,7 +8,7 @@ Contract Chunk(mut value: U256, admin: Address) { @using(updateFields = true) pub fn set(updatedValue: U256) -> () { - checkCaller!(callerAddress!() == admin, ChunkError.NotAdmin) + checkCaller!(callerAddress!() == admin, TickmapChunkError.NotAdmin) value = updatedValue } } \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts index f93d513b..5045c286 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,6 @@ import { NodeProvider, SignerProvider, ZERO_ADDRESS, node, web3 } from '@alephium/web3' import { CLAMM, - Chunk, FeeTier, FeeTiers, Init, @@ -14,6 +13,7 @@ import { PositionsCounter, SwapUtils, Tickmap, + TickmapChunk, Ticks } from '../artifacts/ts' import { Positions } from '../artifacts/ts/Positions' @@ -286,7 +286,7 @@ export async function deployTick(signer: SignerProvider) { export async function deployChunk(signer: SignerProvider) { return await waitTxConfirmed( - Chunk.deploy(signer, { + TickmapChunk.deploy(signer, { initialFields: { value: 0n, admin: ZERO_ADDRESS