A simple smart contract for terra blockchain supporting:
- Instantiation
- Set scores for users and their tokens. This can only be done by the owner.
- Retrieve scores for the users.
To run the unit tests, run cargo test
.
This contract is also deployed on testnet at terra1p77szenk6wy9kv90ppmzumwmpray6exjgnetre.
Possible operations:
- Retrivee the owner address using query
{"get_owner": {}}
. - Retrieve score for a particular user using query
{"get_score": {"address": "terra1vahwu7rlfhxvztnzqsszjr3xtsvqeytnfw4ymd"}}
. If the score is not set for that user the output will be INT_MIN. - Retrieve score for a particular user for a token using query
{"get_score_for_token": {"user_address":"terra1vahwu7rlfhxvztnzqsszjr3xtsvqeytnfw4ymd", "token_address": "terra1vahwu7rlfhxvztnzqsszjr3xtsvqeytnfw4ymd"}}
. If the score is not set for that user and token the output will be INT_MIN. - Set score for some user with some token using execute
{"set_score":{"user_address": "terra1mfafaq4fajgm763zyzgqpmguf0swzdphlcd63j", "token_address": "terra1mfafaq4fajgm763zyzgqpmguf0swzdphlcd63j", "score":5}}
. This can only be done by the owner. Sample execution