Skip to content
Verified contractPartial

MarginProxy

Address0xb74bf8fe9fc050d48f298c04bb87463d2d82891e
Balance

0 ETH

 

Transactions

15

 

Compiler

solc 0.5.10

 

Same code

29 more contracts

 

Details

Compiler
solc 0.5.10+commit.5a6ea5b1
Language
solidity
Optimization
No
EVM version
petersburg
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
8,621,078
Creation transaction
0xaa6876920c…c074744298

MarginProxy.sol

pragma solidity ^0.5.7;
contract MarginProxy {
  uint256 _code;
  uint256 _owner;
  uint256 _parent_address;
  uint256 _run_state;
  
  constructor(address owner, address parent_address) public  {
    assembly {
      sstore(_owner_slot, owner)
      sstore(_parent_address_slot, parent_address)
      sstore(_run_state_slot, 1)
    }
  }
  
  function () external payable  {
    assembly {
      calldatacopy(0, 0, calldatasize)
      let res := delegatecall(gas, sload(_code_slot), 0, calldatasize, 0, 0)
      returndatacopy(0, 0, returndatasize)
      switch res
        case 0 {
          revert(0, returndatasize)
        }
        default {
          return(0, returndatasize)
        }
    }
  }
  
  function setCode(address code_address) external  {
    assembly {
      if xor(caller, sload(_parent_address_slot)) {
        mstore(32, 1)
        revert(63, 1)
      }
      sstore(_code_slot, code_address)
    }
  }
  
  function getCode() public view 
  returns (address code_address) {
    assembly {
      code_address := sload(_code_slot)
    }
  }
  
  function getOwner() public view 
  returns (address owner_address) {
    assembly {
      owner_address := sload(_owner_slot)
    }
  }
  
  function getParent() public view 
  returns (address parent_address) {
    assembly {
      parent_address := sload(_parent_address_slot)
    }
  }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "petersburg",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.