poanetwork / posdao-contracts

Smart contracts for POSDAO (Proof of Stake Decentralized Autonomous Organization consensus), a DPOS consensus implemented in Solidity and running within EVM with swappable BFT consensus
Other
105 stars 49 forks source link

call to non-existing function stake() of ERC677 ? #64

Closed d10r closed 2 years ago

d10r commented 3 years ago

Studying the contracts, I stumbled over this line: https://github.com/poanetwork/posdao-contracts/blob/master/contracts/base/StakingAuRaTokens.sol#L300

IERC677 has a stake function, but it seems to not be implemented in the deployed contract.

This call already existed long ago, see e.g. this commit. Is it (still) there for a purpose or just a forgotten leftover?

varasev commented 3 years ago

@d10r The deployed contract is a shortened version of the full token contract. We should have deployed the full contract but the deployment was made by a bridge developer beforehand.

So, the StakingAuRa contract in production has the stake function which is not used because the token contract doesn't contain the stake function. Instead of that, we use onTokenTransfer function in StakingAuRa which is called by transferAndCall in the stake token contract. So, in the current production contract, the transferAndCall is used instead of the stake to make a stake.