Unit ID
/E8PLYhXdk/aHXrIvWQzEGbbdH4MYRE3Tc+Px8wteeg=
Received
26.06.2021 23:25:23
Confirmation delay (full node)
3 minutes 27 seconds
Confirmation delay (light node)
4 minutes 34 seconds
Messages
Definition
Definition: [ "autonomous agent", { "doc_url": "https://counterstake.org/bridge-import-factory.json", "init": "{ $import_base_aa = '6U6QWWW6EDLNGVHEKW7PLZKJLSSZ577X'; $governance_base_aa = 'KDHCTQOTKTO6MLYOCU6OCBI7KK72DV3P'; }", "messages": { "cases": [ { "if": "{var['creating']}", "messages": [ { "app": "state", "state": "{ $params = var['import_' || trigger.address]; $params.asset = trigger.unit; var['import_' || trigger.address] = $params; var['creating'] = false; }" } ] }, { "init": "{ if (!trigger.data.home_network) bounce("no home network"); if (!trigger.data.home_asset) bounce("no home asset"); $params = { home_network: trigger.data.home_network, home_asset: trigger.data.home_asset, }; if (trigger.data.stake_asset){ if (!asset[trigger.data.stake_asset].exists) bounce("no such asset: " || trigger.data.stake_asset); $params.stake_asset = trigger.data.stake_asset; } // decimals foreach(['stake_asset_decimals', 'asset_decimals'], 2, $p => { $value = trigger.data[$p]; if (!is_integer($value) OR $value < 0 OR $value > 15) bounce("bad " || $p); $params[$p] = $value; }); // ratio of the initial stake to the amount claimed if (trigger.data.ratio){ if (typeof(trigger.data.ratio) != 'number' OR trigger.data.ratio <= 0) bounce("bad ratio: " || trigger.data.ratio); $params.ratio = trigger.data.ratio; } // challenging periods in hours foreach(['challenging_periods', 'large_challenging_periods'], 2, $p => { $value = trigger.data[$p]; if (exists($value)) { $params[$p] = $governance_base_aa.$get_challenging_periods($value); } }); // the counterstake must be that larger than the current stake if (trigger.data.counterstake_coef){ if (typeof(trigger.data.counterstake_coef) != 'number' OR trigger.data.counterstake_coef <= 1) bounce("bad counterstake_coef: " || trigger.data.counterstake_coef); $params.counterstake_coef = trigger.data.counterstake_coef; } // minimum amount of stake - to make sure that even small claims are properly monitored and challenged if necessary if (trigger.data.min_stake){ if (!is_integer(trigger.data.min_stake) OR trigger.data.min_stake < 0) bounce("bad min_stake: " || trigger.data.min_stake); $params.min_stake = trigger.data.min_stake; } // the expatriated tx must be old enough before it is allowed to claim it if (trigger.data.min_tx_age){ if (!is_integer(trigger.data.min_tx_age) OR trigger.data.min_tx_age <= 0) bounce("bad min_tx_age: " || trigger.data.min_tx_age); $params.min_tx_age = trigger.data.min_tx_age; } // transfers that are deemed large and trigger a different schedule of challenging periods if (trigger.data.large_threshold){ if (!is_integer(trigger.data.large_threshold) OR trigger.data.large_threshold <= 0) bounce("bad large_threshold: " || trigger.data.large_threshold); $params.large_threshold = trigger.data.large_threshold; } // min price of imported asset in terms of stake asset, to protect against malicious oracles if (trigger.data.min_price){ if (typeof(trigger.data.min_price) != 'number' OR trigger.data.min_price < 0) bounce("bad min_price: " || trigger.data.min_price); $params.min_price = trigger.data.min_price; } // oracle params if (!trigger.data.oracles) bounce("no oracles"); $params.oracles = $governance_base_aa.$get_oracles(trigger.data.oracles); // governance AA params foreach(['governance_challenging_period', 'freeze_period'], 2, $p => { $value = trigger.data[$p]; if (exists($value)) { if (!is_integer($value) OR $value <= 0) bounce("bad " || $p); $params[$p] = $value; } }); $import_aa = [ 'autonomous agent', { base_aa: $import_base_aa, params: $params } ]; $import_aa_address = chash160($import_aa); }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{ $import_aa_address }", "amount": 4000 } ] } }, { "app": "data", "payload": { "define": 1, "factory": "{this_address}" } }, { "app": "definition", "payload": { "definition": "{$import_aa}" } }, { "app": "state", "state": "{ var['import_' || $import_aa_address] = $params; var['creating'] = 1; response['address'] = $import_aa_address; }" } ] } ] } } ]
Technical information
Fees:
5,229 bytes
(452 headers, 4777 payload)
Level:2053745
Witnessed level:2053733
Main chain index:2045751
Latest included mc index:2045750
Status:stable/confirmed/final