Smart Contract Details
Open on Dero ExplorerInternal ID:
48201
Hash / Transaction:
Block:
Timestamp:
2024-03-03 19:12:52 UTC (1.6 years ago)
Creator:
…qgrdsvnq
(1396094)
Raw Data:
[{"name":"SC_ACTION","datatype":"U","value":1},{"name":"SC_CODE","datatype":"S","value":"{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"method\":\"transfer\",\"params\":{\"ringsize\":2,\"Transfers\":[{\"amount\":0,\"destination\":\"dero1qynekhrgcry8uurh0v8y8gnucc47rz0ejr6ktslz7w8fx8ssdqvd7qgkd3ud5\"}],\"SC_Code\":\"\\/\\/ Issue tokens after depositing DERO (Convert DERO to TOKENX)\\r\\nFunction IssueTOKENX() Uint64\\r\\n10 SEND_ASSET_TO_ADDRESS(SIGNER(), DEROVALUE(),SCID()) \\/\\/ Increment balance of user, without knowing original balance, this is done homomorphically\\r\\n20 RETURN 0\\r\\nEnd Function\\r\\n\\r\\n\\/\\/ Convert TOKENX to DERO after depositing TOKENX. Smart Contract can give DERO, Only if DERO balance exists.\\r\\nFunction ConvertTOKENX() Uint64\\r\\n10 SEND_DERO_TO_ADDRESS(SIGNER(),ASSETVALUE(SCID())) \\/\\/ Increment balance of user, without knowing original balance, this is done using Homomorphic Encryption.\\r\\n20 RETURN 0\\r\\nEnd Function\\r\\n\\r\\n\\/\\/ This function is used to initialize parameters during install time\\r\\n\\/\\/ InitializePrivate initializes a private SC\\r\\nFunction InitializePrivate(nameHdr String) Uint64\\r\\n10 STORE(\\\"owner\\\", SIGNER()) \\/\\/ Store in DB [\\\"owner\\\"] = address\\r\\n20 STORE(\\\"nameHdr\\\", nameHdr)\\\")\\r\\n30 SEND_ASSET_TO_ADDRESS(SIGNER(), 40000000, SCID()) \\/\\/ Gives initial encrypted balance of 1600000. \\r\\n40 RETURN 0 \\r\\nEnd Function\\r\\n\\r\\n\\/\\/ This function is used to change owner\\r\\n\\/\\/ owner is an string form of address\\r\\nFunction TransferOwnership(newowner String) Uint64\\r\\n10 IF LOAD(\\\"owner\\\") == SIGNER() THEN GOTO 30\\r\\n20 RETURN 1\\r\\n30 STORE(\\\"tmpowner\\\",ADDRESS_RAW(newowner))\\r\\n40 RETURN 0\\r\\nEnd Function\\r\\n\\r\\n\\/\\/ Until the new owner claims ownership, existing owner remains owner\\r\\nFunction ClaimOwnership() Uint64\\r\\n10 IF LOAD(\\\"tmpowner\\\") == SIGNER() THEN GOTO 30\\r\\n20 RETURN 1\\r\\n30 STORE(\\\"owner\\\",SIGNER()) \\/\\/ ownership claim successful\\r\\n40 RETURN 0\\r\\nEnd Function\\r\\n\\r\\n\\/\\/ if signer is owner, withdraw any requested funds\\r\\n\\/\\/ if everthing is okay, they will be showing in signers wallet\\r\\nFunction Withdraw( amount Uint64) Uint64 \\r\\n10 IF LOAD(\\\"owner\\\") == SIGNER() THEN GOTO 30 \\r\\n20 RETURN 1 \\r\\n30 SEND_DERO_TO_ADDRESS(SIGNER(),amount) \\r\\n40 RETURN 0 \\r\\nEnd Function\\r\\n\\r\\n\\/\\/ if signer is owner, provide him rights to update code anytime\\r\\n\\/\\/ make sure update is always available to SC\\r\\nFunction UpdateCode( code String) Uint64\\r\\n10 IF LOAD(\\\"owner\\\") == SIGNER() THEN GOTO 30\\r\\n20 RETURN 1\\r\\n30 UPDATE_SC_CODE(code)\\r\\n40 RETURN 0\\r\\nEnd Function\",\"SC_Value\":0,\"SC_RPC\":[{\"name\":\"entrypoint\",\"datatype\":\"S\",\"value\":\"InitializePrivate\"},{\"name\":\"nameHdr\",\"datatype\":\"S\",\"value\":\"Super Token\"}]}}"}]
Code:
{"jsonrpc":"2.0","id":"1","method":"transfer","params":{"ringsize":2,"Transfers":[{"amount":0,"destination":"dero1qynekhrgcry8uurh0v8y8gnucc47rz0ejr6ktslz7w8fx8ssdqvd7qgkd3ud5"}],"SC_Code":"\/\/ Issue tokens after depositing DERO (Convert DERO to TOKENX)\r\nFunction IssueTOKENX() Uint64\r\n10 SEND_ASSET_TO_ADDRESS(SIGNER(), DEROVALUE(),SCID()) \/\/ Increment balance of user, without knowing original balance, this is done homomorphically\r\n20 RETURN 0\r\nEnd Function\r\n\r\n\/\/ Convert TOKENX to DERO after depositing TOKENX. Smart Contract can give DERO, Only if DERO balance exists.\r\nFunction ConvertTOKENX() Uint64\r\n10 SEND_DERO_TO_ADDRESS(SIGNER(),ASSETVALUE(SCID())) \/\/ Increment balance of user, without knowing original balance, this is done using Homomorphic Encryption.\r\n20 RETURN 0\r\nEnd Function\r\n\r\n\/\/ This function is used to initialize parameters during install time\r\n\/\/ InitializePrivate initializes a private SC\r\nFunction InitializePrivate(nameHdr String) Uint64\r\n10 STORE(\"owner\", SIGNER()) \/\/ Store in DB [\"owner\"] = address\r\n20 STORE(\"nameHdr\", nameHdr)\")\r\n30 SEND_ASSET_TO_ADDRESS(SIGNER(), 40000000, SCID()) \/\/ Gives initial encrypted balance of 1600000. \r\n40 RETURN 0 \r\nEnd Function\r\n\r\n\/\/ This function is used to change owner\r\n\/\/ owner is an string form of address\r\nFunction TransferOwnership(newowner String) Uint64\r\n10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30\r\n20 RETURN 1\r\n30 STORE(\"tmpowner\",ADDRESS_RAW(newowner))\r\n40 RETURN 0\r\nEnd Function\r\n\r\n\/\/ Until the new owner claims ownership, existing owner remains owner\r\nFunction ClaimOwnership() Uint64\r\n10 IF LOAD(\"tmpowner\") == SIGNER() THEN GOTO 30\r\n20 RETURN 1\r\n30 STORE(\"owner\",SIGNER()) \/\/ ownership claim successful\r\n40 RETURN 0\r\nEnd Function\r\n\r\n\/\/ if signer is owner, withdraw any requested funds\r\n\/\/ if everthing is okay, they will be showing in signers wallet\r\nFunction Withdraw( amount Uint64) Uint64 \r\n10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30 \r\n20 RETURN 1 \r\n30 SEND_DERO_TO_ADDRESS(SIGNER(),amount) \r\n40 RETURN 0 \r\nEnd Function\r\n\r\n\/\/ if signer is owner, provide him rights to update code anytime\r\n\/\/ make sure update is always available to SC\r\nFunction UpdateCode( code String) Uint64\r\n10 IF LOAD(\"owner\") == SIGNER() THEN GOTO 30\r\n20 RETURN 1\r\n30 UPDATE_SC_CODE(code)\r\n40 RETURN 0\r\nEnd Function","SC_Value":0,"SC_RPC":[{"name":"entrypoint","datatype":"S","value":"InitializePrivate"},{"name":"nameHdr","datatype":"S","value":"Super Token"}]}}