Address
octDSTj5…g7fsBZ
octDSTj5hzYinMQrnn4jGrWKsmFcEHBdYFTHDiaCrg7fsBZ
State
OCT balance
0OCT
wallet balance
Type
Contract
smart contract on chain
Chain-level
View on Octrascan · devnet ↗
raw txs · nonce · pubkey
Pipoke (no profile)
this wallet has not registered a Pipoke profile
Contract
History
live · 20s · last 0Source · ABI · Bytecode✓ verifiedexpand →
Source · ABI · Bytecode
✓ verified✓ verified
contract Xlist {
event Initialized(operator: address, collection: address)
event Added(addr: address, phase: int)
event Removed(addr: address, phase: int)
event CollectionUpdated(old_collection: address, new_collection: address)
state {
operator: address
collection_addr: address
initialized: int
lists: map[int]map[address]int
}
constructor() {
self.operator = caller
self.initialized = 0
}
private fn only_operator() {
require(caller == self.operator, "xlist: not operator")
}
private fn only_initialized() {
require(self.initialized == 1, "xlist: not initialized")
}
fn init(collection: address): bool {
require(self.initialized == 0, "xlist: already initialized")
only_operator()
require(is_address(collection) && collection != 0, "xlist: invalid collection")
self.collection_addr = collection
self.initialized = 1
emit Initialized(self.operator, collection)
return true
}
fn update_collection(new_collection: address): bool {
only_initialized()
only_operator()
require(is_address(new_collection) && new_collection != 0, "xlist: invalid address")
let old = self.collection_addr
self.collection_addr = new_collection
emit CollectionUpdated(old, new_collection)
return true
}
fn add(phase_num: int, addr: address): bool {
only_initialized()
only_operator()
require(phase_num == 0 || phase_num == 1, "xlist: invalid phase")
require(is_address(addr) && addr != 0, "xlist: invalid address")
self.lists[phase_num][addr] = 1
emit Added(addr, phase_num)
return true
}
fn remove(phase_num: int, addr: address): bool {
only_initialized()
only_operator()
require(phase_num == 0 || phase_num == 1, "xlist: invalid phase")
require(is_address(addr) && addr != 0, "xlist: invalid address")
self.lists[phase_num][addr] = 0
emit Removed(addr, phase_num)
return true
}
fn add_batch(phase_num: int, addr_0: address, addr_1: address, addr_2: address, addr_3: address, addr_4: address, addr_5: address, addr_6: address, addr_7: address, addr_8: address, addr_9: address, addr_10: address, addr_11: address, addr_12: address, addr_13: address, addr_14: address, addr_15: address, addr_16: address, addr_17: address, addr_18: address, addr_19: address): int {
only_initialized()
only_operator()
require(phase_num == 0 || phase_num == 1, "xlist: invalid phase")
let count = 0
if is_address(addr_0) && addr_0 != 0 { self.lists[phase_num][addr_0] = 1 count += 1 emit Added(addr_0, phase_num) }
if is_address(addr_1) && addr_1 != 0 { self.lists[phase_num][addr_1] = 1 count += 1 emit Added(addr_1, phase_num) }
if is_address(addr_2) && addr_2 != 0 { self.lists[phase_num][addr_2] = 1 count += 1 emit Added(addr_2, phase_num) }
if is_address(addr_3) && addr_3 != 0 { self.lists[phase_num][addr_3] = 1 count += 1 emit Added(addr_3, phase_num) }
if is_address(addr_4) && addr_4 != 0 { self.lists[phase_num][addr_4] = 1 count += 1 emit Added(addr_4, phase_num) }
if is_address(addr_5) && addr_5 != 0 { self.lists[phase_num][addr_5] = 1 count += 1 emit Added(addr_5, phase_num) }
if is_address(addr_6) && addr_6 != 0 { self.lists[phase_num][addr_6] = 1 count += 1 emit Added(addr_6, phase_num) }
if is_address(addr_7) && addr_7 != 0 { self.lists[phase_num][addr_7] = 1 count += 1 emit Added(addr_7, phase_num) }
if is_address(addr_8) && addr_8 != 0 { self.lists[phase_num][addr_8] = 1 count += 1 emit Added(addr_8, phase_num) }
if is_address(addr_9) && addr_9 != 0 { self.lists[phase_num][addr_9] = 1 count += 1 emit Added(addr_9, phase_num) }
if is_address(addr_10) && addr_10 != 0 { self.lists[phase_num][addr_10] = 1 count += 1 emit Added(addr_10, phase_num) }
if is_address(addr_11) && addr_11 != 0 { self.lists[phase_num][addr_11] = 1 count += 1 emit Added(addr_11, phase_num) }
if is_address(addr_12) && addr_12 != 0 { self.lists[phase_num][addr_12] = 1 count += 1 emit Added(addr_12, phase_num) }
if is_address(addr_13) && addr_13 != 0 { self.lists[phase_num][addr_13] = 1 count += 1 emit Added(addr_13, phase_num) }
if is_address(addr_14) && addr_14 != 0 { self.lists[phase_num][addr_14] = 1 count += 1 emit Added(addr_14, phase_num) }
if is_address(addr_15) && addr_15 != 0 { self.lists[phase_num][addr_15] = 1 count += 1 emit Added(addr_15, phase_num) }
if is_address(addr_16) && addr_16 != 0 { self.lists[phase_num][addr_16] = 1 count += 1 emit Added(addr_16, phase_num) }
if is_address(addr_17) && addr_17 != 0 { self.lists[phase_num][addr_17] = 1 count += 1 emit Added(addr_17, phase_num) }
if is_address(addr_18) && addr_18 != 0 { self.lists[phase_num][addr_18] = 1 count += 1 emit Added(addr_18, phase_num) }
if is_address(addr_19) && addr_19 != 0 { self.lists[phase_num][addr_19] = 1 count += 1 emit Added(addr_19, phase_num) }
return count
}
view fn is_whitelisted(phase_num: int, addr: address): int {
if caller != self.collection_addr {
return 0
}
if phase_num == 0 || phase_num == 1 {
return self.lists[phase_num][addr]
}
return 0
}
view fn check(phase_num: int, addr: address): int {
if phase_num == 0 || phase_num == 1 {
return self.lists[phase_num][addr]
}
return 0
}
view fn get_collection(): address {
return self.collection_addr
}
view fn get_operator(): address {
return self.operator
}
}