- (LoanTokenLogicProxy.sol)
View Source: contracts/connectors/loantoken/LoanTokenLogicProxy.sol
↗ Extends: AdvancedTokenStorage
This contract contains the proxy functionality and it will query the logic target from LoanTokenLogicBeacon This contract will also has the pause/unpause functionality. The purpose of this pausability is so that we can pause/unpause from the loan token level.
Constants & Variables
//public members
address public sovrynContractAddress;
address public wrbtcTokenAddress;
address public target_;
address public admin;
//internal members
bytes32 internal constant LOAN_TOKEN_LOGIC_BEACON_ADDRESS_SLOT;
modifier onlyAdmin() internal
- constructor()
- _beaconAddress()
- beaconAddress()
- _setBeaconAddress(address _newBeaconAddress)
- setBeaconAddress(address _newBeaconAddress)
- getTarget(bytes4 functionSignature)
Fallback function performs a logic implementation address query to LoanTokenLogicBeacon and then do delegate call to that query result address. Returns whatever the implementation call returns.
function () external payable
Source Code
function() external payable {
// query the logic target implementation address from the LoanTokenLogicBeacon
address target = ILoanTokenLogicBeacon(_beaconAddress()).getTarget(msg.sig);
require(target != address(0), "LoanTokenLogicProxy:target not active");
bytes memory data = msg.data;
assembly {
let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result
case 0 {
revert(ptr, size)
}
default {
return(ptr, size)
}
}
}
Returns the current Loan Token logic Beacon.
function _beaconAddress() internal view
returns(beaconAddress address)
Source Code
function _beaconAddress() internal view returns (address beaconAddress) {
bytes32 slot = LOAN_TOKEN_LOGIC_BEACON_ADDRESS_SLOT;
assembly {
beaconAddress := sload(slot)
}
}
function beaconAddress() external view
returns(address)
Source Code
function beaconAddress() external view returns (address) {
return _beaconAddress();
}
Set/update the new beacon address.
function _setBeaconAddress(address _newBeaconAddress) private nonpayable
Arguments
Name | Type | Description |
---|---|---|
_newBeaconAddress | address | Address of the new LoanTokenLogicBeacon. |
Source Code
function _setBeaconAddress(address _newBeaconAddress) private {
require(
Address.isContract(_newBeaconAddress),
"Cannot set beacon address to a non-contract address"
);
bytes32 slot = LOAN_TOKEN_LOGIC_BEACON_ADDRESS_SLOT;
assembly {
sstore(slot, _newBeaconAddress)
}
}
External function to set the new LoanTokenLogicBeacon Address
function setBeaconAddress(address _newBeaconAddress) external nonpayable onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_newBeaconAddress | address | Address of the new LoanTokenLogicBeacon |
Source Code
function setBeaconAddress(address _newBeaconAddress) external onlyAdmin {
_setBeaconAddress(_newBeaconAddress);
}
function getTarget(bytes4 functionSignature) external view
returns(logicTargetAddress address)
Arguments
Name | Type | Description |
---|---|---|
functionSignature | bytes4 |
Source Code
function getTarget(bytes4 functionSignature)
external
view
returns (address logicTargetAddress);
- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC