Description:
Multi-signature wallet contract requiring multiple confirmations for transaction execution.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/l1/UnstakeRelayer.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {Implementation} from "../Implementation.sol";
import {IToken} from "../interfaces/IToken.sol";
interface IST {
/// @dev Top-ups unstake balance from retired models via Depository: increase reserve balance and decrease staked one.
/// @param amount OLAS amount.
function topUpRetiredBalance(uint256 amount) external;
}
/// @dev Zero value.
error ZeroValue();
/// @dev The contract is already initialized.
error AlreadyInitialized();
/// @dev Unauthorized account.
/// @param account Account address.
error UnauthorizedAccount(address account);
/// @dev Caught reentrancy violation.
error ReentrancyGuard();
/// @title UnstakeRelayer - Smart contract for relaying funds obtained via bridging when unstaked from retired models.
contract UnstakeRelayer is Implementation {
event UnstakeRelayed(address indexed account, address indexed st, uint256 olasAmount);
// Depository version
string public constant VERSION = "0.1.0";
// OLAS contract address
address public immutable olas;
// stOLAS contract address
address public immutable st;
// Reentrancy lock
bool transient _locked;
/// @dev UnstakeRelayer constructor.
/// @param _olas OLAS address.
/// @param _st stOLAS address.
constructor(address _olas, address _st) {
olas = _olas;
st = _st;
}
/// @dev UnstakeRelayer initializer.
function initialize() external {
// Check for already initialized
if (owner != address(0)) {
revert AlreadyInitialized();
}
owner = msg.sender;
}
/// @dev Relay OLAS to stOLAS for balances re-distribution.
function relay() external {
// Reentrancy guard
if (_locked) {
revert ReentrancyGuard();
}
_locked = true;
// Get OLAS balance
uint256 olasAmount = IToken(olas).balanceOf(address(this));
if (olasAmount > 0) {
// Approve OLAS for stOLAS
IToken(olas).approve(st, olasAmount);
// Top-up stOLAS with the approved amount
IST(st).topUpRetiredBalance(olasAmount);
emit UnstakeRelayed(msg.sender, st, olasAmount);
}
}
}
"
},
"contracts/Implementation.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/// @dev Only `owner` has a privilege, but the `sender` was provided.
/// @param sender Sender address.
/// @param owner Required sender address as an owner.
error OwnerOnly(address sender, address owner);
/// @dev Zero address.
error ZeroAddress();
/// @title Implementation - Smart contract for default minimal implementation
contract Implementation {
event OwnerUpdated(address indexed owner);
event ImplementationUpdated(address indexed implementation);
// Code position in storage is bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"
bytes32 public constant PROXY_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
// Contract owner address
address public owner;
/// @dev Changes contract owner address.
/// @param newOwner Address of a new owner.
function changeOwner(address newOwner) external {
// Check for ownership
if (msg.sender != owner) {
revert OwnerOnly(msg.sender, owner);
}
// Check for zero address
if (newOwner == address(0)) {
revert ZeroAddress();
}
owner = newOwner;
emit OwnerUpdated(newOwner);
}
/// @dev Changes depository implementation contract address.
/// @param newImplementation New implementation contract address.
function changeImplementation(address newImplementation) external {
// Check for ownership
if (msg.sender != owner) {
revert OwnerOnly(msg.sender, owner);
}
// Check for zero address
if (newImplementation == address(0)) {
revert ZeroAddress();
}
// Store depository implementation address
assembly {
sstore(PROXY_SLOT, newImplementation)
}
emit ImplementationUpdated(newImplementation);
}
}
"
},
"contracts/interfaces/IToken.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
// ERC20 token interface
interface IToken {
/// @dev Transfers the token amount.
/// @param to Address to transfer to.
/// @param amount The amount to transfer.
/// @return True if the function execution is successful.
function transfer(address to, uint256 amount) external returns (bool);
/// @dev Transfers the token amount that was previously approved up until the maximum allowance.
/// @param from Account address to transfer from.
/// @param to Account address to transfer to.
/// @param amount Amount to transfer to.
/// @return True if the function execution is successful.
function transferFrom(address from, address to, uint256 amount) external returns (bool);
/// @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
/// @param spender Account address that will be able to transfer tokens on behalf of the caller.
/// @param amount Token amount.
/// @return True if the function execution is successful.
function approve(address spender, uint256 amount) external returns (bool);
/// @dev Mints tokens.
/// @param account Account address.
/// @param amount Token amount.
function mint(address account, uint256 amount) external;
/// @dev Burns tokens.
/// @param amount Token amount.
function burn(uint256 amount) external;
/// @dev Gets the amount of tokens owned by a specified account.
/// @param account Account address.
/// @return Amount of tokens owned.
function balanceOf(address account) external view returns (uint256);
}
// ERC721 token interface
interface INFToken {
/// @dev Sets token `id` as the allowance of `spender` over the caller's tokens.
/// @param spender Account address that will be able to transfer the token on behalf of the caller.
/// @param id Token id.
function approve(address spender, uint256 id) external;
/// @dev Transfers a specified token Id.
/// @param from Account address to transfer from.
/// @param to Account address to transfer to.
/// @param id Token id.
function transferFrom(address from, address to, uint256 id) external;
/// @dev Transfers a specified token Id with a callback.
/// @param from Account address to transfer from.
/// @param to Account address to transfer to.
/// @param id Token id.
function safeTransferFrom(address from, address to, uint256 id) external;
}
"
}
},
"settings": {
"remappings": [
"@gnosis.pm/=node_modules/@gnosis.pm/",
"@layerzerolabs/oapp-evm/=lib/devtools/packages/oapp-evm/",
"@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@registries/=lib/autonolas-registries/",
"@solmate/=lib/solmate/",
"autonolas-registries/=lib/autonolas-registries/",
"devtools/=lib/devtools/packages/toolbox-foundry/src/",
"ds-test/=lib/autonolas-registries/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/autonolas-registries/lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"layerzero-v2/=lib/layerzero-v2/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solmate/=lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": true
}
}}
Submitted on: 2025-10-24 09:53:46
Comments
Log in to comment.
No comments yet.