Discover more of Etherscan's tools and services in one place.
Sponsored
Contract Source Code:
File 1 of 1 : Vyper_contract
contract Exchange(): def setup(token_addr: address): modifying NewExchange: event({token: indexed(address), exchange: indexed(address)}) exchangeTemplate: public(address) tokenCount: public(uint256) token_to_exchange: address[address] exchange_to_token: address[address] id_to_token: address[uint256] @public def initializeFactory(template: address): assert self.exchangeTemplate == ZERO_ADDRESS assert template != ZERO_ADDRESS self.exchangeTemplate = template @public def createExchange(token: address) -> address: assert token != ZERO_ADDRESS assert self.exchangeTemplate != ZERO_ADDRESS assert self.token_to_exchange[token] == ZERO_ADDRESS exchange: address = create_with_code_of(self.exchangeTemplate) Exchange(exchange).setup(token) self.token_to_exchange[token] = exchange self.exchange_to_token[exchange] = token token_id: uint256 = self.tokenCount + 1 self.tokenCount = token_id self.id_to_token[token_id] = token log.NewExchange(token, exchange) return exchange @public @constant def getExchange(token: address) -> address: return self.token_to_exchange[token] @public @constant def getToken(exchange: address) -> address: return self.exchange_to_token[exchange] @public @constant def getTokenWithId(token_id: uint256) -> address: return self.id_to_token[token_id]
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
My Name Tag:
Private Note:
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.