Transaction:

b14eef48e4e920c480d2d6b207b04588ea66e31b40898a587352aad165b848c1
Status
Failed
Timestamp
11/5/2020, 9:42:18 PM
Result
ImportError('module otoken cannot be imported in a smart contract.',)
Block Number
1542
SubBlock Number
0
Nonce
176
Processor
89f67bb871351a1629d66676e4bd92bbacb23bd0649b890542ef98f1b664a497
Stamps Used
4 ( 0.308 dTAU )
Contract Name
submission
Function Name
submit_contract
Signature
9df7b2e1c0b063c190719a4cc91ba8d973993e6418958858111258b7d77f2cfadeacc10e3dd839dbe85184cc0b2c4e9a5e6f54ec3f29e70ff645112a0b87ef06

Kwargs

code
import otoken import currency tau_price_in_cents = Variable() frozen = Variable() operator = Hash(default_value=False) price = Hash(default_value=0) @construct def seed(): tau_price_in_cents.set(2.5) operator["list"] = [ctx.caller] operator[ctx.caller] = True @export def set_price(new_price: float): assert operator[ctx.caller] is True assert new_price < 1.2 * tau_price_in_cents.get() + 0.1 assert new_price > 0 price[ctx.caller] = new_price @export def calculate_price(): assert frozen.get() != True oracle_count = 0 total_price = 0 for x in operator["list"]: oracle_count += 1 total_price += price[x] tau_price_in_cents.set(total_price / oracle_count) @export def replace_oracle(new_oracle: str): assert operator[ctx.caller] is True operator[ctx.caller] = False operator["list"] = operator["list"].remove(ctx.caller) operator["list"] = operator["list"].append(new_oracle) price[new_oracle] = tau_price_in_cents.get() @export def get_price(): otoken.transfer_from(1, ctx.this, ctx.caller) return tau_price_in_cents.get() @export def disperse_token(): amount = otoken.balance_of(ctx.this) / len(operator["list"]) for x in operator["list"]: otoken.transfer(amount, x) amount = currency.balance_of(ctx.this) / len(operator["list"]) for x in operator["list"]: currency.transfer(amount, x) @export def is_frozen(): return frozen.get() @export def freeze_vote(vote: bool): assert operator[ctx.caller] is True operator[ctx.caller, "freeze"] = vote @export def freeze(): oracle_count = 0 yes_votes = 0 for x in operator["list"]: oracle_count += 1 if operator[x, "freeze"] is True: yes_votes += 1 if yes_votes / oracle_count > 0.5: frozen.set(True) return True else: frozen.set(False) return False
name
con_oracle_5

State Changes

Contract
currency
Variable
balances
New Value
84,366,821