Last active
June 3, 2022 00:58
-
-
Save binsta/5549111561683c967b7aab49e5ac7a7f to your computer and use it in GitHub Desktop.
This gist is owned by 0xa056c6cf5a75cf06d6fa818d29077ce106c4318a0168e9fcccdb6a257527570c
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 gist is owned by address: 0xa056c6cf5a75cf06d6fa818d29077ce106c4318a0168e9fcccdb6a257527570c |
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
{ | |
"source": { | |
"hash": "0x4d9227546d9df7f4bb842438c657f05c1826068f0fe69a32c38a1dd368c414fd", | |
"language": "ink! 3.0.0-rc9", | |
"compiler": "rustc 1.63.0-nightly" | |
}, | |
"contract": { | |
"name": "fat-sample", | |
"version": "0.1.0", | |
"authors": [ | |
"[your_name] <[your_email]>" | |
] | |
}, | |
"V3": { | |
"spec": { | |
"constructors": [ | |
{ | |
"args": [], | |
"docs": [], | |
"label": "default", | |
"payable": false, | |
"selector": "0xed4b9d1b" | |
} | |
], | |
"docs": [], | |
"events": [], | |
"messages": [ | |
{ | |
"args": [ | |
{ | |
"label": "code", | |
"type": { | |
"displayName": [ | |
"Vec" | |
], | |
"type": 4 | |
} | |
} | |
], | |
"docs": [ | |
" Sets the POAP redemption code. (callable, admin-only)", | |
"", | |
" The admin must set enough POAP code while setting up the contract. The code can be", | |
" overrode at any time." | |
], | |
"label": "admin_set_poap_code", | |
"mutates": true, | |
"payable": false, | |
"returnType": { | |
"displayName": [ | |
"Result" | |
], | |
"type": 11 | |
}, | |
"selector": "0xb1cbcb4f" | |
}, | |
{ | |
"args": [ | |
{ | |
"label": "signed", | |
"type": { | |
"displayName": [ | |
"SignedAttestation" | |
], | |
"type": 14 | |
} | |
} | |
], | |
"docs": [ | |
" Redeems a POAP with a signed `attestation`. (callable)", | |
"", | |
" The attestation must be created by [attest_gist] function. After the verification of", | |
" the attestation, the the sender account will the linked to a Github username. Then a", | |
" POAP redemption code will be allocated to the sender.", | |
"", | |
" Each blockchain account and github account can only be linked once." | |
], | |
"label": "redeem", | |
"mutates": true, | |
"payable": false, | |
"returnType": { | |
"displayName": [ | |
"Result" | |
], | |
"type": 11 | |
}, | |
"selector": "0xec3e9290" | |
}, | |
{ | |
"args": [], | |
"docs": [ | |
" Returns my POAP redemption code / link if it exists. (View function)", | |
"", | |
" - If the account doesn't have any redemption code allocated, it returns `None`;", | |
" - If the account has the code allocated but the contract doesn't have sufficient code", | |
" in `poap_code`, it returns `None` as well;", | |
" - Otherwise it returns the code." | |
], | |
"label": "my_poap", | |
"mutates": false, | |
"payable": false, | |
"returnType": { | |
"displayName": [ | |
"Option" | |
], | |
"type": 16 | |
}, | |
"selector": "0xa6cb77ac" | |
}, | |
{ | |
"args": [], | |
"docs": [], | |
"label": "query_example", | |
"mutates": false, | |
"payable": false, | |
"returnType": { | |
"displayName": [], | |
"type": 17 | |
}, | |
"selector": "0xf3901e52" | |
}, | |
{ | |
"args": [ | |
{ | |
"label": "url", | |
"type": { | |
"displayName": [ | |
"String" | |
], | |
"type": 5 | |
} | |
} | |
], | |
"docs": [ | |
" Attests a Github Gist by the raw file url. (Query only)", | |
"", | |
" It sends a HTTPS request to the url and extract an address from the claim (\"This gist", | |
" is owned by address: 0x...\"). Once the claim is verified, it returns a signed", | |
" attestation with the pair `(github_username, account_id)`." | |
], | |
"label": "attest_gist", | |
"mutates": false, | |
"payable": false, | |
"returnType": { | |
"displayName": [ | |
"Result" | |
], | |
"type": 19 | |
}, | |
"selector": "0x8f22b189" | |
} | |
] | |
}, | |
"storage": { | |
"struct": { | |
"fields": [ | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
"ty": 0 | |
} | |
}, | |
"name": "admin" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0100000000000000000000000000000000000000000000000000000000000000", | |
"ty": 3 | |
} | |
}, | |
"name": "attestation_privkey" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0200000000000000000000000000000000000000000000000000000000000000", | |
"ty": 3 | |
} | |
}, | |
"name": "attestation_pubkey" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0300000000000000000000000000000000000000000000000000000000000000", | |
"ty": 4 | |
} | |
}, | |
"name": "poap_code" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0400000000000000000000000000000000000000000000000000000000000000", | |
"ty": 6 | |
} | |
}, | |
"name": "redeem_by_account" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0500000000000000000000000000000000000000000000000000000000000000", | |
"ty": 7 | |
} | |
}, | |
"name": "total_redeemed" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0600000000000000000000000000000000000000000000000000000000000000", | |
"ty": 9 | |
} | |
}, | |
"name": "username_by_account" | |
}, | |
{ | |
"layout": { | |
"cell": { | |
"key": "0x0700000000000000000000000000000000000000000000000000000000000000", | |
"ty": 10 | |
} | |
}, | |
"name": "account_by_username" | |
} | |
] | |
} | |
}, | |
"types": [ | |
{ | |
"id": 0, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"type": 1, | |
"typeName": "[u8; 32]" | |
} | |
] | |
} | |
}, | |
"path": [ | |
"ink_env", | |
"types", | |
"AccountId" | |
] | |
} | |
}, | |
{ | |
"id": 1, | |
"type": { | |
"def": { | |
"array": { | |
"len": 32, | |
"type": 2 | |
} | |
} | |
} | |
}, | |
{ | |
"id": 2, | |
"type": { | |
"def": { | |
"primitive": "u8" | |
} | |
} | |
}, | |
{ | |
"id": 3, | |
"type": { | |
"def": { | |
"sequence": { | |
"type": 2 | |
} | |
} | |
} | |
}, | |
{ | |
"id": 4, | |
"type": { | |
"def": { | |
"sequence": { | |
"type": 5 | |
} | |
} | |
} | |
}, | |
{ | |
"id": 5, | |
"type": { | |
"def": { | |
"primitive": "str" | |
} | |
} | |
}, | |
{ | |
"id": 6, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"name": "offset_key", | |
"type": 8, | |
"typeName": "Key" | |
} | |
] | |
} | |
}, | |
"params": [ | |
{ | |
"name": "K", | |
"type": 0 | |
}, | |
{ | |
"name": "V", | |
"type": 7 | |
} | |
], | |
"path": [ | |
"ink_storage", | |
"lazy", | |
"mapping", | |
"Mapping" | |
] | |
} | |
}, | |
{ | |
"id": 7, | |
"type": { | |
"def": { | |
"primitive": "u32" | |
} | |
} | |
}, | |
{ | |
"id": 8, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"type": 1, | |
"typeName": "[u8; 32]" | |
} | |
] | |
} | |
}, | |
"path": [ | |
"ink_primitives", | |
"Key" | |
] | |
} | |
}, | |
{ | |
"id": 9, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"name": "offset_key", | |
"type": 8, | |
"typeName": "Key" | |
} | |
] | |
} | |
}, | |
"params": [ | |
{ | |
"name": "K", | |
"type": 0 | |
}, | |
{ | |
"name": "V", | |
"type": 5 | |
} | |
], | |
"path": [ | |
"ink_storage", | |
"lazy", | |
"mapping", | |
"Mapping" | |
] | |
} | |
}, | |
{ | |
"id": 10, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"name": "offset_key", | |
"type": 8, | |
"typeName": "Key" | |
} | |
] | |
} | |
}, | |
"params": [ | |
{ | |
"name": "K", | |
"type": 5 | |
}, | |
{ | |
"name": "V", | |
"type": 0 | |
} | |
], | |
"path": [ | |
"ink_storage", | |
"lazy", | |
"mapping", | |
"Mapping" | |
] | |
} | |
}, | |
{ | |
"id": 11, | |
"type": { | |
"def": { | |
"variant": { | |
"variants": [ | |
{ | |
"fields": [ | |
{ | |
"type": 12 | |
} | |
], | |
"index": 0, | |
"name": "Ok" | |
}, | |
{ | |
"fields": [ | |
{ | |
"type": 13 | |
} | |
], | |
"index": 1, | |
"name": "Err" | |
} | |
] | |
} | |
}, | |
"params": [ | |
{ | |
"name": "T", | |
"type": 12 | |
}, | |
{ | |
"name": "E", | |
"type": 13 | |
} | |
], | |
"path": [ | |
"Result" | |
] | |
} | |
}, | |
{ | |
"id": 12, | |
"type": { | |
"def": { | |
"tuple": [] | |
} | |
} | |
}, | |
{ | |
"id": 13, | |
"type": { | |
"def": { | |
"variant": { | |
"variants": [ | |
{ | |
"index": 0, | |
"name": "InvalidUrl" | |
}, | |
{ | |
"index": 1, | |
"name": "RequestFailed" | |
}, | |
{ | |
"index": 2, | |
"name": "NoClaimFound" | |
}, | |
{ | |
"index": 3, | |
"name": "InvalidAddressLength" | |
}, | |
{ | |
"index": 4, | |
"name": "InvalidAddress" | |
}, | |
{ | |
"index": 5, | |
"name": "NoPermission" | |
}, | |
{ | |
"index": 6, | |
"name": "InvalidSignature" | |
}, | |
{ | |
"index": 7, | |
"name": "UsernameAlreadyInUse" | |
}, | |
{ | |
"index": 8, | |
"name": "AccountAlreadyInUse" | |
} | |
] | |
} | |
}, | |
"path": [ | |
"fat_sample", | |
"fat_sample", | |
"Error" | |
] | |
} | |
}, | |
{ | |
"id": 14, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"name": "attestation", | |
"type": 15, | |
"typeName": "Attestation" | |
}, | |
{ | |
"name": "signature", | |
"type": 3, | |
"typeName": "Vec<u8>" | |
} | |
] | |
} | |
}, | |
"path": [ | |
"fat_sample", | |
"fat_sample", | |
"SignedAttestation" | |
] | |
} | |
}, | |
{ | |
"id": 15, | |
"type": { | |
"def": { | |
"composite": { | |
"fields": [ | |
{ | |
"name": "username", | |
"type": 5, | |
"typeName": "String" | |
}, | |
{ | |
"name": "account_id", | |
"type": 0, | |
"typeName": "AccountId" | |
} | |
] | |
} | |
}, | |
"path": [ | |
"fat_sample", | |
"fat_sample", | |
"Attestation" | |
] | |
} | |
}, | |
{ | |
"id": 16, | |
"type": { | |
"def": { | |
"variant": { | |
"variants": [ | |
{ | |
"index": 0, | |
"name": "None" | |
}, | |
{ | |
"fields": [ | |
{ | |
"type": 5 | |
} | |
], | |
"index": 1, | |
"name": "Some" | |
} | |
] | |
} | |
}, | |
"params": [ | |
{ | |
"name": "T", | |
"type": 5 | |
} | |
], | |
"path": [ | |
"Option" | |
] | |
} | |
}, | |
{ | |
"id": 17, | |
"type": { | |
"def": { | |
"tuple": [ | |
18, | |
3 | |
] | |
} | |
} | |
}, | |
{ | |
"id": 18, | |
"type": { | |
"def": { | |
"primitive": "u16" | |
} | |
} | |
}, | |
{ | |
"id": 19, | |
"type": { | |
"def": { | |
"variant": { | |
"variants": [ | |
{ | |
"fields": [ | |
{ | |
"type": 14 | |
} | |
], | |
"index": 0, | |
"name": "Ok" | |
}, | |
{ | |
"fields": [ | |
{ | |
"type": 13 | |
} | |
], | |
"index": 1, | |
"name": "Err" | |
} | |
] | |
} | |
}, | |
"params": [ | |
{ | |
"name": "T", | |
"type": 14 | |
}, | |
{ | |
"name": "E", | |
"type": 13 | |
} | |
], | |
"path": [ | |
"Result" | |
] | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment