Latest 25 from a total of 129 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 30720709 | 773 days ago | IN | 0 BTT | 25.242 | ||||
| Withdraw | 27529963 | 849 days ago | IN | 0 BTT | 42.07 | ||||
| Withdraw | 22504956 | 969 days ago | IN | 0 BTT | 42.076 | ||||
| Withdraw | 22224112 | 976 days ago | IN | 0 BTT | 62.609 | ||||
| Withdraw | 21803698 | 986 days ago | IN | 0 BTT | 60.89084374 | ||||
| Withdraw | 21199578 | 1000 days ago | IN | 0 BTT | 42.07 | ||||
| Withdraw | 21132871 | 1002 days ago | IN | 0 BTT | 37.5618 | ||||
| Withdraw | 20539688 | 1016 days ago | IN | 0 BTT | 34.4974 | ||||
| Withdraw | 20251277 | 1023 days ago | IN | 0 BTT | 25.242 | ||||
| Withdraw | 20140581 | 1026 days ago | IN | 0 BTT | 33.438 | ||||
| Withdraw | 20068090 | 1027 days ago | IN | 0 BTT | 20.1048 | ||||
| Withdraw | 20045271 | 1028 days ago | IN | 0 BTT | 37.5654 | ||||
| Withdraw | 19980639 | 1030 days ago | IN | 0 BTT | 25.242 | ||||
| Withdraw | 19840248 | 1033 days ago | IN | 0 BTT | 25.242 | ||||
| Withdraw | 19835421 | 1033 days ago | IN | 0 BTT | 37.5654 | ||||
| Withdraw | 19725611 | 1036 days ago | IN | 0 BTT | 31.4694 | ||||
| Withdraw | 19725199 | 1036 days ago | IN | 0 BTT | 25.2456 | ||||
| Withdraw | 19704605 | 1036 days ago | IN | 0 BTT | 25.242 | ||||
| Withdraw | 19704344 | 1036 days ago | IN | 0 BTT | 20.1084 | ||||
| Withdraw | 19689004 | 1037 days ago | IN | 0 BTT | 26.343 | ||||
| Withdraw | 19683888 | 1037 days ago | IN | 0 BTT | 25.2456 | ||||
| Withdraw | 19679218 | 1037 days ago | IN | 0 BTT | 31.473 | ||||
| Withdraw | 19674665 | 1037 days ago | IN | 0 BTT | 25.2456 | ||||
| Withdraw | 19551770 | 1040 days ago | IN | 0 BTT | 32.313 | ||||
| Withdraw | 19492928 | 1041 days ago | IN | 0 BTT | 39.249 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 7885574 | 1318 days ago | Contract Creation | 0 BTT |
Cross-Chain Transactions
Loading...
Loading
Minimal Proxy Contract for 0x3f1a457fa17df4d276ef8231c2b5325ab54f799c
Contract Name:
SOYLocalFarm
Compiler Version
v0.8.7+commit.e28d00a7
Contract Source Code (Solidity)
/**
*Submitted for verification at bttcscan.com on 2022-06-16
*/
// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;
abstract contract IERC223 {
/**
* @dev Returns the balance of the `who` address.
*/
function balanceOf(address who) public virtual view returns (uint);
/**
* @dev Transfers `value` tokens from `msg.sender` to `to` address
* and returns `true` on success.
*/
function transfer(address to, uint value) public virtual returns (bool success);
}
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier
* available, which can be aplied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*/
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
abstract contract RewardsRecipient {
address public globalFarm;
function notifyRewardAmount(uint256 reward) external virtual;
modifier onlyGlobalFarm() {
require(msg.sender == globalFarm, "Caller is not global Farm contract");
_;
}
}
interface ISimplifiedGlobalFarm {
function mintFarmingReward(address _localFarm) external;
function getAllocationX1000(address _farm) external view returns (uint256);
function getRewardPerSecond() external view returns (uint256);
function rewardMintingAvailable(address _farm) external view returns (bool);
function farmExists(address _farmAddress) external view returns (bool);
function owner() external view returns (address);
}
contract SOYLocalFarm is ReentrancyGuard, RewardsRecipient
{
/* ========== EVENTS ========== */
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
/* ========== VARIABLES ========== */
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
}
// Info of each user that stakes LP tokens.
mapping (address => UserInfo) public userInfo;
uint256 public limitAmount; // Prevents accumulatedRewardPerShare from overflowing.
IERC223 public rewardsToken;
IERC223 public lpToken;
uint256 public lastRewardTimestamp; // Last block number that SOY distribution occurs.
uint256 public accumulatedRewardPerShare; // Accumulated SOY per share, times 1e18. See below.
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == msg.sender, "Not Owner");
_;
}
// Local Farm owner is an owner of Global Farm contract
function owner() public view returns(address) {
return ISimplifiedGlobalFarm(globalFarm).owner();
}
function initialize(
address _rewardsToken, // SOY token
address _lpToken // LP token that will be staked in this Local Farm
)
external
{
require(globalFarm == address(0), "Already initialized");
rewardsToken = IERC223(_rewardsToken);
lpToken = IERC223(_lpToken);
globalFarm = msg.sender; // GlobalFarm contract
limitAmount = 1e40;
}
bool active = false;
modifier onlyActive {
require(active, "The farm is not enabled by owner!");
_;
}
function setActive(bool _status) external onlyOwner
{
active = _status;
}
/* ========== ERC223 transaction handlers ====== */
// Analogue of deposit() function.
function tokenReceived(address _from, uint256 _amount, bytes memory _data) public nonReentrant onlyActive
{
require(msg.sender == address(lpToken), "Trying to deposit wrong token");
require(userInfo[_from].amount + _amount <= limitAmount, 'exceed the top');
update();
if (userInfo[_from].amount > 0) {
uint256 pending = userInfo[_from].amount * accumulatedRewardPerShare / 1e18 - userInfo[_from].rewardDebt;
if(pending > 0) {
rewardsToken.transfer(address(_from), pending);
}
}
if(_amount > 0) {
userInfo[_from].amount += _amount;
}
userInfo[_from].rewardDebt = userInfo[_from].amount * accumulatedRewardPerShare / 1e18;
emit Staked(_from, _amount);
}
function notifyRewardAmount(uint256 reward) external override
{
emit RewardAdded(reward);
}
function getRewardPerSecond() public view returns (uint256)
{
return ISimplifiedGlobalFarm(globalFarm).getRewardPerSecond();
}
function getAllocationX1000() public view returns (uint256)
{
return ISimplifiedGlobalFarm(globalFarm).getAllocationX1000(address(this));
}
/* ========== Farm Functions ====== */
// View function to see pending Reward on frontend.
function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 _accumulatedRewardPerShare = accumulatedRewardPerShare;
uint256 lpSupply = lpToken.balanceOf(address(this));
if (block.timestamp > lastRewardTimestamp && lpSupply != 0) {
uint256 multiplier = block.timestamp - lastRewardTimestamp;
uint256 _reward = multiplier * getRewardPerSecond() * getAllocationX1000() / 1000;
_accumulatedRewardPerShare = accumulatedRewardPerShare + (_reward * 1e18 / lpSupply);
}
return user.amount * _accumulatedRewardPerShare / 1e18 - user.rewardDebt;
}
// Update reward variables of this Local Farm to be up-to-date.
function update() public reward_request {
if (block.timestamp <= lastRewardTimestamp) {
return;
}
uint256 lpSupply = lpToken.balanceOf(address(this));
if (lpSupply == 0) {
lastRewardTimestamp = block.timestamp;
return;
}
uint256 multiplier = block.timestamp - lastRewardTimestamp;
// This silently calculates "assumed" reward!
// This function does not take contract's actual balance into account
// Global Farm and `reward_request` modifier are responsible for keeping this contract
// stocked with funds to pay actual rewards.
uint256 _reward = multiplier * getRewardPerSecond() * getAllocationX1000() / 1000;
accumulatedRewardPerShare = accumulatedRewardPerShare + (_reward * 1e18 / lpSupply);
lastRewardTimestamp = block.timestamp;
}
// Withdraw tokens from STAKING.
function withdraw(uint256 _amount) public nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "withdraw: not good");
update();
uint256 pending = user.amount * accumulatedRewardPerShare / 1e18 - user.rewardDebt;
if(pending > 0) {
rewardsToken.transfer(address(msg.sender), pending);
}
if(_amount > 0) {
user.amount = user.amount - _amount;
lpToken.transfer(address(msg.sender), _amount);
}
user.rewardDebt = user.amount * accumulatedRewardPerShare / 1e18;
emit Withdraw(msg.sender, _amount);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public nonReentrant {
UserInfo storage user = userInfo[msg.sender];
lpToken.transfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, user.amount);
user.amount = 0;
user.rewardDebt = 0;
}
// Special function that allows owner to withdraw remaining unclaimed tokens of inactive farms
function withdrawInactiveReward() public onlyOwner
{
require(!ISimplifiedGlobalFarm(globalFarm).farmExists(address(this)), "Farm must not be active");
rewardsToken.transfer(msg.sender, rewardsToken.balanceOf(address(this)));
}
/*
// Withdraw reward. EMERGENCY ONLY.
function emergencyRewardWithdraw(uint256 _amount) public onlyOwner {
require(_amount < rewardToken.balanceOf(address(this)), 'not enough token');
rewardsToken.transfer(address(msg.sender), _amount);
}
*/
modifier reward_request
{
if(ISimplifiedGlobalFarm(globalFarm).rewardMintingAvailable(address(this)))
{
ISimplifiedGlobalFarm(globalFarm).mintFarmingReward(address(this));
}
_;
}
function rescueERC20(address token, address to) external onlyOwner {
require(token != address(rewardsToken), "Reward token is not prone to ERC20 issues");
require(token != address(lpToken), "LP token is not prone to ERC20 issues");
uint256 value = IERC223(token).balanceOf(address(this));
IERC223(token).transfer(to, value);
}
}Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"accumulatedRewardPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllocationX1000","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalFarm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_lpToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastRewardTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lpToken","outputs":[{"internalType":"contract IERC223","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"contract IERC223","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"setActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"tokenReceived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawInactiveReward","outputs":[],"stateMutability":"nonpayable","type":"function"}]Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in BTT
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.