# new TimeLockProtocolMiningReward(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
TimeLockProtocolMiningReward~Options
|
NOTE: to encode function signature we use 'web3.eth.abi.encodeFunctionSignature' For example, for encoding transfer function of ERC20 token we do: web3.eth.abi.encodeFunctionSignature('transfer(address,uint256)') NOTE: to encode parameters for encoded call data we use web3.eth.abi.encodeParameters(typesArray, valuesArray) For example, for encoding transfer function parameters of ERC20 token we do: web3.eth.abi.encodeParameters(['address','uint256'], [userAddress, transferTokenAmount]) userAddress, transferTokenAmount are variables holding user address and tokens amount. NOTE: to encode function signature together with parameters as a single encoded call data we use a combination of the two above. Specific details on how to encode call data can be found in the unit test file. |
Members
# __assert
Use a timeLockProtocolMiningReward contract with the current address
Methods
# async callsRewardTokenAmount(params) → {Promise.<Integer>}
Get encoded call reward token amount
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Encoded call hash id as bytes32 string |
Reward token amount
Promise.<Integer>
# async cancel(params, options) → {Promise.<Transaction>}
Cancel an operation
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Call hash |
options |
IContract~TxOptions
|
Transaction Requirements:
- the caller must have the 'proposer' role.
Promise.<Transaction>
# deploy(params, options) → {Promise.<Transaction>}
Deploy contract
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
minDelay |
Integer
|
Minimum delay in seconds to schedule call |
proposers |
Array.<Address>
|
Array of proposers addresses |
executors |
Array.<Address>
|
Array of executors addresses |
rewardTokenAddress |
Address
|
Reward token address |
rewardTokenAmount |
Number
|
Reward token amount |
options |
IContract~TxOptions
|
Transaction
Promise.<Transaction>
# async execute(params, options) → {Promise.<Transaction>}
Execute an (ready) operation containing a single transaction.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
target |
Address
|
Target contract address |
value |
Integer
|
Eth value sent with the call |
data |
string
|
Encoded call data |
predecessor |
string
|
Required call id to be finished before executing current call |
salt |
string
|
Salt id |
options |
IContract~TxOptions
|
Transaction Requirements:
- the caller must have the 'executor' role.
Promise.<Transaction>
# async executeBatch(params, options) → {Promise.<Transaction>}
Execute an (ready) operation containing a batch of transactions.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
targets |
Array.<Address>
|
Target contracts addresses |
values |
Array.<Integer>
|
Eth values sent with the batch |
datas |
Array.<string>
|
Encoded call datas |
predecessor |
string
|
Required call id to be finished before executing current call |
salt |
string
|
Salt id |
options |
IContract~TxOptions
|
Transaction Requirements:
- the caller must have the 'executor' role.
Promise.<Transaction>
# async getMinDelay() → {Promise.<Integer>}
Returns the minimum delay for an operation to become valid.
This value can be changed by executing an operation that calls updateDelay
.
Promise.<Integer>
# async getTimestamp(params) → {Promise.<Integer>}
Returns the timestamp at with an operation becomes ready (0 for unset operations, 1 for done operations).
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Call hash as id |
Promise.<Integer>
# async hashOperation(params) → {Promise.<string>}
Returns the identifier of an operation containing a single transaction.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
target |
Address
|
Target contract address |
value |
Integer
|
Eth value sent with the call |
data |
string
|
Encoded call data |
predecessor |
string
|
Required call id to be finished before executing current call |
salt |
string
|
Salt id |
bytes32 hash
Promise.<string>
# async hashOperationBatch(params) → {Promise.<string>}
Returns the identifier of an operation containing a batch of transactions.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
targets |
Array.<Address>
|
Target contracts addresses |
values |
Array.<Integer>
|
Eth values sent with the batch |
datas |
Array.<string>
|
Encoded call datas |
predecessor |
string
|
Required call id to be finished before executing current call |
salt |
string
|
Salt id |
bytes32 hash
Promise.<string>
# async isOperation(params) → {Promise.<Boolean>}
Returns whether an id correspond to a registered operation. This includes both Pending, Ready and Done operations.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Call hash as id |
Promise.<Boolean>
# async isOperationDone(params) → {Promise.<Boolean>}
Returns whether an operation is done or not.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Call hash as id |
Promise.<Boolean>
# async isOperationPending(params) → {Promise.<Boolean>}
Returns whether an operation is pending or not.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Call hash as id |
Promise.<Boolean>
# async isOperationReady(params) → {Promise.<Boolean>}
Returns whether an operation is ready or not.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
id |
string
|
Call hash as id |
Promise.<Boolean>
# async rewardAmount() → {Promise.<Integer>}
Get reward token default reward amount
Default reward token amount
Promise.<Integer>
# async rewardToken() → {Promise.<Address>}
Get reward token address
Reward token address
Promise.<Address>
# async schedule(params, options) → {Promise.<Transaction>}
Schedule function call
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
target |
Address
|
Target contract address |
value |
Integer
|
Eth value sent with the call |
data |
string
|
Encoded call data |
predecessor |
string
|
Predecessor call hash required to have finished first |
salt |
string
|
Salt id to identify each call |
delay |
Integer
|
Delay in seconds before call execution |
rewardTokenAmount |
Integer
|
Reward token amount for sender for executing the call |
options |
IContract~TxOptions
|
Transaction
Promise.<Transaction>
# async scheduleBatch(params, options) → {Promise.<Transaction>}
Schedule an operation containing a batch of transactions.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
targets |
Array.<Address>
|
Target contracts addresses |
values |
Array.<Integer>
|
Eth values sent with the batch |
datas |
Array.<string>
|
Encoded call datas |
predecessor |
string
|
Required call id to be finished before executing current call |
salt |
string
|
Salt id |
delay |
Integer
|
Delay in seconds before call execution |
rewardTokenAmount |
Integer
|
Reward token amount |
options |
IContract~TxOptions
|
Transaction Requirements:
- the caller must have the 'proposer' role.
Promise.<Transaction>
# async updateDelay(params, options) → {Promise.<Transaction>}
Changes the minimum timelock duration for future operations.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
Parameters |
newDelay |
Integer
|
New delay in seconds |
options |
IContract~TxOptions
|
Transaction Requirements:
- the caller must be the timelock itself. This can only be achieved by scheduling and later executing an operation where the timelock is the target and the data is the ABI-encoded call to this function.
Promise.<Transaction>
Type Definitions
Object
# Options
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
test |
Boolean
|
|||
localtest |
Boolean
|
ganache local blockchain |
||
web3Connection |
Web3Connection
|
<optional> |
Web3Connection | created from params: 'test', 'localtest' and optional 'web3Connection' string and 'privateKey' |
contractAddress |
string
|
<optional> |