update userOriginalStake on buy sellStake
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -96,7 +96,7 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
|
||||
// Epoch-based staking variables
|
||||
mapping(uint256 => Epoch) public epochs;
|
||||
mapping(address => uint256) public userBigStake; // User's main stake amount
|
||||
mapping(address => uint256) public userOriginalStake; // User's original stake amount (never changes)
|
||||
mapping(address => uint256) public userOriginalStake; // User's cumulative original stake (first stake + marketplace purchases)
|
||||
mapping(address => uint256) public userLastClaimedEpoch; // Last epoch user claimed from
|
||||
mapping(address => WithdrawStake[]) public withdrawStakes; // User's withdrawable stakes
|
||||
uint256 public currentEpochId;
|
||||
@@ -757,6 +757,10 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
|
||||
userBigStake[seller] -= value;
|
||||
userBigStake[msg.sender] += buyerStake;
|
||||
pendingSellStakes[seller] -= value;
|
||||
|
||||
// Increment buyer's original stake tracking (marketplace purchases count as original stake)
|
||||
userOriginalStake[msg.sender] += buyerStake;
|
||||
|
||||
// Note: totalBigStakes decreases by protocolShare
|
||||
totalBigStakes -= protocolShare;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require("@nomicfoundation/hardhat-ethers");
|
||||
require("@nomicfoundation/hardhat-chai-matchers");
|
||||
require("@openzeppelin/hardhat-upgrades");
|
||||
require("@nomiclabs/hardhat-etherscan");
|
||||
require("@nomicfoundation/hardhat-verify");
|
||||
require("dotenv").config();
|
||||
|
||||
const env = process.env;
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
settings: {
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
runs: 200,
|
||||
runs: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -33,8 +33,20 @@ module.exports = {
|
||||
url: "http://127.0.0.1:8545",
|
||||
},
|
||||
bscTestnet: {
|
||||
url: "https://virtual.binance.eu.rpc.tenderly.co/863b23c4-3a3a-4cdf-8620-41a2fd0be25b",
|
||||
chainId: 56,
|
||||
url: "https://virtual.binance.eu.rpc.tenderly.co/77a9a30c-44ca-45e0-ae2a-9b5ddb41d20e",
|
||||
chainId: 1337,
|
||||
accounts: env.PRIVATE_KEY ? [env.PRIVATE_KEY] : [],
|
||||
},
|
||||
anvil: {
|
||||
url: "https://rpc.tacopancake.com",
|
||||
chainId: 1337,
|
||||
accounts: [
|
||||
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", // Default Anvil account 0
|
||||
],
|
||||
},
|
||||
buildbear: {
|
||||
url: "https://rpc.buildbear.io/stale-bucky-0f42044d",
|
||||
chainId: 31337,
|
||||
accounts: env.PRIVATE_KEY ? [env.PRIVATE_KEY] : [],
|
||||
},
|
||||
},
|
||||
@@ -42,6 +54,21 @@ module.exports = {
|
||||
apiKey: {
|
||||
bsc: env.BSCSCAN_API_KEY || "",
|
||||
bscTestnet: env.BSCSCAN_API_KEY || "",
|
||||
buildbear: "abc", // API key not needed for BuildBear
|
||||
},
|
||||
customChains: [
|
||||
{
|
||||
network: "buildbear",
|
||||
chainId: 31337,
|
||||
urls: {
|
||||
apiURL: "https://rpc.buildbear.io/verify/etherscan/stale-bucky-0f42044d",
|
||||
browserURL: "https://explorer.buildbear.io/stale-bucky-0f42044d"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
sourcify: {
|
||||
enabled: true,
|
||||
apiUrl: "https://rpc.buildbear.io/verify/sourcify/server/stale-bucky-0f42044d"
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user