DAPP智慧合約LP池質押模式軟體開發詳情

lxqy1668發表於2023-04-12

智慧合約可以說是與區塊鏈相輔相成互為成就的。如果說智慧合約是能夠智慧地自動化地執行一系列複雜且具有觸發條件的數字化承諾,則新增區塊鏈技術可以使智慧合約根據參與者預先指定的規則自動、智慧、確定和可信地執行。智慧合約在區塊鏈中的應用也將會以多種方式呈現在公眾的視野中,從而實現與多種場景的深度融合。I88智慧合約I928系統開發8024

  

  contract Params is Initializable,OwnableUpgradeable {

  

  function initialize()public initializer{

  

  __Context_init_unchained();

  

  __Ownable_init_unchained();

  

  }

  

  mapping(string => uint256) private uint256Params;

  

  event Uint256ParamSetted(string indexed _key,uint256 _value);

  

  function SetUint256Param(string memory _key,uint256 _value) external onlyOwner{

  

  uint256Params[_key] = _value;

  

  emit Uint256ParamSetted(_key,_value);

  

  }

  

  function GetUint256Param(string memory _key)public view returns(uint256){

  

  return uint256Params[_key];

  

  }

  

  }

  

  constructor(

  

  address _logic,

  

  address admin_,

  

  bytes memory _data

  

  ) payable ERC1967Proxy(_logic, _data) {

  

  assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));

  

  _changeAdmin(admin_);

  

  }

  

  /**

  

  * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.

  

  */

  

  modifier ifAdmin() {

  

  if (msg.sender == _getAdmin()) {

  

  _;

  

  } else {

  

  _fallback();

  

  }

  

  }

  

  /**

  

  * @dev Returns the current admin.

  

  *

  

  * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.

  

  console.log("Owner:", owner);

  

  const uri = await contract.tokenURI(1);

  

  console.log("URI: ", uri);

  

  }

  

  main().then(() => process.exit(0)).catch(error => {

  

  console.error(error);

  

  process.exit(1);

  

  });


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70020038/viewspace-2945304/,如需轉載,請註明出處,否則將追究法律責任。

相關文章