SC CODE: /*
Black Diamond Token
Only 1000 black diamonds in the world.
Super Rare Anonymous Token powered by DERO platform.
By Ez3kiel
*/
Function Initialize() Uint64
10 STORE("owner", SIGNER())
20 STORE("original_supply", 100000000)
30 STORE("remaining_supply", 100000000)
40 SEND_ASSET_TO_ADDRESS(SIGNER(), 100000, SCID()) // A black diamond for memory
50 RETURN 0
End Function
Function IssueBlackDiamondToken() Uint64
10 IF LOAD("remaining_supply") != 0 THEN GOTO 30
20 RETURN 1
30 dim bd_claimed, new_supply as Uint64
40 LET bd_claimed = DEROVALUE() / 100
50 LET new_supply = LOAD("remaining_supply") - bd_claimed
60 IF new_supply < 0 THEN GOTO 20
70 SEND_ASSET_TO_ADDRESS(SIGNER(), bd_claimed, SCID())
80 STORE("remaining_supply", new_supply)
90 RETURN 0
End Function
// UTILITY FUNCTIONS
// This function is used to change owner
// owner is an string form of address
Function TransferOwnership(newowner String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("tmpowner", ADDRESS_RAW(newowner))
40 RETURN 0
End Function
// Until the new owner claims ownership, existing owner remains owner
Function ClaimOwnership() Uint64
10 IF LOAD("tmpowner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("owner", SIGNER()) // ownership claim successful
40 RETURN 0
End Function
// if signer is owner, withdraw any requested funds
// if everthing is okay, they will be showing in signers wallet
Function Withdraw(amount Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 SEND_DERO_TO_ADDRESS(SIGNER(), amount)
40 RETURN 0
End Function
// if signer is owner, provide him rights to update code anytime
// make sure update is always available to SC
Function UpdateCode(code String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 UPDATE_SC_CODE(code)
40 RETURN 0
End Function
|
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'/*
Black Diamond Token
Only 1000 black diamonds in the world.
Super Rare Anonymous Token powered by DERO platform.
By Ez3kiel
*/
Function Initialize() Uint64
10 STORE("owner", SIGNER())
20 STORE("original_supply", 100000000)
30 STORE("remaining_supply", 100000000)
40 SEND_ASSET_TO_ADDRESS(SIGNER(), 100000, SCID()) // A black diamond for memory
50 RETURN 0
End Function
Function IssueBlackDiamondToken() Uint64
10 IF LOAD("remaining_supply") != 0 THEN GOTO 30
20 RETURN 1
30 dim bd_claimed, new_supply as Uint64
40 LET bd_claimed = DEROVALUE() / 100
50 LET new_supply = LOAD("remaining_supply") - bd_claimed
60 IF new_supply < 0 THEN GOTO 20
70 SEND_ASSET_TO_ADDRESS(SIGNER(), bd_claimed, SCID())
80 STORE("remaining_supply", new_supply)
90 RETURN 0
End Function
// UTILITY FUNCTIONS
// This function is used to change owner
// owner is an string form of address
Function TransferOwnership(newowner String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("tmpowner", ADDRESS_RAW(newowner))
40 RETURN 0
End Function
// Until the new owner claims ownership, existing owner remains owner
Function ClaimOwnership() Uint64
10 IF LOAD("tmpowner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("owner", SIGNER()) // ownership claim successful
40 RETURN 0
End Function
// if signer is owner, withdraw any requested funds
// if everthing is okay, they will be showing in signers wallet
Function Withdraw(amount Uint64) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 SEND_DERO_TO_ADDRESS(SIGNER(), amount)
40 RETURN 0
End Function
// if signer is owner, provide him rights to update code anytime
// make sure update is always available to SC
Function UpdateCode(code String) Uint64
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 UPDATE_SC_CODE(code)
40 RETURN 0
End Function
'] |