Transaction Details

Open on Dero Explorer
Internal ID:
3104442
Transaction Hash:
9f15ebad0abe0f1cef59a3186d70058f10c97c89fbb9857373e2bbcba6be3aac
Block:
Timestamp:
2022-12-12 12:37:11 UTC (2.8 years ago)
Type:
sc
Ring Size:
2
Payloads:
1
Caller:
Slixe (1442429)
SC Data:
[{"name":"SC_ACTION","datatype":"U","value":"1"},{"name":"SC_CODE","datatype":"S","value":"Function InitializePrivate() Uint64\n10  STORE(\"owner\", SIGNER())\n20  STORE(\"balance\", 0)\n30  STORE(\"depositor\", \"\")\n40  STORE(\"beneficiary\", \"\")\n50  STORE(\"agent\", \"\")\n60  STORE(\"agentFee\", 100) // Fee in 1/10000 parts, granularity .01%. E.g., 1000 = 10%, 100 = 1%, 50 = 0.5%, 3 = 0.03%.\n70  STORE(\"status\", 0) // 0 = Contract unresolved. 1 = Contract fulfilled. 2 = Depositor refunded.\nRETURN 0\nEnd Function\n\n// Boilerplate functions\n\nFunction TransferOwnership(newOwner String) Uint64 \n10  IF LOAD(\"owner\") == SIGNER() THEN GOTO 20\n11  RETURN 1\n\n20  IF IS_ADDRESS_VALID(ADDRESS_RAW(newOwner)) == 1 THEN GOTO 30\n21  RETURN 2\n\n30  STORE(\"tmpOwner\", ADDRESS_RAW(newOwner))\n40  RETURN 0\nEnd Function\n\nFunction ClaimOwnership() Uint64 \n10  IF EXISTS(\"tmpOwner\") == 1 THEN GOTO 20\n11  RETURN 1\n\n20  IF LOAD(\"tmpOwner\") == SIGNER() THEN GOTO 30\n21  RETURN 2\n\n30  STORE(\"owner\", SIGNER())\n40  RETURN 0\nEnd Function\n\n// Owner functions\n\nFunction TuneEscrowParameters(depositor String, beneficiary String, agent String, agentFee Uint64) Uint64\n10  IF LOAD(\"owner\") == SIGNER() THEN GOTO 20\n11  RETURN 1\n\n20  IF LOAD(\"status\") == 0 THEN GOTO 30\n21  RETURN 2\n\n30  DIM depositorRaw, beneficiaryRaw, agentRaw as String\n\n40  LET depositorRaw = ADDRESS_RAW(depositor)\n50  IF IS_ADDRESS_VALID(depositorRaw) == 1 THEN GOTO 60\n51  RETURN 3\n\n60  STORE(\"depositor\", depositorRaw)\n\n70  LET beneficiaryRaw = ADDRESS_RAW(beneficiary)\n80  IF IS_ADDRESS_VALID(beneficiaryRaw) == 1 THEN GOTO 90\n81  RETURN 4\n\n90  STORE(\"beneficiary\", beneficiaryRaw)\n\n100  LET agentRaw = ADDRESS_RAW(agent)\n110  IF IS_ADDRESS_VALID(agentRaw) == 1 THEN GOTO 120\n111  RETURN 5\n\n120  STORE(\"agent\", agentRaw)\n\n130  IF agentFee \u003c= 10000 THEN GOTO 140\n131  RETURN 6\n\n140  STORE(\"agentFee\", agentFee)\n150  RETURN 0\nEnd Function\n\n// User functions\n\nFunction Deposit() Uint64\n10  IF ADDRESS_RAW(LOAD(\"depositor\")) == SIGNER() || LOAD(\"owner\") == SIGNER() THEN GOTO 20\n11  SEND_DERO_TO_ADDRESS(SIGNER(), DEROVALUE()-1)\n12  RETURN 0\n\n20  IF LOAD(\"status\") == 0 THEN GOTO 30\n21  SEND_DERO_TO_ADDRESS(SIGNER(), DEROVALUE()-1)\n22  RETURN 0\n\n30  STORE(\"balance\", LOAD(\"balance\") + DEROVALUE())\n40  RETURN 0\nEnd Function\n\nFunction ForfeitAgentFee() Uint64\n10  IF ADDRESS_RAW(LOAD(\"agent\")) == SIGNER() THEN GOTO 20\n11  RETURN 1\n\n20  STORE(\"agentFee\", 0)\n30  RETURN 0\nEnd Function\n\nFunction Fulfill() Uint64\n10  IF ADDRESS_RAW(LOAD(\"agent\")) == SIGNER() || ADDRESS_RAW(LOAD(\"depositor\")) == SIGNER() THEN GOTO 20\n11  RETURN 1\n\n20  IF LOAD(\"status\") == 0 THEN GOTO 30\n21  RETURN 2\n\n30  RETURN sendFunds(1)\nEnd Function\n\nFunction RefundDepositor() Uint64\n10  IF ADDRESS_RAW(LOAD(\"agent\")) == SIGNER() || ADDRESS_RAW(LOAD(\"beneficiary\")) == SIGNER() THEN GOTO 20\n11  RETURN 1\n\n20  IF LOAD(\"status\") == 0 THEN GOTO 30\n21  RETURN 2\n\n30  RETURN sendFunds(2)\nEnd Function\n\n// Private functions\n\nFunction sendFunds(recipient Uint64) Uint64 // recipient: 1 = beneficiary, 2 = depositor.\n10  DIM balance, agentFee, funds as Uint64\n20  LET balance = LOAD(\"balance\")\n30  LET agentFee = balance * LOAD(\"agentFee\") / 10000\n40  LET funds = balance - agentFee\n\n50  DIM recipientAddress as String\n\n60  IF recipient == 1 || recipient == 2 THEN GOTO 70\n61  RETURN 100\n\n70  IF recipient == 1 THEN GOTO 71 ELSE GOTO 80\n71  LET recipientAddress = ADDRESS_RAW(LOAD(\"beneficiary\"))\n\n80  IF recipient == 2 THEN GOTO 81 ELSE GOTO 90\n81  LET recipientAddress = ADDRESS_RAW(LOAD(\"depositor\"))\n\n90  SEND_DERO_TO_ADDRESS(ADDRESS_RAW(LOAD(\"agent\")), agentFee)\n100  SEND_DERO_TO_ADDRESS(recipientAddress, funds-1)\n110  STORE(\"balance\", 0)\n120  STORE(\"status\", recipient)\n130  RETURN 0\nEnd Function\n"}]

Payload

Token (SCID):
DERO
Deposited:
none
Fees:
0.05569 DERO