Address
octCcgs6…bNPmVs
octCcgs68MFeeG8kpcwpHjdfD1M7tvjLKMvxkKMRkbNPmVs
State
OCT balance
10.003OCT
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 WOCT {
// Wrapped OCT for native OCT
// Users deposit native OCT and receive WOCT tokens (1:1 ratio)
// WOCT can be used in DEX pools, then unwrapped back to native OCT
// Deploy with no constructor args: []
// Native OCT uses 6 decimals (1 OCT = 1,000,000 uOCT)
// Verified: transfer() builtin takes priority over fn transfer() at runtime
state {
name: string
symbol: string
decimals: int
total_supply: int
balances: map[address]int
allowances: map[address]map[address]int
locked: bool
}
constructor() {
self.name = "Wrapped OCT"
self.symbol = "WOCT"
self.decimals = 6
self.total_supply = 0
self.locked = false
}
view fn name(): string {
return self.name
}
view fn symbol(): string {
return self.symbol
}
view fn decimals(): int {
return self.decimals
}
view fn total_supply(): int {
return self.total_supply
}
view fn balance_of(account: address): int {
return self.balances[account]
}
view fn allowance(token_owner: address, spender: address): int {
return self.allowances[token_owner][spender]
}
// Deposit native OCT, receive WOCT 1:1
// Call with native OCT value attached to the transaction
fn deposit(): int {
let v = value
require(v > 0, "no OCT sent")
self.balances[caller] += v
self.total_supply += v
return v
}
// Burn WOCT, receive native OCT 1:1
fn withdraw(amount: int): int {
require(amount > 0, "amount > 0")
require(self.locked == false, "reentrancy")
self.locked = true
require(self.balances[caller] >= amount, "insufficient WOCT")
self.balances[caller] -= amount
self.total_supply -= amount
transfer(caller, amount)
self.locked = false
return amount
}
fn transfer(to: address, amount: int): bool {
require(amount > 0, "amount must be positive")
require(self.balances[caller] >= amount, "insufficient balance")
self.balances[caller] -= amount
self.balances[to] += amount
return true
}
fn approve(spender: address, amount: int): bool {
self.allowances[caller][spender] = amount
return true
}
fn transfer_from(from: address, to: address, amount: int): bool {
require(amount > 0, "amount must be positive")
require(self.balances[from] >= amount, "insufficient balance")
require(self.allowances[from][caller] >= amount, "insufficient allowance")
self.balances[from] -= amount
self.balances[to] += amount
self.allowances[from][caller] -= amount
return true
}
}