-
Notifications
You must be signed in to change notification settings - Fork 11
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 #261 from ultraio/feature/BLOCK-2613-add-airgrab-c…
…ontract [BLOCK-2613] Add airgrab contract and update avatar contract
- Loading branch information
Showing
18 changed files
with
756 additions
and
56 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
57 changes: 57 additions & 0 deletions
57
docs/blockchain/contracts/airgrab-contract/airgrab-actions/claimrewards.md
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,57 @@ | ||
--- | ||
title: 'claimrewards' | ||
order: 2 | ||
|
||
--- | ||
|
||
# claimrewards | ||
|
||
## Summary | ||
|
||
This action will allow user to claim reward from `campaign` using their whitelisted wallets. | ||
|
||
## Action Parameters | ||
|
||
| Property Name | C++ Type | JavaScript Type | Description | | ||
| ------------- | --------------------- | --------------- | ---------------------------------------------------------------------------- | | ||
| `campaign` | eosio::name | String | The name of the campaign | | ||
| `wallet_id` | std::vector\<uint8_t> | String | The wallet owned by the user which is registered in the campaign's whitelist | | ||
|
||
Required Permissions: `user` | ||
|
||
## CLI - cleos | ||
|
||
```shell script | ||
cleos push action ultra.rgrab claimrewards '["testcampaign", "448e3de41c8b52750c664f57fe023a730bcc0047"]' -p user | ||
``` | ||
|
||
## Javascript - eosjs | ||
|
||
```typescript | ||
(async () => { | ||
const result = await api.transact( | ||
{ | ||
actions: [ | ||
{ | ||
account: 'ultra.rgrab', | ||
name: 'claimrewards', | ||
authorization: [ | ||
{ | ||
actor: 'user', | ||
permission: 'active', | ||
}, | ||
], | ||
data: { | ||
campaign: 'testcampaign', | ||
wallet_id: '448e3de41c8b52750c664f57fe023a730bcc0047' | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
blocksBehind: 3, | ||
expireSeconds: 30, | ||
} | ||
); | ||
})(); | ||
``` |
60 changes: 60 additions & 0 deletions
60
docs/blockchain/contracts/airgrab-contract/airgrab-actions/closecampgn.md
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,60 @@ | ||
--- | ||
title: 'closecampgn' | ||
order: 3 | ||
|
||
--- | ||
|
||
# closecampgn | ||
|
||
## Summary | ||
|
||
This action will allow `manager` to remove all whitelist users from `campaign`, and once whitelist is empty, `campaign` will be deleted. | ||
If campaign have a large whitelist, this action might fail when trying to remove users. | ||
|
||
## Action Parameters | ||
|
||
| Property Name | C++ Type | JavaScript Type | Description | | ||
| ------------- | ----------- | --------------- | --------------------------------------------------------------------------------------------------------- | | ||
| `campaign` | eosio::name | String | The name of the campaign | | ||
| `manager` | eosio::name | String | The account that will act as manager of the campaign | | ||
| `limit` | uint32_t | Number | How many whitelist users to remove from the campaign. If 0, try to remove all entries and delete campaign | | ||
|
||
Required Permissions: `manager` | ||
|
||
## CLI - cleos | ||
|
||
```shell script | ||
cleos push action ultra.rgrab closecampgn '["testcampaign", "manager", 0]' -p manager | ||
``` | ||
|
||
## Javascript - eosjs | ||
|
||
```typescript | ||
(async () => { | ||
const result = await api.transact( | ||
{ | ||
actions: [ | ||
{ | ||
account: 'ultra.rgrab', | ||
name: 'closecampgn', | ||
authorization: [ | ||
{ | ||
actor: 'manager', | ||
permission: 'active', | ||
}, | ||
], | ||
data: { | ||
campaign: 'testcampaign', | ||
manager: 'manager', | ||
limit: 0 | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
blocksBehind: 3, | ||
expireSeconds: 30, | ||
} | ||
); | ||
})(); | ||
``` |
57 changes: 57 additions & 0 deletions
57
docs/blockchain/contracts/airgrab-contract/airgrab-actions/createcampgn.md
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,57 @@ | ||
--- | ||
title: 'createcampgn' | ||
order: 0 | ||
|
||
--- | ||
|
||
# createcampgn | ||
|
||
## Summary | ||
|
||
This action will allow `manager` to create a new `campaign` | ||
|
||
## Action Parameters | ||
|
||
| Property Name | C++ Type | JavaScript Type | Description | | ||
| ------------- | ----------- | --------------- | ---------------------------------------------------- | | ||
| `campaign` | eosio::name | String | The name of the campaign | | ||
| `manager` | eosio::name | String | The account that will act as manager of the campaign | | ||
|
||
Required Permissions: `manager` | ||
|
||
## CLI - cleos | ||
|
||
```shell script | ||
cleos push action ultra.rgrab createcampgn '["testcampaign", "manager"]' -p manager | ||
``` | ||
|
||
## Javascript - eosjs | ||
|
||
```typescript | ||
(async () => { | ||
const result = await api.transact( | ||
{ | ||
actions: [ | ||
{ | ||
account: 'ultra.rgrab', | ||
name: 'createcampgn', | ||
authorization: [ | ||
{ | ||
actor: 'manager', | ||
permission: 'active', | ||
}, | ||
], | ||
data: { | ||
campaign: 'testcampaign', | ||
manager: 'manager' | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
blocksBehind: 3, | ||
expireSeconds: 30, | ||
} | ||
); | ||
})(); | ||
``` |
54 changes: 54 additions & 0 deletions
54
docs/blockchain/contracts/airgrab-contract/airgrab-actions/on_transfer.md
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,54 @@ | ||
--- | ||
title: 'on_transfer' | ||
order: 4 | ||
|
||
--- | ||
|
||
# on_transfer | ||
|
||
## Summary | ||
|
||
This is a notify action which will trigger when `manager` do a token transfer to `ultra.rgrab` with memo that follow the format of `<CampaignName>,<TotalCampaignPoints>,<Deadline>` with `Deadline` in block number. For example: `'testcampaign,10,10003123'` | ||
|
||
## Action Parameters | ||
|
||
Please refer to [token transfer action](../../token-contract/token-actions/transfer.md). | ||
|
||
## CLI - cleos | ||
|
||
```shell script | ||
cleos push action eosio.token transfer '["manager", "ultra.rgrab", "1000.00000000 UOS", "testcampaign,10,10003123"]' -p manager | ||
``` | ||
|
||
## Javascript - eosjs | ||
|
||
```typescript | ||
(async () => { | ||
const result = await api.transact( | ||
{ | ||
actions: [ | ||
{ | ||
account: 'eosio.token', | ||
name: 'transfer', | ||
authorization: [ | ||
{ | ||
actor: 'manager', | ||
permission: 'active', | ||
}, | ||
], | ||
data: { | ||
from: 'manager', | ||
to: 'ultra.rgrab', | ||
quantity: '1000.00000000 UOS', | ||
memo: 'testcampaign,10,10003123', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
blocksBehind: 3, | ||
expireSeconds: 30, | ||
} | ||
); | ||
})(); | ||
``` |
66 changes: 66 additions & 0 deletions
66
docs/blockchain/contracts/airgrab-contract/airgrab-actions/whitelistusr.md
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,66 @@ | ||
--- | ||
title: 'whitelistusr' | ||
order: 1 | ||
|
||
--- | ||
|
||
# whitelistusr | ||
|
||
## Summary | ||
|
||
This action will allow `manager` to whitelist user wallet and updating their points to be used for claiming rewards. | ||
|
||
## Action Parameters | ||
|
||
| Property Name | C++ Type | JavaScript Type | Description | | ||
| ------------- | ----------------------- | --------------- | ---------------------------------------------------------------------------------- | | ||
| `campaign` | eosio::name | String | The name of the campaign | | ||
| `wallets` | std::vector\<whitelist> | Object | The whitelist user wallets, can be ultra wallet (8 bytes) or eth wallet (20 bytes) | | ||
|
||
Required Permissions: `manager` | ||
|
||
## CLI - cleos | ||
|
||
```shell script | ||
cleos push action ultra.rgrab whitelistusr '["testcampaign", [{"90a7a60819855c34", 1}, {"448e3de41c8b52750c664f57fe023a730bcc0047", 2}]]' -p manager | ||
``` | ||
|
||
## Javascript - eosjs | ||
|
||
```typescript | ||
(async () => { | ||
const result = await api.transact( | ||
{ | ||
actions: [ | ||
{ | ||
account: 'ultra.rgrab', | ||
name: 'whitelistusr', | ||
authorization: [ | ||
{ | ||
actor: 'manager', | ||
permission: 'active', | ||
}, | ||
], | ||
data: { | ||
campaign: 'testcampaign', | ||
wallets: [ | ||
{ | ||
wallet_id: '90a7a60819855c34', | ||
points: 1 | ||
}, | ||
{ | ||
wallet_id: '448e3de41c8b52750c664f57fe023a730bcc0047', | ||
points: 2 | ||
} | ||
] | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
blocksBehind: 3, | ||
expireSeconds: 30, | ||
} | ||
); | ||
})(); | ||
``` |
Oops, something went wrong.