Skip to content

Commit

Permalink
refactor builtin interfaces to .vyi files
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Nov 23, 2023
1 parent b61176e commit 6c7f795
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@view
@external
def supportsInterface(interface_id: bytes4) -> bool:
pass
...
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
# Events
event Transfer:
_from: indexed(address)
_to: indexed(address)
_value: uint256
sender: indexed(address)
recipient: indexed(address)
value: uint256

event Approval:
_owner: indexed(address)
_spender: indexed(address)
_value: uint256
owner: indexed(address)
spender: indexed(address)
value: uint256

# Functions
@view
@external
def totalSupply() -> uint256:
pass
...

@view
@external
def balanceOf(_owner: address) -> uint256:
pass
...

@view
@external
def allowance(_owner: address, _spender: address) -> uint256:
pass
...

@external
def transfer(_to: address, _value: uint256) -> bool:
pass
...

@external
def transferFrom(_from: address, _to: address, _value: uint256) -> bool:
pass
...

@external
def approve(_spender: address, _value: uint256) -> bool:
pass
...
18 changes: 0 additions & 18 deletions vyper/builtins/interfaces/ERC20Detailed.vy

This file was deleted.

14 changes: 14 additions & 0 deletions vyper/builtins/interfaces/ERC20Detailed.vyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@view
@external
def name() -> String[...]:
...

@view
@external
def symbol() -> String[...]:
...

@view
@external
def decimals() -> uint8:
...
Original file line number Diff line number Diff line change
Expand Up @@ -16,75 +16,75 @@ event Withdraw:
@view
@external
def asset() -> address:
pass
...

@view
@external
def totalAssets() -> uint256:
pass
...

@view
@external
def convertToShares(assetAmount: uint256) -> uint256:
pass
...

@view
@external
def convertToAssets(shareAmount: uint256) -> uint256:
pass
...

@view
@external
def maxDeposit(owner: address) -> uint256:
pass
...

@view
@external
def previewDeposit(assets: uint256) -> uint256:
pass
...

@external
def deposit(assets: uint256, receiver: address=msg.sender) -> uint256:
pass
...

@view
@external
def maxMint(owner: address) -> uint256:
pass
...

@view
@external
def previewMint(shares: uint256) -> uint256:
pass
...

@external
def mint(shares: uint256, receiver: address=msg.sender) -> uint256:
pass
...

@view
@external
def maxWithdraw(owner: address) -> uint256:
pass
...

@view
@external
def previewWithdraw(assets: uint256) -> uint256:
pass
...

@external
def withdraw(assets: uint256, receiver: address=msg.sender, owner: address=msg.sender) -> uint256:
pass
...

@view
@external
def maxRedeem(owner: address) -> uint256:
pass
...

@view
@external
def previewRedeem(shares: uint256) -> uint256:
pass
...

@external
def redeem(shares: uint256, receiver: address=msg.sender, owner: address=msg.sender) -> uint256:
pass
...
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
# Events

event Transfer:
_from: indexed(address)
_to: indexed(address)
_tokenId: indexed(uint256)
sender: indexed(address)
recipient: indexed(address)
token_id: indexed(uint256)

event Approval:
_owner: indexed(address)
_approved: indexed(address)
_tokenId: indexed(uint256)
owner: indexed(address)
approved: indexed(address)
token_id: indexed(uint256)

event ApprovalForAll:
_owner: indexed(address)
_operator: indexed(address)
_approved: bool
owner: indexed(address)
operator: indexed(address)
approved: bool

# Functions

@view
@external
def supportsInterface(interface_id: bytes4) -> bool:
pass
...

@view
@external
def balanceOf(_owner: address) -> uint256:
pass
...

@view
@external
def ownerOf(_tokenId: uint256) -> address:
pass
...

@view
@external
def getApproved(_tokenId: uint256) -> address:
pass
...

@view
@external
def isApprovedForAll(_owner: address, _operator: address) -> bool:
pass
...

@external
@payable
def transferFrom(_from: address, _to: address, _tokenId: uint256):
pass
...

@external
@payable
def safeTransferFrom(_from: address, _to: address, _tokenId: uint256):
pass
...

@external
@payable
def safeTransferFrom(_from: address, _to: address, _tokenId: uint256, _data: Bytes[1024]):
pass
def safeTransferFrom(_from: address, _to: address, _tokenId: uint256, _data: Bytes[...]):
...

@external
@payable
def approve(_approved: address, _tokenId: uint256):
pass
...

@external
def setApprovalForAll(_operator: address, _approved: bool):
pass
...

0 comments on commit 6c7f795

Please sign in to comment.