Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Commit_transfer_... | 1583728 | 44 days ago | IN | 0 S | 0.00004627 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x4656d808...Be84DF0EE The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Layer Zero Bridge - Curve DAO Token
Compiler Version
vyper:0.3.10
Contract Source Code (Vyper language format)
# @version 0.3.10 """ @title Layer Zero Bridge - Curve DAO Token @license MIT @author Curve Finance """ interface ERC20: def transferFrom(_from: address, _to: address, _value: uint256) -> bool: nonpayable def transfer(_to: address, _value: uint256): nonpayable def burn(_value: uint256) -> bool: nonpayable interface LZEndpoint: def send( _dst_chain_id: uint16, _destination: Bytes[40], _payload: Bytes[64], _refund_address: address, _zro_payment_address: address, _adapter_params: Bytes[34] ): payable def estimateFees( _dst_chain_id: uint16, _user_application: address, _payload: Bytes[64], _pay_in_zro: bool, _adapter_params: Bytes[34] ) -> uint256: view interface Minter: def mint(_gauge: address): nonpayable event BridgeSent: receiver: indexed(address) amount: uint256 event BridgeReceived: receiver: indexed(address) amount: uint256 event Delayed: nonce: indexed(uint64) receiver: indexed(address) amount: uint256 event SetPeriod: period: uint256 event SetLimit: limit: uint256 event SetGasLimit: gas_limit: uint256 event SetKilled: killed: bool event TransferOwnership: owner: address TOKEN: public(immutable(address)) MINTER: public(immutable(address)) LZ_ENDPOINT: public(immutable(address)) TOKEN_MIRROR: immutable(address) # token address on the other side of the bridge LZ_CHAIN_ID: immutable(uint16) LZ_ADDRESS: immutable(Bytes[40]) KECCAK_LZ_ADDRESS: immutable(bytes32) integrate_fraction: public(HashMap[address, uint256]) cache: uint256 # [last timestamp uint64][last available uint192] limit: public(uint256) period: public(uint256) delayed: public(HashMap[uint64, bytes32]) gas_limit: public(uint256) is_killed: public(bool) owner: public(address) future_owner: public(address) @external def __init__( _period: uint256, _limit: uint256, _gas_limit: uint256, _token: address, _minter: address, _lz_endpoint: address, _token_mirror: address, _lz_chain_id: uint16 ): assert _period != 0 self.period = _period log SetPeriod(_period) self.limit = _limit log SetLimit(_limit) self.gas_limit = _gas_limit log SetGasLimit(_gas_limit) self.owner = msg.sender log TransferOwnership(msg.sender) TOKEN = _token MINTER = _minter LZ_ENDPOINT = _lz_endpoint TOKEN_MIRROR = _token_mirror LZ_CHAIN_ID = _lz_chain_id LZ_ADDRESS = concat( slice(convert(self, bytes32), 12, 20), slice(convert(self, bytes32), 12, 20) ) KECCAK_LZ_ADDRESS = keccak256(LZ_ADDRESS) @payable @external def bridge(_receiver: address, _amount: uint256, _refund: address = msg.sender): """ @notice Bridge tokens. """ assert not self.is_killed assert _receiver not in [empty(address), TOKEN_MIRROR] and _amount != 0 assert ERC20(TOKEN).transferFrom(msg.sender, self, _amount) assert ERC20(TOKEN).burn(_amount) LZEndpoint(LZ_ENDPOINT).send( LZ_CHAIN_ID, LZ_ADDRESS, _abi_encode(_receiver, _amount), _refund, empty(address), concat(b"\x00\x01", convert(self.gas_limit, bytes32)), value=msg.value ) log BridgeSent(_receiver, _amount) @external def lzReceive(_lz_chain_id: uint16, _lz_address: Bytes[40], _nonce: uint64, _payload: Bytes[64]): assert msg.sender == LZ_ENDPOINT assert _lz_chain_id == LZ_CHAIN_ID assert keccak256(_lz_address) == KECCAK_LZ_ADDRESS receiver: address = empty(address) amount: uint256 = empty(uint256) receiver, amount = _abi_decode(_payload, (address, uint256)) if receiver in [empty(address), TOKEN] or amount == 0: # safeguard return limit: uint256 = self.limit if self.is_killed or amount > limit: self.delayed[_nonce] = keccak256(_abi_encode(block.timestamp, receiver, amount)) log Delayed(_nonce, receiver, amount) return cache: uint256 = self.cache ts: uint256 = cache >> 192 available: uint256 = cache & convert(max_value(uint192), uint256) period: uint256 = self.period if period <= (block.timestamp - ts): available = limit else: # regenerate amount which is available to mint at a rate of (limit / period) available = min(available + (limit * (block.timestamp - ts) / period), limit) if amount > available: remainder: uint256 = amount - available amount = available available = 0 # delay the remainder self.delayed[_nonce] = keccak256(_abi_encode(block.timestamp, receiver, remainder)) log Delayed(_nonce, receiver, remainder) else: available -= amount self.cache = (block.timestamp << 192) + available if amount != 0: self.integrate_fraction[self] += amount Minter(MINTER).mint(self) ERC20(TOKEN).transfer(receiver, amount) log BridgeReceived(receiver, amount) @external def retry(_nonce: uint64, _timestamp: uint256, _receiver: address, _amount: uint256): """ @notice Retry a delayed bridge attempt. """ assert not self.is_killed or msg.sender == self.owner assert self.delayed[_nonce] == keccak256(_abi_encode(_timestamp, _receiver, _amount)) self.delayed[_nonce] = empty(bytes32) period: uint256 = self.period assert block.timestamp >= _timestamp + period cache: uint256 = self.cache ts: uint256 = cache >> 192 available: uint256 = cache & convert(max_value(uint192), uint256) limit: uint256 = self.limit if period <= (block.timestamp - ts): available = limit else: available = min(available + (limit * (block.timestamp - ts) / period), limit) amount: uint256 = _amount if amount > available: remainder: uint256 = amount - available amount = available available = 0 # delay the remainder with the waiting period removed self.delayed[_nonce] = keccak256(_abi_encode(_timestamp, _receiver, remainder)) log Delayed(_nonce, _receiver, remainder) else: available -= amount self.cache = (block.timestamp << 192) + available if amount != 0: self.integrate_fraction[self] += amount Minter(MINTER).mint(self) ERC20(TOKEN).transfer(_receiver, amount) log BridgeReceived(_receiver, amount) @view @external def quote() -> uint256: """ @notice Quote the cost to bridge tokens. """ return LZEndpoint(LZ_ENDPOINT).estimateFees( LZ_CHAIN_ID, self, _abi_encode(self, block.timestamp), False, concat(b"\x00\x01", convert(self.gas_limit, bytes32)), ) @view @external def available() -> uint256: """ @notice Query the available amount this bridge can currently mint. """ cache: uint256 = self.cache ts: uint256 = cache >> 192 available: uint256 = cache & convert(max_value(uint192), uint256) limit: uint256 = self.limit period: uint256 = self.period if period <= (block.timestamp - ts): available = limit else: # regenerate amount which is available to mint at a rate of (limit / period) available = min(available + (limit * (block.timestamp - ts) / period), limit) return available @external def user_checkpoint(_user: address) -> bool: return True @external def set_period(_period: uint256): """ @notice Set the bridge limit period. """ assert msg.sender == self.owner assert _period != 0 self.period = _period log SetPeriod(_period) @external def set_limit(_limit: uint256): """ @notice Set the bridge limit. """ assert msg.sender == self.owner self.limit = _limit log SetLimit(_limit) @external def set_gas_limit(_gas_limit: uint256): """ @notice Set the gas limit for bridge execution. """ assert msg.sender == self.owner self.gas_limit = _gas_limit log SetGasLimit(_gas_limit) @external def set_killed(_killed: bool): assert msg.sender == self.owner self.is_killed = _killed log SetKilled(_killed) @external def commit_transfer_ownership(_future_owner: address): """ @notice Transfer ownership to `_future_owner` @param _future_owner The account to commit as the future owner """ assert msg.sender == self.owner # dev: only owner self.future_owner = _future_owner @external def accept_transfer_ownership(): """ @notice Accept the transfer of ownership @dev Only the committed future owner can call this function """ assert msg.sender == self.future_owner # dev: only future owner self.owner = msg.sender log TransferOwnership(msg.sender)
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"name":"BridgeSent","inputs":[{"name":"receiver","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"BridgeReceived","inputs":[{"name":"receiver","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Delayed","inputs":[{"name":"nonce","type":"uint64","indexed":true},{"name":"receiver","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"SetPeriod","inputs":[{"name":"period","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"SetLimit","inputs":[{"name":"limit","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"SetGasLimit","inputs":[{"name":"gas_limit","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"SetKilled","inputs":[{"name":"killed","type":"bool","indexed":false}],"anonymous":false,"type":"event"},{"name":"TransferOwnership","inputs":[{"name":"owner","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_period","type":"uint256"},{"name":"_limit","type":"uint256"},{"name":"_gas_limit","type":"uint256"},{"name":"_token","type":"address"},{"name":"_minter","type":"address"},{"name":"_lz_endpoint","type":"address"},{"name":"_token_mirror","type":"address"},{"name":"_lz_chain_id","type":"uint16"}],"outputs":[]},{"stateMutability":"payable","type":"function","name":"bridge","inputs":[{"name":"_receiver","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[]},{"stateMutability":"payable","type":"function","name":"bridge","inputs":[{"name":"_receiver","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_refund","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"lzReceive","inputs":[{"name":"_lz_chain_id","type":"uint16"},{"name":"_lz_address","type":"bytes"},{"name":"_nonce","type":"uint64"},{"name":"_payload","type":"bytes"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"retry","inputs":[{"name":"_nonce","type":"uint64"},{"name":"_timestamp","type":"uint256"},{"name":"_receiver","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"quote","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"available","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"user_checkpoint","inputs":[{"name":"_user","type":"address"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"set_period","inputs":[{"name":"_period","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_limit","inputs":[{"name":"_limit","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_gas_limit","inputs":[{"name":"_gas_limit","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_killed","inputs":[{"name":"_killed","type":"bool"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"_future_owner","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"accept_transfer_ownership","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"TOKEN","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"MINTER","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"LZ_ENDPOINT","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"integrate_fraction","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"limit","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"period","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"delayed","inputs":[{"name":"arg0","type":"uint64"}],"outputs":[{"name":"","type":"bytes32"}]},{"stateMutability":"view","type":"function","name":"gas_limit","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"is_killed","inputs":[],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"future_owner","inputs":[],"outputs":[{"name":"","type":"address"}]}]
Deployed Bytecode
0x5f3560e01c60026017820660011b61102a01601e395f51565b6382bfefc88118610036573461102657602061105860403960206040f35b63fe6d81248118611022573461102657602061107860403960206040f3611022565b63cd4d1c648118611022573461102657602061109860403960206040f3611022565b630940070781186100b457602436103417611026576004358060a01c611026576040525f6040516020525f5260405f205460605260206060f35b6348a0d754811861102257346110265760015460405260405160c01c60605277ffffffffffffffffffffffffffffffffffffffffffffffff6040511660805260025460a05260035460c05242606051808203828111611026579050905060c051111561017c5760805160a051426060518082038281116110265790509050808202811583838304141715611026579050905060c05180156110265780820490509050808201828110611026579050905060a05180828118828410021890509050608052610183565b60a0516080525b60206080f3611022565b63a4d66daf811861102257346110265760025460405260206040f3611022565b63ef78d4fd811861102257346110265760035460405260206040f3611022565b639155ba68811861102257602436103417611026576004358060401c6110265760405260046040516020525f5260405f205460605260206060f3611022565b63d4180b58811861022857346110265760055460405260206040f35b638da5cb5b811861102257346110265760075460405260206040f3611022565b639c868ac0811861102257346110265760065460405260206040f3611022565b631ec0cdc1811861028457346110265760085460405260206040f35b6349e33d73811861102257602436103417611026576007543318611026576004356005557ff5bdeca176beddded5a1132996e4edf0d16be5100214b17d8bada54bf867629760043560405260206040a100611022565b63c3de453d8118611022576043361115611026573360605261031e56611022565b636aea40ed81186105bc576063361115611026576044358060a01c611026576060525b6004358060a01c6110265760405260065461102657604051801561034d5760206110b85f395f5181141561034f565b5f5b905061035b575f610361565b60243515155b156110265760206110585f395f516323b872dd6080523360a0523060c05260243560e052602060806064609c5f855af161039d573d5f5f3e3d5ffd5b60203d10611026576080518060011c6110265761010052610100905051156110265760206110585f395f516342966c6860805260243560a052602060806024609c5f855af16103ee573d5f5f3e3d5ffd5b60203d10611026576080518060011c6110265760c05260c0905051156110265760206110985f395f5163c58031006101805260c060206110d86101a039806101c052806101a001602060206110f85f395f5101806110f88339508051806020830101601f825f03163682375050601f19601f82516020010116905081019050806101e05260405160a05260243560c05260406080526080816101a00160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f825160200101169050905081019050606051610200525f6102205280610240525f600260e0527e010000000000000000000000000000000000000000000000000000000000006101005260e080516020820183610140018151815250508083019250505060055481610140015260208101905080610120526101209050816101a00160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f825160200101169050905081015050803b15611026575f6101806101e461019c34855af161058a573d5f5f3e3d5ffd5b506040517f777da483241f48da719a29340d31b6a40d4e1f4596cab4c19b6c9483d7bc090b60243560805260206080a2005b63e5ea47b88118611022573461102657600854331861102657336007557fcfaaa26691e16e66e73290fc725eee1a6b4e0e693a1640484937aac25ffb55a43360405260206040a100611022565b621d356781186110225760c436103417611026576004358060101c611026576040526024356004016028813511611026576020813501808260603750506044358060401c6110265760c0526064356004016040813511611026576020813501808260e037505060206110985f395f5133186110265760206110d85f395f51604051186110265760206111585f395f51606051608020186110265760403661014037604060e0511861102657610100518060a01c6110265761018052610120516101a0526101808051610140526020810151610160525061014051806106ef5760016106fc565b60206110585f395f518118155b905061070c57610160511561070f565b60015b1561071957610a2a565b6002546101805260065461073557610180516101605111610738565b60015b156107ae57426101c052610140516101e052610160516102005260606101a0526101a0805160208201209050600460c0516020525f5260405f20556101405160c0517f2f9d03e55b4e245db68169fb64481b4794dd8a7f22fb8f4a5b99c1c6a6f743c5610160516101a05260206101a0a3610a2a565b6001546101a0526101a05160c01c6101c05277ffffffffffffffffffffffffffffffffffffffffffffffff6101a051166101e05260035461020052426101c051808203828111611026579050905061020051111561086e576101e05161018051426101c051808203828111611026579050905080820281158383830414171561102657905090506102005180156110265780820490509050808201828110611026579050905061018051808281188284100218905090506101e052610877565b610180516101e0525b6101e05161016051116108a3576101e0516101605180820382811161102657905090506101e052610937565b610160516101e0518082038281116110265790509050610220526101e051610160525f6101e05242610260526101405161028052610220516102a052606061024052610240805160208201209050600460c0516020525f5260405f20556101405160c0517f2f9d03e55b4e245db68169fb64481b4794dd8a7f22fb8f4a5b99c1c6a6f743c561022051610240526020610240a35b4260c01b6101e05180820182811061102657905090506001556101605115610a2a575f306020525f5260405f20805461016051808201828110611026579050905081555060206110785f395f51636a627842610220523061024052803b15611026575f610220602461023c5f855af16109b2573d5f5f3e3d5ffd5b5060206110585f395f5163a9059cbb6102205261014051610240526101605161026052803b15611026575f610220604461023c5f855af16109f5573d5f5f3e3d5ffd5b50610140517f7ac74faccfcb8a61818a637e0b0c68069a699338973a73c9a47e9f55cede536861016051610220526020610220a25b00611022565b63b5fb0b42811861102257608436103417611026576004358060401c611026576040526044358060a01c61102657606052600654610a6f576001610a76565b6007543318155b156110265760243560a05260605160c05260643560e0526060608052608080516020820120905060046040516020525f5260405f205418611026575f60046040516020525f5260405f2055600354608052602435608051808201828110611026579050905042106110265760015460a05260a05160c01c60c05277ffffffffffffffffffffffffffffffffffffffffffffffff60a0511660e052600254610100524260c05180820382811161102657905090506080511115610b965760e051610100514260c05180820382811161102657905090508082028115838383041417156110265790509050608051801561102657808204905090508082018281106110265790509050610100518082811882841002189050905060e052610b9e565b6101005160e0525b6064356101205260e0516101205111610bce5760e05161012051808203828111611026579050905060e052610c5f565b6101205160e05180820382811161102657905090506101405260e051610120525f60e052602435610180526060516101a052610140516101c05260606101605261016080516020820120905060046040516020525f5260405f20556060516040517f2f9d03e55b4e245db68169fb64481b4794dd8a7f22fb8f4a5b99c1c6a6f743c561014051610160526020610160a35b4260c01b60e05180820182811061102657905090506001556101205115610d4f575f306020525f5260405f20805461012051808201828110611026579050905081555060206110785f395f51636a627842610140523061016052803b15611026575f610140602461015c5f855af1610cd9573d5f5f3e3d5ffd5b5060206110585f395f5163a9059cbb61014052606051610160526101205161018052803b15611026575f610140604461015c5f855af1610d1b573d5f5f3e3d5ffd5b506060517f7ac74faccfcb8a61818a637e0b0c68069a699338973a73c9a47e9f55cede536861012051610140526020610140a25b00611022565b63999b93af8118611022573461102657602060206110985f395f516340a7bb106101405260a060206110d8610160393061018052806101a052306060524260805260406040526040816101600160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f8251602001011690509050810190505f6101c052806101e0525f600260a0527e0100000000000000000000000000000000000000000000000000000000000060c05260a08051602082018361010001815181525050808301925050506005548161010001526020810190508060e05260e09050816101600160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f825160200101169050905081015050602061014061016461015c845afa610e91573d5f5f3e3d5ffd5b60203d10611026576101409050f3611022565b634b820093811861102257602436103417611026576004358060a01c61102657604052600160605260206060f3611022565b637ff4ee4b8118611022576024361034176110265760075433186110265760043515611026576004356003557f1445a8659aa0e3feb1c4a3ea8344a4e720c388d7ce59ab4824248fbc3bd1ef9460043560405260206040a100611022565b63be028426811861102257602436103417611026576007543318611026576004356002557f479881bf41e329f328c21c2cbb11514b05a021cd33ea4e5a576ea6bc03874fd660043560405260206040a100611022565b6390b22997811861102257602436103417611026576004358060011c611026576040526007543318611026576040516006557ff6a23ecf31263066d4cc1ac21837c1714818045ecc5c0dd89f279e0bd4b7ef8760405160605260206060a100611022565b636b441a40811861102257602436103417611026576004358060a01c61102657604052600754331861102657604051600855005b5f5ffd5b5f80fd0a300d55018d102201ad001801cd0ea410220fee02da0268020c10220f8a02fb0f3406090058007a0ed6024810220000000000000000000000005af79133999f7908953e94b7a5cf367740ebee350000000000000000000000005de4ef4879f4fe3bbadf2227d2ac5d0e2d76c895000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000285a537a46d780b1c70138ab98edce69e7a53177ba5a537a46d780b1c70138ab98edce69e7a53177ba000000000000000000000000000000000000000000000000344b188b361627efea74f74ce45b6637ed3f70a1a0981d3cca929e3607e7ec63
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.