Skip to content

Commit

Permalink
Remove calls to set vesting start and end
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed Nov 16, 2020
1 parent d263542 commit e58764a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/sdk",
"version": "0.3.7",
"version": "0.3.8",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
71 changes: 47 additions & 24 deletions src/modules/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,19 @@ class TokenMigration {
return this.asSudoIfNeeded(txn, asSudo);
}

setVestingStart(start, asSudo = false) {
const txn = this.module.setVestingStart(start);
return this.asSudoIfNeeded(txn, asSudo);
}

setVestingEnd(end, asSudo = false) {
const txn = this.module.setVestingEnd(end);
return this.asSudoIfNeeded(txn, asSudo);
}

// Accepts recipients as an BtreeMap of address -> amount
/**
* Accepts recipients as an BTreeMap of address -> amount
* @param {*} recipients
*/
migrate(recipients) {
return this.api.tx.migrationModule.migrate(recipients);
}

// Accepts recipients as an array of pairs, each pair is (address, amount). Amount can either be a safe JS integer
// or a string which will be expected in decimal format. If an address is repeated, its intended amounts are added.
/**
* Accepts recipients as an array of pairs, each pair is (address, amount). Amount can either be a safe JS integer
* or a string which will be expected in decimal format. If an address is repeated, its intended amounts are added.
* @param {*} recipients
*/
migrateRecipAsList(recipients) {
// @ts-ignore
const recipMap = new BTreeMap();
Expand All @@ -66,53 +62,80 @@ class TokenMigration {
return this.api.tx.migrationModule.migrate(recipMap);
}

// swapBonuses should be an array of arrays with each inner array of size 3 where first item is recipient account, 2nd item is bonus amount and 3rd item is offset (u32)
// vestingBonuses should be an array of arrays with each inner array of size 3 where first item is recipient account, 2nd item is bonus amount and 3rd item is offset (u32)
/**
* swapBonuses should be an array of arrays with each inner array of size 3 where first item is recipient account, 2nd item is bonus amount and 3rd item is offset (u32)
* vestingBonuses should be an array of arrays with each inner array of size 3 where first item is recipient account, 2nd item is bonus amount and 3rd item is offset (u32)
* @param {*} swapBonuses
* @param {*} vestingBonuses
*/
giveBonuses(swapBonuses, vestingBonuses) {
return this.api.tx.migrationModule.giveBonuses(swapBonuses, vestingBonuses);
}

// Claim bonus for itself
/**
* Claim bonus for itself
*/
claimBonus() {
return this.api.tx.migrationModule.claimBonus();
}

// Claim bonus for other account
/**
* Claim bonus for other account
* @param {*} other
*/
claimBonusForOther(other) {
return this.api.tx.migrationModule.claimBonusForOther(other);
}

// Claim swap bonus for itself
/**
* Claim swap bonus for itself
*/
claimSwapBonus() {
return this.api.tx.migrationModule.claimSwapBonus();
}

// Claim swap bonus for other account
/**
* Claim swap bonus for other account
* @param {*} other
*/
claimSwapBonusForOther(other) {
return this.api.tx.migrationModule.claimSwapBonusForOther(other);
}

// Claim vesting bonus for itself
/**
* Claim vesting bonus for itself
*/
claimVestingBonus() {
return this.api.tx.migrationModule.claimVestingBonus();
}

// Claim vesting bonus for other account
/**
* Claim vesting bonus for other account
* @param {*} other
*/
claimVestingBonusForOther(other) {
return this.api.tx.migrationModule.claimVestingBonusForOther(other);
}

// Get details of all migrators
/**
* Get details of all migrators
*/
async getMigrators() {
return this.api.query.migrationModule.migrators.entries();
}

// Get detail of a given migrator
/**
* Get detail of a given migrator
* @param {*} address
*/
async getMigrator(address) {
return this.api.query.migrationModule.migrators(address);
}

// Get bonus of given account
/**
* Get bonus of given account
* @param {*} address
*/
async getBonus(address) {
return this.api.query.migrationModule.bonuses(address);
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"Bonus": {
"total_locked_bonus": "Balance",
"swap_bonuses": "Vec<(Balance, BlockNumber)>",
"vesting_bonuses": "Vec<(Balance, Balance, u32)>"
"vesting_bonuses": "Vec<(Balance, Balance, BlockNumber)>"
},
"Payload": {
"proposal": "Vec<u8>",
Expand Down

0 comments on commit e58764a

Please sign in to comment.