@celo/contractkit › "wrappers/LockedGold" › LockedGoldWrapper
Class: LockedGoldWrapper
Contract for handling deposits needed for voting.
Hierarchy
- BaseWrapper‹LockedGold›
↳ LockedGoldWrapper
Index
Constructors
Properties
- _relock
- eventTypes
- events
- getAccountNonvotingLockedGold
- getAccountTotalLockedGold
- getTotalLockedGold
- lock
- methodIds
- unlock
- withdraw
Accessors
Methods
- computeInitialParametersForSlashing
- computeParametersForSlashing
- getAccountSummary
- getAccountsSlashed
- getConfig
- getHumanReadableConfig
- getPastEvents
- getPendingWithdrawals
- getPendingWithdrawalsTotalValue
- relock
- version
Constructors
constructor
+ new LockedGoldWrapper(kit
: ContractKit, contract
: LockedGold): LockedGoldWrapper
Inherited from BaseWrapper.constructor
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:30
Parameters:
Name | Type |
---|---|
kit |
ContractKit |
contract |
LockedGold |
Returns: LockedGoldWrapper
Properties
_relock
• _relock: function = proxySend( this.kit, this.contract.methods.relock, tupleParser(valueToString, valueToString) )
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:144
Relocks gold that has been unlocked but not withdrawn.
param
The index of the pending withdrawal to relock from.
param
The value to relock from the specified pending withdrawal.
Type declaration:
▸ (index
: number, value
: BigNumber.Value): CeloTransactionObject‹void›
Parameters:
Name | Type |
---|---|
index |
number |
value |
BigNumber.Value |
eventTypes
• eventTypes: EventsEnum‹T› = Object.keys(this.events).reduce
Inherited from BaseWrapper.eventTypes
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61
events
• events: LockedGold["events"] = this.contract.events
Inherited from BaseWrapper.events
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:59
getAccountNonvotingLockedGold
• getAccountNonvotingLockedGold: function = proxyCall( this.contract.methods.getAccountNonvotingLockedGold, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:177
Returns the total amount of non-voting locked gold for an account.
param
The account.
returns
The total amount of non-voting locked gold for an account.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getAccountTotalLockedGold
• getAccountTotalLockedGold: function = proxyCall( this.contract.methods.getAccountTotalLockedGold, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:155
Returns the total amount of locked gold for an account.
param
The account.
returns
The total amount of locked gold for an account.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getTotalLockedGold
• getTotalLockedGold: function = proxyCall( this.contract.methods.getTotalLockedGold, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:166
Returns the total amount of locked gold in the system. Note that this does not include gold that has been unlocked but not yet withdrawn.
returns
The total amount of locked gold in the system.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
lock
• lock: function = proxySend(this.kit, this.contract.methods.lock)
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:80
Locks gold to be used for voting.
The gold to be locked, must be specified as the tx.value
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
methodIds
• methodIds: Record‹keyof T["methods"], string› = Object.keys(this.contract.methods).reduce
acc[method] =
methodABI === undefined
? '0x'
: this.kit.connection.getAbiCoder().encodeFunctionSignature(methodABI)
return acc
},
{} as any
)
Inherited from BaseWrapper.methodIds
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:66
unlock
• unlock: function = proxySend( this.kit, this.contract.methods.unlock, tupleParser(valueToString) )
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:86
Unlocks gold that becomes withdrawable after the unlocking period.
param
The amount of gold to unlock.
Type declaration:
▸ (value
: BigNumber.Value): CeloTransactionObject‹void›
Parameters:
Name | Type |
---|---|
value |
BigNumber.Value |
withdraw
• withdraw: function = proxySend( this.kit, this.contract.methods.withdraw )
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:71
Withdraws a gold that has been unlocked after the unlocking period has passed.
param
The index of the pending withdrawal to withdraw.
Type declaration:
▸ (index
: number): CeloTransactionObject‹void›
Parameters:
Name | Type |
---|---|
index |
number |
Accessors
address
• get address(): string
Inherited from BaseWrapper.address
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:35
Contract address
Returns: string
Methods
computeInitialParametersForSlashing
▸ computeInitialParametersForSlashing(account
: string, penalty
: BigNumber): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:264
Computes parameters for slashing penalty
from account
.
Parameters:
Name | Type | Description |
---|---|---|
account |
string | The account to slash. |
penalty |
BigNumber | The amount to slash as penalty. |
Returns: Promise‹object›
List of (group, voting gold) to decrement from account
.
computeParametersForSlashing
▸ computeParametersForSlashing(account
: string, penalty
: BigNumber, groups
: AddressListItem[]): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:271
Parameters:
Name | Type |
---|---|
account |
string |
penalty |
BigNumber |
groups |
AddressListItem[] |
Returns: Promise‹object›
getAccountSummary
▸ getAccountSummary(account
: string): Promise‹AccountSummary›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:205
Parameters:
Name | Type |
---|---|
account |
string |
Returns: Promise‹AccountSummary›
getAccountsSlashed
▸ getAccountsSlashed(epochNumber
: number): Promise‹AccountSlashed[]›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:242
Retrieves AccountSlashed for epochNumber.
Parameters:
Name | Type | Description |
---|---|---|
epochNumber |
number | The epoch to retrieve AccountSlashed at. |
Returns: Promise‹AccountSlashed[]›
getConfig
▸ getConfig(): Promise‹LockedGoldConfig›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:186
Returns current configuration parameters.
Returns: Promise‹LockedGoldConfig›
getHumanReadableConfig
▸ getHumanReadableConfig(): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:197
dev
Returns human readable configuration of the lockedgold contract
Returns: Promise‹object›
LockedGoldConfig object
getPastEvents
▸ getPastEvents(event
: Events‹LockedGold›, options
: PastEventOptions): Promise‹EventLog[]›
Inherited from BaseWrapper.getPastEvents
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:55
Contract getPastEvents
Parameters:
Name | Type |
---|---|
event |
Events‹LockedGold› |
options |
PastEventOptions |
Returns: Promise‹EventLog[]›
getPendingWithdrawals
▸ getPendingWithdrawals(account
: string): Promise‹PendingWithdrawal[]›
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:226
Returns the pending withdrawals from unlocked gold for an account.
Parameters:
Name | Type | Description |
---|---|---|
account |
string | The address of the account. |
Returns: Promise‹PendingWithdrawal[]›
The value and timestamp for each pending withdrawal.
getPendingWithdrawalsTotalValue
▸ getPendingWithdrawalsTotalValue(account
: Address): Promise‹BigNumber‹››
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:92
Parameters:
Name | Type |
---|---|
account |
Address |
Returns: Promise‹BigNumber‹››
relock
▸ relock(account
: Address, value
: BigNumber.Value): Promise‹Array‹CeloTransactionObject‹void›››
Defined in packages/sdk/contractkit/src/wrappers/LockedGold.ts:104
Relocks gold that has been unlocked but not withdrawn.
Parameters:
Name | Type | Description |
---|---|---|
account |
Address | - |
value |
BigNumber.Value | The value to relock from pending withdrawals. |
Returns: Promise‹Array‹CeloTransactionObject‹void›››
version
▸ version(): Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››
Inherited from BaseWrapper.version
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:39
Returns: Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››