use url and nested for cheaper calls

This commit is contained in:
Ricardo Guilherme Schmidt
2017-05-03 07:30:18 +00:00
parent 9b419badc6
commit 175ea76628
+7 -7
View File
@@ -47,10 +47,10 @@ contract GitHubAPIOraclize is GitHubAPI, Owned, usingOraclize{
//register or change a github user ethereum address. 100000000000000000
function register(address _sender, string _github_user, string _gistid)
payable only_owner{
StringLib.concat(_github_user,",",_gistid);
bytes32 ocid = oraclize_query("computation", [script, "user-add", _github_user.concat(",",_gistid), cred]);
payable only_owner{
bytes32 ocid = oraclize_query("nested", StringLib.concat("[identity] ${[URL] https://gist.githubusercontent.com/",_github_user,"/",_gistid,"/raw/}, ${[URL] json(https://api.github.com/gists/").concat(_gistid,credentials,").owner.[id,login]}"));
claimType[ocid] = OracleType.SET_USER;
userClaim[ocid] = UserClaim({sender: _sender, githubid: _github_user});
}
function updateCommits(string _repository, bytes20 _commitid)
@@ -62,10 +62,10 @@ contract GitHubAPIOraclize is GitHubAPI, Owned, usingOraclize{
function addRepository(string _repository)
payable only_owner{
bytes32 ocid = oraclize_query("computation", [script, "repo-add", _repository, cred],4000000);
bytes32 ocid = oraclize_query("URL", StringLib.concat("json(https://api.github.com/repos/",_repository,credentials,").$.id,full_name,watchers,subscribers_count"),4000000);
claimType[ocid] = OracleType.SET_REPOSITORY;
}
}
function updateIssue(string _repository, string issue) payable only_owner{
bytes32 ocid = oraclize_query("computation", [script, "issue-update",_repository.concat(",",issue),cred]);
}