Source Code
Overview
MATIC Balance
0 MATIC
More Info
ContractCreator:
Multichain Info
N/A
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 29588800 | 474 days ago | IN | Create: BoomBgemConversion | 0 MATIC | 0.00109521 |
Loading...
Loading
Contract Name:
BoomBgemConversion
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.15; import "@openzeppelin/contracts/access/Ownable.sol"; interface IERC20Transferable { function balanceOf(address account) external view returns (uint256); function transferFrom(address from, address to, uint256 amount) external returns (bool); function transfer(address to, uint256 amount) external returns (bool); } /// @notice Convert BOOM tokens to BGEM /// @author zetsub0ii.eth contract BoomBgemConversion is Ownable { /// @dev This assumes that BOOM will have less decimals than BGEM (6 < 18) /// This allows us to have 12 decimal places for the rate /// If 1 BOOM is equal to 1 BGEM this amount will be 1 * 10**12 /// If 1 BOOM is equalt to 2.5 BGEM this amount will be 25 * 10**11 uint256 public boomToBgemRate; /// @dev Packet ID => Conversion amount mapping(uint256 => uint256) packets; IERC20Transferable bgem; IERC20Transferable boom; address bgemWallet; address boomWallet; constructor( uint256 startRate, address _bgemWallet, address _boomWallet, address _bgem, address _boom, uint256[] memory _packets ) { boomToBgemRate = startRate; boomWallet = _boomWallet; bgemWallet = _bgemWallet; boom = IERC20Transferable(_boom); bgem = IERC20Transferable(_bgem); for (uint256 i = 0; i < _packets.length; i++) { packets[i] = _packets[i]; } } function boomReserve() public view returns(uint256) { return boom.balanceOf(boomWallet); } /// @notice Setter for boom to bgem rate function setBoomToBgemRate(uint256 newRate) external onlyOwner { boomToBgemRate = newRate; } /// @notice Updates packet /// @dev Setting amount to 0 deletes the packet function updatePacket(uint256 packetId, uint256 amount) external onlyOwner { packets[packetId] = amount; } function convert(uint256 packetId) external { uint256 bgemAmount = packets[packetId]; require(bgemAmount != 0, "This packet doesn't exist"); uint256 boomAmount = bgemAmount / boomToBgemRate; require(boomAmount < boomReserve(), "Conversion limit is reached"); // Do the transfers bgem.transferFrom(msg.sender, bgemWallet, bgemAmount); boom.transferFrom(boomWallet, msg.sender, boomAmount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "remappings": [ "@chainlink/=lib/chainlink/", "@openzeppelin/=lib/openzeppelin-contracts/", "chainlink/=lib/chainlink/contracts/src/v0.8/dev/vendor/@arbitrum/nitro-contracts/src/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "src/=src/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
[{"inputs":[{"internalType":"uint256","name":"startRate","type":"uint256"},{"internalType":"address","name":"_bgemWallet","type":"address"},{"internalType":"address","name":"_boomWallet","type":"address"},{"internalType":"address","name":"_bgem","type":"address"},{"internalType":"address","name":"_boom","type":"address"},{"internalType":"uint256[]","name":"_packets","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"boomReserve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boomToBgemRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"packetId","type":"uint256"}],"name":"convert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"setBoomToBgemRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"packetId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updatePacket","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051620009ea380380620009ea83398101604081905261003191610163565b61003a336100e1565b6001869055600680546001600160a01b038087166001600160a01b0319928316179092556005805488841690831617905560048054858416908316179055600380549286169290911691909117905560005b81518110156100d5578181815181106100a7576100a761026e565b60209081029190910181015160008381526002909252604090912055806100cd81610284565b91505061008c565b505050505050506102ab565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811461014857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060c0878903121561017c57600080fd5b86519550602061018d818901610131565b955061019b60408901610131565b94506101a960608901610131565b93506101b760808901610131565b60a08901519093506001600160401b03808211156101d457600080fd5b818a0191508a601f8301126101e857600080fd5b8151818111156101fa576101fa61014d565b8060051b604051601f19603f8301168101818110858211171561021f5761021f61014d565b60405291825284820192508381018501918d83111561023d57600080fd5b938501935b8285101561025b57845184529385019392850192610242565b8096505050505050509295509295509295565b634e487b7160e01b600052603260045260246000fd5b6000600182016102a457634e487b7160e01b600052601160045260246000fd5b5060010190565b61072f80620002bb6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638a1b81541161005b5780638a1b8154146100ce5780638da5cb5b146100e1578063a3908e1b14610109578063f2fde38b1461011c57600080fd5b80633530d30d1461008d5780633a8584ca146100a9578063715018a6146100b157806374bb25f9146100bb575b600080fd5b61009660015481565b6040519081526020015b60405180910390f35b61009661012f565b6100b96101d0565b005b6100b96100c936600461060b565b6101e4565b6100b96100dc366004610624565b6101f1565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100a0565b6100b961011736600461060b565b61020b565b6100b961012a366004610646565b61045e565b600480546006546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216938101939093526000929116906370a0823190602401602060405180830381865afa1580156101a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cb9190610683565b905090565b6101d8610515565b6101e26000610596565b565b6101ec610515565b600155565b6101f9610515565b60009182526002602052604090912055565b60008181526002602052604081205490819003610289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f54686973207061636b657420646f65736e27742065786973740000000000000060448201526064015b60405180910390fd5b600060015482610299919061069c565b90506102a361012f565b811061030b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f436f6e76657273696f6e206c696d6974206973207265616368656400000000006044820152606401610280565b6003546005546040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9182166024820152604481018590529116906323b872dd906064016020604051808303816000875af115801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b091906106d7565b50600480546006546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216938101939093523360248401526044830184905216906323b872dd906064016020604051808303816000875af1158015610434573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045891906106d7565b50505050565b610466610515565b73ffffffffffffffffffffffffffffffffffffffff8116610509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610280565b61051281610596565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1633146101e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610280565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061d57600080fd5b5035919050565b6000806040838503121561063757600080fd5b50508035926020909101359150565b60006020828403121561065857600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461067c57600080fd5b9392505050565b60006020828403121561069557600080fd5b5051919050565b6000826106d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156106e957600080fd5b8151801515811461067c57600080fdfea26469706673582212203b5ddba98e46b903f97293185f241c2d612464d43747eb60ac481ddee95b7f4564736f6c634300080f00330000000000000000000000000000000000000000000000000000026ce3b4cb000000000000000000000000003120e153e89b7850b158d1a93d4289066a14ccd50000000000000000000000003120e153e89b7850b158d1a93d4289066a14ccd50000000000000000000000003384f3f87fcdfd83141a86e37d070e3b17e0fd60000000000000000000000000e28a5eeccea87c34f4ae2d90197d66ee2a87f13a00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000046500000000000000000000000000000000000000000000000000000000000008ca00000000000000000000000000000000000000000000000000000000000015f90000000000000000000000000000000000000000000000000000000000002bf2000000000000000000000000000000000000000000000000000000000000668a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638a1b81541161005b5780638a1b8154146100ce5780638da5cb5b146100e1578063a3908e1b14610109578063f2fde38b1461011c57600080fd5b80633530d30d1461008d5780633a8584ca146100a9578063715018a6146100b157806374bb25f9146100bb575b600080fd5b61009660015481565b6040519081526020015b60405180910390f35b61009661012f565b6100b96101d0565b005b6100b96100c936600461060b565b6101e4565b6100b96100dc366004610624565b6101f1565b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100a0565b6100b961011736600461060b565b61020b565b6100b961012a366004610646565b61045e565b600480546006546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216938101939093526000929116906370a0823190602401602060405180830381865afa1580156101a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cb9190610683565b905090565b6101d8610515565b6101e26000610596565b565b6101ec610515565b600155565b6101f9610515565b60009182526002602052604090912055565b60008181526002602052604081205490819003610289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f54686973207061636b657420646f65736e27742065786973740000000000000060448201526064015b60405180910390fd5b600060015482610299919061069c565b90506102a361012f565b811061030b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f436f6e76657273696f6e206c696d6974206973207265616368656400000000006044820152606401610280565b6003546005546040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff9182166024820152604481018590529116906323b872dd906064016020604051808303816000875af115801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b091906106d7565b50600480546006546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216938101939093523360248401526044830184905216906323b872dd906064016020604051808303816000875af1158015610434573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045891906106d7565b50505050565b610466610515565b73ffffffffffffffffffffffffffffffffffffffff8116610509576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610280565b61051281610596565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1633146101e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610280565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561061d57600080fd5b5035919050565b6000806040838503121561063757600080fd5b50508035926020909101359150565b60006020828403121561065857600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461067c57600080fd5b9392505050565b60006020828403121561069557600080fd5b5051919050565b6000826106d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156106e957600080fd5b8151801515811461067c57600080fdfea26469706673582212203b5ddba98e46b903f97293185f241c2d612464d43747eb60ac481ddee95b7f4564736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000026ce3b4cb000000000000000000000000003120e153e89b7850b158d1a93d4289066a14ccd50000000000000000000000003120e153e89b7850b158d1a93d4289066a14ccd50000000000000000000000003384f3f87fcdfd83141a86e37d070e3b17e0fd60000000000000000000000000e28a5eeccea87c34f4ae2d90197d66ee2a87f13a00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e1000000000000000000000000000000000000000000000000000000000000046500000000000000000000000000000000000000000000000000000000000008ca00000000000000000000000000000000000000000000000000000000000015f90000000000000000000000000000000000000000000000000000000000002bf2000000000000000000000000000000000000000000000000000000000000668a
-----Decoded View---------------
Arg [0] : startRate (uint256): 2666700000000
Arg [1] : _bgemWallet (address): 0x3120E153E89B7850B158d1a93d4289066a14ccd5
Arg [2] : _boomWallet (address): 0x3120E153E89B7850B158d1a93d4289066a14ccd5
Arg [3] : _bgem (address): 0x3384f3F87fCDFd83141a86E37d070e3b17E0FD60
Arg [4] : _boom (address): 0xe28a5eEccEa87c34F4aE2D90197d66EE2A87f13A
Arg [5] : _packets (uint256[]): 225,1125,2250,5625,11250,26250
-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000026ce3b4cb00
Arg [1] : 0000000000000000000000003120e153e89b7850b158d1a93d4289066a14ccd5
Arg [2] : 0000000000000000000000003120e153e89b7850b158d1a93d4289066a14ccd5
Arg [3] : 0000000000000000000000003384f3f87fcdfd83141a86e37d070e3b17e0fd60
Arg [4] : 000000000000000000000000e28a5eeccea87c34f4ae2d90197d66ee2a87f13a
Arg [5] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [7] : 00000000000000000000000000000000000000000000000000000000000000e1
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000465
Arg [9] : 00000000000000000000000000000000000000000000000000000000000008ca
Arg [10] : 00000000000000000000000000000000000000000000000000000000000015f9
Arg [11] : 0000000000000000000000000000000000000000000000000000000000002bf2
Arg [12] : 000000000000000000000000000000000000000000000000000000000000668a
Loading...
Loading
[ 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.