-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from jdogresorg/btns420-indexer
v0.12.0 Release
- Loading branch information
Showing
37 changed files
with
1,837 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# ADDRESS command | ||
This command configures address specific options. | ||
|
||
## PARAMS | ||
| Name | Type | Description | | ||
| ---------------- | ------ | ----------------------------------------| | ||
| `VERSION` | String | Broadcast Format Version | | ||
| `FEE_PREFERENCE` | String | Set preference for how `FEE` is used | | ||
| `REQUIRE_MEMO` | String | Require a `MEMO` on any received `SEND` | | ||
|
||
## Formats | ||
|
||
### Version `0` | ||
- `VERSION|FEE_PREFERENCE|REQUIRE_MEMO` | ||
|
||
## Examples | ||
``` | ||
bt:ADDRESS|0|1|0 | ||
This example sets the address to DESTROY fees | ||
``` | ||
|
||
``` | ||
bt:ADDRESS|0|2|0 | ||
This example sets the address to DONATE fees | ||
``` | ||
|
||
``` | ||
bt:ADDRESS|0|0|1 | ||
This example sets the address to require a `MEMO` on any received `SEND` | ||
``` | ||
|
||
## `FEE_PREFERENCE` Options | ||
- `1` = Destroy `FEE`, provably lowering supply | ||
- `2` = Donate `FEE` to protocol development (default) | ||
- `3` = Donate `FEE` to community development | ||
|
||
## Notes | ||
- `ADDR` `ACTION` can be used for shorter reference to `ADDRESS` `ACTION` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/********************************************************************* | ||
* address.php - ADDRESS command | ||
* | ||
* PARAMS: | ||
* - VERSION - Broadcast Format Version | ||
* - FEE_PREFERENCE - Set preference for how `FEE` is used | ||
* - REQUIRE_MEMO - Require a `MEMO` on any received `SEND` | ||
* | ||
* FORMATS: | ||
* - 0 = Full | ||
* | ||
********************************************************************/ | ||
function btnsAddress($params=null, $data=null, $error=null){ | ||
global $mysqli, $reparse; | ||
|
||
// Define list of known FORMATS | ||
$formats = array( | ||
0 => 'VERSION|FEE_PREFERENCE|REQUIRE_MEMO' | ||
); | ||
|
||
/***************************************************************** | ||
* DEBUGGING - Force params | ||
****************************************************************/ | ||
// $str = "0|1|1"; | ||
// $params = explode('|',$str); | ||
|
||
// Validate that broadcast format is known | ||
$format = getFormatVersion($params[0]); | ||
if(!$error && ($format===NULL || !in_array($format,array_keys($formats)))) | ||
$error = 'invalid: VERSION (unknown)'; | ||
|
||
// Parse PARAMS using given VERSION format and update BTNS transaction data object | ||
if(!$error) | ||
$data = setActionParams($data, $params, $formats[$format]); | ||
|
||
/***************************************************************** | ||
* FORMAT Validations | ||
****************************************************************/ | ||
|
||
// Verify FEE_PREFERENCE is numeric | ||
if(!$error && isset($data->FEE_PREFERENCE) && !is_numeric($data->FEE_PREFERENCE)) | ||
$error = "invalid: FEE_PREFERENCE (format)"; | ||
|
||
// Verify REQUIRE_MEMO is numeric | ||
if(!$error && isset($data->REQUIRE_MEMO) && !is_numeric($data->REQUIRE_MEMO)) | ||
$error = "invalid: REQUIRE_MEMO (format)"; | ||
|
||
/***************************************************************** | ||
* General Validations | ||
****************************************************************/ | ||
|
||
// Verify FEE_PREFERENCE value is valid | ||
if(!$error && isset($data->FEE_PREFERENCE) && !in_array($data->FEE_PREFERENCE,array(0,1,2))) | ||
$error = 'invalid: FEE_PREFERENCE'; | ||
|
||
// Verify REQUIRE_MEMO value is valid | ||
if(!$error && isset($data->REQUIRE_MEMO) && !in_array($data->REQUIRE_MEMO,array(0,1))) | ||
$error = 'invalid: REQUIRE_MEMO'; | ||
|
||
// Determine final status | ||
$data->STATUS = $status = ($error) ? $error : 'valid'; | ||
|
||
// Print status message | ||
print "\n\t ADDRESS : {$data->SOURCE} : {$data->STATUS}"; | ||
|
||
// Create record in addresses table | ||
createAddressOption($data); | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.