Reputation: 139
So basically I'm not quite sure how I can get my parameters from my solidity code and pass them in the deploy function of the deployer for my 2nd migration with Truffle.
This is the constructor of my Solidity code:
constructor(
IBEP20 _stakeToken,
IBEP20 _rewardToken,
uint256 _rewardPerSecond,
uint256 _startTimestamp,
uint256 _bonusEndTimestamp
) public {
stakeToken = _stakeToken;
rewardToken = _rewardToken;
rewardPerSecond = _rewardPerSecond;
startTimestamp = _startTimestamp;
bonusEndTimestamp = _bonusEndTimestamp;
// staking pool
poolInfo.push(PoolInfo({
lpToken: _stakeToken,
allocPoint: 1000,
lastRewardTimestamp: startTimestamp,
accRewardTokenPerShare: 0
}));
totalAllocPoint = 1000;
}
Then this is my javascript migration code:
const tokenstaking = artifacts.require("TokenStaking");
module.exports = function(deployer) {
deployer.deploy(tokenstaking, stakeToken, rewardToken, rewardPerSecond, startTimestamp,
bonusEndTimestamp);};
Each time I receive the same error for all parameters:
ReferenceError: stakeToken is not defined
How can I reference my parameters? help
Upvotes: 2
Views: 1235
Reputation: 49182
for parameters you have to pass values. You defined constructor before with parameters. stakeToken, rewardToken, rewardPerSecond, startTimestamp, bonusEndTimestamp
. Now you are initalizing the contract, so you have to pass arguments meaning that inital values.
So you have to get values of stakeToken, rewardToken, rewardPerSecond, startTimestamp, bonusEndTimestamp
and pass it
deployer.deploy(tokenstaking,
"getStakeToken", // stakeToken
"getRewardToken", //rewardToken,
"1", // 1 reward per second
"92389424982",//startTimestamp
"99239323232"//bonusEndTimestamp
Upvotes: 1