Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2290a39
commit f85a40c
Showing
9 changed files
with
80 additions
and
64 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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
#include <eosio/transaction.hpp> | ||
#include <eosio/crypto.hpp> | ||
|
||
checksum256 xy::get_trx_id() { | ||
size_t size = transaction_size(); | ||
char buf[size]; | ||
size_t read = read_transaction( buf, size ); | ||
check( size == read, "read_transaction failed"); | ||
return sha256( buf, read ); | ||
} |
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,26 @@ | ||
uint64_t xy::global_available_primary_key() { | ||
auto global = _global.get_or_default(); | ||
uint64_t available_primary_key = global.available_primary_key; | ||
global.available_primary_key += 1; | ||
_global.set(global, get_self()); | ||
return available_primary_key; | ||
} | ||
|
||
/** | ||
* ACTION setrate | ||
*/ | ||
void xy::setrate( asset rate ) | ||
{ | ||
require_auth( get_self() ); | ||
|
||
auto sym_code = rate.symbol.code(); | ||
const asset supply = token::get_supply( TOKEN_CONTRACT, sym_code ); | ||
|
||
check( rate.is_valid(), "invalid rate" ); | ||
check( rate.amount > 0, "must set rate positive rate" ); | ||
check( rate.symbol == supply.symbol, "symbol precision mismatch" ); | ||
|
||
auto global = _global.get_or_default(); | ||
global.rate = rate; | ||
_global.set(global, get_self()); | ||
} |
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